I'm trying to authenticate with gcr using the docker login command and I get no access_token output. But the auth works fine.
echo '${{ steps.auth.outputs.access_token }}'
should show output
echo ''
...
build-and-publish-new-image:
runs-on: ubuntu-latest
environment: development
steps:
- name: Install Go
uses: actions/[email protected]
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout
uses: actions/[email protected]
# GCP Setup
- name: "Authenticate to Google Cloud"
uses: "google-github-actions/[email protected]"
with:
create_credentials_file: true
token_format: 'access_token'
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
- name: View Access token
run: |-
echo '${{ steps.auth.outputs.access_token }}'
- name: Docker Artifacts Registry configuration
uses: 'docker/[email protected]'
with:
registry: 'gcr.io' # or REGION-docker.pkg.dev
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
Error: Username and password required
and
```bash
echo ''
### Additional information
Is there something I'm missing with my yaml configs?
Hi @nyanchor
Thank you for opening an issue. A few things:
create_credentials_file: true
is the default, so you don't technically need that option.
You need to give the auth
step an "id" property. Right now, you're referencing a step with the id "auth", but no such step exists. This should really be an error on GitHub Actions, but it silently returns the empty string instead. You need to add an "id" property to the step:
- name: "Authenticate to Google Cloud"
id: "auth" # <--
# ... existing values
Then you can access the outputs. There's a more detailed example in the Usage section of the README.
Even if you fix the output naming, it will print as ***
, because it's marked as a "secret" in GitHub Actions.
Let me know if you have any questions!
Owner Name | google-github-actions |
Repo Name | auth |
Full Name | google-github-actions/auth |
Language | TypeScript |
Created Date | 2021-09-16 |
Updated Date | 2023-03-24 |
Star Count | 573 |
Watcher Count | 16 |
Fork Count | 116 |
Issue Count | 3 |
Issue Title | Created Date | Updated Date |
---|