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

Extend AWS ECR regex for c2s support #20648

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ethanchowell
Copy link

@ethanchowell ethanchowell commented Jun 22, 2024

Thank you for contributing to Harbor!

Comprehensive Summary of your change

This PR extends the ecr regex check for c2s regions that don't follow the amazonaws domain convention.

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.
@ethanchowell ethanchowell requested a review from a team as a code owner June 22, 2024 02:33
@ethanchowell ethanchowell changed the title Extend regex for c2s support Jun 22, 2024
@MinerYang
Copy link
Contributor

MinerYang commented Jun 24, 2024

Hi @ethanchowell ,

Thanks for your contributions!
Could you help to provide the related official doc for this regex definition if there's any?

Best,
Miner

@MinerYang MinerYang assigned chlins and unassigned stonezdj and MinerYang Jun 24, 2024
@ethanchowell
Copy link
Author

ethanchowell commented Jun 24, 2024

I'm not aware of any official docs, but can point to the ecr-credential-helper that implements this pattern successfully. Slightly modified of course to account for existing tests within the project.

@chlins chlins added the release-note/update Update or Fix label Jul 4, 2024
@chlins
Copy link
Member

chlins commented Jul 4, 2024

@ethanchowell Hi, thanks for your contribution, please resolve the DCO failure in CI.

Copy link

codecov bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.24%. Comparing base (c8c11b4) to head (a73e539).
Report is 238 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #20648       +/-   ##
===========================================
+ Coverage   45.36%   66.24%   +20.87%     
===========================================
  Files         244     1045      +801     
  Lines       13333   113501   +100168     
  Branches     2719     2845      +126     
===========================================
+ Hits         6049    75188    +69139     
- Misses       6983    34202    +27219     
- Partials      301     4111     +3810     
Flag Coverage Δ
unittests 66.24% <100.00%> (+20.87%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/pkg/reg/adapter/awsecr/adapter.go 68.62% <100.00%> (ø)

... and 1286 files with indirect coverage changes

Signed-off-by: Ethan Howell <ethan.c.howell@hotmail.com>
Signed-off-by: Ethan Howell <ethan.c.howell@hotmail.com>
Signed-off-by: Ethan Howell <ethan.c.howell@hotmail.com>
Signed-off-by: Ethan Howell <ethan.c.howell@hotmail.com>
@@ -67,7 +67,7 @@ func parseAccountRegion(url string) (string, string, error) {
if rs == nil {
return "", "", errors.New("bad aws url")
}
return rs[1], rs[2], nil
return rs[1], rs[3], nil
Copy link
Member

Choose a reason for hiding this comment

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

Please add length check for rs before this line.

Copy link
Author

Choose a reason for hiding this comment

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

Happy to add it, but shouldn't that always evaluate to true based on the docs for FindStringSubmatch? In the event of no match it would just be nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/update Update or Fix
5 participants