mirror of
https://github.com/docker/login-action.git
synced 2025-04-27 17:16:35 +02:00
ecr input to specify whether the given registry is ECR
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
b20b9f5e31
commit
b9a4d91ee5
8 changed files with 29 additions and 15 deletions
|
@ -4,6 +4,7 @@ export interface Inputs {
|
|||
registry: string;
|
||||
username: string;
|
||||
password: string;
|
||||
ecr: string;
|
||||
logout: boolean;
|
||||
}
|
||||
|
||||
|
@ -12,6 +13,7 @@ export function getInputs(): Inputs {
|
|||
registry: core.getInput('registry'),
|
||||
username: core.getInput('username'),
|
||||
password: core.getInput('password'),
|
||||
ecr: core.getInput('ecr'),
|
||||
logout: core.getBooleanInput('logout')
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as aws from './aws';
|
|||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
export async function login(registry: string, username: string, password: string): Promise<void> {
|
||||
if (aws.isECR(registry)) {
|
||||
export async function login(registry: string, username: string, password: string, ecr: string): Promise<void> {
|
||||
if (/true/i.test(ecr) || (ecr == 'auto' && aws.isECR(registry))) {
|
||||
await loginECR(registry, username, password);
|
||||
} else {
|
||||
await loginStandard(registry, username, password);
|
||||
|
|
|
@ -5,10 +5,10 @@ import * as stateHelper from './state-helper';
|
|||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const {registry, username, password, logout} = context.getInputs();
|
||||
stateHelper.setRegistry(registry);
|
||||
stateHelper.setLogout(logout);
|
||||
await docker.login(registry, username, password);
|
||||
const input: context.Inputs = context.getInputs();
|
||||
stateHelper.setRegistry(input.registry);
|
||||
stateHelper.setLogout(input.logout);
|
||||
await docker.login(input.registry, input.username, input.password, input.ecr);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue