Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

getting last commit before push of a specific build

Ido Schachter
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!
November 13, 2017

Hi,

sometimes when working a user accumulates multiple local commits before pushing to the origin.

in that case, BITBUCKET_COMMIT will only point to the last one.

is it possible to somehow get the range of commits that triggered the build?

it is necessary for my team in order to determine which services changed during the last update and only build them.

 

in addition to that, better support for mono-repos could be really great.

Thanks!

2 answers

1 vote
Deleted user November 16, 2017

Ough, sorry, I thought this is discussion, not answer, so don't treat my post as answer please.

 

It's not totally correct heading of question. It's not commit range is required but the last commit hash BEFORE push happen.

So, idea is to check, manipulate only with files newely delivered by push triggered build. To be able to use something like `git diff --names-only ${BITBUCKET_PREVIOUS_COMMIT} HEAD`. Such functionality is highly demanded for CI server. Thanks.

Arjan Oskam February 23, 2018

I am looking for exact the same functionality!

Cedric van Putten March 7, 2018

Not only are you guys looking for this, it's also here https://community.atlassian.com/t5/Git-questions/Is-there-a-way-to-get-the-range-of-comits-pushed-to-a-pipeline/qaq-p/610323.

 

I find it kind of strange that Bitbucket Pipelines doesn't already have this functionality. I mean Travis CI has it (`TRAVIS_COMMIT_RANGE`), CircleCI somehow has it too and even Jenkins has something for this... I really prefer to stick with Pipelines to have an all-in-one power repo, but this kind of things really makes you think about using others...

Like Aaron Hong likes this
vbelozyorov
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!
August 16, 2018

Still no solution for this?

Mathieu Attal
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!
November 7, 2019

any news ?

0 votes
cadic
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!
April 14, 2022

Just in case someone needs this, I was looking for the way to get list of changed files on a pull-request trigger:

 git diff --name-only origin/${BITBUCKET_PR_DESTINATION_BRANCH}..origin/${BITBUCKET_BRANCH}

Please note that this will not work for "tag" trigger or custom pipelines because BITBUCKET_BRANCH is not set

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events