Search code examples
gitlabcicdartifact

Is it possible to set the expiration of artifact to 'next-successful-build' in gitlab?


In the documentation, it seems that we can set the expire-in to several days or weeks. But I cannot decide an accurate fixed date. Is it possible to always keep the 'lastest' artifact, and remove the old one when a new one is successfully built?


Solution

  • Okey. I found a solution here :

    https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#keep-artifacts-from-most-recent-successful-jobs

    With this help, it can be easily reached. The question should be closed.


    Here's the instruction given by gitlab official.

    Keeping the latest artifacts can use a large amount of storage space in projects with a lot of jobs or large artifacts. If the latest artifacts are not needed in a project, you can disable this behavior to save space:

    • On the top bar, select Menu > Projects and find your project.
    • On the left sidebar, select Settings > CI/CD.
    • Expand Artifacts.
    • Clear the Keep artifacts from most recent successful jobs checkbox.

    You can disable this behavior for all projects on a self-managed instance in the instance’s CI/CD settings.