Add CI_COMMIT_SHORT_SHA to gitlab-runner-exec
What does this MR do?
This simply adds a precomputed environment variable containing the first eight characters of CI_COMMIT_SHA.
Why was this MR needed?
It's handy for versioning and other purposes to associate a shorter ID with a build, change, etc. We use it in some cases in our own software:
func (b *AbstractShell) writeCheckoutCmd(w ShellWriter, build *common.Build) {
w.Notice("Checking out %s as %s...", build.GitInfo.Sha[0:8], build.GitInfo.Ref)
w.Command("git", "checkout", "-f", "-q", build.GitInfo.Sha)
}
Are there points in the code the reviewer needs to double check?
Don't think this really needs test but open to hearing otherwise.
Does this MR meet the acceptance criteria?
-
Documentation created/updated -
Added tests for this feature/bug -
In case of conflicts with master- branch was rebased
What are the relevant issue numbers?
Expands on https://gitlab.com/gitlab-org/gitlab-ce/issues/48061
Edited by Jason Yavorsky