Condition: Check for other repo if there is changes/no-changes in that repo pipeline skip/no-skip?

Abdul Rehman June 23, 2022

Use Case:
If there is a change in Repository A (Which is outside the workspace) 

atlassian/trigger-pipeline:5.0.0 will trigger pipeline in the Repository B

  • We have a project outside our workspace in that project's bitbucket-pipelines.yml file there is a step that triggers the pipeline in Repository B. (Working Perfectly Fine)

  • There is a condition in Repository B that if there is no change in these paths below:

    condition:

                changesets:

                    includePaths:

                        # Any changes in Cypress Directories

                        - cypress/fixtures/**

                        - cypress/integration/**

                        - cypress/plugins/**

                        - cypress/support/**

    pipeline gets stopped automatically. (Working Perfectly Fine)

     

The main Question starts here:

We want to bring a functionality in the condition that if there is no-change in Repository A's specified paths. As the condition is in Repository B's pipeline, Repository B's pipeline gets stopped
So basically our condition will be checking for two kinds of conditions either Repository A and B both has changes in specified path or not. If one of the two conditions get true pipeline should complete its steps, if it gets false pipeline should stop.

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 27, 2022

Hi @Abdul Rehman,

I'm afraid that the following is not possible by using condition and changesets in the bitbucket-pipelines.yml file:

If one of the two conditions get true pipeline should complete its steps

 

If you include a condition in Repository A and that condition is false, then the step in repo A will not run at all, and therefore the pipeline in Repository B is not going to get triggered in order to check if the condition in repo B is true.

 

If you want to check whether one of the conditions is true in order to trigger the pipeline in repo B, you could do this with some scripting and without using the condition and changesets in your yml file:

  • Create a script that checks if there are changes in certain files and/or paths in the HEAD of a repo
  • In the pipeline of repo A:
    • run this script for the HEAD of repo A (check 1)
    • clone repo B and run the script for repo B (check 2)
  • If both check 1 and check 2 are false, you can fail the build in repo A
  • Otherwise, trigger the pipeline in repo B

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events