[SERVER] Resolving "401 Unauthorized" Error During CircleCI Server License Update

Overview

Encountering a "401 Unauthorized" error while updating the CircleCI Server license using the helm diff upgrade or helm upgrade command can be frustrating. This issue often arises due to outdated OAuth tokens or incorrect configuration settings. This guide provides a step-by-step solution to resolve the error and ensure a successful license update.

Prerequisites

  • Access to the Kubernetes cluster where CircleCI Server is deployed.
  • Helm and kubectl installed and configured.
  • Valid credentials for the Docker registry and CircleCI Server.

Instructions

Step 1: Verify Docker Registry Credentials

Ensure that the Docker registry credentials are correctly configured. If necessary, recreate the secret using the following command: 

kubectl -n <namespace> create secret docker-registry regcred \
--docker-server=cciserver.azurecr.io \
--docker-username=<provided-username> \
--docker-password="<provided-credential>" \
--docker-email=<your-contact-email>

Updating a Server 4.x Environment with a new license

Step 2: Clear Old OAuth Tokens

Log out of the Helm registry to clear any outdated OAuth tokens:helm registry logout cciserver.azurecr.io Repeat the command until you receive an error indicating that credentials are not found.

Step 3: Re-login to Helm Registry

Log back into the Helm registry with the updated credentials:helm registry login cciserver.azurecr.io

Step 4: Execute Helm Upgrade

Run the helm upgrade command to apply the new license:helm upgrade circleci-server oci://cciserver.azurecr.io/circleci-server -n circleci-server --version <VERSION> -f <VALUES_YAML_FILE>

Step 5: Restart Frontend Pods

Restart the frontend pods to ensure the new license is applied:kubectl rollout restart deployment frontend

Solution

Following these steps should resolve the "401 Unauthorized" error and successfully update the CircleCI Server license. If the issue persists, verify the license details via the API endpoint to ensure the new license is applied.

Additional Resources

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

Comments

0 comments

Article is closed for comments.