Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,644,519
Community Members
 
Community Events
196
Community Groups

401 during running atlassian/trigger-pipeline

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:
The pipeline is described such way:
 - 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!

1 answer

1 accepted

1 vote
Answer accepted
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 29, 2022

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?

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 04, 2022

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)

Hey Ben,

The solution with static tags looks good for me, thanks a lot!

Best regards,

Al

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 06, 2022

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)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events