Bitbucket Pipeline git commit metadata

Johnathan Gilday
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!
February 8, 2018

Bitbucket Pipeline makes available the environment variable `BITBUCKET_COMMIT` which contains the commit hash of a commit that kicked off the build. My build requires additional metadata about this git commit, because we build a version string based off of this metadata like so

 

    REVISION = "$(TZ=UTC git show -s --format=%cd --date=format-local:%Y%m%d-%H%M HEAD).$(git rev-parse --short HEAD)"

Is there a way to configure Bitbucket Pipeline to include this additional variable in the environment? I assume the `.git` directory is available in the build container, so if git were present in the build docker image, I could execute this command in the container - is that right?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events