Skip to content

Instantly share code, notes, and snippets.

@ar45
Created August 22, 2016 05:31
Show Gist options
  • Save ar45/49a98be9345c1e6236e72621a9ea1818 to your computer and use it in GitHub Desktop.
Save ar45/49a98be9345c1e6236e72621a9ea1818 to your computer and use it in GitHub Desktop.
Jenkins extract commit from comment
def thr = Thread.currentThread()
def build = thr?.executable
def env = build.getBuildVariables()
//def env = build.getEnvironment()
println env
def ghprbCommentBody = env.get("ghprbCommentBody")
println "ghprbCommentBody=$ghprbCommentBody"
def map = [BACKEND_TARGET_BRANCH: "refs/remotes/origin/master"]
def match = (ghprbCommentBody =~ /jenkins retest this please against ([0-9a-zA-Z]+)/)
if (match) {
map = [BACKEND_TARGET_BRANCH: match[0][1]]
}
println map
return map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment