The pipe "trigger-pipeline" only works for branches, and not tags
Asked by Steve Annett:

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](http://bitbucket.org:443/)  
DEBUG: [https://bitbucket.org:443](https://bitbucket.org/) "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](http://api.bitbucket.org:443/)  
DEBUG: [https://api.bitbucket.org:443](https://api.bitbucket.org/) "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](http://api.bitbucket.org:443/)  
DEBUG: [https://api.bitbucket.org:443](https://api.bitbucket.org/) "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": {}}}}

<br />

<br />

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?


Answers:
author: Patrik S
body: Hello [@Steve Annett](/t5/user/viewprofilepage/user-id/5074534) ,

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**](https://support.atlassian.com/bitbucket-cloud/docs/pipeline-start-conditions/#Tags) 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](https://support.atlassian.com/bitbucket-cloud/docs/use-glob-patterns-on-the-pipelines-yaml-file/) that matched the tag configured in the pipe.

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

Thank you, [@Steve Annett](/t5/user/viewprofilepage/user-id/5074534)

Patrik S

comments: author: Steve Annett
body: 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
```


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

trigger