-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Overview of the Issue
When Atlantis v0.33.0
is deployed against a GitHub Enterprise Server (GHES) instance, it repeatedly fails to post comments on pull requests with:
401 Must authenticate to access this API
Despite:
- Generating and validating a GitHub App JWT (returns HTTP 200 from /api/v3/app).
- Exchanging that JWT for an installation access token (manually via curl).
- Confirming the App has Read & Write permissions on Issues and Pull Requests and is installed on the target repo.
- Mounting the private key and webhook secret correctly via a Kubernetes Secret.
- Setting both ATLANTIS_GH_APP_KEY_FILE and ATLANTIS_GH_WEBHOOK_SECRET in the pod environment.
Restarting the StatefulSet after every configuration change.
What does work
I’ve verified that posting an atlantis help comment on a PR in the allowed repository successfully appears in the pod’s logs.
Reproduction Steps
- Deploy Atlantis via
kubectl apply
- Bootstraped the GitHub App via Atlantis
gtihub-app/setup
URL - Store credentials in Kubernetes secrets encoding them via base64 (including app-key file contents)
- Confirmed Github Enterprise server can ping atlantis
- Create a PR in the allowed repo and create a comment
atlantis help
Logs
Environment details
- Atlantis version:
v0.33.0
- Deployment method: Kustomization via GKE
- Atlantis flags: None
- Env Vars:
- name: ATLANTIS_DATA_DIR
value: /atlantis
- name: ATLANTIS_PORT
value: "4141"
- name: ATLANTIS_GH_USER
value: fake # recommended by Atlantis docs: https://www.runatlantis.io/docs/access-credentials.html#github-app
- name: ATLANTIS_GH_TOKEN
value: fake # recommended by Atlantis docs: https://www.runatlantis.io/docs/access-credentials.html#github-app
- name: ATLANTIS_GH_ORG
value: readacted_org
- name: ATLANTIS_ATLANTIS_URL
value: https://<ATLANTIS_URL>
- name: ATLANTIS_LOG_LEVEL
value: debug
- name: ATLANTIS_REPO_ALLOWLIST
value: URL/REPO
- name: ATLANTIS_GH_HOSTNAME
value: "HOSTNAME"
- name: ATLANTIS_GH_APP_ID
value: "redacted"
- name: ATLANTIS_GH_APP_KEY_FILE
value: /etc/atlantis/gh-app-key.pem
- name: ATLANTIS_GH_WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: atlantis-vcs
key: webhook-secret # must generate this with base64 encode
Additional Context
Decided to use an ATLANTIS_GH_APP_KEY_FILE
but I also tried just passing the value for ATLANTIS_GH_APP_KEY
directly from the Kubernetes secret. That failed to authenticate as well.
dosubot