Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I want to trigger second pipeline from first pipeline if it runs successfully.

Harshit Singhal April 5, 2020

Hi Community,

 

Since I am not a pro in writing bitbucket.yml scripts, I need some help and suggestions. 

Scenario: We have a 3rd-party test environment to execute test scripts for the release. We have already setup a separate pipeline for this test environment which runs on schedule or whenever anyone makes changes to source code. The requirement is now to run test pipeline automatically whenever the release pipeline(in the same repo) runs successfully.

Problem: What should be the script(or sequence of git commands) that I should write to update source code(say, a log file) in test branch, so that test pipeline runs from release pipeline? I will add this script as a new "-step" in the release pipeline.

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2020

Hello @Harshit Singhal ,

There's no way to call one pipeline from another other than pushing something that triggers it back to the repository. Commands for this would be similar to what you'd do locally: echo (or any other sort of update), git add, git commit, git push. Or you can configure your test pipeline to trigger on tags – in that case you can create and push a Git tag in the end of release pipeline, which would kick off the test pipeline.

However, this might be not the best approach in your case. You can make use of anchors and aliases in YAML and inline your test steps into the release pipeline. That might be preferable as the release pipeline would shown as failed if tests fail after release (this sounds like post-deployment verification tests to me), reflecting the actual status of the release.

Hope this helps.

Cheers,
Daniil

Harshit Singhal April 7, 2020

Thankyou @Daniil Penkin , I will try the given approaches. But it is good to know that there is nothing to directly trigger one pipeline from another. Thanks again!

Like Daniil Penkin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events