Validate GitLab CI/CD configuration fails with error 500 and cryptic message
Summary
Validation of some GitLab CI/CD configurations can cause the API to return 500
errors. When visiting the validation page, the validation fails with:
Pipeline simulation completed with errors Simulated a git push event for a default branch. Rules, only, except, and needs job dependencies logic have been evaluated. Learn more
Steps to reproduce
- Go to https://gitlab.com/api/v4/projects/components%2ftoolkit/ci/lint
- Response is
{
message: "500 Internal Server Error"
}
Also:
- Go to the project CI/CD validation page: https://gitlab.com/components/toolkit/-/ci/editor?branch_name=main&tab=2
- Fails with:
Pipeline simulation completed with errors Simulated a git push event for a default branch. Rules, only, except, and needs job dependencies logic have been evaluated. Learn more You do not have sufficient permission to run a pipeline on 'main'. Please select a different branch or contact your administrator for assistance.
Example Project(s)
- https://gitlab.com/api/v4/projects/components%2ftoolkit/ci/lint
- https://gitlab.com/api/v4/projects/components%2fautodevops/ci/lint
- https://gitlab.com/api/v4/projects/components%2fsast/ci/lint
- https://gitlab.com/api/v4/projects/components%2fcontainer-scanning/ci/lint
- https://gitlab.com/api/v4/projects/components%2fsecret-detection/ci/lint
- https://gitlab.com/api/v4/projects/components%2fcode-quality/ci/lint
- https://gitlab.com/api/v4/projects/components%2fgo/ci/lint
- https://gitlab.com/api/v4/projects/components%2faws/ci/lint
- https://gitlab.com/api/v4/projects/gitlab-org%2fgitlab-qa/ci/lint
What is the current bug behavior?
500
error. This is new, as this API endpoint was fine last week (Monday March 25th 2024).
What is the expected correct behavior?
- More explicit error
- If nothing changed in the project (last commit was 2 months ago), no
500
.
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)