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

Make SCCACHE_S3_NO_CREDENTIALS require a value of true #1724

Merged
merged 8 commits into from Apr 24, 2023

Conversation

ajschmidt8
Copy link
Contributor

Closes #1723.

This PR updates the SCCACHE_S3_NO_CREDENTIALS environment variable to require a value of true in order to enable this feature.

Note: This is a breaking change and should probably be called out loudly in any future release notes.

src/config.rs Outdated
@@ -506,7 +506,10 @@ fn config_from_env() -> Result<EnvConfig> {
// ======= AWS =======
let s3 = env::var("SCCACHE_BUCKET").ok().map(|bucket| {
let region = env::var("SCCACHE_REGION").ok();
let no_credentials = env::var("SCCACHE_S3_NO_CREDENTIALS").ok().is_some();
let no_credentials = env::var("SCCACHE_S3_NO_CREDENTIALS")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should be more aggressive here.

if SCCACHE_S3_NO_CREDENTIALS is set, it can be only true or false (or 1 or 0).
Otherwise, we don't start the program.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sylvestre, I just pushed some changes. I'm not great with rust. Can you tell me if my approach is right? It took me a while to figure out the Option / Result handling.

I'll update the tests in a follow-up commit.

@@ -1066,7 +1069,7 @@ fn config_overrides() {
#[test]
#[serial]
fn test_s3_no_credentials() {
env::set_var("SCCACHE_S3_NO_CREDENTIALS", "1");
env::set_var("SCCACHE_S3_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.

we would need more (and separate) tests to cover this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in the latest commits. I mostly just copy and pasted the existing test functions.

Let me know if there's a better convention than that.

@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2023

Codecov Report

Patch coverage: 54.90% and project coverage change: +0.12 🎉

Comparison is base (6fffb2a) 29.14% compared to head (6352388) 29.26%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1724      +/-   ##
==========================================
+ Coverage   29.14%   29.26%   +0.12%     
==========================================
  Files          49       49              
  Lines       17456    17496      +40     
  Branches     8471     8481      +10     
==========================================
+ Hits         5087     5120      +33     
+ Misses       7297     7291       -6     
- Partials     5072     5085      +13     
Impacted Files Coverage Δ
src/config.rs 28.69% <54.90%> (+2.14%) ⬆️

... and 8 files with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ajschmidt8
Copy link
Contributor Author

@sylvestre, just checking in. any thoughts on this PR so far?

@sylvestre sylvestre merged commit 75c0330 into mozilla:main Apr 24, 2023
36 of 37 checks passed
@ajschmidt8 ajschmidt8 deleted the no-credentials branch April 24, 2023 14:29
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.

Proposal: Make SCCACHE_S3_NO_CREDENTIALS require a value of true
3 participants