-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
I want to be able to access parent job/build from my pipeline, unfortunately it throws an error.
import org.jenkinsci.plugins.workflow.job.WorkflowJob import org.jenkinsci.plugins.workflow.job.WorkflowRun WorkflowJob ParentJob WorkflowRun ParentBuild pipeline { agent any stages { stage('Run') { steps { script { def cause = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause) if (cause == null) { currentBuild.result = 'ABORTED' error("Unknown parent build or current build was triggered by user directly.") } def parentJob = hudson.model.Hudson.instance.getItem(cause.upstreamProject) def parentBuild = parentJob.getBuildByNumber(cause.upstreamBuild) ParentJob = parentJob ParentBuild = parentBuild } } } } }