Maintenance: Update AWS SDK to v3, limit to only S3 client #2785
Merged
Conversation
Contributor
Author
|
selfie |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On top of #2784.
This is from a deprecation warning via email, and from looking at https://github.com/aws/aws-sdk-ruby/blob/master/V3_UPGRADING_GUIDE.md No impact expected, other than that we can now pull in only the S3 client and not the rest of the AWS SDK. So incidentally this should also reduce the slug size.
EDIT: turns out that there's a change in how credentials are read across versions, and the S3 client checks that config is present in the constructor. Some tests use the real client, and then mock calls to it, but those now fail since the constructor raises that there is no config.
In development, this SDK behavior is a bit dangerous and not what we want. If if there was local config or credentials in
~/.awsthe SDK would read that from disk, which is why these tests didn't fail when run locally. It's dangerous because it's possible that test bugs could lead to exercising stale credentials a developer left on disk from doing unrelated work on the AWS CLI (even for a different project). We never want this to be possible, so this addsAWS_SDK_CONFIG_OPT_OUT.It also adds fake values to the ENV for keys and secrets in dev and test, so that the constructor doesn't raise and we can mock and test. It looks like the SDK may now have more first-class ways to stub it that are baked in (eg https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ClientStubs.html) but this PR didn't look more deeply into that.