Pipeline failed to upload APK in Microsoft App center tester group
Asked by Abdull Wahab:

Hi All, I am running a pipeline to upload files to the app center tester group. I follow the steps using bitbucket docs to generate a file bitbucket-pipeline. YAML file my issue is every time I try to upload a file to the Microsoft app center through Node script it failed a pipeline and throws the error **No Such file or directory open package.json error picture also attach**

![pipeline_3.png](https://community.atlassian.com/t5/image/serverpage/image-id/217506i8C4D10EEB2B41134/image-size/large?v=v2&px=999 "pipeline_3.png")

my complete bitbucket-pipeline.YAML file is this

```
image: androidsdk/android-30

pipelines:
  default:
    - parallel:
        - step:
            name: Android Debug Application
            caches:
              - gradle
            script:
              - ./gradlew assembleDebug
            artifacts:
              - app/build/outputs/**
#        - step:
#            name: Lint
#            caches:
#              - gradle
#            script:
#              - ./gradlew lint
#            artifacts:
#              - app/build/reports/**
#        - step:
#            name: Debug Unit Test
#            caches:
#              - gradle
#            script:
#              - ./gradlew testDebugUnitTest
        - step:
            name: Installing node.js and npm appcenter-cli
            image: node:12.22.9
            script:
              - npm install
              - npm cache verify
              - npm install -g appcenter-cli
                - appcenter distribute release --group Collaborators --file "/app/build/outputs/apk/debug/app-debug.apk" --release-notes 'release' --app m.wahab-nextgeni.com/CICD --token "value_removed" --quiet
```

Can anyone help me with this issue I will be very thankful to you because I am stuck on this issue? I am using an android project with this pipeline and wanted to share the build with the testers group in the Microsoft app center


Answers:
author: Theodora Boudale
body: Hi [@Abdull Wahab](/t5/user/viewprofilepage/user-id/5038216),

I noticed the following two things in your yml file:

**1st.** The path in the **--file** argument in your last command:

The command in the bitbucket-pipelines.yml file you posted here has as --file the following path:

```
/app/build/outputs/apk/debug/app-debug.apk
```

In the screenshot you posted above, the path is different

```
app/build/outputs/apk/debug/app-debug.apk
```

The first one will look for a directory named **app** in the root of the container, while the second one will look for the directory **app** in the clone directory.

Are you generating this file during the first step named "Android Debug Application"?

If so, is it generated in the path that you defined as an artifact in that first step, **app/build/outputs/\*\*** ?

If so, you will need to use **--file "app/build/outputs/apk/debug/app-debug.apk"** without the slash in the beginning so that the file can be found.

**2nd.** I noticed the keyword **parallel** in your bitbucket-pipelines.yml file.

Do the first and the last step run in parallel?

If they do, and if the app-debug.apk file gets generated during the first step, it will not be available in the second step, because they are parallel. Parallel steps can only use artifacts produced by previous steps, not by steps in the same parallel set.

If the apk file gets generated during the first step, and the two steps are parallel, you will need to remove the parallel keyword so that the steps will no longer be parallel and the file will be available for the second step.

<br />

Also, just a heads up, I removed the value of the token from your post for security reasons (not sure if you posted the actual token or if you replaced the value with something else, but I removed it just in case).

Kind regards,  
Theodora

comments: author: Abdull Wahab
body: ++Thanks [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) for detail answer i will change the pipeline with your suggestions and then back to you thanks for help again really appreciate++


author: Theodora Boudale
body: Hi [@Abdull Wahab](/t5/user/viewprofilepage/user-id/5038216),

You are very welcome! I will wait to hear your update then.

In case you still get errors, please let us know:

1) What is the content of the bitbucket-pipelines.yml now (please mask any secrets)

2) If the apk file is indeed generated during the first step

3) Copy-paste any errors from the Pipelines build log (please sanitize sensitive/private info, if any, prior to sharing)

Kind regards,  
Theodora


author: Abdull Wahab
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) ,

Hope you are doing great I made the changes you suggest in bitbucket-pipelines.yml but it still gives an error but this time new one. I also attach the content of bitbucket-pipelines.yml, APK file is generated in the artifact section of the pipeline screen short also attach as evidence, Also attach the complete error of this step pipeline.

Here is the Complete bitbucket-pipelines.yml file

```
image: cimg/android:2022.09-node
pipelines:
  default:
        - step:
            name: Android Debug Application
            caches:
              - gradle
            script:
              - ./gradlew assembleDebug
            artifacts:
              - app/build/outputs/**
        - step:
            name: Installing node.js and npm appcenter-cli
            image: node:12.22.9
            script:
              - npm install
              - npm cache verify
              - npm install -g appcenter-cli
                - appcenter distribute release --group Collaborators --file "app/build/outputs/apk/debug/app-debug.apk" --release-notes 'release' --app m.wahab-nextgeni.com/CICD --token "*********daa5220b4" --quiet
```

Here is the Artifact file directory in Android Debug Application Step  

![artificat.png](https://community.atlassian.com/t5/image/serverpage/image-id/218827i0E64F43B97028A9C/image-size/large?v=v2&px=999 "artificat.png")

Here is the Error log screenshot and text

![complete_error_bitbucket.png](https://community.atlassian.com/t5/image/serverpage/image-id/218828i7C229861F6E69793/image-size/large?v=v2&px=999 "complete_error_bitbucket.png")  
npm ERR! code ENOLOCAL npm ERR! Could not install "app/build/outputs/apk/debug/app-debug.apk" as it is not a directory and is not a file with a name ending in .tgz.tar.gz or.tar


author: Theodora Boudale
body: Hi [@Abdull Wahab](/t5/user/viewprofilepage/user-id/5038216),

Thank you for the info.

Your latest build shows that the command expects either a directory or a file with a name ending in .tgz, .tar.gz or .tar

I am not familiar with Microsoft App center or appcenter-cli so I am unsure if you need to provide a different argument or if you simply need to provide a .tgz, .tar.gz or .tar file and what its contents should be.

I would suggest reaching out to the developers of appcenter-cli here: <https://github.com/microsoft/appcenter-cli/issues?q=is%3Aissue+> with details about the issue and asking for more info regarding the configuration you need to make.

Kind regards,  
Theodora


author: Nasir Majeed
body: yes i have been facing the same issue regarding to my website. can some body help me to get rid of this problem[.](https://modgila.net/) Thanks


author: Theodora Boudale
body: Hi Nasir,

Please create a new question about this issue in community via <https://community.atlassian.com/t5/forums/postpage/board-id/bitbucket-questions> and provide more details (what exactly you are doing, commands you execute and output).

It's best to create a a new question when you need assistance instead of posting on someone else's question, as an existing question can become convoluted and difficult to follow when trying to troubleshoot multiple users' issues in it.

Please also refrain from posting links to another website when it is not relevant to a question. You can review our guidelines here:

<https://community.atlassian.com/t5/custom/page/page-id/rules-of-engagement>

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud