Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(docker): add ghworkflows example for GAR with Workload Identity #30692

Merged
merged 4 commits into from
Aug 24, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions docs/usage/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,44 @@ To make use of this authentication mechanism, specify the username as `AWS`:

#### Google Container Registry / Google Artifact Registry

##### Using Application Default Credentials / Workload Identity (Self-Hosted only)
##### Using Workload Identity

Just configure [ADC](https://cloud.google.com/docs/authentication/provide-credentials-adc) /
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) as normal and _don't_
provide a username, password or token. Renovate will automatically retrieve the credentials using the
google-auth-library.
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) has to be configured and the Service Account needs `artifactregistry.repositories.downloadArtifacts` permission.
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved

###### With Application Default Credentials (Self-Hosted only)
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved

Just configure [ADC](https://cloud.google.com/docs/authentication/provide-credentials-adc) as normal and _don't_ provide a username, password or token.
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved
Renovate will automatically retrieve the credentials using the google-auth-library.
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved

###### With short-lived access token / GitHub Actions (Self-hosted only)
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved

Below you find the example configuration for both Workload Identity and the Renovate Host rules. For a full GitHub Workflow example see [renovatebot/github-action](https://github.com/renovatebot/github-action) repo.
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved

```yaml
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved
- name: authenticate to google cloud
id: auth
uses: google-github-actions/[email protected]
with:
token_format: 'access_token'
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}

- name: renovate
uses: renovatebot/[email protected]
env:
RENOVATE_HOST_RULES: |
[
{
matchHost: "us-central1-docker.pkg.dev",
hostType: "docker",
username: "oauth2accesstoken",
password: "${{ steps.auth.outputs.access_token }}"
}
]
with:
token: ${{ secrets.RENOVATE_TOKEN }}
configurationFile: .github/renovate.json5
```

jazzlyn marked this conversation as resolved.
Show resolved Hide resolved
##### Using long-lived service account credentials

Expand Down Expand Up @@ -386,7 +418,7 @@ If you have dependencies on Google Container Registry (and Artifact Registry) yo
}
```

##### Using short-lived access tokens
##### Using short-lived access token / Gitlab CI / Google Cloud
jazzlyn marked this conversation as resolved.
Show resolved Hide resolved

Assume you are running GitLab CI in the Google Cloud, and you are storing your Docker images in the Google Container Registry (GCR).

Expand Down