A Singapore Government Agency Website

Manage GitLab token rotation

SHIP-HATS provides pre-configured templates to simplify the creation of automated token rotation for your Personal, Group, and Project access tokens in GitLab.

If you prefer to manually rotate your tokens, you can continue doing so, but we recommend using these templates as it simplifies the process.

Benefits of these templates

  • Save time and reduce risk of expired tokens disrupting workflows.
  • Maintain good security and compliance practices.

Steps

To manage GitLab token rotation, first identify the token type, then choose its storage location, configure the settings, and finally automate the process.

  1. Review the following templates and determine which tokens you need to rotate:

  2. Depending on the tokens to be rotated, reference .check-rotate-personal-access-token and/or .check-rotate-access-token template(s) in your CI/CD pipeline.

  3. Based on where you store your GitLab access token, reference the corresponding templates in your CI/CD pipeline:

If you store your GitLab Access token as GitLab CI/CD variable, reference the following templates in the CI/CD pipeline as required:

If you store your GitLab Access token as AWS secret, reference the following templates in the CI/CD pipeline as required:

If you store your GitLab Access token as Kibana parameter, reference the following templates in the CI/CD pipeline as required:

If you store your GitLab Access token as Workato connections, reference the following templates in the CI/CD pipeline as required:

If you store your GitLab Access token as GitLab pull mirroring configuration, reference the following templates in the CI/CD pipeline as required:

  1. Review the Sample usage code for the template and set up your CI/CD pipeline jobs and project settings to apply the token rotation.

    Use a Personal Access Token (PAT) for authentication when you rotate your GitLab access token. Store this PAT securely in your project’s CI/CD variables.

  2. Create a scheduled pipeline that uses these templates to rotate tokens regularly.

Chat with me!
Bot Launcher