-
Notifications
You must be signed in to change notification settings - Fork 625
feat: support for Tencent Cloud Object Storage #2563
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
base: main
Are you sure you want to change the base?
Conversation
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
| pub bucket: String, | ||
| #[serde(default)] | ||
| pub key_prefix: String, | ||
| pub endpoint: Option<String>, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | ||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
| } | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| } | ||
| if cos.is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | |
| if cos.is_some() { | |
| } | |
| if cos.is_some() { |
| } | ||
|
|
||
| // ======= COS ======= | ||
| let cos = if let Ok(bucket) = env::var("SCCACHE_COS_BUCKET") { |
There was a problem hiding this comment.
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'); }
There was a problem hiding this comment.
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.
Support for Tencent Cloud Object Storage.