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

ci: release charts to ACR #154

Merged
merged 2 commits into from
Aug 13, 2024
Merged

ci: release charts to ACR #154

merged 2 commits into from
Aug 13, 2024

Conversation

zyy17
Copy link
Collaborator

@zyy17 zyy17 commented Aug 12, 2024

Also resolve #108 by adding sleep 300.

Summary by CodeRabbit

  • New Features

    • Introduced a new job for releasing Helm charts directly to an Azure Container Registry, enhancing deployment capabilities.
    • Added a script to automate the packaging and pushing of Helm charts to an OCI-compliant registry.
  • Improvements

    • Upgraded GitHub Actions workflow actions to their latest versions for improved functionality and security.

Copy link
Contributor

coderabbitai bot commented Aug 12, 2024

Walkthrough

The recent changes enhance the GitHub Actions workflow for releasing Helm charts by introducing a new job for packaging and pushing charts to an OCI registry, alongside dependency upgrades for improved functionality and security. This streamlining reduces unnecessary workflow runs and optimizes deployment capabilities directly into Azure Container Registry.

Changes

File Change Summary
.github/.../release.yaml Added new job release-charts-to-acr for OCI registry; upgraded actions/checkout and azure/setup-helm to latest versions; updated release-charts-to-s3 job for consistency.
scripts/.../release-charts-to-acr.sh New script automating the packaging and pushing of Helm charts to OCI registry, featuring default values and feedback during execution.

Poem

🐇 In fields of code, we happily prance,
A new workflow blooms, giving charts a chance.
With Helm we pack, and to the clouds we send,
Integration and ease, on which we depend.
Hooray for the changes, let’s celebrate bright,
For smooth releases make our hearts feel light! 🌼✨


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 Configuration 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
Contributor

@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

Outside diff range, codebase verification and nitpick comments (3)
scripts/release-charts-to-acr.sh (3)

3-4: Consider adding validation for environment variables.

While default values are provided for OCI_REGISTRY_URL and OCI_NAMESPACE, consider adding validation to ensure these variables are correctly set if provided by the user.

# Example validation
if [[ -z "$OCI_REGISTRY_URL" || -z "$OCI_NAMESPACE" ]]; then
  echo "Error: OCI_REGISTRY_URL and OCI_NAMESPACE must be set."
  exit 1
fi

7-9: Add a check for empty directories.

The current check only verifies if the directory exists. Consider adding a check to ensure the directory is not empty before proceeding.

if [ -d "$dir" ] && [ "$(ls -A "$dir")" ]; then

22-22: Add error handling for Helm push.

Consider adding error handling to capture and respond to any failures during the helm push operation.

# Example error handling
if ! helm push "${packaged_file}" "oci://$OCI_REGISTRY_URL/$OCI_NAMESPACE/$chart_name"; then
  echo "Failed to push $chart_name to OCI registry."
  exit 1
fi
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 478c631 and d89925b.

Files selected for processing (2)
  • .github/workflows/release.yaml (4 hunks)
  • scripts/release-charts-to-acr.sh (1 hunks)
Additional comments not posted (5)
scripts/release-charts-to-acr.sh (1)

17-17: Handle multiple packaged files.

The find command might return multiple files if there are multiple .tgz files in the directory. Ensure that the script handles this scenario appropriately.

Verification successful

No multiple packaged files found currently, but ensure future-proofing.

The script currently does not encounter any .tgz files in the directories checked, so handling multiple files is not an immediate concern. However, ensure that the script logic can handle multiple .tgz files if they are added in the future. This could involve iterating over the files or selecting the correct one based on specific criteria.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if multiple packaged files exist in any chart directory.

