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

Add missing permissions in update-helm-repo workflow #3383

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Oct 29, 2024

This is the fixup for #3366

The changes in #3366 added an explicit list of permissions, the workflow intents to use. It seems that this broke the release of Helm charts in Mimir. The "Push release tag on origin" now fails with the following:

Pushing tag mimir-distributed-5.6.0-weekly.314
remote: Permission to grafana/mimir.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/grafana/mimir/': The requested URL returned error: 403
Error: Process completed with exit code 128.

(refer to this failed build)

If I understand it right, even though we add all necessary permissions in the repo's "Workflow permissions" settings, the permissions explicitly defined in workflow's YAML override those (refer to github docs). And since the workflow doesn't list the contents: write, the action, that executes the workflow cannot push the tag. This PR fixes that.

Signed-off-by: Vladimir Varankin <[email protected]>
@narqo narqo requested a review from a team as a code owner October 29, 2024 11:51
Signed-off-by: Vladimir Varankin <[email protected]>
@@ -145,7 +146,7 @@ jobs:
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.5.2
version: v3.16.2
Copy link
Contributor Author

@narqo narqo Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that helm push was introduced in 3.7.0, which was release in 2021.

With 3.5.2 the workflow fails with:

The workflow fails with "Error: unknown command "push" for helm"

I propose we update to the latest release, which is 3.16, as of today.

Copy link
Contributor

@krajorama krajorama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamp.

@narqo
Copy link
Contributor Author

narqo commented Oct 29, 2024

Note that we also need the repo's admin to add grafana/mimir write access to the mimir-distributed package in this repository.

Right now, with the fixes from this PR, the CI job fails when it pushes the OCI package:

helm push "/home/runner/work/mimir/mimir/.cr-release-packages/mimir-distributed-5.6.0-weekly.314.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

I've found this explanation of the problem.

@narqo narqo merged commit 20d0ecd into main Oct 29, 2024
6 checks passed
@narqo narqo deleted the vldmr/fix-gh-workflow-update-helm-repo branch October 29, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants