Take the password from stdin

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-09-24 20:21:04 +02:00
parent 53f337dbae
commit 6e236fe59d
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 15 additions and 8 deletions

View file

@ -19,7 +19,7 @@ export async function logout(registry: string): Promise<void> {
}
export async function loginStandard(registry: string, username: string, password: string): Promise<void> {
let loginArgs: Array<string> = ['login', '--password', password];
let loginArgs: Array<string> = ['login', '--password-stdin'];
if (username) {
loginArgs.push('--username', username);
}
@ -30,7 +30,7 @@ export async function loginStandard(registry: string, username: string, password
} else {
core.info(`🔑 Logging into DockerHub...`);
}
await execm.exec('docker', loginArgs, true).then(res => {
await execm.exec('docker', loginArgs, true, password).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
}