The pipe "trigger-pipeline" only works for branches, and not tags

Steve Annett January 17, 2023

I have a pipeline that's using the pipe atlassian/trigger-pipeline:5.0.1 to trigger a pipeline in a different project.

It works perfectly for branches, but not for tags.

The error it gets is:

Digest: sha256:f6effedb090ab2c1e936b7b382dd4512b810a52033706459095e6089fc7e19c7
Status: Downloaded newer image for bitbucketpipelines/trigger-pipeline:5.0.1
DEBUG: Starting new HTTPS connection (1): bitbucket.org:443
DEBUG: https://bitbucket.org:443 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 None
INFO: Fetching the tag info for tag:v1.0.14
DEBUG: Starting new HTTPS connection (1): api.bitbucket.org:443
DEBUG: https://api.bitbucket.org:443 "GET /2.0/repositories/steve_ie/steve/refs/tags/v1.0.14 HTTP/1.1" 200 None
DEBUG: Starting new HTTPS connection (1): api.bitbucket.org:443
DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/steve_ie/steve/pipelines/ HTTP/1.1" 400 160
✖ Error: {"error": {"message": "Bad request", "detail": "bitbucket-pipelines.yml not found.", "data": {"key": "result-service.pipeline.yml-not-found", "arguments": {}}}}



bitbucket-pipeline.yml definitely exists, on all branches on the target project. Also the target project definitely has the tag "v1.0.14"

 

How do I get atlassian/trigger-pipeline:5.0.1 to work correctly with tags?

 

1 answer

1 accepted

2 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 19, 2023

Hello @Steve Annett ,

Welcome to Atlassian Community! 

I was able to reproduce the same error message when the branch where this tag was created had a bitbucket-pipelines.yml file that did not contain a definition for the tag I configured in the pipe.

So I think the message might be misleading in this case, and it doesn't necessarily mean the bitbucket-pipelines.yml does not exist for the branch where the tag was created, but also that a tag-triggered pipeline is not defined in that branch.

You can use the following command to check at which branch a tag was created : 

git log -1 --pretty='%D' TAG_NAME

And then you can go to that branch's bitbucket-pipelines.yml file and check if there's a tag definition that matches the name/pattern of the tag you are trying to trigger. If there isn't, or if the tag pattern does not match the tag you are triggering, this is the reason why the pipe is failing.

To solve it, you can edit the yml file of that particular branch to include a tag section as well with a name/glob pattern that matched the tag configured in the pipe.

Hope that helps! Let me know in case you have any questions.

Thank you, @Steve Annett 

Patrik S

Steve Annett January 25, 2023

Thanks for your help! This is exactly it

 

I mistakenly thought it would run the default declaration in the target project, but that's not the case, it needs a tags declaration

Adding a tags declaration on the triggered project fixes it

  tags:
    '*': # Tag of any name
      - step: *build-java
Like Patrik S likes this

Suggest an answer

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

Atlassian Community Events