Unclear error message when clicking on deploy job without needed permissions
Summary
Users who can approve but not deploy to protected environments receive an unclear error message when attempting to trigger a deployment job, causing confusion and a poor user experience.
Steps to reproduce
- Create a project with protected environments
- Configure a user who can approve but not deploy to protected environments
- Log in as that user
- Navigate to the Pipelines overview page
- Click on a deploy job for a protected environment
- Observe the unhelpful error message
What is the current bug behavior?
When a user who lacks deployment permissions clicks on a deploy job, they receive a vague error message like "An error occurred while making the request" or "There was a problem running the job" without any information about the actual cause - their lack of permissions.
What is the expected correct behavior?
The error message should clearly explain that the user lacks the required permissions to deploy to the protected environment, potentially with guidance on how to request those permissions or what role would be needed.
Relevant logs and/or screenshots
Possible fixes
Update the error message handling to specifically detect permission-related errors and display a more helpful message like "You don't have permission to deploy to this protected environment" instead of the generic error message.
Implementation guide
The specific error message is already provided from the backend. We can choose to show it in job_action_button.vue instead of the generic alert message if provided:
} catch (error) {
createAlert({
message: error?.message || this.$options.JOB_ACTIONS[this.actionType].error,
});
reportToSentry(this.$options.name, error);
}
Update the related specs.
Related to https://gitlab.com/gitlab-com/account-management/commercial/arcesium/-/issues/38 (internal)
