You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
we have a lot of microservice repositories. And we want to write a parent CI/CD pipe that we can reuse in any of these repositories to reduce the management effort if we have to adjust the CI/CD pipe.
Based on the doc of writing a custom pipe (https://support.atlassian.com/bitbucket-cloud/docs/write-a-pipe-for-bitbucket-pipelines/) I'm understanding that I have to write shell or python scripts. But my use case is mostly writing a parent pipe that is including other pipes e.g. the sonarcloud pipe. And this standard pipe I can reuse in all my repositories.
So my question is: How am I able to integrate other pipes into my parent pipe?
Hi @Micha Mailänder . Thanks for you question. It's a good case to use trigger-pipeline pipe.
All you need is to use this pipe, pass credentials and specify the name of your repo. Example below:
script: - pipe: atlassian/trigger-pipeline:4.2.1 variables: BITBUCKET_USERNAME: $BITBUCKET_USERNAME BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD REPOSITORY: 'your-awesome-repo'
Regards, Igor.
Thanks for the reply @Igor Stoyanov
But can I use that also that the triggered pipeline uses my current repository code as the base?
My understanding:
One repo = One pipe
If I run the pipe_1.yml that is included in repo_1 then it uses the data from repo_1. If I trigger pipe_2 (with the trigger-pipeline) of repo_2 then the pipe_2 uses the code of repo_2 and not from repo_1. Or do I misunderstand here something, and I can use pipe_2 to run it with the code of repo_1?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Micha Mailänder As far as i understand, you can set
REPOSITORY: 'your-awesome-repo'
with repo_1 or repo_2 in any repository where you want to trigger your pipeline.
Example: in repository repo_1 in pipe_1.yml you can set
REPOSITORY: 'repo_2'
This is your case?
Regards, Igor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure if we're talking from the same :D
I try to explain it with the picture:
If I'm understanding you correctly, I can use the "trigger-pipeline" to call another pipeline.
My understanding is, the Repository-2 bitbucket-pipeline.yml would use now the code that is inside Repository-2. But instead, it should use the code of Repository-1.
So what do I have to do for that, that the Repository-2 bitbucket-pipelines.yml is used to run on the code of repository-1?
Hoping that this explanation is now more clear ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My understanding is, the Repository-2 bitbucket-pipeline.yml would use now the code that is inside Repository-2. But instead, it should use the code of Repository-1. So what do I have to do for that, that the Repository-2 bitbucket-pipelines.yml is used to run on the code of repository-1?
@Micha Mailänder If you want to use code of Repository-1 inside bitbucket-pipeline.yml of Repository-2 you need to add this to bitbucket-pipeline.yml of Repository-2:
script: - pipe: atlassian/trigger-pipeline:4.2.1 variables: BITBUCKET_USERNAME: $BITBUCKET_USERNAME BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD REPOSITORY: 'Repository-1'
without any changes in bitbucket-pipeline.yml of Repository-1
Regards, Igor.
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.