[JIRA] (JENKINS-57190) Getting error in presend script section in POST action

25 views
Skip to first unread message

shreyas.arjun007@gmail.com (JIRA)

unread,
Apr 25, 2019, 10:33:03 PM4/25/19
to jenkinsc...@googlegroups.com
Shreyas Arjun created an issue
 
Jenkins / Task JENKINS-57190
Getting error in presend script section in POST action
Issue Type: Task Task
Assignee: David van Laatum
Components: email-ext-plugin
Created: 2019-04-26 02:32
Environment: Local
Labels: presendScript post-actions declarative jenkinspipeline
Priority: Minor Minor
Reporter: Shreyas Arjun

My post section code as follows

post {
always {
emailext attachmentsPattern: "Serenity_Test_Results_${env.BUILD_NUMBER}.zip" ,
presendScript: "def reportPath=${workspace}.child(\"target/serenity-summary.html\")msg.setContents(reportPath.readToString(), \"text/html\")",
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}",
subject: "Testing: Jenkins Job Results - Build # ${env.BUILD_NUMBER}",
mimeType: 'text/html',
to: "x...@abc.com"
}
}

 

I am getting below error

 

[Pipeline] { (Declarative: Post Actions) [Pipeline] emailext groovy.lang.MissingPropertyException: No such property: jenkins for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:264) 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$0.callStatic(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:230) at Script1.run(Script1.groovy:1) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:154) at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:627) at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:573) at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:456) at hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:224) at hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:163) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

shreyas.arjun007@gmail.com (JIRA)

unread,
Apr 29, 2019, 3:18:02 AM4/29/19
to jenkinsc...@googlegroups.com

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

unread,
Jul 16, 2019, 4:25:02 PM7/16/19
to jenkinsc...@googlegroups.com
Alex Earl closed an issue as Not A Defect
 

My guess is that you don't want ${workspace}. There is no binding that is named workspace for a pre-send script. The one coming from the job itself is a String not a FilePath, so you can't do .child() directly on it. In the future please use the mailing lists for questions.

Change By: Alex Earl
Status: Open Closed
Resolution: Not A Defect
Reply all
Reply to author
Forward
0 new messages