mirror of
https://github.com/docker/login-action.git
synced 2024-12-23 10:47:44 +01:00
commit
5d62c58fc3
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 120,
|
"printWidth": 240,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
|
@ -74,21 +74,9 @@ describe('getRegion', () => {
|
|||||||
describe('getAccountIDs', () => {
|
describe('getAccountIDs', () => {
|
||||||
test.each([
|
test.each([
|
||||||
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', undefined, ['012345678901']],
|
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', undefined, ['012345678901']],
|
||||||
[
|
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', '012345678910,023456789012', ['012345678901', '012345678910', '023456789012']],
|
||||||
'012345678901.dkr.ecr.eu-west-3.amazonaws.com',
|
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', '012345678901,012345678910,023456789012', ['012345678901', '012345678910', '023456789012']],
|
||||||
'012345678910,023456789012',
|
['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', '012345678910,023456789012', ['390948362332', '012345678910', '023456789012']],
|
||||||
['012345678901', '012345678910', '023456789012']
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'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']
|
|
||||||
],
|
|
||||||
['public.ecr.aws', undefined, []]
|
['public.ecr.aws', undefined, []]
|
||||||
])('given registry %p', async (registry, accountIDsEnv, expected) => {
|
])('given registry %p', async (registry, accountIDsEnv, expected) => {
|
||||||
if (accountIDsEnv) {
|
if (accountIDsEnv) {
|
||||||
|
3
codecov.yml
Normal file
3
codecov.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
comment: false
|
||||||
|
github_checks:
|
||||||
|
annotations: false
|
6861
dist/index.js
generated
vendored
6861
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@ -33,16 +33,16 @@
|
|||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.3",
|
"@types/jest": "^26.0.23",
|
||||||
"@types/node": "^14.0.14",
|
"@types/node": "^14.17.4",
|
||||||
"@vercel/ncc": "^0.23.0",
|
"@vercel/ncc": "^0.28.6",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.6.0",
|
||||||
"jest": "^26.1.0",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^26.1.0",
|
"jest-circus": "^26.6.3",
|
||||||
"jest-runtime": "^26.1.0",
|
"jest-runtime": "^26.6.3",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.3.2",
|
||||||
"ts-jest": "^26.1.1",
|
"ts-jest": "^26.5.6",
|
||||||
"typescript": "^3.9.5",
|
"typescript": "^3.9.10",
|
||||||
"typescript-formatter": "^7.2.2"
|
"typescript-formatter": "^7.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
src/aws.ts
17
src/aws.ts
@ -71,27 +71,14 @@ export const parseCLIVersion = async (stdout: string): Promise<string> => {
|
|||||||
return semver.clean(matches[1]);
|
return semver.clean(matches[1]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDockerLoginCmds = async (
|
export const getDockerLoginCmds = async (cliVersion: string, registry: string, region: string, accountIDs: string[]): Promise<string[]> => {
|
||||||
cliVersion: string,
|
|
||||||
registry: string,
|
|
||||||
region: string,
|
|
||||||
accountIDs: string[]
|
|
||||||
): Promise<string[]> => {
|
|
||||||
let ecrCmd = (await isPubECR(registry)) ? 'ecr-public' : 'ecr';
|
let ecrCmd = (await isPubECR(registry)) ? 'ecr-public' : 'ecr';
|
||||||
if (semver.satisfies(cliVersion, '>=2.0.0') || (await isPubECR(registry))) {
|
if (semver.satisfies(cliVersion, '>=2.0.0') || (await isPubECR(registry))) {
|
||||||
return execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => {
|
return execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => {
|
||||||
return [`docker login --username AWS --password ${pwd} ${registry}`];
|
return [`docker login --username AWS --password ${pwd} ${registry}`];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return execCLI([
|
return execCLI([ecrCmd, 'get-login', '--region', region, '--registry-ids', accountIDs.join(' '), '--no-include-email']).then(dockerLoginCmds => {
|
||||||
ecrCmd,
|
|
||||||
'get-login',
|
|
||||||
'--region',
|
|
||||||
region,
|
|
||||||
'--registry-ids',
|
|
||||||
accountIDs.join(' '),
|
|
||||||
'--no-include-email'
|
|
||||||
]).then(dockerLoginCmds => {
|
|
||||||
return dockerLoginCmds.trim().split(`\n`);
|
return dockerLoginCmds.trim().split(`\n`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user