Get AccountID from registry URL and handle ECR registry through regexp

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-12-17 20:21:48 +01:00
parent d3160f671f
commit 24646ef465
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 122 additions and 34 deletions

View file

@ -44,6 +44,7 @@ export async function loginECR(registry: string, username: string, password: str
const cliPath = await aws.getCLI();
const cliVersion = await aws.getCLIVersion();
const region = await aws.getRegion(registry);
const accountIDs = await aws.getAccountIDs(registry);
if (await aws.isPubECR(registry)) {
core.info(`💡 AWS Public ECR detected with ${region} region`);
@ -55,7 +56,7 @@ 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 loginCmds = await aws.getDockerLoginCmds(cliVersion, registry, region);
const loginCmds = await aws.getDockerLoginCmds(cliVersion, registry, region, accountIDs);
core.info(`🔑 Logging into ${registry}...`);
loginCmds.forEach((loginCmd, index) => {