fix: a forbidden service fails alone and its error says where to look - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A real run failed with
GitLab rejected the token (403) for /api/v4/projects/11736/deployments. It needs 'read_api' scope.and stopped the whole run. The token was fine. GitLab refusesread_deploymenton a project whose Environments, CI/CD or repository is disabled, or when the user's role is too low. Group and project listing had already succeeded, which rules out a missing scope.Changes
Projects with no deployments are skipped. When
builds_access_levelorenvironments_access_levelisdisabled, the service stays in the report with no rows and a warning naming the setting to enable, and no request is made for it. GitLab versions that don't return these fields are collected as before.A forbidden service fails alone. A 403 inside one service becomes that service's
errorand the run continues (exit 1). A 401 still stops the run (exit 3). So does a 403 while resolving a--groupor--project, because without it the tool can't know which services exist; that message now names the group or project.Errors name the project and where to look. Per-service errors start with the project path instead of the numeric id. For a 403 they list the likely causes, each with a link:
The settings link is
<project>/edit#js-shared-permissions, section "Visibility, project features, permissions", and the members link is<project>/-/project_members. Both were checked against GitLab's source and docs.The API layer now sets the resource name on each error, so
_messages.pyno longer parses URLs.The CLI prints
Error: <error>, since errors now carry the project path.The report schema is unchanged:
schema_version1, stillwarningsanderror. Theerrortext now starts with the project path and can span several lines.Tests
The tests were written first. They cover:
--groupand on--projectresolutionenabledandprivatevalues still being collectedAll tests use respx only. 59 tests pass at 100% coverage.