Skip to content

Commit

Permalink
docker auth: improve missing user/pwd
Browse files Browse the repository at this point in the history
Specify the "missing username and password" error message. This makes debugging the action easier when for example mistyping the username or the password.

Signed-off-by: Frank Villaro-Dixon <frank@vi-di.fr>
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
  • Loading branch information
Frankkkkk committed Apr 30, 2024
1 parent 5f4866a commit 1e92894
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ export async function logout(registry: string): Promise<void> {
}

export async function loginStandard(registry: string, username: string, password: string): Promise<void> {
if (!username || !password) {
if (!username && !password) {
throw new Error('Username and password required');
}
if (!username) {
throw new Error('Username required');
}
if (!password) {
throw new Error('Password required');
}


const loginArgs: Array<string> = ['login', '--password-stdin'];
loginArgs.push('--username', username);
Expand Down

0 comments on commit 1e92894

Please sign in to comment.