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

chore: add CRDs file to release assets #1099

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

Rory-Z
Copy link
Member

@Rory-Z Rory-Z commented Jan 13, 2025

Summary by CodeRabbit

  • New Features

    • Added generation of Custom Resource Definitions (CRDs) during release workflow
    • Included crds.yaml as a release asset
  • Chores

    • Updated GitHub Actions release workflow to use latest softprops/action-gh-release@v2
    • Improved release output handling by using $GITHUB_OUTPUT

Copy link

coderabbitai bot commented Jan 13, 2025

Walkthrough

The pull request introduces enhancements to the EMQX Operator's release workflow and CRD generation script. The .github/workflows/release.yml file is updated to include a new step for generating Custom Resource Definitions (CRDs), modernize GitHub Actions output handling, and upgrade the release action version. The scripts/gen-helm-crds.sh script receives minor indentation adjustments for annotation and webhook service configuration updates.

Changes

File Change Summary
.github/workflows/release.yml - Added CRD generation step with make kustomize and ./bin/kustomize build ./config/crd > crds.yaml
- Updated output handling from ::set-output to $GITHUB_OUTPUT
- Upgraded softprops/action-gh-release from v1 to v2
- Added crds.yaml to release assets
scripts/gen-helm-crds.sh - Restored previously removed lines with consistent indentation
- Maintained existing annotation and webhook service configuration logic

Poem

🐰 Release workflow hopping along,
CRDs dancing to a new song!
Annotations aligned with care,
GitHub Actions beyond compare,
A rabbit's release, precise and bright! 🚀


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

@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

🧹 Nitpick comments (2)
.github/workflows/release.yml (2)

41-44: Add validation for the generated CRDs file.

While the CRDs generation step is correctly implemented, consider adding validation to ensure the generated file is not empty and contains valid YAML.

     - name: Generate CRDs file
       run: |
         make kustomize
         ./bin/kustomize build ./config/crd > crds.yaml
+        # Validate the generated file
+        if [ ! -s crds.yaml ]; then
+          echo "Error: Generated crds.yaml is empty"
+          exit 1
+        fi
+        # Verify YAML validity
+        yq eval 'true' crds.yaml > /dev/null

89-89: Consider adding explicit step dependency for the release step.

While the changes are correct, consider adding an id to the CRDs generation step and making the release step depend on it using needs to ensure proper sequencing.

     - name: Generate CRDs file
+      id: generate_crds
       run: |
         make kustomize
         ./bin/kustomize build ./config/crd > crds.yaml

     # ... other steps ...

     - uses: softprops/action-gh-release@v2
+      needs: generate_crds
       with:
         tag_name: ${{ env.GIT_TAG }}

Also applies to: 103-104

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f4089d and 3d2e8f2.

📒 Files selected for processing (3)
  • .github/workflows/release.yml (3 hunks)
  • deploy/charts/emqx-operator/Chart.yaml (1 hunks)
  • scripts/gen-helm-crds.sh (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • scripts/gen-helm-crds.sh
  • deploy/charts/emqx-operator/Chart.yaml
⏰ Context from checks skipped due to timeout of 90000ms (30)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-full.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-full.yaml, false)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-slim.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-slim.yaml, false)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml, false)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml, false)
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2beta1/emqx-full.yaml, false)
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2beta1/emqx-slim.yaml, false)
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml, false)
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml, false)
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-full.yaml...
  • GitHub Check: upgrade (EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml)
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-slim.yaml...
  • GitHub Check: upgrade (EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml)
  • GitHub Check: upgrade (EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml)
  • GitHub Check: unit-test
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-full.yaml...
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml...
  • GitHub Check: upgrade (EmqxBroker, emqx, config/samples/emqx/v1beta3/emqxbroker-slim.yaml)
  • GitHub Check: lint
🔇 Additional comments (1)
.github/workflows/release.yml (1)

85-85: LGTM! Proper update to GitHub Actions output syntax.

The change correctly implements the new recommended approach for setting outputs in GitHub Actions, replacing the deprecated ::set-output syntax with $GITHUB_OUTPUT.

