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

feat: Implement cache storage check #1519

Merged
merged 2 commits into from
Jan 2, 2023
Merged

Conversation

Xuanwo
Copy link
Collaborator

@Xuanwo Xuanwo commented Jan 2, 2023

Signed-off-by: Xuanwo github@xuanwo.io

This PR will add storage check during start.

Demo Show

Start server without s3 ak/sk

:( SCCACHE_START_SERVER=1 SCCACHE_NO_DAEMON=1 SCCACHE_BUCKET=test ./target/debug/sccache                  
sccache: error: cache storage failed to read: ObjectPermissionDenied (permanent) at read => S3Error { code: "AccessDenied", message: "Access Denied", resource: "", request_id: "46RYHDRAN8WD64XW" }

Context:
    response: Parts { status: 403, version: HTTP/1.1, headers: {"x-amz-request-id": "46RYHDRAN8WD64XW", "x-amz-id-2": "R9ldSWAQSbbTSYOowzLoJD0dRgRWbcS0wYV0ibbb+4yVok+oYEmvB+F8+2g05KWvXnGYK8poafw=", "content-type": "application/xml", "transfer-encoding": "chunked", "date": "Mon, 02 Jan 2023 04:48:47 GMT", "server": "AmazonS3"} }
    service: s3
    path: .sccache_check
    range: 0-

Start with rustc wrapper also works:

:( RUSTC_WRAPPER=/home/xuanwo/Code/mozilla/sccache/target/debug/sccache SCCACHE_BUCKET=test CARGO_INCREMENTAL=false SCCACHE_LOG=debug SCCACHE_ERROR_LOG=/tmp/sccache_log.txt cargo build                 
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/xuanwo/Code/mozilla/sccache/target/debug/sccache rustc - --crate-name ___ --print=file-names -C link-arg=-fuse-ld=/usr/bin/mold --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 2)
  --- stderr
  [2023-01-02T12:05:01Z DEBUG sccache::config] Attempting to read config file at "/home/xuanwo/.config/sccache/config"
  [2023-01-02T12:05:01Z DEBUG sccache::config] Couldn't open config file: No such file or directory (os error 2)
  [2023-01-02T12:05:01Z DEBUG sccache::config] Attempting to read config file at "/home/xuanwo/.config/sccache/config"
  [2023-01-02T12:05:01Z DEBUG sccache::config] Couldn't open config file: No such file or directory (os error 2)
  sccache: error: Server startup failed: cache storage failed to read: ObjectPermissionDenied (permanent) at read => S3Error { code: "AccessDenied", message: "Access Denied", resource: "", request_id: "1V54QP0EPZQ5J3A7" }

  Context:
      response: Parts { status: 403, version: HTTP/1.1, headers: {"x-amz-request-id": "1V54QP0EPZQ5J3A7", "x-amz-id-2": "YRQ+E3KrYscCNKSrajVyQU0JT8hxEvdgzBhbHB4OK4Y+m15W6HVFko3NDBaMxIFQRFm/QVl/C+I=", "content-type": "application/xml", "transfer-encoding": "chunked", "date": "Mon, 02 Jan 2023 12:05:03 GMT", "server": "AmazonS3"} }
      service: s3
      path: .sccache_check
      range: 0-

Affected Issues

Xuanwo added 2 commits January 2, 2023 20:11
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2023

Codecov Report

Base: 30.09% // Head: 30.46% // Increases project coverage by +0.37% 🎉

Coverage data is based on head (60d2a91) compared to base (dd418ab).
Patch coverage: 29.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1519      +/-   ##
==========================================
+ Coverage   30.09%   30.46%   +0.37%     
==========================================
  Files          47       48       +1     
  Lines       16643    16703      +60     
  Branches     7907     7931      +24     
==========================================
+ Hits         5008     5089      +81     
+ Misses       6315     6206     -109     
- Partials     5320     5408      +88     
Impacted Files Coverage Δ
tests/sccache_cargo.rs 34.21% <ø> (+1.26%) ⬆️
src/cache/cache.rs 39.53% <15.00%> (+0.87%) ⬆️
src/server.rs 31.68% <28.57%> (-0.04%) ⬇️
tests/sccache_args.rs 36.58% <36.58%> (ø)
src/mock_command.rs 52.05% <0.00%> (-0.38%) ⬇️
src/compiler/args.rs 61.19% <0.00%> (-0.36%) ⬇️
src/compiler/gcc.rs 55.37% <0.00%> (-0.21%) ⬇️
src/compiler/msvc.rs 43.29% <0.00%> (-0.14%) ⬇️
src/compiler/rust.rs 33.46% <0.00%> (ø)
src/compiler/compiler.rs 35.66% <0.00%> (ø)
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sylvestre sylvestre merged commit b891fbf into mozilla:main Jan 2, 2023
@Xuanwo Xuanwo deleted the storage-check branch January 2, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment