Deleting an Re-creation of a CI variable leads to unintuitive "Variables key has already been taken" error message
Summary
Deleting an already saved CI variable VAR0 in the corresponding settings section and re-creating it causes the error message Validation failed - Variables key (VAR0) has already been taken
Steps to reproduce
- Create a new project
- Navigate to CI/CD settings for variables
- Create a new variable named
VAR0 - Save the variables
- Delete the
VAR0variable - Without saving the variables, recreate the
VAR0variable
Example Project
./.
What is the current bug behavior?
Error message is displayed
What is the expected correct behavior?
The message is wrong in every sense since it is the result of comparison to the last saved state. However the set of variables which is saved is valid, so changes, like the deletion should be reflected/enforced before the validation occurs, the validation message (and probably algorithm) should be changed or re-creation of a not-yet-saved deletion of a variable should be prohibited.
Relevant logs and/or screenshots
./.
Output of checks
This bug happens on GitLab.com.
Results of GitLab environment info
./.
Results of GitLab application Check
./.
Possible fixes
see correct behaviour description
Edited by Mark Fletcher