-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Plugin version: 2.6.1 (latest, on the day of reporting this bug)
-
-
pipeline-utility-steps:2.7.0
Symptom
If you provide the "overwrite: true" parameter, and the file did not exist, the step throws this exception:
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from XX-XX-XXX-XX.kube-prometheus-stack-kubelet.kube-system.svc.cluster.local/XX.XX.XXX.XX:XXXX at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357) at hudson.remoting.Channel.call(Channel.java:1001) at hudson.FilePath.act(FilePath.java:1070) at hudson.FilePath.act(FilePath.java:1059) at org.jenkinsci.plugins.pipeline.utility.steps.zip.ZipStepExecution.run(ZipStepExecution.java:95) at org.jenkinsci.plugins.pipeline.utility.steps.zip.ZipStepExecution.run(ZipStepExecution.java:60) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) 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)java.io.IOException: Failed to delete XXXXXXXXXXXXXXXXXXXX.zip at org.jenkinsci.plugins.pipeline.utility.steps.zip.ZipStepExecution$ZipItFileCallable.invoke(ZipStepExecution.java:137) at org.jenkinsci.plugins.pipeline.utility.steps.zip.ZipStepExecution$ZipItFileCallable.invoke(ZipStepExecution.java:122) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3122) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:375) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:73) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:118) at java.lang.Thread.run(Unknown Source)
I masked the private info with 'X'-es.
Cause
The code was simply written that way:
if (overwrite && !Files.deleteIfExists(Paths.get(canonicalZip))) { throw new IOException("Failed to delete " + canonicalZip); }
See corresponding code in ZipStepExecution.java.
Since the docu says:
> overwrite (optional)
> If the zip file should be overwritten in case of already existing a file with the same name.
I considered this as a bug. The zip step called with "overwrite: true" should tolerate if the zip file did not exist before.