It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Windows can't unzip Pipelines artifact Edited

I have multiple files that I want to archive, and would like them to end up in a single directory with a custom name so that its easier to consume for testers. 

 

This repo is compiling fw for embedded devices, but that shouldn't matter much. 

After the build, these are the last two commands in the step. They work perfectly and I have no problem opening them on Mac. 

- folderName=BUILD_ARTIFACTS_$(date +%Y%m%d_%H%M%S); mkdir $folderName;

- cp $projectPath/*.{img,elf,hex} $folderName;
- zip -r -y -9 -q ${folderName}.zip $folderName/;

Then I collect the artifact like this:


artifacts:
- BUILD_ARTIFACTS_*

Also, if I unzip the artifact zip that pipelines makes and send windows users my zipped up directory, they open it without issue. 

Is this issue unique to me? Maybe its because I have nested zips? Is there an easier way to accomplish the goal?

UPDATE: It seems to be that its gzipping the artifact, and likely doesn't have anything to do with what im doing. I could of course be wrong, but if im not, is there a way to prevent this?

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Elias Zeidan Atlassian Team Aug 21, 2018

Hi @sebastien Gouin-davis,

Thank you so much for reaching out to the Atlassian Community!

You are spot-on in your update, the download is gzipping the artifact, regardless of how many files are included as part of the artifact definition:

$ file artifact_fe922810-834f-4364-bf8e-e18db40ef0db.zip
artifact_fe922810-834f-4364-bf8e-e18db40ef0db.zip: gzip compressed data

We are raising the issue to the Bitbucket Pipelines development team, and will follow up as soon as we have an answer.

As a potential workaround, your Windows users may be able to use 7zip or a similar application to unzip these GZip archives.

In the meantime, if you have any further questions, please feel free to ask!

Happy Coding!

Elias | Atlassian Support

Thank you Elias!

You are right that 7zip works, but because ive zipped it on the inside as well, even that is more awkward than I would like. I fully appreciate that Gzipping the artifacts makes sense, and it probably makes more sense for me to deploy them somewhere else for download at some point anyway.

Maybe I was just doing something silly, but can I artifact a folder? It seemed like I could not when I first try, which is why its zipped before getting gzipped.

Hopefully there is a simple solution that doesn't require a new feature!

Sebastien

Elias Zeidan Atlassian Team Aug 22, 2018

Hi @sebastien Gouin-davis,

Thanks for your reply!

You can use a folder as an artifact, all you'd need to do is remove the following line from your bitbucket-pipelines.yml file:

- zip -r -y -9 -q ${folderName}.zip $folderName/;

To use a regular expression that matches the directory name, you should be able to declare the artifact as follows:

artifacts:
- BUILD_ARTIFACTS_*/**

This worked in my case with

pipelines:
default:
- step:
script:
- mkdir foobar-test
...

artifacts:
- foobar*/**

 I hope this helps, please let me know if you have any other questions!

Cheers,

Elias | Atlassian Support

Elias Zeidan Atlassian Team Aug 23, 2018

Hi @sebastien Gouin-davis,

I have an update on this issue.

The Bitbucket Pipelines developers have just implemented a fix for this that changes the artifact download filename from ".zip" to ".tar.gz" to correctly reflect the compression type used.

I was just able to confirm that my downloaded artifact is now artifact_[uuid].tar.gz.

Please do not hesitate to reach out if there is anything else we can help with!

Cheers,

Elias | Atlassian Support

Thats fantastic! Thank you for your help and support!

UPDATE: Just saw your one liner solution to my other issue 'artifacting a folder'. All I needed was the `/**` on the end. I should have thought of that. Thanks again!

Elias Zeidan Atlassian Team Aug 23, 2018

@sebastien Gouin-davis

You are most welcome! I am glad we could help!

Could you please mark this answer as "Accepted" by clicking the checkmark icon next to the first reply? This will help other Community members find this answer faster and easier.

Thank you very much again!

Cheers,

Elias | Atlassian Support

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,032 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you