Keep artifacts currently deployed on an environment
Problem to solve
Missing artifacts, who got already deleted/expired if they are currently deployed on an environment.
Intended users
Software Developer, Systems Administrator , Product Manager
Further details
The Problem is that artifacts are erased by the lifecycle ("Expiring artifacts") after the configured limit in gitlab ci. If you have to do a redeploy after some days / weeks or do a deployment on a higher stage (e.g. after some testing go to production), there is a huge possibility that the artifact is already deleted.
Proposal
Adding an exclude option for the artifacts expiring (https://docs.gitlab.com/ee/ci/yaml/README.html#artifactsexpire_in) to keep artifacts, which are currently deployed on an living environment (https://docs.gitlab.com/ee/ci/yaml/README.html#environment).
For example by a new key in gitlab-ci keepIfDeployed: true
in the artifacts section.
Permissions and Security
This task would run by gitlab itself. (Cleanup Task/scheduler)
Documentation
Documentation should include how the key is working and what it mens if it is set to keep the currently deployed artifacts
Testing
There should be a test, that gitlab would not delete a artifact, which is expired by the gitlab definition but currently is deployed