I defined variable in declarative Jenkins pipeline script but having issues with simple variable declaration.
Here is my script:
pipeline { agent none stages { stage("first") { def foo = "foo" // fails with "WorkflowScript: 5: Expected a step @ line 5, column 13." sh "echo ${foo}" } }}
but it's shows error:
org.codehaus.groovy.control.MultipleCompilationErrorsException:startup failed:WorkflowScript: 5: Expected a step @ line 5, column 13. def foo = "foo" ^