Environment expiration (environment:expire_in)
Description
Problem statement: I host some test environments for projects on paid cloud provider platforms (AWS, Azure, etc.). In several of my CI pipelines I will spin up an environment, use it for 15 minutes to 1 hour and then burn it down. Additionally there are environments that I spin up that I may forget (or be side tracked away) to shutdown/burn down after I am done with them and would prefer they didn't needless run up hosting costs.
Benefits:
- Cost reduction (when using paid hosting provider)
- Cleans up stale environments (or at least attempts to run the stop job)
Goal:
- Environment can be specified to expire in X amount of time.
Proposal
Add expire_in: x
as option for environments. On expiration, the environment on_stop job would run.
Documentation blurb
environment:expire_in
is used to stop running environments after the specified time. By default, environments run until manually stopped or on a merge request closure. expire_in
allows you to specify how long environments should live before they are stopped, counting from the time the environment job completes successfully. This can be particularly useful for temporary environments hosted on paid cloud platforms.
After expiry, the environment on_stop job will run.
The value of expire_in
is an elapsed time. Examples of parseable values:
- '3 mins 4 sec'
- '2 hrs 20 min'
- '2h20min'
- '6 mos 1 day'
- '47 yrs 6 mos and 4d'
- '3 weeks and 2 days'