# Test: Search for multiple .tgz files in any chart directory. Expect: No directories should contain more than one .tgz file.
for dir in charts/*/; do
  count=$(find "$dir" -type f -name "*.tgz" | wc -l)
  if [ "$count" -gt 1 ]; then
    echo "Multiple packaged files found in $dir"
  fi
done

Length of output: 354

.github/workflows/release.yaml (4)

48-69: Ensure secrets are correctly configured for OCI login.

The release-charts-to-acr job uses secrets for OCI login. Verify that these secrets are correctly configured in the repository settings.


4-9: Verify the paths-ignore patterns.

Ensure that the paths-ignore patterns correctly match the intended files and directories to prevent unnecessary workflow runs.

Verification successful

Paths-ignore patterns are correctly configured.

The paths-ignore patterns in your workflow configuration are correctly matching the intended files and directories, such as documentation and markdown files, preventing unnecessary workflow runs. The matched files include .gitignore, CODE_OF_CONDUCT.md, README.md, and several README.md files under the charts directory.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the paths-ignore patterns correctly match the intended files and directories.

# Test: List all files ignored by the paths-ignore patterns. Expect: Only documentation and markdown files should be listed.
git ls-files | grep -E '^(docs/|.*\.md$|\.gitignore)$'

Length of output: 208


26-26: Upgrade to the latest stable version of actions.

Ensure that upgrading to actions/checkout@v4 is compatible with the rest of the workflow and does not introduce any issues.

Verification successful

Upgrade to actions/checkout@v4 is compatible with the workflow.

The current workflow configuration does not involve SSH keys or container actions that would be affected by the open issue related to actions/checkout@v4. Therefore, upgrading to this version should not introduce any problems.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of actions/checkout@v4 with the workflow.

# Test: Check for any known issues with actions/checkout@v4. Expect: No issues should be reported.
gh issue list --repo actions/checkout --label bug --state open

Length of output: 141


Script:

#!/bin/bash
# Search for any usage of SSH keys or related configurations in the workflow file
rg 'ssh|key|container' .github/workflows/release.yaml -A 2 -B 2

Length of output: 333


36-36: Upgrade to the latest stable version of azure/setup-helm.

Ensure that upgrading to azure/[email protected] is compatible with the rest of the workflow and does not introduce any issues.

Verification successful

Upgrade to azure/[email protected] is compatible with the workflow.

The release notes for v4.2.0 do not indicate any breaking changes that would affect the specified Helm version v3.12.1 or subsequent workflow steps. The upgrade should be safe to proceed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of azure/[email protected] with the workflow.

# Test: Check for any known issues with azure/[email protected]. Expect: No issues should be reported.
gh issue list --repo Azure/setup-helm --label bug --state open

Length of output: 64


Script:

#!/bin/bash
# Find the usage of azure/setup-helm in the release.yaml file to understand its context.
rg 'azure/setup-helm' .github/workflows/release.yaml -A 5

Length of output: 494


Script:

#!/bin/bash
# Check the changelog or release notes for azure/setup-helm to identify any breaking changes.
gh release view v4.2.0 --repo Azure/setup-helm

Length of output: 325

@zyy17 zyy17 force-pushed the ci/release-to-acr branch from d89925b to 765f11a Compare August 12, 2024 16:15
@zyy17 zyy17 requested a review from daviderli614 August 12, 2024 16:16
Copy link
Contributor

@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 d89925b and 765f11a.

Files selected for processing (2)
  • .github/workflows/release.yaml (3 hunks)
  • scripts/release-charts-to-acr.sh (1 hunks)
Files skipped from review due to trivial changes (1)
  • scripts/release-charts-to-acr.sh
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yaml

@zyy17 zyy17 force-pushed the ci/release-to-acr branch from 765f11a to 6f98814 Compare August 12, 2024 16:24
@zyy17 zyy17 force-pushed the ci/release-to-acr branch from 6f98814 to b918424 Compare August 13, 2024 03:11
Copy link
Contributor

@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 765f11a and b918424.

Files selected for processing (2)
  • .github/workflows/release.yaml (3 hunks)
  • scripts/release-charts-to-acr.sh (1 hunks)
Files skipped from review due to trivial changes (1)
  • scripts/release-charts-to-acr.sh
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yaml

Copy link
Member

@daviderli614 daviderli614 left a comment

Choose a reason for hiding this comment

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

LGTM

@zyy17 zyy17 merged commit 326a753 into GreptimeTeam:main Aug 13, 2024
4 checks passed
@zyy17 zyy17 deleted the ci/release-to-acr branch August 13, 2024 03:28
@coderabbitai coderabbitai bot mentioned this pull request Nov 28, 2024
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.

Can not release the current latest chart to S3
2 participants