Can I update GIT_PREVIOUS_SUCCESSFUL_COMMIT/GIT_SUCCESSFUL_COMMIT?
I have an Jenkins project implementation where I have a git repo which holds the Jenkinsfile that I want to run for my scripted pipeline job which checks out another git repo to build. This build repo is not mentioned on the Jenkins job
All is well, except in the repo where I build, I bump the revision number and push that in as part of my scripted pipeline. Later, when bitbucket detects a change in the repo that I build, it kicks Jenkins to see if there are any changes.
Jenkins detects the change of the bumped version number (it’s the only change) and Jenkins kicks off another build. Obviously this is not what I want.
I tried setting the ignore regex and author settings on the jobs configuration change, but obviously it doesn’t work because I don’t have the git repo that I build mentioned on the project change.
Is there a way in my scripted pipeline that I can set GIT_PREVIOUS_SUCCESSFUL_COMMIT to the SHA of my bumped version number change at the end of my run so that next time a job is launched and git ls-remote checks the top of tree , the comparison
of GIT_PREVIOUS_SUCCESS_COMMIT (or is it GIT_PREVIOUS_COMMIT) to the top of my build git repo is the same and a build is averted? I really don’t want to clone a tree to do the comparison myself which I have done but with lots of branches, it becomes over
bearing with all the git clones just to abort the run.
I hope I added enough of a description to make sense.