Environments : how to manage failed deployments?


For testing purpose I deploy workload in some workloads (in Openstack in my case) with pipeline. I need to make ensure everything is deleted at the end. Even if I run cleaning job at the end of the pipeline, I still need to periodically run cleaning job in order to make sure there is no pending workload. For example I could happen if an user manually retries a deploy job which had fail and forgets to run cleaning job.

For this use case, I would like to use environments to track deployments and auto-stop is exactly the feature I need to avoid running periodic cleaning. But after making some testing, I quite disappointed about the environment lifecycle management. Especially failing deployments seems to completely be managed at all.

I mean an environment is considered as running if start job ends with success and is considered as stopped as soon stop job is started. How make sure there are no pending resource if start or stop jobs are failing ?

Is there already issue or feature to deal with this behavior ?

Thanks !