Skip to content

Instantly share code, notes, and snippets.

View MachinesAreUs's full-sized avatar

Agustín Ramos MachinesAreUs

View GitHub Profile
@MachinesAreUs
MachinesAreUs / gist:3014977
Created June 29, 2012 00:45 — forked from chrix2/gist:2232656
Get parent build Jenkins
def myJob = hudson.model.Hudson.instance.getItem("My_Job")
def lastBuild = myJob.getLastBuild()
def cause = lastBuild.getCause(hudson.model.Cause$UpstreamCause)
def parentBuildNum = cause.upstreamBuild
def parentJobName = cause.upstreamProject
def parentJobUrl = cause.upstreamUrl
println(parentBuildNum)
println(parentJobName)
println(parentJobUrl)