mirror of
https://gitee.com/actions-mirror/docker-login-action
synced 2026-01-14 11:02:05 +08:00
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>
This commit is contained in:
parent
916386b000
commit
f6ef577545
@ -11,6 +11,7 @@ describe('isECR', () => {
|
||||
['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', true],
|
||||
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', true],
|
||||
['012345678901.dkr-ecr.eu-north-1.on.aws', true],
|
||||
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', true],
|
||||
['public.ecr.aws', true],
|
||||
['ecr-public.aws.com', true]
|
||||
])('given registry %p', async (registry, expected) => {
|
||||
@ -26,6 +27,7 @@ describe('isPubECR', () => {
|
||||
['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', false],
|
||||
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', false],
|
||||
['012345678901.dkr-ecr.eu-north-1.on.aws', false],
|
||||
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', false],
|
||||
['public.ecr.aws', true],
|
||||
['ecr-public.aws.com', true]
|
||||
])('given registry %p', async (registry, expected) => {
|
||||
@ -39,6 +41,7 @@ describe('getRegion', () => {
|
||||
['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', 'cn-north-1'],
|
||||
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', 'cn-northwest-1'],
|
||||
['012345678901.dkr-ecr.eu-north-1.on.aws', 'eu-north-1'],
|
||||
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', 'eusc-de-east-1'],
|
||||
['public.ecr.aws', 'us-east-1']
|
||||
])('given registry %p', async (registry, expected) => {
|
||||
expect(aws.getRegion(registry)).toEqual(expected);
|
||||
@ -52,6 +55,7 @@ describe('getAccountIDs', () => {
|
||||
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', '012345678901,012345678910,023456789012', ['012345678901', '012345678910', '023456789012']],
|
||||
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', '012345678910,023456789012', ['390948362332', '012345678910', '023456789012']],
|
||||
['876820548815.dkr-ecr.eu-north-1.on.aws', '012345678910,023456789012', ['876820548815', '012345678910', '023456789012']],
|
||||
['012345678901.dkr.ecr.eusc-de-east-1.amazonaws.eu', '012345678910,023456789012', ['012345678901', '012345678910', '023456789012']],
|
||||
['public.ecr.aws', undefined, []]
|
||||
])('given registry %p', async (registry, accountIDsEnv, expected) => {
|
||||
if (accountIDsEnv) {
|
||||
|
||||
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@ import {NodeHttpHandler} from '@smithy/node-http-handler';
|
||||
import {HttpProxyAgent} from 'http-proxy-agent';
|
||||
import {HttpsProxyAgent} from 'https-proxy-agent';
|
||||
|
||||
const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.com(.cn)?))(\/([^:]+)(:.+)?)?$/;
|
||||
const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.(com(.cn)?|eu)))(\/([^:]+)(:.+)?)?$/;
|
||||
const ecrPublicRegistryRegex = /public\.ecr\.aws|ecr-public\.aws\.com/;
|
||||
|
||||
export const isECR = (registry: string): boolean => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user