Skip to content

Improve error messages for protect environment setting

What does this MR do and why?

This MR fixes #368353 (closed). We now use serverside error messages if present, and provide a better error message for the case when the environment is already protected.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2023-12-21_at_17.42.49

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Make sure you are running an EE version of gitlab locally
  2. Navigate to Project -> Operate -> Environments and make sure you have at least one environment there
  3. Navigate to Settings -> CI/CD And find a protected environment expando there.
  4. Duplicate the browser tab with the settings.
  5. Open the Protected environments expando, select an environment to protect and select users allowed to deploy. DON'T PRESS PROTECT yet
  6. Repeat the previous step on a duplicated browser tab. This time PRESS PROTECT button to save the changes.
  7. Return to the other settings tab and PRESS PROTECT button there there. You should see the error message saying that this environment is already protected.
Edited by Andrei Zubov

Merge request reports