Skip to content

Add environment name search that returns environment id

Kirstie Cook requested to merge environment-search-for-id into master

What does this MR do?

This closes #37969 (closed). We need an endpoint that allows for the searching of environments by name and returns both id and name. We have an existing endpoint Projects::EnvironmentsController#search that only returns the names of the environments, and changing that to include the ids as well would break the implementation for the current consumer of that endpoint. Therefore, a very similar endpoint has been added Projects::EnvironmentsController#search_for_id that searches a project's environments for a matching name and returns both the name and the id.

This environment search https://docs.gitlab.com/ee/api/environments.html#list-environments will not work for this purpose because we need the search to work on partial matches as the user is typing.

tagging @dbodicherla

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports