How can I set the expiration time for artifacts in Bitbucket Downloads?
Asked by Miko?aj Wa?niewski:

I want to automatically delete artifacts in Bitbucket Downloads after 7 days. How can I do that?


Answers:
author: Aron Gombas _Midori_
body: [@Miko?aj Wa?niewski](/t5/user/viewprofilepage/user-id/5329036) We had the same use case, and we built the following solution:

1. Create a new Pipeline
2. The Pipeline can [get the list of the artifacts](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-downloads/#api-repositories-workspace-repo-slug-downloads-get) using the Bitbucket Cloud REST API
3. It can test if an artifact is "too old", and [delete that](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-downloads/#api-repositories-workspace-repo-slug-downloads-filename-delete) using another REST API end-point

It is really just a few line of code. Then, you just have to run this pipeline periodically and you're done.

(In our case, it is just one step in a complete pipeline which is executed at each commit, but the core is roughly the same as yours. And it has been working reliably for us for a few years.)


author: Syahrul
body: G'day, [@Miko?aj Wa?niewski](/t5/user/viewprofilepage/user-id/5329036)

Artifacts expiry is not configurable for the default 14 days in the Bitbucket cloud. We do have a feature request on this at:

[Ability to set expiration period for artifacts](https://jira.atlassian.com/browse/BCLOUD-21844)

Please **Vote** and **Watch**the feature request to make sure you won't miss any updates in the future if the feature is accepted.

Regards,  
Syahrul

comments: author: Miko?aj Wa?niewski
body: Hello [@Syahrul](/t5/user/viewprofilepage/user-id/744536)

Does this 14 days expiration period apply also to artifacts in Bitbucket Downloads? (which can be i.e. uploaded manually)


author: Syahrul
body: Hey [@Miko?aj Wa?niewski](/t5/user/viewprofilepage/user-id/5329036)

Artifacts do not expire if you upload them on the Downloads tabs.

Regards,  
Syahrul


author: Miko?aj Wa?niewski
body: Thanks [@Syahrul](/t5/user/viewprofilepage/user-id/744536) ,

So is there any size limit for artifacts stored in Download tab?


author: Syahrul
body: Hey [@Miko?aj Wa?niewski](/t5/user/viewprofilepage/user-id/5329036)

The artifact limit is 1 GB, and the upload limit for the Download tab section is 2 GB.

You can only generate artifacts up to 1 GB in size to upload to the Downloads section. So technically you can upload only 1 GB artifacts to Downloads.

Regards,  
Syahrul


author: yosser_mahfoudh
body: Hi [@Syahrul](/t5/user/viewprofilepage/user-id/744536) , Is there a way to upgrade the artifact limit from 1GB to 5GB?


author: Syahrul
body: Hey [@yosser_mahfoudh](/t5/user/viewprofilepage/user-id/3803216)

Unfortunately, that is the current hard limit. If you require bigger storage for artifacts, we recommend that you use your own storage solution, such as Amazon S3, or a hosted artifact repository like JFrog Artifactory.

Regards,  
Syahrul


author: yosser_mahfoudh
body: how to implement that in my pipeline. Because what I have now is storing my executable in the artifacts then copy its content to S3.


author: Syahrul
body: Hey [@yosser_mahfoudh](/t5/user/viewprofilepage/user-id/3803216)

Please check our guide below on how to publish and link your artifacts to AWS or S3:

[Publish and link your build artifacts](https://support.atlassian.com/bitbucket-cloud/docs/publish-and-link-your-build-artifacts/)

Regards,  
Syahrul


Tags: bitbucket-cloud

bitbucket-pipelines

cloud