Compare commits

...

4 Commits

Author SHA1 Message Date
Frank Villaro-Dixon
4c4b6e86c3
Merge 1e928945a0 into 7840e6ddd4 2024-05-08 14:44:39 -05:00
CrazyMax
7840e6ddd4
Merge pull request #693 from dsotirakis/patch-1
Fixes in README.md file around GAR authentication
2024-05-08 16:58:44 +02:00
Frank Villaro-Dixon
1e928945a0 docker auth: improve missing user/pwd
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>
2024-04-30 22:51:23 +02:00
Dimitris Sotirakis
225e47902b
Update README.md
Fixes a few issues in the login-action README.md file

Signed-off-by: Dimitris Sotirakis <sotirakis.dim@gmail.com>
2024-04-04 18:17:07 +03:00
2 changed files with 12 additions and 6 deletions

View File

@ -228,10 +228,9 @@ You can authenticate with workload identity federation or a service account.
#### Workload identity federation
Download the key for the service account as a JSON file. Save the contents of
the file [as a secret](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository)
named `GCR_JSON_KEY` in your GitHub repository. Set the username to `_json_key`,
or `_json_key_base64` if you use a base64-encoded key.
Your service account must have permission to push to GAR. Use the
`google-github-actions/auth` action to authenticate using workload identity as
shown in the following example:
```yaml
name: ci
@ -275,7 +274,7 @@ jobs:
Use a service account with permission to push to GAR and [configure access control](https://cloud.google.com/artifact-registry/docs/access-control).
Download the key for the service account as a JSON file. Save the contents of
the file [as a secret](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository)
named `GCR_JSON_KEY` in your GitHub repository. Set the username to `_json_key`,
named `GAR_JSON_KEY` in your GitHub repository. Set the username to `_json_key`,
or `_json_key_base64` if you use a base64-encoded key.
```yaml

View File

@ -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);