Skip to content

Instantly share code, notes, and snippets.

@kmadel
Created June 28, 2016 14:52
Show Gist options
  • Save kmadel/766c8d4bea0cd58d0ae087f16a67d14e to your computer and use it in GitHub Desktop.
Save kmadel/766c8d4bea0cd58d0ae087f16a67d14e to your computer and use it in GitHub Desktop.
for (cause in currentBuild.rawBuild.getCauses()) {
if (cause instanceof Cause.UpstreamCause) {
def upstreamProjectName = cause.getUpstreamProject()
echo upstreamProjectName
def job = hudson.model.Hudson.instance.getItem(upstreamProjectName)
def build = job.getBuildByNumber(cause.getUpstreamBuild())
echo build.buildVariableResolver.resolve("version")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment