Create an activity event when an agent token is revoked
What does this MR do and why?
Logs an activity event when an agent token is revoked, so that it can be shown in the agent's activity stream.
Revoking a token is now more than a single record update, so the logic has been extracted into a dedicated service.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
In a Rails console, create agent and token records:
agent = Clusters::Agent.create!(project: <project>, name: 'my-test-agent')
agent.agent_tokens.create!(name: 'my-test-token')
-
Use the following GraphQL mutation to revoke the token (this operation is not yet available from the UI):
mutation { clusterAgentTokenRevoke(input: { id:"gid://gitlab/Clusters::AgentToken/<token-id>" }) { errors } }
-
Visit
http://path/to/your/project/-/cluster_agents/my-test-agent
and observe a "token revoked" event now exists in the activity stream:
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 Tiger Watson