Created
June 1, 2012 09:37
-
-
Save cheeming/2850764 to your computer and use it in GitHub Desktop.
Groovy script to get git HEAD to be used in Jenkins
This file contains hidden or 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.FilePath; | |
import hudson.util.StreamTaskListener; | |
import hudson.plugins.git.GitAPI; | |
import hudson.EnvVars; | |
j = Jenkins.instance.getJob("codility"); | |
workspace_path = j.getRootDir().toString() + "/workspace"; | |
workspace = new FilePath(new File(workspace_path)); | |
listener = new StreamTaskListener(); | |
envvars = new EnvVars(); | |
scm = new GitAPI("git", workspace, listener, envvars, ""); | |
result = scm.revParse("HEAD") | |
result.getName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmmm, seems the Dynamic Parameter plugin don't work well with import of plugins... I wonder why