Skip to content

Conversation

@RinChanNOWWW
Copy link

Support for Tencent Cloud Object Storage.

docs/COS.md Outdated

If you want to use _Tencent Cloud Object Storage_ (aka COS) for the sccache cache, you need to set the `SCCACHE_COS_BUCKET` environment variable to the name of the COS bucket to use.

You **must** specify the endpoint URL using the `SCCACHE_COS_ENDPOINT` environment variable. More details is at [COS endpoints](https://www.tencentcloud.com/document/product/436/6224).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You **must** specify the endpoint URL using the `SCCACHE_COS_ENDPOINT` environment variable. More details is at [COS endpoints](https://www.tencentcloud.com/document/product/436/6224).
You **must** specify the endpoint URL using the `SCCACHE_COS_ENDPOINT` environment variable. More details are at [COS endpoints](https://www.tencentcloud.com/document/product/436/6224).

@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2026

Codecov Report

❌ Patch coverage is 36.00000% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.18%. Comparing base (d9d2eb6) to head (6492ef8).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
src/cache/cache.rs 0.00% 12 Missing ⚠️
src/cache/cos.rs 0.00% 11 Missing ⚠️
src/config.rs 60.86% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2563   +/-   ##
=======================================
  Coverage   71.18%   71.18%           
=======================================
  Files          64       65    +1     
  Lines       35588    35640   +52     
=======================================
+ Hits        25333    25372   +39     
- Misses      10255    10268   +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

pub bucket: String,
#[serde(default)]
pub key_prefix: String,
pub endpoint: Option<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the doc, you say that it is mandatory, so, maybe don't use Option here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other object store services like S3, OSS use Option too.

https://github.com/mozilla/sccache/blob/main/docs/OSS.md?plain=1#L5

endpoint = "oss-us-east-1.aliyuncs.com"
key_prefix = "ossprefix"
no_credentials = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a test to cover the parsing of this block

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is already added here:

[cache.cos]
bucket = "name"
endpoint = "cos.na-siliconvalley.myqcloud.com"
key_prefix = "cosprefix"

if webdav.is_some() {
self.webdav = webdav;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the empty line to be consistent

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is inconsistent with others.

Comment on lines 475 to +476
}
if cos.is_some() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
if cos.is_some() {
}
if cos.is_some() {

}

// ======= COS =======
let cos = if let Ok(bucket) = env::var("SCCACHE_COS_BUCKET") {
Copy link
Collaborator

@sylvestre sylvestre Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation: SCCACHE_COS_ENDPOINT should be required when SCCACHE_COS_BUCKET is set. Add validation like: if env::var('SCCACHE_COS_BUCKET').is_ok() && env::var('SCCACHE_COS_ENDPOINT').is_err() { bail!('SCCACHE_COS_ENDPOINT must be set'); }

Copy link
Author

@RinChanNOWWW RinChanNOWWW Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the codes of other object stores (like OSS). They don't validate the Option but declare the endpoint as a necessary (must) configuration.

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

Successfully merging this pull request may close these issues.

3 participants