Created
August 9, 2018 08:19
-
-
Save kumbasar/fde8a6748d089a5d0fe8d38dcc8ab7d3 to your computer and use it in GitHub Desktop.
Get upstream info in downstream Jenkins job
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
node('myslave') { | |
stage('downstream') { | |
sh """ | |
export shortDescription="${getCauser()?.shortDescription}" | |
export upstreamBuild="${getCauser()?.upstreamBuild}" | |
export upstreamUrl="${getCauser()?.upstreamUrl}" | |
export upstreamProject="${getCauser()?.upstreamProject}" | |
""" | |
} | |
} | |
@NonCPS | |
def getCauser() { | |
def upstream = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause) | |
return upstream | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment