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

sleep step inside node throws RejectedAccessException

XMLWordPrintable

      Jenkins ver. 1.609.14.1 (CloudBees Jenkins Enterprise 15.05)

      http://jenkins-aws.beesshop.org/job/game-of-life-multi-branch/branch/amazon-ecs-pipeline/3/console

      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (org.jenkinsci.plugins.workflow.cps.CpsClosure2 sleep java.lang.Integer)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:155)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:77)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:68)
      	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)
      	at WorkflowScript.run(WorkflowScript:27)
      	at Unknown.Unknown(Unknown)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
      	at sun.reflect.GeneratedMethodAccessor312.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	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:145)
      	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:106)
      	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:274)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:74)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:183)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:181)
      	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
      

      https://github.com/cyrille-leclerc/game-of-life/blob/53f279a48de561e3ff95beb10d433c3875a2ad07/Jenkinsfile

      docker.withRegistry('', 'dockerhub-credentials-cleclerc') {
      
          checkout scm
          def mavenSettingsFile = "${pwd()}/.m2/settings.xml"
          writeFile file: mavenSettingsFile, text: "<settings><localRepository>${pwd()}/.m2/repo</localRepository></settings>"
          echo "1. PWD: ${pwd()}"
      
          stage 'Build Web App'
          docker.image('cloudbees/java-build-tools:0.0.5').inside {
              echo "2. PWD: ${pwd()}"
              sh "mvn -B -V -s ${mavenSettingsFile} clean package"
          }
      
          // build docker image 'cleclerc/game-of-life' and push it to docker hub
          stage 'Build & Push Docker Image'
      
          echo 'Build docker image cleclerc/game-of-life...'
          def gameOfLifeImage = docker.build('cleclerc/game-of-life', 'gameoflife-web')
      
          echo 'Push docker image cleclerc/game-of-life to Docker Hub...'
          gameOfLifeImage.push()
      
          stage 'Redeploy ECS Service'
          wrap([$class: 'AmazonAwsCliBuildWrapper', credentialsId: 'aws-cleclerc-admin', defaultRegion: 'us-east-1']) {
              // TODO THESE ARE PROBABLY NOT THE BEST ECS CALLS
              sh "aws ecs update-service --service game-of-life --desired-count 0"
              sleep 60
              sh "aws ecs update-service --service game-of-life --desired-count 1"
              sleep 20
          }
      
          stage 'Web Browser tests'
          mail body: "Start web browser tests on http://gameoflife-ecs.beesshop.org/ ?",subject: "Start web browser tests on http://gameoflife-ecs.beesshop.org/ ?", to: 'cleclerc@cloudbees.com'
      
          input "Start web browser tests on http://gameoflife-ecs.beesshop.org/ ?"
      
          // web browser tests are fragile, test up to 3 times
          retry(3) {
              docker.image('cloudbees/java-build-tools:0.0.5').inside {
                  echo "3. PWD: ${pwd()}"
                  sh """
                     curl http://gameoflife-ecs.beesshop.org/
                     cd gameoflife-acceptance-tests
                     mvn -B -V -s -s ${mavenSettingsFile} verify -Dwebdriver.driver=remote -Dwebdriver.base.url=http://gameoflife-ecs.beesshop.org/
                  """
              }
          }
      }
      

            jglick Jesse Glick
            cleclerc Cyrille Le Clerc
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: