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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.