mirror of
https://github.com/docker/login-action.git
synced 2025-04-19 01:26:45 +00:00
Handle Amazon ECR registries associated with other accounts
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
3b14bab101
commit
d3160f671f
4 changed files with 77 additions and 54 deletions
|
@ -55,13 +55,19 @@ export async function loginECR(registry: string, username: string, password: str
|
|||
process.env.AWS_SECRET_ACCESS_KEY = password || process.env.AWS_SECRET_ACCESS_KEY;
|
||||
|
||||
core.info(`⬇️ Retrieving docker login command through AWS CLI ${cliVersion} (${cliPath})...`);
|
||||
const loginCmd = await aws.getDockerLoginCmd(cliVersion, registry, region);
|
||||
const loginCmds = await aws.getDockerLoginCmds(cliVersion, registry, region);
|
||||
|
||||
core.info(`🔑 Logging into ${registry}...`);
|
||||
execm.exec(loginCmd, [], true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
}
|
||||
core.info('🎉 Login Succeeded!');
|
||||
loginCmds.forEach((loginCmd, index) => {
|
||||
execm.exec(loginCmd, [], true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
}
|
||||
if (loginCmds.length > 1) {
|
||||
core.info(`🎉 Login Succeeded! (${index}/${loginCmds.length})`);
|
||||
} else {
|
||||
core.info('🎉 Login Succeeded!');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue