Get git branches for a tag within pipeline triggered by a tag

Mohit
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 11, 2020

My bitbucket pipeline is triggered by a tag.

I am running a bash script within the pipeline step.

 

I am using this command to get all the git branches that have the tag that triggered the pipeline.

git branch --contains tags/$1

 The bash script works fine on my local (same docker env as the bitbucket pipeline). I made sure I had checked out the tag in git before running the bash script. 

I get the following result

* (HEAD detached at <commit>)
  <branch-name>

 

But when I run the actual pipeline, I get the following output for the above command -

* (no branch)

 

 

UPDATE:

I added more git debug commands to see if any of the concerned branches exist inside the docker when the pipeline runs.

git fetch
git show-branch master

 

I get this error -

fatal: bad sha1 reference master

 

Any idea why this is happening ?

1 answer

0 votes
Philip Wilson December 12, 2023

I'm still looking for an Answer


I have the same issue, did you ever get an answer to this... been trying for days to work out how to commit back to the original branch the build ID increment that was triggered by a publish tag...

I've tried lots of methods, even querying the git origin... none have worked

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events