Skip to content

Commit 9800b7a

Browse files
committed
update ecrPattern for ECR registry to allow for ecr-public to be mirrored similar to how ecr-fips is
Signed-off-by: Ryan Hartje <ryan@ryanhartje.com>
1 parent a7e990c commit 9800b7a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/pkg/reg/adapter/awsecr/adapter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
)
3030

3131
const (
32-
ecrPattern = "https://(?:api|(\\d+)\\.dkr)\\.ecr(\\-fips)?\\.([\\w\\-]+)\\.(amazonaws\\.com(\\.cn)?|sc2s\\.sgov\\.gov|c2s\\.ic\\.gov)"
32+
ecrPattern = "https://(?:api|(\\d+)\\.dkr)\\.ecr(?:-public|-fips)?\\.([\\w\\-]+)\\.(amazonaws\\.com(\\.cn)?|sc2s\\.sgov\\.gov|c2s\\.ic\\.gov)"
3333
)
3434

3535
var (

src/pkg/reg/adapter/awsecr/adapter_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ func TestAdapter_NewAdapter(t *testing.T) {
115115
})
116116
assert.Nil(t, err)
117117
assert.NotNil(t, adapter)
118+
119+
adapter, err = newAdapter(&model.Registry{
120+
Type: model.RegistryTypeAwsEcr,
121+
Credential: &model.Credential{
122+
AccessKey: "xxx",
123+
AccessSecret: "ppp",
124+
},
125+
URL: "https://api.ecr-public.us-east-1.amazonaws.com",
126+
})
127+
assert.Nil(t, err)
128+
assert.NotNil(t, adapter)
118129
}
119130

120131
func getMockAdapter(t *testing.T, hasCred, health bool) (*adapter, *httptest.Server) {

0 commit comments

Comments
 (0)