Also applies to: 87-87

Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com>
@Rory-Z Rory-Z force-pushed the chore/add-crds-to-release-assets branch from 3d2e8f2 to 4e91eb5 Compare January 13, 2025 08:18
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

🧹 Nitpick comments (2)
.github/workflows/release.yml (2)

41-44: Add error handling and validation for CRDs generation.

The CRDs generation step could be more robust with:

  1. Error handling for the make kustomize command
  2. Validation of the generated CRDs file

Consider updating the step with this implementation:

     - name: Generate CRDs file
       run: |
+        set -e
         make kustomize
+        if [ ! -f "./bin/kustomize" ]; then
+          echo "Error: kustomize binary not found"
+          exit 1
+        fi
         ./bin/kustomize build ./config/crd > crds.yaml
+        if [ ! -s crds.yaml ]; then
+          echo "Error: Generated CRDs file is empty"
+          exit 1
+        fi
+        # Basic YAML validation
+        cat crds.yaml | grep -q "kind: CustomResourceDefinition" || (echo "Error: Invalid CRDs file"; exit 1)

89-89: Consider adding cleanup step for generated files.

Good update to the latest release action version and proper addition of the CRDs file to release assets. However, consider adding a cleanup step for the generated crds.yaml file.

Add this step after the release:

    - name: Cleanup
      if: always()
      run: rm -f crds.yaml

Also applies to: 103-104

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d2e8f2 and 4e91eb5.

📒 Files selected for processing (2)
  • .github/workflows/release.yml (3 hunks)
  • scripts/gen-helm-crds.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/gen-helm-crds.sh
⏰ Context from checks skipped due to timeout of 90000ms (34)
  • GitHub Check: e2e-test (e2e/v2beta1/e2e_rebalance_test.go)
  • GitHub Check: e2e-test (e2e/v2beta1/e2e_test.go)
  • GitHub Check: e2e-test (e2e/v1beta4/e2e_base_test.go)
  • GitHub Check: e2e-test (e2e/v1beta4/e2e_upgrade_test.go)
  • GitHub Check: e2e-test (e2e/v1beta4/e2e_blure_green_upgrade_test.go)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-full.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-full.yaml, false)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-slim.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2beta1/emqx-slim.yaml, false)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml, false)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml, true)
  • GitHub Check: deployment (helm, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml, false)
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-full.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (helm, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml, ...
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2beta1/emqx-full.yaml, false)
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2beta1/emqx-slim.yaml, false)
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml, false)
  • GitHub Check: deployment (static, EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml, false)
  • GitHub Check: upgrade (EMQX, emqx, config/samples/emqx/v2alpha1/emqx-full.yaml)
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-full.yaml...
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta4/emqxenterprise-slim.yaml...
  • GitHub Check: unit-test
  • GitHub Check: upgrade (EMQX, emqx, config/samples/emqx/v2alpha1/emqx-slim.yaml)
  • GitHub Check: upgrade (EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml)
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-full.yaml...
  • GitHub Check: deployment (static, EmqxEnterprise, emqx-ee, config/samples/emqx/v1beta3/emqxenterprise-slim.yaml...
  • GitHub Check: upgrade (EmqxBroker, emqx, config/samples/emqx/v1beta3/emqxbroker-slim.yaml)
🔇 Additional comments (1)
.github/workflows/release.yml (1)

85-87: LGTM! Good migration to the new output syntax.

The change correctly implements the new GitHub Actions output syntax using $GITHUB_OUTPUT environment file, replacing the deprecated ::set-output command.

@Rory-Z Rory-Z merged commit 25f9d29 into main Jan 13, 2025
41 checks passed
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.24%. Comparing base (2f4089d) to head (4e91eb5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1099      +/-   ##
==========================================
- Coverage   76.32%   76.24%   -0.09%     
==========================================
  Files          69       69              
  Lines        6246     6246              
==========================================
- Hits         4767     4762       -5     
- Misses       1242     1246       +4     
- Partials      237      238       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant