Cannot zip files in subdirectories
Hey there 😃
Calling ziputil.ZipDir("path/to/file", "path/to/zip", false) produces the /usr/bin/zip -rTy path/to/zip file command which ultimately fails with zip I/O error: No such file or directory as file does not exist but path/to/file does.
Indeed, this happens:
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/ziputil/ziputil.go#L24
Before opening a pull request I wanted to know if there was any reason behind this implementation.
Thanks!
Hello @sa-spag
is this a custom script, or the Create ZIP step?
I can reproduce the issue with the Create ZIP step.
Could you please send me a build's url where this issue happens, so I can check out the full logs to it?
Here it is. Notice the:
config:
- SourcePath: path/to/file
- Destination: path/to/zip
Issue with compress: command: (/usr/bin/zip "-rTy" "path/to/zip" "file") failed, output: zip I/O error: No such file or directory
zip error: Could not create output file (path/to/zip), error: exit status 15
could it be that the correct path would be Users/vagrant/git/fastlane/test_output/BlaBlaCar.test_result/ ?
hmm that is the same that you set 🤔 I would try it to be sure
As I expected:
Error: failed to parse config:
- SourcePath: /Users/vagrant/git/fastlane/test_output/BlaBlaCar.test_result/: file does not exist
Again I'm pretty sure my initial problem is that filepath.Base is called but I want to make sure it's indeed not the intended behavior.
could you add and run a script step with:
#!/bin/bash
set -e
set -x
/usr/bin/zip "-rTy" "/Users/vagrant/git/fastlane/test_output/BlaBlaCar.test_result.zip" "BlaBlaCar.test_result"
"BlaBlaCar.test_result" does not exist (but fastlane/test_output/BlaBlaCar.test_result does), the previous snippet will fail. FYI I already implemented a workaround using a script step:
- script:
title: Compress test results bundle
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
cd fastlane/test_output
zip -qrTy BlaBlaCar.test_result.zip BlaBlaCar.test_result
I'm glad you found a solution!
and I realised that if you give it the long path, then the second argument needs the same path to it as well like
/usr/bin/zip "-rTy" "/Users/vagrant/git/fastlane/test_output/BlaBlaCar.test_result.zip" "/Users/vagrant/git/fastlane/test_output/BlaBlaCar.test_result"
Bump—is this issue still on the radar? The workaround is pretty inconvenient for something that should work out of the box. Thanks!
Hello @fehersanyi-bitrise, is this issue still considered?
Hi @tdesert, Could you please send a build URL where the issue is reproducible? My guess is that the issue happens when the destination directory does not exist, but this should be validated. Thanks