Adding GraphQL mutations to trigger Allowlist Autopopulation processes
What does this MR do and why?
As part of https://gitlab.com/gitlab-org/gitlab/-/issues/47854+, this MR adds GraphQL mutations for the autopopulate and clearAutopopulation services that are used to generate and clear the allowlist entries. Designs are detailed here: #509883 (closed).
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
-
Create sample authorization log records in the rails console:
project = Project.first project2 = Project.second project3 = Project.third Ci::JobToken::Authorization.create(accessed_project: project, origin_project: project2, last_authorized_at: 1.day.ago) Ci::JobToken::Authorization.create(accessed_project: project, origin_project: project3, last_authorized_at: 1.day.ago) -
Ensure two records have been created:
Ci::JobToken::Authorization.all -
Ensure no
ProjectScopeLinksexist for the given project:Ci::JobToken::ProjectScopeLink.where(source_project: project) -
Run the autopopulate mutation in graphiql:
mutation CiJobTokenScopeAutopopulateAllowlist($projectPath: ID!) { ciJobTokenScopeAutopopulateAllowlist(input: { projectPath:$projectPath }){ status errors } }Note: Should be the path of whatever
projectis locally. For me it wastoolbox/gitlab-smoke-tests{ "projectPath": "toolbox/gitlab-smoke-tests" } -
Ensure that 2
ProjectScopeLinksnow exist for the given project:Ci::JobToken::ProjectScopeLink.where(source_project: project) -
Run the autopopulation clear mutation in graphiql:
mutation CiJobTokenScopeClearAllowlistAutopopulations($projectPath: ID!) { ciJobTokenScopeClearAllowlistAutopopulations(input: { projectPath:$projectPath }){ status errors } }{ "projectPath": "toolbox/gitlab-smoke-tests" } -
Ensure no
ProjectScopeLinksexist anymore for the given project:Ci::JobToken::ProjectScopeLink.where(source_project: project)