Skip to content

Commit f6ef577

Browse files
committed
feat: add support for AWS European Sovereign Cloud ECR registries
- Update ECR registry regex to match `.amazonaws.eu` domain suffix - Add test cases for `eusc-de-east-1.amazonaws.eu` region format Fixes: #908 Signed-off-by: Philipp Dreimann <pdreiman@amazon.de> Tested-by: Lukas Valentin Buchmeier-Probst <lvbp@amazon.de>
1 parent 916386b commit f6ef577

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

__tests__/aws.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe('isECR', () => {
1111
['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', true],
1212
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', true],
1313
['012345678901.dkr-ecr.eu-north-1.on.aws', true],
14+
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', true],
1415
['public.ecr.aws', true],
1516
['ecr-public.aws.com', true]
1617
])('given registry %p', async (registry, expected) => {
@@ -26,6 +27,7 @@ describe('isPubECR', () => {
2627
['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', false],
2728
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', false],
2829
['012345678901.dkr-ecr.eu-north-1.on.aws', false],
30+
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', false],
2931
['public.ecr.aws', true],
3032
['ecr-public.aws.com', true]
3133
])('given registry %p', async (registry, expected) => {
@@ -39,6 +41,7 @@ describe('getRegion', () => {
3941
['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', 'cn-north-1'],
4042
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', 'cn-northwest-1'],
4143
['012345678901.dkr-ecr.eu-north-1.on.aws', 'eu-north-1'],
44+
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', 'eusc-de-east-1'],
4245
['public.ecr.aws', 'us-east-1']
4346
])('given registry %p', async (registry, expected) => {
4447
expect(aws.getRegion(registry)).toEqual(expected);
@@ -52,6 +55,7 @@ describe('getAccountIDs', () => {
5255
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', '012345678901,012345678910,023456789012', ['012345678901', '012345678910', '023456789012']],
5356
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', '012345678910,023456789012', ['390948362332', '012345678910', '023456789012']],
5457
['876820548815.dkr-ecr.eu-north-1.on.aws', '012345678910,023456789012', ['876820548815', '012345678910', '023456789012']],
58+
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', '012345678910,023456789012', ['012345678901', '012345678910', '023456789012']],
5559
['public.ecr.aws', undefined, []]
5660
])('given registry %p', async (registry, accountIDsEnv, expected) => {
5761
if (accountIDsEnv) {

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/aws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {NodeHttpHandler} from '@smithy/node-http-handler';
55
import {HttpProxyAgent} from 'http-proxy-agent';
66
import {HttpsProxyAgent} from 'https-proxy-agent';
77

8-
const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.com(.cn)?))(\/([^:]+)(:.+)?)?$/;
8+
const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.(com(.cn)?|eu)))(\/([^:]+)(:.+)?)?$/;
99
const ecrPublicRegistryRegex = /public\.ecr\.aws|ecr-public\.aws\.com/;
1010

1111
export const isECR = (registry: string): boolean => {

0 commit comments

Comments
 (0)