I have tried reading the build cause as suggested in this example https://github.com/jenkinsci/pipeline-examples/tree/master/pipeline-examples/get-build-cause
Accessing the build cause outside of a node causes the pipeline to fail right after entering the first stage and without an error or exception. void main(def args) { def causes = currentBuild.rawBuild.getCauses() stage 'Checkout' node { scm checkout } } Accessing the build cause within a node throws exception java.io.NotSerializableException: hudson.model.Cause$UserIdCause void main(def args) { stage 'Checkout' node { def causes = currentBuild.rawBuild.getCauses() scm checkout } } So I put it within a @NonCPS method, but it still fails the same way as before. void main(def args) { stage 'Checkout' node { def cause = getLastBuildCause() scm checkout } } @NonCPS def getLastBuildCause() { def causes = currentBuild.rawBuild.getCauses() return causes.last() } I need to find out who or what caused the build, to find out if it is an upstream project. Unless there is some other access methods for this? -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/14e02411-a669-4225-a405-9c2299894aea%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.