Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Triggering a custom pipeline using the "trigger-pipeline" pipe

pmilosevic December 4, 2024

I have an application that needs to be installed and tested on three different hardware systems. Additionally, since the systems are independent, I want to avoid dependency and use parallel pipelines instead of parallel steps. Based on the documentation, it is necessary to define pipelines as "custom" pipelines. The downside of custom pipelines is that their execution is manual, while my project requires them to run automatically. To achieve this, there are two methods:

  • Using the API
  • Using the trigger-pipeline pipe

I created a custom branch separate from the develop branch and defined custom pipelines. After pushing the branch to remote, these pipelines are visible on the Bitbucket page and can be triggered manually.

When using the trigger-pipeline pipe, the trigger occurs, but it always executes the pipeline for the master branch (both the pipeline and the branch are incorrect). I checked the content of $BITBUCKET_BRANCH, and the branch name is always correct. However, for some reason, neither the correct pipeline nor the correct branch is triggered.

Here is the relevant segment of the YAML file:

 

default:

    - step: *create_artifacts

    - step: name: Start Custom Pipeline

      script:

          - echo $BITBUCKET_REPO_SLUG

          - echo $BITBUCKET_BRANCH

          - pipe: atlassian/trigger-pipeline:5.8.1

          variables:

              BITBUCKET_USERNAME: $BITBUCKET_USERNAME

              BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD

              REPOSITORY: $BITBUCKET_REPO_SLUG

              PIPELINE: "first-test-system"

              BRANCH: $BITBUCKET_BRANCH

custom:

    first-test-system:

        - step: *restart_first

        - step: *status_first

    second-test-system:

        - step: *restart_second

        - step: *status_second

 

 

Generally, my requirement is to have parallel pipelines, independent, running on the same repository, and triggered automatically.

 

 

Any assistance is appreciated.
Thank you in advance.

1 answer

0 votes
pmilosevic December 4, 2024

Ok, this: https://bitbucket.org/product/features/pipelines/integrations?&p=atlassian/trigger-pipeline

resolves the issue.

Is there any way to pass artifacts to the triggered pipelines? Let's say the build is common step so I want to pass new installation to the pipeline I want to trigger.

In other words, everything under "artifacts: " from the previous step (could be the new installation file or the unit test report, etc) I want to pass to the triggered custom pipeline. Is that possible?

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events