Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bonfire should check the validity of GITHUB_TOKEN #362

Open
awood opened this issue Apr 25, 2024 · 1 comment
Open

Bonfire should check the validity of GITHUB_TOKEN #362

awood opened this issue Apr 25, 2024 · 1 comment

Comments

@awood
Copy link
Contributor

awood commented Apr 25, 2024

Recently my token expired. Instead of an error notifying me that I needed a new token, Bonfire would error out attempting to deploy a frontend (curiosity)

2024-04-25 15:57:13 [ WARNING] [          MainThread] http response 404 for url https://raw.githubusercontent.com/RedHatInsights/curiosity-frontend/e4e2f7ea7da3507f18e796e813dab8860ca65593/deploy/frontend.yaml, checking for template in current working dir...
2024-04-25 15:57:13 [   ERROR] [          MainThread] failed to fetch template file for curiosity-frontend
2024-04-25 15:57:13 [   ERROR] [          MainThread] hit fatal error: [Errno 2] No such file or directory: '/home/awood/devel/rhsm-subscriptions/deploy/frontend.yaml'
2024-04-25 15:57:13 [    INFO] [          MainThread] deploy failed: [Errno 2] No such file or directory: '/home/awood/devel/rhsm-subscriptions/deploy/frontend.yaml'
ERROR: deploy failed: [Errno 2] No such file or directory: '/home/awood/devel/rhsm-subscriptions/deploy/frontend.yaml'

I spent awhile trying to figure out why --frontends false wasn't working before a sharp-eyed colleague noticed the warning and mentioned the token which I realized had expired.

A check of the token's validity right at the beginning would be nice but if that's not possible, than even just an addition to the warning message like "Has your GITHUB_TOKEN expired or been left unset in .config/bonfire/env?" would be helpful.

@bsquizz
Copy link
Collaborator

bsquizz commented May 6, 2024

Apparently a GET to https://api.github.com/user/repos can be used to check if a token is valid. If the user is not authenticated, a 401 is returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants