[JIRA] (JENKINS-57147) MissingPropertyException: $DEFAULT_CONTENT is not available in declarative pipeline.

4 views
Skip to first unread message

saurabh.sp.tripathi@gmail.com (JIRA)

unread,
Apr 22, 2019, 6:13:02 PM4/22/19
to jenkinsc...@googlegroups.com
Saurabh Tripathi created an issue
 
Jenkins / Bug JENKINS-57147
MissingPropertyException: $DEFAULT_CONTENT is not available in declarative pipeline.
Issue Type: Bug Bug
Assignee: David van Laatum
Components: email-ext-plugin
Created: 2019-04-22 22:12
Priority: Major Major
Reporter: Saurabh Tripathi

$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: "s...@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)
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

slide.o.mix@gmail.com (JIRA)

unread,
Jul 16, 2019, 4:29:01 PM7/16/19
to jenkinsc...@googlegroups.com
Alex Earl closed an issue as Not A Defect
Change By: Alex Earl
Status: Open Closed
Resolution: Not A Defect

slide.o.mix@gmail.com (JIRA)

unread,
Jul 16, 2019, 4:29:02 PM7/16/19
to jenkinsc...@googlegroups.com
emailext body: '''
    		    <p><b>Build Initiated by test</b> </p>
                <p>${DEFAULT_CONTENT}</p>
                <p></p>
                <p><a href="HOST">HOST</a></p>
        ''',

This will stop groovy from trying to resolve the variable and let email-ext do it during it's variable replacement.

Reply all
Reply to author
Forward
0 new messages