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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.