-
-
Save ygor-glaboo/ed7443686f7e0ed33aebbbdc15e15d9a to your computer and use it in GitHub Desktop.
Exporting short git commit sha1 hash in Jenkins through System Groovy Script build step
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
import hudson.model.* | |
def env = build.getEnvironment() | |
def gitCommit = env['GIT_COMMIT'] | |
def shortGitCommit = gitCommit[0..6] | |
def pa = new ParametersAction([ | |
new StringParameterValue("SHORT_GIT_COMMIT", shortGitCommit) | |
]) | |
// add variable to current job | |
build.addAction(pa) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment