I want to say something like:
git branch: commitHash, credentialsId: credentialsId, url: url
Usecase: I do parallel assembly and testing on different platforms and I want each of them to get the same code. This is C ++, and we build on separate platforms, and also build on them.
If I do this above, it fails - the base code assumes that the given branch is actually a branch, or you get something like:
[Linux64 Build] > git rev-parse origin/e4b6c976a0a986c348a211579f1e8fd32cf29567^{commit} # timeout=10 [Pipeline] [Linux64 Build] } [Pipeline] [Linux64 Build] // dir [Pipeline] [Linux64 Build] } [Pipeline] [Linux64 Build] // node [Pipeline] [Linux64 Build] } [Linux64 Build] Failed in branch Linux64 Build
I saw the variations on this question asked earlier, although there are no real answers - just suggestions, for example, to hide the source code, etc. Not quite what I need.
The documentation suggests that it should be possible to give explicit hash hashes, perhaps using branches instead, but I cannot parse the syntax and cannot find any examples. When I do this, I get a master branch, I think - in our setup the master does not work.
So far, the only solution I have found was to check the branch and then explicitly call git to get the commit:
git branch: branch, credentialsId: credentialsId, url: url sh 'git checkout ' + commitHash
(where the branch is the branch, I initially got the hash at the top of the job. It works, but is not the easiest.
Has anyone got a better way?