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.
I create a pipeline, triggered by a tag, which should launch a custom pipeline on another repository.
I'm an admin for both repos, so probably, should have correct access rights.
The pipeline is starting on tag push, and log bottom is the following:
Status: Downloaded newer image for bitbucketpipelines/trigger-pipeline:5.0.1
INFO: Fetching the tag info for tag:sometag
✖ Failed to get the tag info for sometag from Bitbucket. Response code: 401. Error:
- step:
script:
- pipe: atlassian/trigger-pipeline:5.0.1
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
REPOSITORY: 'some/repository'
REF_TYPE: 'tag'
REF_NAME: $BITBUCKET_TAG
CUSTOM_PIPELINE_NAME: 'custom-pipeline-name'
How the trigger-pipeline should be used for the case?
I tried the REPOSITORY variable without 'some/' achieving no success.
On first sight automatic pipelines are running from another user's name, but if I launch the pipeline manually I get the same problem.
What is the solution for the case?
Thank you!
G'day Al!
Welcome to the Bitbucket Cloud community! :)
The way that the trigger-pipeline pipe works is that it will read the bitbucket-pipelines.yml from the respective repository that is mentioned, and execute the REF_TYPE/REF_NAME from that other repository.
The most important variables to include for your use case are:
BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD
REPOSITORY
REF_TYPE
REF_NAME
ACCOUNT
Therefore, if you are trying to trigger a build step from another repository, you will need to configure the bitbucket-pipelines.yml file on the other repository to have this tag build step present.
As long as the repository is from the same workspace, you will not need to include the "some/" part.
For example Repository A YML config may look like this:
- pipe: atlassian/trigger-pipeline:5.0.1
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
REPOSITORY: 'test'
REF_TYPE: tag
REF_NAME: test-tag
ACCOUNT: 'username'
And Repository B YML config may look like this:
tags:
test-tag:
- step:
name: TestStep
script:
- echo "HelloWorld"
The end result would be that Repository B has a pipeline build triggered for the "test-tag" tag definition as above and echo "HelloWorld" within that build.
The 401 error you are receiving is usually because the AppPassword is incorrect - I would suggest ensuring that the variable is updated to reflect the correct AppPassword or just generate a new one.
Hope this helps.
Cheers!
- Ben (Bitbucket Cloud Support)
Hello, Ben!
Thank you for your response!
Is there a way to pass the tag's name to the second pipeline?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Al,
The example I provided has the tag named "test-tag" in the REF_NAME field on Repository A, this field is used to tell Repository A that there is a tag named this in Repository B and to check for this in its respective YML config.
The REF_NAME is then matched against Repository B YML config, as it finds that there is a test-tag tag definition in Repository B YML config, it runs that build step accordingly.
Hope this makes sense.
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Ben,
The solution with static tags looks good for me, thanks a lot!
Best regards,
Al
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries Al!
I'm glad to hear this was helpful, I hope you have a great day and an even greater weekend :)
Cheers!
- Ben (Bitbucket Cloud Support)
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.