zip availability in pipeline

chudinov March 6, 2019

Is zip, or any other compressor program that producing zip archives available in pipelines?

Azure Function pipe works with zip archives only.

But how to produce the archive in a pipeline ?

 

4 answers

2 votes
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2019

If the Docker image you're using has zip built in, or if you install zip as part of the pipeline (perhaps with apt), then you can use zip in Bitbucket Pipelines.

chudinov March 7, 2019

The default image I use for build dot net application does not have zip. So I use apt-get to install every time before build with

apt-get update && apt-get install --yes zip

what a wasting of time!

Like # people like this
Kavashgar Manimarpan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 27, 2020

waste of time = more pipeline run time =  more $

Like # people like this
1 vote
Raul Gomis
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2019

@chudinov the default image: atlassian/default-image:2 has already zip installed. You could use that one.

Also, here you can see an example using Azure Web Apps Pipe: https://bitbucket.org/microsoft/example-azure-web-apps-deploy/src/master/bitbucket-pipelines.yml

chudinov March 7, 2019

The default image I need is obviously microsoft/dotnet:sdk. No it does not have zip unfortunately. So I do now every build:

apt-get update && apt-get install --yes zip

Graham Gatus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2019

@chudinov you can also build your own docker image, and host it for free up on Dockerhub. Any tools you required for your pipeline can be added to the image, simplifying your pipeline.

 

An example Dockefile:

FROM microsoft/dotnet:sdk
RUN apt-get update && apt-get install -y zip
# Install any other tooling you need.

In your bitbucket-pipelines.yml file, you can then specify the image you've built at either the pipeline or the step level.

Like Javier Vegas likes this
0 votes
Stanislav Ponomarenko
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 23, 2023

Hello

Had the same problem, zip command was not found when I used atlassian/default-image in my pipeline. The global env had attached all known paths but whereis command didn't find the zip binary location.

$PATH=/root/.nvm:/bin/versions/node/v4.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ zip -r $BITBUCKET_REPO_SLUG.zip cfg/ client/ node_modules/ src/ *.js
bash: zip: command not found

The problem was fixed by defining the version of atlassian/default-image image to version 4.

 

name: Create archive
image: atlassian/default-image:4
script:
- env
- npm ci --omit=dev


I hope this will help someone else.

0 votes
Karthi Natarajan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 10, 2019

I had the exactly same issue with a dotnet sdk and a need to zip the file and SFTP to a remote server after a small struggle I managed to resolve if anyone needs let me know.. since this is an old post....

Paresh_Bijarane March 12, 2020

Hi,

I'm executing the command - dotnet build $PROJECT_NAME

Here once build successful, wanted to convert it to zip file before publishing it to SFTP

 

Please let me know how it was work for you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events