Invalid Environment Not Being Created Should Be Surfaced To User
Description
When an environment cannot be created it should fail the whole pipeline creation and surface the errors to the user. Right now they see failed jobs with no information about what went wrong (eg. gitlab-ce#43196 )
Proposal
Force the failure of the pipeline job that creates the environment if the environment name is invalid, and display an error in the job log page:
This job could not be executed because it would create an environment with an invalid name. See documentation
Documentation link: https://docs.gitlab.com/ee/ci/yaml/index.html#environmentname
Original proposal 👇
For example one way to create a job with an invalid environment is to create a name that is longer than 255 characters like this build. Ideally this should not even run the build (or create a pipeline) it should just show an errors as though they had an invalid .gitlab-ci.yml
otherwise this can cause confusing downstream errors as you can see in the build output the CI_ENVIRONMENT_SLUG
is not assigned a value and it should be.
Links / references
https://gitlab.com/gitlab-org/gitlab-ce/issues/43196#note_59275652