How can I use trigger pipeline to automatically launch a specific step in the other repository ,
for example, I have repo A and repo B. I added the trigger pipeline pipe in the repository A and I want to autpmaticcaly trigger repo B with a specific step.
repo B contains default step which is launched auto when there is any new commits in the branch, patch and unit test steps.
Hello @yosser_mahfoudh and thank you for reaching out to Community!
You can have multiple pipelines defined in the same YML file that are triggered differently (default pipeline, branch pipeline, pull-request pipeline). When using the pipe atlassian/trigger-pipeline you need to define which pipeline of the repo B you want to trigger, and this is configured through the variables REF_TYPE and REF_VALUE provided in the pipe's configuration.
For the use-case in your description, where from repo A you want to trigger the default pipeline in repo B, the following pipe definition would work :
- pipe: atlassian/trigger-pipeline:5.3.0
variables:
BITBUCKET_USERNAME: $BB_USERNAME
BITBUCKET_APP_PASSWORD: $BB_APP_PASS
REPOSITORY: 'repoB'
REF_TYPE: 'branch'
REF_NAME: 'master'
WAIT: 'true'
Ref_name is the name of the branch you want the pipeline to run against. In this example, we are triggering the default pipeline in repo B to run against the latest commit in the branch master.
It's important to note that if you have defined a branch-triggered pipeline in your YML file of repo B for branch master (or any other name you provide in REF_NAME), the branch pipeline will get prioritized over the default pipeline.
Hope that helps to clarify your question! If anything is not clear, feel free to ask!
Thank you, @yosser_mahfoudh !
Patrik S
How can I launch a specific step in the repoB repository?
There are different steps in repoA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Erkan Sahin ,
It's not possible to launch only one step of a pipeline. The atlassian/trigger-pipeline pipe will trigger a pipeline and all the steps defined under that pipeline.
What you can do is create a pipeline with only one step, and then trigger that pipeline using the instructions above.
pipelines:
branches:
hotfix/*: # this is a branch pipeline and contains multiple steps
- step:
name: Build hotfix
script:
- echo "Hello, hotfix!"
- step:
name: Test hotfix
script:
- echo "Testing hotfix"
default: # this is the default pipeline and it contains just 1 step
- step:
name: All other builds
script:
- echo "Hello, World!"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Patrik S I just one trigger run after test execution getting failed, but now it triggers forever
For example, build 1 get failed, new auto trigger comes (build 2), build 2 gets failed, new auto trigger comes (build 3)....it doesn't stop
please help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Linh_Nguyen ,
Do you mean that the pipeline in the parent repo keeps triggering the pipeline on the second repo multiple times even after the pipeline on the second repo has failed?
Could you share with us the pipeline YML of both the parent and second repo?
Thank you, @Linh_Nguyen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.