-
Bug
-
Resolution: Not A Defect
-
Major
-
None
$DEFAULT_CONTENT is not available in jenkins declarative pipeline. Attempt to access it
pipeline { agent any stages { stage('one') { agent any steps { script { println 'Hello world' } } } } post { always { println 'xxxxxxxxxxxxxxxxxxxxxxxxxx' emailext body: """ <p><b>Build Initiated by test</b> </p> <p>${DEFAULT_CONTENT}</p> <p></p> <p><a href="HOST">HOST</a></p> """, subject: '$DEFAULT_SUBJECT', to: "srb@gmail.com" } } }
gives the follow error(line number are not correct as code omitted for brevity):
groovy.lang.MissingPropertyException: No such property: DEFAULT_CONTENT for class: WorkflowScript
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)
at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:290)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onGetProperty(GroovyInterceptor.java:68)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:348)
at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
at WorkflowScript.run(WorkflowScript:30)
[JENKINS-57147] MissingPropertyException: $DEFAULT_CONTENT is not available in declarative pipeline.
Resolution | New: Not A Defect [ 7 ] | |
Status | Original: Open [ 1 ] | New: Closed [ 6 ] |