Add a on_stop job to cleanup as-if-foss branch
What does this MR do and why?
Add a on_stop
job to cleanup as-if-foss branch, and then have a subsequent job to delete the environment because we're relying on that to automatically clean up the branch and we no longer need the environment. Note that we cannot delete the environment in the stopping job because we can only delete the environment after it's stopped and that means the stopping job needs to finish first.
prepare-as-if-foss-env
This also optimize In a separate commit so please don't squash.
How to validate
- Stop job, deleting branch: https://gitlab.com/gitlab-org/gitlab/-/jobs/5903121908
- Check there's no corresponding branch at: https://gitlab.com/gitlab-org/gitlab-foss/-/branches?state=all&sort=updated_desc&search=as-if-foss%2F
- Subsequent job to delete environment: https://gitlab.com/gitlab-org/gitlab/-/jobs/5903121913
- Check there's no corresponding environment at: https://gitlab.com/gitlab-org/gitlab/-/environments
- Closing the merge request did run the stop job: !141492 (comment 1721602969)
Related to #412717 (closed)
Edited by Lin Jen-Shin