Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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

Why is BITBUCKET_COMMIT short all of a sudden?

I have scripts comparing BITBUCKET_COMMIT and git rev-parse. We noticed in a 1yo repository where we now added that kind of script, that BITBUCKET_COMMIT for whatever reason is now only 12 characters long. This way the short revision compared with the long revision from git rev-parse will never be equal again like this. Is this a change where I missed a memo? Which newsletter do I need to subscribe?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 09, 2023

Hi Joshua,

Is the build that returns the short hash running on a pull-requests definition?

Builds that run on pull-requests will return a short hash for BITBUCKET_COMMIT. However, builds running on branches, tags, custom pipelines, and the default pipeline will return the full hash for BITBUCKET_COMMIT.

We have a bug report about this in our issue tracker:

Workaround:

You can use the following command in the script of that step, prior to using the variable:

- export BITBUCKET_COMMIT=$(git log -1 --format="%H" $BITBUCKET_COMMIT 2>/dev/null)

The variable BITBUCKET_COMMIT will then return the full commit hash.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events