Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't figure out an auth issue for runner autoscaler

Mike Stanley April 25, 2023

I was following this guide:
https://bitbucket.org/bitbucketpipelines/runners-autoscaler/src/master/

 

I have things in a state where, when the runner controller pod spins up, it gives me 401 errors:
DEBUG: Starting new HTTPS connection (1): api.bitbucket.org:443
DEBUG: https://api.bitbucket.org:443 "GET /2.0/workspaces/myworkspace HTTP/1.1" 401 380
DEBUG: GET request to https://api.bitbucket.org/2.0/workspaces/myworkspace
DEBUG: Got 401 Client Error: Unauthorized for url: https://api.bitbucket.org/2.0/workspaces/myworkspace. Status: 401
✖ Unauthorized. Check your bitbucket credentials. Status code: 401. Login failed due to incorrect login credentials or method.
For information on authentication methods for Bitbucket Cloud APIs, visit:
https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication
If you are unsure of which login details or login method to use, visit:
https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/

If I exec into the pod, the username and password variables are correct, and I have tried to use them manually via curl to connect to the https://api.bitbucket.org/2.0/workspaces/myworkspace and that does work successfully.

However if I purposely use the wrong password via curl, it spits out the same error. 

I'm a little stumped as this case isn't covered by the documentation. Any help would be appreciated.

1 answer

1 accepted

1 vote
Answer accepted
Mike Stanley April 26, 2023

Well... weirdly enough I got it working and I'm not exactly sure why it wasn't to begin with. 
If you're here with the same problem, regenerate the b64 encoding for the app password. That's really the only thing I changed even though I verified it was right.

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2023

@Mike Stanley  hi. Happy to know you solved this issue for yourself.
There are possible 3 reasons where this could happen:

  1. Check correct permissions for the app password
  2. Ensure you correctly encode with base64 the app password (linux and mac have different shell commands), copy/paste to k8s manifest without trailed characters
  3. Apply secrets manifest to k8s
    kubectl apply -f config/runners-autoscaler-secret.yaml

Regards, Igor

Mike Stanley April 28, 2023

I think the encoding was the issue.

I usually use:
"echo 'password' | base64 -w0"

Typically, this works fine for my purposes. But in this case it wouldn't. It really did need to be:
"echo -n 'password' | base64"

Like Igor Stoyanov likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events