Allow name-as-ID in Environments API
Proposal
Currently, some of the Environment APIs takes only Integer-type of environment_id
, but this is hard to consume in CI/CD jobs because we don't expose Environment ID as a predefined variable.
We should allow users to specify Environment name as the environment_id
, so that they can use CI_ENVIRONMENT_NAME
predefined variable to the Environment API.
Related to Product update requests for Runway (gitlab-com/gl-infra/platform/runway/team#26)
Implementation Guide
As of now in the Environments REST API we are using the code like this to get the environment:
environment = user_project.environments.find(params[:environment_id])
However, we should probably make use of the (EnvironmentsFinder
](https://gitlab.com/gitlab-org/gitlab/-/blob/155cb8b4b6f3f2a92891e3e22942d83169dc0f1a/app/finders/environments/environments_finder.rb#L4-4) which already supports a by_name()
finder.