Permission error banner is not specific enough when running Pipeline

Summary

Steps to reproduce

  1. !73422 (closed)
  2. Run pipeline with account that does not have permission

Example Project

What is the current bug behavior?

When running a Pipeline without enough permission, the error is not specific enough.

It currently says An error occurred while trying to run a new pipeline for this merge request..

What is the expected correct behavior?

It should say that I do not have permission.

Example:

  1. !73422 (closed)
  2. Run pipeline with account that does not have permission
  3. The 400 error has the following body:
{"message":{"base":["You do not have sufficient permission to run a pipeline on 'refs/merge-requests/73422/head'. Please select a different branch or contact your administrator for assistance. \u003ca href=https://docs.gitlab.com/ee/ci/pipelines/#pipeline-security-on-protected-branches\u003eLearn more\u003c/a\u003e"]}}

This does work on https://gitlab.com/gitlab-org/gitlab/-/pipelines/new (error message below).

Screen_Shot_2021-12-10_at_11.36.25_AM

Relevant logs and/or screenshots

Output of checks

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)

Possible fixes

Edited by Sean Arnold