-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[match] Added s3_skip_encryption parameter #21018
Merged
Merged
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d7c7871
Added s3_skip_encryption parameter to match
mbogh 0ea04c4
Fixed tests for now.
mbogh 001b67d
Added tests for encryption for_storage_mode
mbogh 7af388b
Forgot rubocop
mbogh 52507e5
Added warning to option
mbogh fd31159
for_mode to from_params
mbogh f0f1e84
Merge branch 'master' into match-skip-encryption
getaaron fd8a503
Fix GitLabSecureFiles config params
getaaron b82a1a9
disable ClassLength rubocop on match/options.rb
getaaron a24fbc7
Remove no longer needed fields from importer spec assertion
getaaron 2179f5e
Remove trailing comma
getaaron 63b23ac
Removed one more param from importer_spec
getaaron 4813d3d
A bit of clean up should make the tests go green
mbogh 6f7b56d
One comma
mbogh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
describe Match::Encryption do | ||
describe "for_storage_mode" do | ||
it "returns nil if storage mode is google_cloud" do | ||
storage_mode = "google_cloud" | ||
|
||
encryption = Match::Encryption.for_storage_mode(storage_mode, { | ||
git_url: "", | ||
s3_bucket: "", | ||
s3_skip_encryption: false, | ||
working_directory: "" | ||
}) | ||
|
||
expect(encryption).to be_nil | ||
end | ||
|
||
it "returns nil if storage mode is gitlab_secure_files" do | ||
storage_mode = "gitlab_secure_files" | ||
|
||
encryption = Match::Encryption.for_storage_mode(storage_mode, { | ||
git_url: "", | ||
s3_bucket: "", | ||
s3_skip_encryption: false, | ||
working_directory: "" | ||
}) | ||
|
||
expect(encryption).to be_nil | ||
end | ||
|
||
it "returns nil if storage mode is s3 and skip encryption is true" do | ||
storage_mode = "s3" | ||
|
||
encryption = Match::Encryption.for_storage_mode(storage_mode, { | ||
git_url: "", | ||
s3_bucket: "my-bucket", | ||
s3_skip_encryption: true, | ||
working_directory: "" | ||
}) | ||
|
||
expect(encryption).to be_nil | ||
end | ||
|
||
it "should return OpenSSL object for storage mode git" do | ||
storage_mode = "git" | ||
git_url = "git@github.com:you/your_repo.git" | ||
working_directory = "my-workding-directory" | ||
|
||
encryption = Match::Encryption.for_storage_mode(storage_mode, { | ||
git_url: git_url, | ||
s3_bucket: "", | ||
s3_skip_encryption: false, | ||
working_directory: working_directory | ||
}) | ||
|
||
expect(encryption).to_not(be_nil) | ||
expect(encryption).to be_kind_of(Match::Encryption::OpenSSL) | ||
expect(encryption.keychain_name).to be(git_url) | ||
expect(encryption.working_directory).to be(working_directory) | ||
end | ||
|
||
it "should return OpenSSL object for storage mode s3 and skip encryption is false" do | ||
storage_mode = "s3" | ||
s3_bucket = "my-bucket" | ||
working_directory = "my-workding-directory" | ||
|
||
encryption = Match::Encryption.for_storage_mode(storage_mode, { | ||
git_url: "", | ||
s3_bucket: s3_bucket, | ||
s3_skip_encryption: false, | ||
working_directory: working_directory | ||
}) | ||
|
||
expect(encryption).to_not(be_nil) | ||
expect(encryption).to be_kind_of(Match::Encryption::OpenSSL) | ||
expect(encryption.keychain_name).to be(s3_bucket) | ||
expect(encryption.working_directory).to be(working_directory) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 kinda dislike how the current design of
for_storage_mode
forces all these unrelated params to be littered across all the call sites... what do you think about refactoring it so we just pass in the wholeparams
object plus any overrides and nil replacements? Then this entire block of code could be replaced with something likeThere 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.
Fine with me, I can give it a go. It was kinda more changes than I thought would be needed since I had to hand pick all params.
Stay tuned :)
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.
Okay, so the
params
object in this case is aFastlaneCore::Configuration
and that does not play nicely with the existing tests... I will see if it something I can work around.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.
@getaaron I gave it a swing, found that it made the most sense to cherry pick the params going into the Storage classes themselves since they are more specific.
Please give me your thoughts.