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)
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.
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.