Manually renaming environments breaks future deployments
Summary
Manually renaming a CI environment breaks all future deployments to that environment. Instead, each respective pipeline step shows the message This job is an out-of-date deployment to .
Deleting the old, renamed environment did not fix the issue.
Steps to reproduce
- Create an environment from a CI pipeline step; I used
$PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME
as a name. - Manually rename the environment. I just shortened the name by a few characters.
- Run any CI step that re-creates/updates the environment
This job is an out-of-date deployment to .
Example Project
https://gitlab.com/FabianSperrle/deployment-renaming
- Initial job: https://gitlab.com/FabianSperrle/deployment-renaming/-/jobs/280211792
- then rename the environment.
- Trigger pipeline again: https://gitlab.com/FabianSperrle/deployment-renaming/-/jobs/280213363
What is the current bug behavior?
The changed name of the original environment is correctly updated in the first pipeline. All other pipelines fail to update/re-populate any environment (with either the original or the changed name).
What is the expected correct behavior?
Renaming an environment does not impact future (re-)creations of environments with the original name.
Relevant logs and/or screenshots
See example project + job links above.
Output of checks
This bug happens on GitLab.com. It also happens on our self-hosted gitlab ce instance.
Workaround
Rename the environment back to how it was called
Solution
Disallow renaming environments.