Skip to content

Instantly share code, notes, and snippets.

@zionyx
Created January 17, 2022 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zionyx/578b4daa9c7f81019df089fba6d53563 to your computer and use it in GitHub Desktop.
Save zionyx/578b4daa9c7f81019df089fba6d53563 to your computer and use it in GitHub Desktop.
Jenkinsfile gitversion docker image
// https://hub.docker.com/layers/gittools/gitversion/5.8.1-alpine.3.14-6.0-amd64/images/sha256-ca0a8c928333b55e976b8c1f7e33b34a9b0884598adad92be2d2e1234b9b28c2?context=explore
scripts {
def gitversionJson = sh label: 'Running GitVersion.', returnStdout: true, script: 'docker run --rm -v "$(pwd):/repo" gittools/gitversion:5.8.1-alpine.3.14-6.0-amd64 /repo'
try {
def gitversionMap = new groovy.json.JsonSlurperClassic().parseText(gitversionJson)
gitversionMap.each { k, v -> env["${prefix}${k}"] = "${v}" }
} catch (Exception ex) {
echo "GitVersion output: \n${gitversionJson}"
error ex.getMessage()
throw ex
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment