Created
January 17, 2022 13:45
-
-
Save zionyx/578b4daa9c7f81019df089fba6d53563 to your computer and use it in GitHub Desktop.
Jenkinsfile gitversion docker image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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