Try nesting that in a script block
pipeline {
agent any
stages {
stage('example') {
steps {
* script {*
def causes = currentBuild.getBuildCauses()
echo "Causes are ${causes}"
* }*
}
}
}
}
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
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