Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57190

Getting error in presend script section in POST action

    Details

    • Similar Issues:

      Description

      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: "xyz@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)

        Attachments

          Activity

          Hide
          shreyasbilikere Shreyas Arjun added a comment -

          Any updates on this ?

          Show
          shreyasbilikere Shreyas Arjun added a comment - Any updates on this ?
          Hide
          slide_o_mix Alex Earl added a comment -

          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.

          Show
          slide_o_mix Alex Earl added a comment - 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.

            People

            • Assignee:
              davidvanlaatum David van Laatum
              Reporter:
              shreyasbilikere Shreyas Arjun
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: