Multiple on_stop for an environment
It would be beneficial if it was possible to define multiple
on_stop hooks for any give environment within
.gitlab-ci.yaml. According to my tests, if you have multiple jobs defining
on_stop for the same environment, only the last one defined is used once the environment is being torn down (eg. the corresponding branch is deleted).
Our deployment pipelines have a
deploy stage, which contains multiple jobs:
- Deploying our containers to Kubernetes using Helm, using the
devth/helmimage for running the job.
- Provisioning DNS records in Cloudflare for the deployment using Terraform, using the
hashicorp/terraformimage for running the job.
Our goal was then to have each of these
deploy jobs define a corresponding teardown-job so that we - in this example - would have one teardown-job running
helm delete using the
devth/helm image, and one running
terraform destroy using the
It would be great if either:
on_stophooks for any given environment are collected and run in parallel or succession when the environment is being stopped.
on_stopcould take in a list of jobs to run when the environment is being stopped, instead of just one. As far as I can tell it currently expects this being a plain string.