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

Can no longer run Node.js mocha as part of my Pipeline Script

XMLWordPrintable

      Previously on version of the script-security-plugin 1.15, I didn't have a problem running my Pipeline script, but recently I moved to Jenkins 2.4 and upgraded all the plugins, but my Node.js mocha tests are failing with this error:

      Done, without errors.
      + export APPLICATION_HOSTNAME=http://swagger-rest-dev.runq-sd-d.qualcomm.com
      + APPLICATION_HOSTNAME=http://swagger-rest-dev.runq-sd-d.qualcomm.com
      + export MOCHA_FILE=./jenkins-test-results.xml
      + MOCHA_FILE=./jenkins-test-results.xml
      + ./node_modules/.bin/_mocha test/swagger-test.js --reporter mocha-junit-reporter
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified field hudson.AbortException stack
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363)
      	at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
      	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:23)
      	at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17)
      	at WorkflowScript.runTests(WorkflowScript:288)
      	at WorkflowScript.run(WorkflowScript:55)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62)
      	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
      	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54)
      	at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:277)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:77)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:186)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:184)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Finished: FAILURE
      

      The snippet of code from my Pipeline script is as follows:

      def runTests(env) {
          echo "Testing apps on " + env
          def appName = (env == 'prod' ? APPLICATION_NAME : APPLICATION_NAME + '-' + env)
          def appDomain = 'http://' + appName + APPLICATION_DOMAIN
      
          // Use try/catch if you want to continue with notification only even if tests fail
          try {
              git GITHUB_PROJECT
              sh '''
                  npm config set registry="http://registry.npmjs.org/"
                  npm install
                  ./node_modules/grunt-cli/bin/grunt
                  export APPLICATION_HOSTNAME=''' + appDomain + '''
                  export MOCHA_FILE=./jenkins-test-results.xml
                  ./node_modules/.bin/_mocha test/** --reporter mocha-junit-reporter
              '''
              archive 'jenkins-test-results.xml'
              step $class: 'hudson.tasks.junit.JUnitResultArchiver', testResults: '**/*.xml'
          } catch (e) {
              def msg = 'Error running tests (do you have the right APPLICATION_HOSTNAME set?) : ' + e.stack
              echo msg
              emailError(msg)
          }
      }
      

      Attached is my plugins.txt file from our Docker build.

      Any idea how I can overcome this issue?

            abayer Andrew Bayer
            occasl Lou Sacco
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: