Re: cannot get build causes

2020-07-30 Thread 'Gavin Davies' via Jenkins Users
Try nesting that in a script block pipeline { agent any stages { stage('example') { steps { * script {* def causes = currentBuild.getBuildCauses() echo "Causes are ${causes}" * }* } } } }

Re: cannot get build causes

2020-07-30 Thread Gianluca
Hi, that is a confusing error in my point of view that you will learn to interpret :-) The pipeline you wrote is a declarative one and the usage of "def ... " is something you can do only in scripted pipelines ... hence, what the error really means is: "You forgot to open a script block". The

cannot get build causes

2020-07-29 Thread Tom Brownridge
Hello, I am new and am fundamentally misunderstanding pipeline syntax and cannot relate the examples in the documentation. What am I missing? Looking at the example here: https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/get-build-cause/getBuildCause.groovy, I see a