Use AgentTokensFinder in AgentTokensResolver
What does this MR do and why?
The AgentTokensFinder
was introduced in !103170 (merged) and !104038 (merged). This finder is used in the Cluster Agent Tokens REST API endpoints. (See also !103292 (merged) & !103300 (merged))
As discussed in the related issue (#363119 (comment 1158908371)), we'd also like to use the AgentTokensFinder
in the AgentTokensResolver. This MR implements said change.
Issue: #363119 (closed)
Screenshots or screen recordings
Setup
Project
Agent and tokens
Test
Querying project.clusterAgent.tokens
How to set up and validate locally
Setup
- Create a project (or use an existing one)
-
Set up an agent in that project
- This will register an agent and create one agent token
- Create more agent tokens:
- Go to project Infrastructure -> Kubernetes clusters page
- Go to the agent's page
- Select the Access tokens tab
- Click the Create token button
Validate
Query project.clusterAgent.tokens
in the GitLab GraphQL API. See the Getting Started Guide for a quick how-to on querying the GraphQL API.
curl "<local-gitlab-url>/api/graphql" \
-k -X POST \
--header "Authorization: Bearer <ACCESS_TOKEN>" \
--header "Content-Type: application/json" \
--data "{\"query\": \"query {project(fullPath: \\\"<full-path-to-the-project>\\\") {name clusterAgent(name: \\\"<agent-name>\\\") {name tokens {nodes {id name status}}}}}\"}"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by João Alexandre Cunha