Skip to content

Commit 574f134

Browse files
authored
Merge pull request #1287 from sam-berning/automated-cherry-pick-of-#1284-upstream-release-1.30
Automated cherry pick of #1284: support new aws partition in credential provider
2 parents b196b42 + 9a0819d commit 574f134

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cmd/ecr-credential-provider/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
const ecrPublicRegion string = "us-east-1"
4343
const ecrPublicHost string = "public.ecr.aws"
4444

45-
var ecrPrivateHostPattern = regexp.MustCompile(`^(\d{12})\.dkr[\.\-]ecr(\-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.(amazonaws\.com(?:\.cn)?|on\.(?:aws|amazonwebservices\.com\.cn)|sc2s\.sgov\.gov|c2s\.ic\.gov|cloud\.adc-e\.uk|csp\.hci\.ic\.gov)$`)
45+
var ecrPrivateHostPattern = regexp.MustCompile(`^(\d{12})\.dkr[\.\-]ecr(\-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.(amazonaws\.(?:com(?:\.cn)?|eu)|on\.(?:aws|amazonwebservices\.com\.cn)|sc2s\.sgov\.gov|c2s\.ic\.gov|cloud\.adc-e\.uk|csp\.hci\.ic\.gov)$`)
4646

4747
// ECR abstracts the calls we make to aws-sdk for testing purposes
4848
type ECR interface {

cmd/ecr-credential-provider/main_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ func Test_parseRegionFromECRPrivateHost(t *testing.T) {
352352
host: "123456789123.dkr.ecr.us-iso-east-1.c2s.ic.gov",
353353
region: "us-iso-east-1",
354354
},
355+
// EUSC
356+
{
357+
name: "success",
358+
host: "123456789123.dkr.ecr.eusc-de-east-1.amazonaws.eu",
359+
region: "eusc-de-east-1",
360+
},
355361
// Dual-Stack
356362
{
357363
name: "success",
@@ -411,6 +417,10 @@ func TestRegistryPatternMatch(t *testing.T) {
411417
{"123456789012.dkr.ecr-fips.lala-land-1.amazonaws.com", true},
412418
// .cn
413419
{"123456789012.dkr.ecr.lala-land-1.amazonaws.com.cn", true},
420+
// .eu
421+
{"123456789012.dkr.ecr.eusc-de-east-1.amazonaws.eu", true},
422+
// .eu with fips
423+
{"123456789012.dkr.ecr-fips.eusc-de-east-1.amazonaws.eu", true},
414424
// registry ID too long
415425
{"1234567890123.dkr.ecr.lala-land-1.amazonaws.com", false},
416426
// registry ID too short

0 commit comments

Comments
 (0)