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

"zip" step is not working according to the documentation

      When using "zip" as per the documentation:

      zip zipFile: '.tmp/management-console.zip', dir: 'dist', archive: true
      

      I receive the following error message:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 30: Invalid parameter "zipFile", did you mean "label"? @ line 30, column 21.
                         zip zipFile: '.tmp/app.zip', dir: 'dist', archive: true
                             ^
      
      WorkflowScript: 30: Invalid parameter "dir", did you mean "url"? @ line 30, column 61.
         .tmp/app.zip', dir: 'dist
                                       ^
      
      WorkflowScript: 30: Invalid parameter "archive", did you mean "url"? @ line 30, column 74.
         app.zip', dir: 'dist', archive: t
                                       ^
      
      3 errors
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:116)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:430)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:393)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:238)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:405)
      
      

      Were the parameters changed? This is the reference I followed: https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#code-zip-code-create-zip-file

          [JENKINS-44078] "zip" step is not working according to the documentation

          Roch Devost created issue -
          Roch Devost made changes -
          Summary Original: "zip is not working according to the documentation New: "zip" step is not working according to the documentation
          Roch Devost made changes -
          Description Original: When using "zip" as per the documentation:
          {code:java}
          zip zipFile: '.tmp/management-console.zip', dir: 'dist', archive: true
          {code}
          I receive the following error message:
          {code:java}
          org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
          WorkflowScript: 30: Invalid parameter "zipFile", did you mean "label"? @ line 30, column 21.
                             zip zipFile: '.tmp/app.zip', dir: 'dist', archive: true
                                 ^

          WorkflowScript: 30: Invalid parameter "dir", did you mean "url"? @ line 30, column 61.
             .tmp/app.zip', dir: 'dist
                                           ^

          WorkflowScript: 30: Invalid parameter "archive", did you mean "url"? @ line 30, column 74.
             app.zip', dir: 'dist', archive: t
                                           ^

          3 errors

          at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
          at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
          at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
          at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
          at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
          at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
          at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
          at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
          at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:116)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:430)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:393)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:238)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:405)

          {code}
          Were the parameters changed?
          New: When using "zip" as per the documentation:
          {code:java}
          zip zipFile: '.tmp/management-console.zip', dir: 'dist', archive: true
          {code}
          I receive the following error message:
          {code:java}
          org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
          WorkflowScript: 30: Invalid parameter "zipFile", did you mean "label"? @ line 30, column 21.
                             zip zipFile: '.tmp/app.zip', dir: 'dist', archive: true
                                 ^

          WorkflowScript: 30: Invalid parameter "dir", did you mean "url"? @ line 30, column 61.
             .tmp/app.zip', dir: 'dist
                                           ^

          WorkflowScript: 30: Invalid parameter "archive", did you mean "url"? @ line 30, column 74.
             app.zip', dir: 'dist', archive: t
                                           ^

          3 errors

          at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
          at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
          at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
          at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
          at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
          at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
          at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
          at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
          at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:116)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:430)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:393)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:238)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:405)

          {code}
          Were the parameters changed? This is the reference I followed: https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#code-zip-code-create-zip-file
          Paul Garstenauer made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          Steve Todorov made changes -
          Link New: This issue relates to JENKINS-50157 [ JENKINS-50157 ]
          Ivan Fernandez Calvo made changes -
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          Ivan Fernandez Calvo made changes -
          Component/s New: pipeline-model-definition-plugin [ 21706 ]
          Tobin Davis made changes -
          Comment [ I am getting a very different error.  The code:
          {code:java}
          node('compute'){
              def BRANCH_NAME = 'develop'
              stage('Checkout'){
                  checkout scm // This is only for sample code flow - original code works fine here
              }
              stage('Zip test'){
                  zip zipfile: "test.zip", archive: true, dir: "${WORKSPACE}", glob: "Jenkinsfile"
             } // Jenkinsfile exists in the repo and is in the ${WORKSPACE} directory for this job
          }
          {code}
          Error output:
          {quote}hudson.model.Descriptor$FormException: Can not be empty
           at org.jenkinsci.plugins.pipeline.utility.steps.zip.ZipStep.<init>(ZipStep.java:58)
           Caused: java.lang.reflect.InvocationTargetException
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:289)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:263)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:177)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor571.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:158)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:156)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:160)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
           Caused: java.lang.IllegalArgumentException: Could not instantiate \{zipfile=/scratch/jenkins/workspace/test-tobin/test.zip, archive=true, dir=/scratch/jenkins/workspace/test-tobin, glob=Jenkinsfile} for ZipStep(zipFile: String, archive?: boolean, dir?: String, glob?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:263)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:177)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor571.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:158)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:156)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:160)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:130)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
           at WorkflowScript.run(WorkflowScript:13)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:84)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
           at sun.reflect.GeneratedMethodAccessor466.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.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor468.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:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
           at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:66)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           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)
           Finished: FAILURE
          {quote}
           Granted, there is virtually NO documentation on the proper use of this function (or that zip must be installed), but it should work.   ]

            rsandell rsandell
            rochdev Roch Devost
            Votes:
            11 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: