mirror of
https://github.com/docker/login-action.git
synced 2024-11-15 15:03:51 +08:00
commit
5d62c58fc3
@ -1,5 +1,5 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"printWidth": 240,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
|
@ -74,21 +74,9 @@ describe('getRegion', () => {
|
||||
describe('getAccountIDs', () => {
|
||||
test.each([
|
||||
['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,012345678910,023456789012',
|
||||
['012345678901', '012345678910', '023456789012']
|
||||
],
|
||||
[
|
||||
'390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn',
|
||||
'012345678910,023456789012',
|
||||
['390948362332', '012345678910', '023456789012']
|
||||
],
|
||||
['012345678901.dkr.ecr.eu-west-3.amazonaws.com', '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, []]
|
||||
])('given registry %p', async (registry, accountIDsEnv, expected) => {
|
||||
if (accountIDsEnv) {
|
||||
|
3
codecov.yml
Normal file
3
codecov.yml
Normal file
@ -0,0 +1,3 @@
|
||||
comment: false
|
||||
github_checks:
|
||||
annotations: false
|
6883
dist/index.js
generated
vendored
6883
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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.3",
|
||||
"@types/node": "^14.0.14",
|
||||
"@vercel/ncc": "^0.23.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"jest": "^26.1.0",
|
||||
"jest-circus": "^26.1.0",
|
||||
"jest-runtime": "^26.1.0",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-jest": "^26.1.1",
|
||||
"typescript": "^3.9.5",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/node": "^14.17.4",
|
||||
"@vercel/ncc": "^0.28.6",
|
||||
"dotenv": "^8.6.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"jest-runtime": "^26.6.3",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^26.5.6",
|
||||
"typescript": "^3.9.10",
|
||||
"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]);
|
||||
};
|
||||
|
||||
export const getDockerLoginCmds = async (
|
||||
cliVersion: string,
|
||||
registry: string,
|
||||
region: string,
|
||||
accountIDs: string[]
|
||||
): Promise<string[]> => {
|
||||
export const getDockerLoginCmds = async (cliVersion: string, registry: string, region: string, accountIDs: string[]): Promise<string[]> => {
|
||||
let ecrCmd = (await isPubECR(registry)) ? 'ecr-public' : 'ecr';
|
||||
if (semver.satisfies(cliVersion, '>=2.0.0') || (await isPubECR(registry))) {
|
||||
return execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => {
|
||||
return [`docker login --username AWS --password ${pwd} ${registry}`];
|
||||
});
|
||||
} else {
|
||||
return execCLI([
|
||||
ecrCmd,
|
||||
'get-login',
|
||||
'--region',
|
||||
region,
|
||||
'--registry-ids',
|
||||
accountIDs.join(' '),
|
||||
'--no-include-email'
|
||||
]).then(dockerLoginCmds => {
|
||||
return execCLI([ecrCmd, 'get-login', '--region', region, '--registry-ids', accountIDs.join(' '), '--no-include-email']).then(dockerLoginCmds => {
|
||||
return dockerLoginCmds.trim().split(`\n`);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user