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,462,561
Community Members
 
Community Events
176
Community Groups

how can I integrate the bitbucket build Id to my bitbucket pipeline file as a tag for the artifact?

Edited

I would like to specify the bitbucket build Id that appears when running the pipeline into my bitbucket pipeline file as a tag for the version that will be released from bitbucket.

It is very important for us can you help us?

1 answer

0 votes
Caroline R Atlassian Team Sep 21, 2021

Hi, @fatma_elbehi!

Thank you for reaching out to Atlassian Community!

Pipelines provides a set of default variables that are available for builds and can be used in scripts. 

It’s possible to get the build number by using the BITBUCKET_BUILD_NUMBER variable: 

The unique identifier for a build. It increments with each build and can be used to create unique artifact names.

You can also find more default variables in this documentation:

I hope this helps, but please let me know if you face any obstacles. 

Kind regards,
Caroline

Hi,

yes I tried this solution and it works!

but now I want to add Tags in my pipeline with the branches but my script shows errors when adding the tags could you please help?

I tried this trick but I don't know if it's the correct syntax or not? v2.2.1 is the branch and for v2.2.7 represents the name of the tag.

Screenshot_1.png

Your help will be much appreciated! Thanks in advance!

Fatma

Caroline R Atlassian Team Sep 23, 2021

Hi, Fatma!

Could you confirm if you want to run the Pipeline on a Tag or would like to create a Tag?

The reason I’m asking this is that in the original question, you asked to create a tag. If this is what you need, you can run the following: 

git tag $BITBUCKET_BUILD_NUMBER

Looking forward to hearing from you.

Kind regards,
Caroline

Hi caroline,

no not creating a tag but run the pipeline on a Tag.

Thanks,

Fatma

Caroline R Atlassian Team Sep 27, 2021

Hi, Fatma! :) 

In this case, you need to add a section on your .yml file to run the pipelines on tags:

tags:                         # add the 'tags' section
    release-*:                  # specify the tag
      - step:                   # define the build pipeline for the tag
          name: tags
          script:
             - echo $BITBUCKET_BUILD_NUMBER

In the example above, all the tags that start with "release-" will trigger this pipeline. 

In case you would like to read more about how to configure the bitbucket-pipelines.yml, you can access the following link:

Please let me know how it goes and feel free to share any additional questions regarding this case.

Kind regards,
Caroline

I think that the Tags section does not work properly with artifacts any idea why ?

hello Team,

It works fine now! 

Thanks a lot for the help! I really appreciated!

Best,

Fatma

Caroline R Atlassian Team Oct 01, 2021

Hi, Fatma! 

Thanks for your confirmation, I'm glad to know it's working now :) 

Kind regards,
Caroline 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events