Disallow changing environment name via API
Note: This issue is marked as Seeking community contributions, but we will only be able to merge closer to the end of %16.0. Feel free to open an MR and pass through review, then we just press the merge
button when we can.
As a follow-up #31268 (closed) and !68550 (merged) we need to actually remove support for changing the environment name via the API.
Implementation guide
- apply
diff --git a/lib/api/environments.rb b/lib/api/environments.rb index 64510a9615af..461c86aaec03 100644 --- a/lib/api/environments.rb +++ b/lib/api/environments.rb @@ -90,8 +90,6 @@ class Environments < ::API::Base end params do requires :environment_id, type: Integer, desc: 'The ID of the environment' - # TODO: disallow renaming via the API https://gitlab.com/gitlab-org/gitlab/-/issues/338897 - optional :name, type: String, desc: 'DEPRECATED: Renaming environment can lead to errors, this will be removed in 15.0' optional :external_url, type: String, desc: 'The new URL on which this deployment is viewable' optional :slug, absence: { message: "is automatically generated and cannot be changed" }, documentation: { hidden: true } optional :tier, type: String, values: Environment.tiers.keys, desc: 'The tier of the new environment. Allowed values are `production`, `staging`, `testing`, `development`, and `other`'
- fix tests in https://gitlab.com/gitlab-org/gitlab/-/blob/a01e430402b2ef0d66adc75c254a9bd1e24c7ac2/spec/requests/api/environments_spec.rb#L231-231
Edited by Vladimir Shushlin