grafana / helm-charts

Apache License 2.0
1.67k stars 2.28k forks source link

update-helm-repo: fix oci image push failure #3418

Closed narqo closed 2 weeks ago

narqo commented 2 weeks ago

This is the fixup for https://github.com/grafana/helm-charts/pull/3366

Relates to #3068

It turned out GitHub doesn't support publishing a package using GitHub App installation tokens (or fine-grained personal tokens). That is, as of today, the users are left with using either "classic" PAT with org-scopes or the magical GITHUB_TOKEN (docs).

This PR fixes the update-helm-repo workflow, updating the last step to use the GITHUB_TOKEN token. Otherwise, the workflow fails with:

Run helm push "/home/runner/work/mimir/mimir/.cr-release-packages/mimir-distributed-5.6.0-weekly.315.tgz" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts"
Error: unexpected status from POST request to https://ghcr.io/v2/grafana/helm-charts/mimir-distributed/blobs/uploads/: 403 Forbidden

Note that, the package is pushed to the GITHUB_REPOSITORY_OWNER repository, under the name helm-charts/<chart-name>. The package than is automatically associated with the source repository that ran the push. This is similar to how helm-chart/grafana-operator is published currently (ref).