When I run pipeline getting error Task 'promoteArtifact' not found in root project 'build'.
Asked by Krunal Pandav:

+ [./gradlew](https://bitbucket.org/outsorcedglobal/action_log_android_app/src/43e1635ae42a0067c3ccaab59d0056084562721f/gradlew) promoteArtifact --track beta  
Downloading <https://services.gradle.org/distributions/gradle-7.4-all.zip>  
.......................................................................................................................................................  
Unzipping /root/.gradle/wrapper/dists/gradle-7.4-all/aadb4xli5jkdsnukm30eibyiu/gradle-7.4-all.zip to /root/.gradle/wrapper/dists/gradle-7.4-all/aadb4xli5jkdsnukm30eibyiu  
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-7.4-all/aadb4xli5jkdsnukm30eibyiu/gradle-7.4/bin/gradle  
Welcome to Gradle 7.4!  
Here are the highlights of this release:  
- Aggregated test and JaCoCo reports  
- Marking additional test source directories as tests in IntelliJ  
- Support for Adoptium JDKs in Java toolchains  
For more details see <https://docs.gradle.org/7.4/release-notes.html>  
Starting a Gradle Daemon (subsequent builds will be faster)  
FAILURE: Build failed with an exception.  
* What went wrong:  
Task 'promoteArtifact' not found in root project 'build'.  
* Try:  
> Run [gradlew](https://bitbucket.org/outsorcedglobal/action_log_android_app/src/43e1635ae42a0067c3ccaab59d0056084562721f/gradlew) tasks to get a list of available tasks.  
> Run with --stacktrace option to get the stack trace.  
> Run with --info or --debug option to get more log output.  
> Run with --scan to get full insights.  
* Get more help at [https://help.gradle.org](https://help.gradle.org/)  
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.  
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.  
See <https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings>  
BUILD FAILED in 41s

```
image: androidsdk/android-30
definitions:
  services:
    docker:
      memory: 512
    docker-with-more-memory:
      memory: 2048
      type: docker
    docker-with-large-memory:
      memory: 5120
      type: docker
pipelines:
  branches:
    develop:
#      - parallel:
          - step:
              size: 2x
              name: Build
              caches:
                - gradle
              script:
                - echo "$SIGNING_JKS_FILE" | base64 -di > android-signing-keystore.jks
                - ./gradlew assembleRelease
              artifacts:
                - app/build/outputs/**
          - step:
              size: 2x
              name: Build Debug
              caches:
                - gradle
              script:
                - echo "$SIGNING_JKS_FILE" | base64 -di > android-signing-keystore.jks
                - ./gradlew assembleDebug
              artifacts:
                - app/build/outputs/**
          - step:
              size: 2x
              name: Test
              script:
                - ./gradlew test
          - step:
              name: Push On Beta
              trigger: manual
              script:
                - echo $GOOGLE_API_KEY_JSON > google_play_api_key.json
                - ./gradlew promoteArtifact --track beta




```


Answers:
author: Theodora Boudale
body: Hi [@Krunal Pandav](/t5/user/viewprofilepage/user-id/5059912) and welcome to the community.

I see that you get this error when running the command

```
./gradlew promoteArtifact --track beta
```

in the last step of your pipeline. Does the execution of this command depend on files you modify or generate in previous steps, that you have not defined as artifacts yet?

Please keep in mind that for each step of your pipeline, a separate Docker container starts, the repo is cloned in that container, then this step's commands from the script are executed, and in the end, the container gets destroyed. Only files that you define as artifacts will be available for later steps.

One thing you could try, for debugging purposes, would be to combine all 4 steps into 1 and check if the command runs successfully then or not.

You could also debug this locally with Docker following the steps mentioned in the following doc, so that you don't consume any Pipelines minutes, and check if there is any configuration issue in your project causing this error:

* <https://support.atlassian.com/bitbucket-cloud/docs/debug-pipelines-locally-with-docker/>

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines