-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Describe the bug
We have a GitHub Action workflow for our CI checks, and the runners are self hosted, and split between a mac "rent-a-machine" company and GCP. As part of our checks we use the google-github-actions/auth@v3 action to authenticate each run to Google and obtain a credentials file, the location of which is passed to subsequence steps via the well known environment variable GOOGLE_APPLICATION_CREDENTIALS.
Subsequent steps, that use gcloud storage cp are able to copy data, from both the macs and GCP VMs, to the GCS bucket that we use for our Bazel cache, which, to us, indicates the authentication has succeeded, and valid credentials are available, and that the GCP VMs have all the permissions needed to write to the bucket.
When we run a bazel build, however, we see numerous HTTP 403 errors stating;
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message><Details>Provided scope(s) are not authorized</Details></Error>
which appears to correlate with when we would expect cache writes to be sent to the bucket.
To confirm the problem is with this credential helper we replaced it with a two step process; Create a bearer token using gcloud auth print-access-token, which is stored in an environment variable, and then the script returns the appropriately formatted response, with that token, to Bazel, in place of the credential helper. When we do this the 403 errors do not occur.
We have also tried running this helper in standalone mode, by setting CREDENTIAL_HELPER_STANDALONE to 1 in the environment. This did not resolve the issue.
To Reproduce
Setup a GCS bucket as the bazel remote cache.
Setup a GHA workflow that runs on GCP hosted virtual machines, that perform the auth step mentioned above.
Run workflow.
Expected behavior
No 403 errors, and cache writes succeeding.
Environment
- Ubuntu 24.04 on X86_64 and ARM.
- 0.0.9
Additional context
Seems to be a GCP VM related issue. GHA may, or may not, be a relevant factor.