hendrikmuhs / ccache-action

github action to speedup building using ccache
MIT License
114 stars 52 forks source link

Silently fails to write GCS cache #115

Closed GMNGeoffrey closed 1 year ago

GMNGeoffrey commented 1 year ago

If sccache is unable to authenticate to GCS it just silently proceeds without authentication. If it gets a "unauthorized" response when writing, it proceeds. Instead, I think several of these things should be an error, with the option to configure it to bypass the errors. I found https://github.com/mozilla/sccache/issues/1180, which I think covers some of these issues, but there are others that should

Here are some logs demonstrating the issue: https://gist.github.com/GMNGeoffrey/b0f7453349b8211b3af355bc9a9765f9

[2022-11-08T22:53:15Z DEBUG sccache::cache::cache] Trying GCS bucket(iree-github-actions-presubmit-artifacts, gcmn-test-sccache, Some("/usr/local/google/home/gcmn/.config/gcloud/application_default_credentials.json"), None, None, ReadWrite)
[2022-11-08T22:53:15Z WARN  sccache::cache::cache] Failed to parse service account credentials from file: missing field `private_key` at line 6 column 1. Continuing without authentication.

This should be an error. I think just changing https://github.com/mozilla/sccache/blob/b6b20059cec5d3c4311b7f5fe99f9c37d0412fb9/src/cache/cache.rs#L378 here.

[2022-11-08T22:53:16Z DEBUG reqwest::async_impl::client] response '404 Not Found' for https://www.googleapis.com/download/storage/v1/b/iree-github-actions-presubmit-artifacts/o/gcmn-test-sccache%2F03e462fba45b71c78c638ecafbbf2a1e233ab6b79214350310269d3593f26987?alt=media
[2022-11-08T22:53:16Z WARN  sccache::cache::gcs] Got GCS error: didn't get a successful HTTP status, got `404 Not Found`

This should be DEBUG. A 404 is just a cache miss. https://github.com/mozilla/sccache/issues/1180 covers this.

[2022-11-08T22:56:53Z DEBUG sccache::cache::cache] Trying GCS bucket(iree-github-actions-presubmit-artifacts, gcmn-test-sccache, None, None, None, ReadWrite)
[2022-11-08T22:56:53Z WARN  sccache::cache::cache] No SCCACHE_GCS_KEY_PATH specified-- no authentication will be used.

Should this be an error? No authentication with ReadWrite, seems exceptionally unlikely to work... I wonder if any cloud bucket is configured for unauthenticated write access

[2022-11-08T22:56:53Z DEBUG reqwest::async_impl::client] response '401 Unauthorized' for https://www.googleapis.com/upload/storage/v1/b/iree-github-actions-presubmit-artifacts/o?name=gcmn-test-sccache/03e462fba45b71c78c638ecafbbf2a1e233ab6b79214350310269d3593f26987&uploadType=media
[2022-11-08T22:56:53Z DEBUG sccache::compiler::compiler] [Demangle.cpp.o]: Cache write error: failed to put cache entry in GCS

This should be an error.

I am happy to send patches for these issues.

GMNGeoffrey commented 1 year ago

I'm sorry... I had the wrong repository open when filing this issue. Closing and filing in the right place...