I have a number of files being generated from my build which I want to publish together in a single zip file. I tried scripting this making use of the 'zip' command, however I get the following error. Is this possible?
bash: zip: command not found
I'm using this workaraound now:
Instead of
- zipfile="filename"
- dir="directory"
- zip -r $zipfile.zip $dir
I'm using pythons like so:
- zipfile="filename"
- dir="directory"
- python -c "import shutil;shutil.make_archive('$zipfile','zip',root_dir='.', base_dir='$dir')"
This will create a zipfile without having to install zip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jon, can you show us your bitbucket-pipelines.yml file? Can you confirm you have 'zip' installed?
Regards!
Ana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ana,
I also want to zip in a pipeline and I also come across the error
bash: zip: command not found
Could you please assist: How could I get zip installed (in a pipeline) so that I can use it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want to do the same thing . Want to zip the files in the repository using bitbucket pipeline yml file
Please anyone , guide me ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or - if you have python available - use my above-described workaround
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried with python and this is what i am getting as error. I am very new to bitbucket pipeline ,
python -c "import shutil;shutil.make_archive('$zipfile','zip',root_dir='.', base_dir='$dir')"<1s+ python -c "import shutil;shutil.make_archive('$zipfile','zip',root_dir='.', base_dir='$dir')"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.5/shutil.py", line 794, in make_archive
filename = func(base_name, base_dir, **kwargs)
File "/usr/local/lib/python3.5/shutil.py", line 683, in _make_zipfile
zf.write(path, path)
File "/usr/local/lib/python3.5/zipfile.py", line 1441, in write
while arcname[0] in (os.sep, os.altsep):
IndexError: string index out of range
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
my yml file looks as follows. Just trying a simple example.
and this is my bitbucket repo: I need to have a web.zip in the repo after the pipeline execution. is it possible with this approach?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure you can use ./ as a basedir. I#m also neither a pipeline nor a python expert.
Maybe take a look at the documentation for shutil.make_archive or check this https://stackoverflow.com/questions/32640053/compressing-directory-using-shutil-make-archive-while-preserving-directory-str
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.