Gitlab CI: Environment created for manual jobs even when job isn't run
Summary
An environment is created for manual jobs before the job is even ran.
This is problematic because for our setup, we want to provide the user the option to create a review branch, but it isn't required. In case where they choose not to deploy a review app, when they delete the branch, the stop-dynamic-service job does not run because the deploy-dynamic-service wasn't ran. this leads to a build up of empty envs and is really annoying! Please help.
Steps to reproduce
# Dynamic Service
deploy-dynamic-service:
stage: review
dependencies: []
retry: 2
script:
- echo 2
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: stop-dynamic-service
when: manual
allow_failure: true
stop-dynamic-service:
stage: review
dependencies: []
retry: 2
variables:
GIT_STRATEGY: none
script:
- echo 4
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
except:
- stage
- master
allow_failure: true
Example Project
I can provide one if needed.
What is the current bug behavior?
An environment is created for manual jobs before the job is even ran.
What is the expected correct behavior?
An environment should be created when the manual job is run.
Relevant logs and/or screenshots
Code blocks in summary.
Output of checks
N/A
Results of GitLab environment info
N/A
Results of GitLab application Check
Possible fixes
N/A