From 26618cd0df78271d936ab551b5a709347e19c3df Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 20 Aug 2020 16:24:35 +0200 Subject: [PATCH] Retrieve command --- dist/index.js | 10 ++++++++-- src/main.ts | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4401305..44428bd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1095,12 +1095,18 @@ function run() { const ecrRegion = yield ecr.getRegion(registry); process.env.AWS_ACCESS_KEY_ID = username; process.env.AWS_SECRET_ACCESS_KEY = password; - core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`); + core.info(`⬇️ Retrieving docker login command for ECR region ${ecrRegion}...`); yield execm.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } - core.info('🎉 Login Succeeded!'); + core.info(`🔑 Logging into ${registry}...`); + execm.exec(res.stdout, [], true).then(res => { + if (res.stderr != '' && !res.success) { + throw new Error(res.stderr); + } + core.info('🎉 Login Succeeded!'); + }); }); } else { diff --git a/src/main.ts b/src/main.ts index 054e350..0746e3d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,12 +26,18 @@ async function run(): Promise { process.env.AWS_ACCESS_KEY_ID = username; process.env.AWS_SECRET_ACCESS_KEY = password; - core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`); + core.info(`⬇️ Retrieving docker login command for ECR region ${ecrRegion}...`); await execm.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } - core.info('🎉 Login Succeeded!'); + core.info(`🔑 Logging into ${registry}...`); + execm.exec(res.stdout, [], true).then(res => { + if (res.stderr != '' && !res.success) { + throw new Error(res.stderr); + } + core.info('🎉 Login Succeeded!'); + }); }); } else { let loginArgs: Array = ['login', '--password', password];