Skip to content

Commit

Permalink
Merge pull request #533 from Tradeshift/POPS-2913
Browse files Browse the repository at this point in the history
fix: ECR public registry uses us-east-1 region
  • Loading branch information
arminioa authored Jul 20, 2023
2 parents cc5178a + e2174bf commit 1971a90
Show file tree
Hide file tree
Showing 5 changed files with 852 additions and 5,085 deletions.
20 changes: 19 additions & 1 deletion __tests__/aws.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isECRRepository} from '../src/aws';
import {isECRRepository, getRegion} from '../src/aws';

describe(isECRRepository, () => {
it('returns true when given an ECR repository', () => {
Expand All @@ -24,3 +24,21 @@ describe(isECRRepository, () => {
expect(isECRRepository('test/test')).toEqual(false);
});
});

describe('getRegion', () => {
it('returns us-east-1 when given an ECR public repository', () => {
expect(getRegion('public.ecr.aws/tradeshift/my-image')).toEqual(
'us-east-1'
);
});
it('returns eu-west-1 when given an ECR private repository in eu-west-1', () => {
expect(
getRegion('123456789012.dkr.ecr.eu-west-1.amazonaws.com/my-image')
).toEqual('eu-west-1');
});
it('returns cn-north-1 when given an ECR private repository in cn-north-1', () => {
expect(
getRegion('123456789012.dkr.ecr.cn-north-1.amazonaws.com.cn/my-image')
).toEqual('cn-north-1');
});
});
Loading

0 comments on commit 1971a90

Please sign in to comment.