How to Rotate a CircleCI Container Runner Token and Delete Resource Class

Overview

In this support article, we will walk through the steps for rotating a CircleCI runner token and deleting a resource class using the CircleCI CLI.

Note: Deleting a Resource Class is only possible after all the tokens associated with it have been removed, if not, you may encounter an error message like error: resource class still has tokens in use

Prerequisites

Before you begin, ensure you have the CircleCI CLI installed and configured in your system.

Deleting a Runner Resource Class

Follow the steps below to rotate a token and delete a resource class:

1. List Runner Tokens

First, list all the runner tokens associated with the resource class:

circleci runner token list <resource-class>

2. Delete Runner Token

Next, delete the desired token by using the token ID returned from the list command:

circleci runner token delete <token-id>

3. Delete Resource Class

At this point, you can delete the Resource Class.

 

Delete the Resource Class

Use the following command to delete the resource class:

circleci runner resource-class delete <resource-class>

 

Creating a new Runner Resource Class token

Create a New Token

If you need a new token for the same resource class, run the following command:

circleci runner token create <resource-class> <nickname>

 

This new token should be updated in your values.yaml file or in your secrets manager if you are using one. For example:

helm upgrade container-agent container-agent/container-agent -n circleci -f values.yaml

 

If applicable, you can then delete the old token by running through steps 1-2 above.

 

Please Note: The process to rotate the runner's token requires a new token generation and the replacement of the old token in all places it was used including configuration files and environment variables. Taking proper precautions to keep these tokens secure is paramount for maintaining a safe and efficient CI/CD environment.

 

Additional Resources

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.