Check changes shows extra changes on branches x commits behind
Short version of the problem: When a branch/MR is several commits behind master in BB extra "check changes" labels will get added.
Long version...
Example: https://repo1.dso.mil/platform-one/big-bang/bigbang/-/jobs/11510060
Problem: This branch was 4 commits behind, changes to Nexus/Sonarqube were made in the master branch. This pipeline should NOT have enabled nexus or sonarqube but the diff check showed changes because my branch was behind.
Solution: https://repo1.dso.mil/platform-one/big-bang/pipeline-templates/pipeline-templates/-/blob/master/library/templates.sh#L83 - this line should change to essentially check out the last common commit between source/target branch.
While iterating through changes reviewing this functionality I stumbled on the magic ...
which when used with git diff
would ensure you were diffing against the last common commit (see this reference). I'm not sure if the same works with git checkout
although git checkout master...
does something.