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

0 views
Skip to first unread message

kuisathaverat@gmail.com (JIRA)

unread,
Sep 24, 2018, 10:19:11 AM9/24/18
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo commented on Bug JENKINS-44078
 
Re: "zip" step is not working according to the documentation

I have found the same error, after some time trying to understand why on a simple pipeline works and on a declarative does not, I found that on a script blocks works

This works

pipeline {
    agent any 
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                script{
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                } 
            }
        }
    }
}

This does not work

pipeline {
    agent any 
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                //script{ remove the script block
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                //} 
            }
        }
    }
}
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kuisathaverat@gmail.com (JIRA)

unread,
Sep 24, 2018, 10:19:11 AM9/24/18
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo reopened an issue
 
Jenkins / Bug JENKINS-44078
Change By: Ivan Fernandez Calvo
Resolution: Cannot Reproduce
Status: Closed Reopened

kuisathaverat@gmail.com (JIRA)

unread,
Sep 24, 2018, 10:23:08 AM9/24/18
to jenkinsc...@googlegroups.com
I have found the same error, after some time trying to understand why on a simple pipeline works and on a declarative does not, I found that on a script blocks works


pipeline {
    agent any
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                script{
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                }
            }
        }
    }
}
{code}

{color: red #FF0000 }This does not work{color}
{code
:java }

pipeline {
    agent any
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                //script{ remove the script block
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                //}
            }
        }
    }
}
{code}

kuisathaverat@gmail.com (JIRA)

unread,
Sep 24, 2018, 10:23:08 AM9/24/18
to jenkinsc...@googlegroups.com
I have found the same error, after some time trying to understand why on a simple pipeline works and on a declarative does not, I found that on a script blocks works



 

This works
{code:java}
pipeline {
    agent any
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                script{
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                }
            }
        }
    }
}
{code}
{color:# FF0000 ff0000 }This does not work{color}

{code:java}
pipeline {
    agent any
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                //script{ remove the script block
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                //}
            }
        }
    }
}
{code}

kuisathaverat@gmail.com (JIRA)

unread,
Sep 24, 2018, 10:24:03 AM9/24/18
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo updated an issue
 
Component/s: pipeline-model-definition-plugin

kuisathaverat@gmail.com (JIRA)

unread,
Sep 24, 2018, 10:27:03 AM9/24/18
to jenkinsc...@googlegroups.com
I have found the same error, after some time trying to understand why on a simple pipeline works and on a declarative does not, I found that on a script blocks works


     deleteDir()
     sh 'mkdir -p archive'
     sh 'echo test > archive/test.txt'
     zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
}
{code}

{code:java}
pipeline {
    agent any
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                script{
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                }
            }
        }
    }
}
{code}
{color:#ff0000}This does not work{color}

{code:java}
pipeline {
    agent any
    stages{
        stage('test'){
            agent { label 'linux' }
            steps{
                deleteDir()
                sh 'mkdir -p archive'
                sh 'echo test > archive/test.txt'
                //script{ remove the script block
                    zip archive: true, dir: 'archive', glob: '', zipFile: 'coverage-files.zip'
                //}
            }
        }
    }
}
{code}

tobin.davis@meghcomputing.com (JIRA)

unread,
Jul 11, 2019, 2:21:05 PM7/11/19
to jenkinsc...@googlegroups.com

I am getting a very different error.  The code:

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
}

Error output:

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

 Granted, there is virtually NO documentation on the proper use of this function (or that zip must be installed), but it should work.  

tobin.davis@meghcomputing.com (JIRA)

unread,
Jul 11, 2019, 2:42:07 PM7/11/19
to jenkinsc...@googlegroups.com
Tobin Davis updated an issue
 
Change By: Tobin Davis
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 ___cps.transform___(Native Method)
{quote}

 Granted, there is virtually NO documentation on the proper use of this function (or that zip must be installed), but it should work.  
Reply all
Reply to author
Forward
0 new messages