Improve user experience when environment name points to an empty variable
Summary
User experience is not ideal for cases when environment
name is accidentally configured as an empty value. There are two issues with it:
- The error message received when users run such jobs is not pointing out the fact that the name of the environment is empty, it prints a generic error:
This job could not be executed because it would create an environment with an invalid parameter.
. We should point out that the environment name is empty instead. - Upon job re-try, the job doesn't give the same error, but instead proceeds with the following message:
This behavior is inconsistent, the job should fail with the same error upon retry.
Scope This issue is about the error message. The unconsistent re-try is being addresses in Inconsistent behaviour with retries for jobs wi... (#456467)
Steps to reproduce
- given some project A
- define a pipeline with a job that targets environment named dynamically to variable
$ACTIVE_NONPROD_ENVIRONMENT
(this environment is not set) - run pipeline
job:
environment:
name: $ACTIVE_NONPROD_ENVIRONMENT
- pipeline fails because minimal job fails: "This job could not be executed because it would create an environment with an invalid parameter. How do I fix it?"
- attempt to re-run
- succeeds even though environment does not exist
Example Project
https://gitlab.com/gl-demo-ultimate-khrechyshkina/tickets/zd516022
What is the current bug behavior?
Unclear message doesn't point out the fact that the env name is empty. The job can be executed if retried even though the environment name is still empty.
What is the expected correct behavior?
The job should show consistent error message upon retries. The error should point to the fact that environment name is empty, instead of showing the generic message it does now.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)