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

Added actions to publish to ghcr.io #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

a1994sc
Copy link

@a1994sc a1994sc commented Jul 15, 2024

This is a PR to publish the helm chart and docker image to the ghcr.io oci repo. This will address #1 .

The actions will publish the docker image to ghcr.io/container-rec/helm-charts-oci-proxy and the helm chart to ghcr.io/container-rec/chart/helm-charts-oci-proxy. Please advise if you would like to change those locations.

Copy link

coderabbitai bot commented Jul 15, 2024

Walkthrough

The recent changes to the workflow files primarily focus on enhancing container management with additional steps for logging into the Github Container Registry (ghcr.io) using Docker. Permissions for packages have been updated to allow writing, and steps for building and pushing container images, as well as Helm charts, to ghcr.io have been added.

Changes

Files Change Summary
.github/workflows/build-release.yaml Added permissions for packages to write, steps to login, build, and push images to ghcr.io.
.github/workflows/publish-chart.yml Introduced steps for logging into registry, pushing packaged charts to ghcr.io, and specifying package permissions.

Poem

In the realm of workflows, we dance and twirl,
With Docker and Helm, our flags unfurl.
To ghcr.io we now deploy,
Bringing efficiency and joy.
Packages write and images soar,
In the container registry, evermore.
🌟🐇🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 81b6020 and e3a41ed.

Files selected for processing (2)
  • .github/workflows/build-release.yaml (3 hunks)
  • .github/workflows/publish-chart.yml (2 hunks)
Additional comments not posted (4)
.github/workflows/publish-chart.yml (2)

18-19: Ensure appropriate permissions for package actions.

The addition of packages: write permission is crucial for the ability to push packages to the registry. Ensure this level of permission aligns with the principle of least privilege.


38-45: Review of new registry login and push steps.

  1. Login to ghcr.io (line 39): The use of ${{ secrets.GITHUB_TOKEN }} for authentication is appropriate, ensuring secure access to GitHub's container registry. Ensure that the GITHUB_TOKEN has the necessary scopes enabled.
  2. Push Packaged Chart to ghcr.io (line 45): The Helm push command is correctly formatted. Verify that the repository path oci://ghcr.io/${{ github.repository_owner }}/chart is correctly set up in ghcr.io to receive the Helm chart.

Both steps are crucial for integrating Helm chart management with GitHub's container registry and appear to be implemented correctly.

Verification successful

To ensure the repository path is correctly set up in ghcr.io and the environment variable GITHUB_REPOSITORY_OWNER is correctly used, we need to examine the workflow file for the proper usage of this variable. Let's search for the usage of GITHUB_REPOSITORY_OWNER in the .github/workflows/publish-chart.yml file.


To understand how the repository owner information is being handled in the workflow file, let's search for the usage of github.repository_owner and other relevant environment variables in the .github/workflows/publish-chart.yml file.


Verified: The usage of github.repository_owner in the workflow file is correct.

  • The github.repository_owner variable is correctly used for logging in to the registry and pushing the Helm chart.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the repository path in ghcr.io.

# Test: Check if the repository path is correctly set up in ghcr.io. Expect: Correct setup confirmation.
echo "Verifying repository path setup in ghcr.io for ${GITHUB_REPOSITORY_OWNER}."
# Placeholder for actual verification command, which would typically be part of a CI debug log or a manual check.

Length of output: 106


Script:

#!/bin/bash
# Search for the usage of GITHUB_REPOSITORY_OWNER in the .github/workflows/publish-chart.yml file
rg 'GITHUB_REPOSITORY_OWNER' .github/workflows/publish-chart.yml -A 5

Length of output: 69


Script:

#!/bin/bash
# Search for the usage of github.repository_owner and other relevant environment variables in the .github/workflows/publish-chart.yml file
rg 'github.repository_owner' .github/workflows/publish-chart.yml -A 5

Length of output: 462

.github/workflows/build-release.yaml (2)

75-76: Ensure appropriate permissions for package actions.

The addition of packages: write permission is crucial for the ability to push container images to the registry. Ensure this level of permission aligns with the principle of least privilege.


Line range hint 91-114: Review of new Docker login and push steps to ghcr.io.

  1. Login to GitHub Container Registry (lines 91-96): The use of docker/login-action@v3 with ${{ secrets.GITHUB_TOKEN }} is appropriate for secure login. Ensure that the GITHUB_TOKEN has the necessary scopes enabled.
  2. Build & push container image to ghcr.io (lines 107-114): The Docker build and push commands are correctly formatted. Verify that the environment variables and the repository path ghcr.io/${{ github.repository_owner }}/helm-charts-oci-proxy are correctly set up in ghcr.io to receive the container image.

Both steps are crucial for integrating container image management with GitHub's container registry and appear to be implemented correctly.

@a1994sc
Copy link
Author

a1994sc commented Jul 28, 2024

@tpoxa do you mind reviewing, sorry for the ping

@WladyX
Copy link

WladyX commented Sep 4, 2024

Please keep the separation of helm/image like in the PR, I was searching for an existing issue that solves exactly this.
Renovate does not differentiate between docker and helm when helm is oci, so it thinks the latest docker image is actually the latest helm version (when both helm and image have the same repo and name like on 8gears).
Hope this will get merged soon so I can switch to ghcr.io, thank you for the PR!

@a1994sc
Copy link
Author

a1994sc commented Sep 4, 2024

Yea, I realized that both the chart and image are in the same namespace/path... Having them separated out makes sense to me

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.

2 participants