Skip to content

Fix ECR Client Migration to V2 #4550

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

Merged
merged 2 commits into from
Apr 24, 2025
Merged

Fix ECR Client Migration to V2 #4550

merged 2 commits into from
Apr 24, 2025

Conversation

TheanLim
Copy link
Contributor

@TheanLim TheanLim commented Mar 29, 2025

Summary

A fix on PR #4512 by adding HTTPS prefix.

Implementation details

HTTPS/HTTP prefix is automatically added to endpoint in sdk v1 but not in v2.
Adding HTTPS prefix to endpoint override if it's not already so.

Testing

New tests cover the changes: no, but adapting the existing test.

Description for the changelog

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TheanLim TheanLim requested a review from a team as a code owner March 29, 2025 00:09
@TheanLim TheanLim changed the title WIP - Fix ecr migration [Pending additional FIPS testing] Fix ECR Client Migration to V2 Apr 3, 2025
@TheanLim TheanLim changed the title [Pending additional FIPS testing] Fix ECR Client Migration to V2 [Pending manual FIPS testing] Fix ECR Client Migration to V2 Apr 3, 2025
@TheanLim TheanLim force-pushed the fix-ecr-migration branch from 8cf4edb to d672034 Compare April 4, 2025 17:50
)

const httpsPrefix = "https://"
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Do we also need to consider http as well?

Looks like in AWS SDK Go V1, it takes that into consideration when appending the prefixes -> https://github.com/aws/aws-sdk-go/blob/8d203ccff393340d080be0417d091cc60354449b/aws/endpoints/endpoints.go#L324-L339

Copy link
Contributor Author

@TheanLim TheanLim Apr 7, 2025

Choose a reason for hiding this comment

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

No, we don't need to consider http.
We currently (in v1) do not instantiate a new client with Config.DisableSSL set to true. This flag is passed to AddScheme to determine whether the HTTP or HTTPS schemes should be added.

In short, we only prepend https prefix, if it's needed.

if !strings.HasPrefix(endpoint, httpsPrefix) {
endpoint = httpsPrefix + endpoint
}
opts = append(opts, awsconfig.WithBaseEndpoint(endpoint))
Copy link
Contributor Author

@TheanLim TheanLim Apr 23, 2025

Choose a reason for hiding this comment

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

BaseEndpoint override in config has a higher precedence than environment variable and shared config file per https://docs.aws.amazon.com/sdkref/latest/guide/settings-reference.html. Verified this by manual testings too.

This means that customer host configurations should not affect endpoint override, which is the v1 behaviour

@TheanLim TheanLim changed the title [Pending manual FIPS testing] Fix ECR Client Migration to V2 Fix ECR Client Migration to V2 Apr 23, 2025
@TheanLim TheanLim force-pushed the fix-ecr-migration branch from 621514e to 8c77c09 Compare April 23, 2025 18:35
@TheanLim TheanLim enabled auto-merge (squash) April 23, 2025 18:36
@TheanLim TheanLim force-pushed the fix-ecr-migration branch from 8c77c09 to a0dd1e8 Compare April 23, 2025 18:45
@TheanLim TheanLim force-pushed the fix-ecr-migration branch from a0dd1e8 to ede603a Compare April 24, 2025 00:38
@TheanLim TheanLim merged commit d64a9ba into aws:dev Apr 24, 2025
40 checks passed
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.

4 participants