From 16b2f90c243a943bf1562b59189dd6d2ff0c1512 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 20 Aug 2020 16:10:17 +0200 Subject: [PATCH] Display AWS CLI version --- dist/index.js | 14 +++++++++++++- src/main.ts | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9830c25..6ea7f58 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1090,10 +1090,16 @@ function run() { const username = core.getInput('username'); const password = core.getInput('password', { required: true }); if (yield ecr.isECR(registry)) { + yield exec.exec('aws', ['--version'], true).then(res => { + if (res.stderr != '' && !res.success) { + throw new Error(res.stderr); + } + core.info(`💡 Using ${res.stdout}`); + }); 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(`🔑 Logging into AWS ECR region ${ecrRegion}...`); yield exec.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); @@ -1107,6 +1113,12 @@ function run() { loginArgs.push('--username', username); } loginArgs.push(registry); + if (registry) { + core.info(`🔑 Logging into ${registry}...`); + } + else { + core.info(`🔑 Logging into DockerHub...`); + } yield exec.exec('docker', loginArgs, true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); diff --git a/src/main.ts b/src/main.ts index d466257..4994f8f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,11 +19,18 @@ async function run(): Promise { const password: string = core.getInput('password', {required: true}); if (await ecr.isECR(registry)) { + await exec.exec('aws', ['--version'], true).then(res => { + if (res.stderr != '' && !res.success) { + throw new Error(res.stderr); + } + core.info(`💡 Using ${res.stdout}`); + }); + const ecrRegion = await 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(`🔑 Logging into AWS ECR region ${ecrRegion}...`); await exec.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); @@ -37,6 +44,11 @@ async function run(): Promise { } loginArgs.push(registry); + if (registry) { + core.info(`🔑 Logging into ${registry}...`); + } else { + core.info(`🔑 Logging into DockerHub...`); + } await exec.exec('docker', loginArgs, true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr);