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

Fix gpg key #68

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Fix gpg key #68

merged 2 commits into from
Dec 19, 2024

Conversation

akshat5302
Copy link
Collaborator

@akshat5302 akshat5302 commented Dec 19, 2024

Changed build the image from ubuntu-latest to ubuntu-22.04.

Summary by CodeRabbit

  • New Features

    • Updated workflow for Helm Preview Build with enhanced GPG key management.
    • Added HTML index file generation for available builds.
  • Chores

    • Changed runner environment from ubuntu-latest to ubuntu-22.04.
    • Retained AWS CLI installation for artifact uploads.

@akshat5302 akshat5302 requested a review from mguptahub December 19, 2024 07:17
Copy link

coderabbitai bot commented Dec 19, 2024

Walkthrough

The pull request updates the GitHub Actions workflow for Helm Chart Preview Build, specifically targeting the .github/workflows/chart-preview.yml file. The primary modifications involve specifying a precise Ubuntu runner version (22.04), enhancing GPG key management configuration, and refining the chart build and publishing processes. The workflow maintains its core functionality of building Plane-CE and Plane-Enterprise charts while introducing more robust configuration for artifact generation and handling.

Changes

File Change Summary
.github/workflows/chart-preview.yml - Updated runner from ubuntu-latest to ubuntu-22.04
- Added GPG configuration to disable gpg-agent
- Modified chart build steps with improved metadata handling
- Enhanced chart publishing to generate HTML index file

Poem

🐰 In workflows of code so bright,
Ubuntu 22 takes its flight
GPG keys dance, charts unfurl
With precision our pipeline swirls
Helm's preview, a rabbit's delight! 🚢


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 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.

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.

@mguptahub mguptahub merged commit 934ec73 into develop Dec 19, 2024
1 of 2 checks passed
@mguptahub mguptahub deleted the fix-gpg-key branch December 19, 2024 07: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

🔭 Outside diff range comments (1)
.github/workflows/chart-preview.yml (1)

Line range hint 79-127: Consider reducing code duplication in build steps.

The build steps for Plane-CE and Plane-Enterprise are identical except for the chart repository name. This duplication increases maintenance overhead and the risk of inconsistencies.

Consider creating a reusable composite action or shell script:

# .github/actions/build-chart/action.yml
name: 'Build Helm Chart'
inputs:
  chart-repo:
    required: true
    type: string
runs:
  using: "composite"
  steps:
    - shell: bash
      env:
        EXPORT_DIR: ${{env.PREVIEW_BUILD_FOLDER}}
        CR_KEY: ${{ env.GPG_KEY_NAME }}
        CR_PASSPHRASE_FILE: ${{env.GNUPGHOME}}/gpg-passphrase
        CR_KEYRING: ${{env.GNUPGHOME}}/secring.gpg
      run: |
        flatBranchName=$(echo "${{ github.ref_name}}" | sed 's/\//\-/g')
        sed -i "s/name: ${{ inputs.chart-repo }}/name: ${{ env.CHART_PREFIX }}-${{ inputs.chart-repo }}/" charts/${{ inputs.chart-repo }}/Chart.yaml
        sed -i "s/description: .*/description: ${flatBranchName}/g" charts/${{ inputs.chart-repo }}/Chart.yaml
        
        helm package --sign --key "$CR_KEY" --keyring $CR_KEYRING --passphrase-file "$CR_PASSPHRASE_FILE" charts/${{ inputs.chart-repo }} -u -d $EXPORT_DIR/${{ inputs.chart-repo }}/charts
        cp charts/${{ inputs.chart-repo }}/README.md $EXPORT_DIR/${{ inputs.chart-repo }}/${{ inputs.chart-repo }}.md
        helm repo index $EXPORT_DIR/${{ inputs.chart-repo }}

Then use it like this:

- id: build-plane-ce
  if: ${{ env.BUILD_PLANE_CE == 'true' }}
  name: Build Plane-CE
  working-directory: code
  env:
    EXPORT_DIR: ${{env.PREVIEW_BUILD_FOLDER}}
    CHART_REPO: plane-ce
    CR_KEY: ${{ env.GPG_KEY_NAME }}
    CR_PASSPHRASE_FILE: ${{env.GNUPGHOME}}/gpg-passphrase
    CR_KEYRING: ${{env.GNUPGHOME}}/secring.gpg
  run: |
    flatBranchName=$(echo "${{ github.ref_name}}" | sed 's/\//\-/g')
    ...
+ id: build-plane-ce
+ if: ${{ env.BUILD_PLANE_CE == 'true' }}
+ name: Build Plane-CE
+ uses: ./.github/actions/build-chart
+ with:
+   chart-repo: plane-ce
🧹 Nitpick comments (2)
.github/workflows/chart-preview.yml (2)

Line range hint 52-77: Consider using gpg-preset-passphrase instead of storing passphrase in file.

While the GPG configuration is generally well-structured, storing the passphrase in a file (even temporarily) could pose a security risk. Consider using gpg-preset-passphrase from gpg-agent for a more secure approach.

Here's an alternative approach:

- echo "${{env.GPG_PASSPHRASE}}" > ${{env.CR_PASSPHRASE_FILE}}
+ # Use gpg-preset-passphrase instead
+ echo "allow-preset-passphrase" >> ${{env.GNUPGHOME}}/gpg-agent.conf
+ /usr/lib/gnupg2/gpg-preset-passphrase --preset "${{ env.GPG_KEY_NAME }}" <<< "${{ env.GPG_PASSPHRASE }}"

Line range hint 129-166: Optimize AWS CLI installation.

Installing AWS CLI during runtime adds overhead to each workflow run. Consider using the official AWS CLI action instead.

Replace the pip installation with the official action:

- pip install awscli
- aws s3 cp ${{env.PREVIEW_BUILD_FOLDER}} s3://${{env.AWS_BUCKET}}/${{ env.HELM_SUB_FOLDER }} --recursive
+ - name: Configure AWS Credentials
+   uses: aws-actions/configure-aws-credentials@v4
+   with:
+     aws-access-key-id: ${{ secrets.HELM_PREVIEW_AWS_ACCESS_KEY_ID }}
+     aws-secret-access-key: ${{ secrets.HELM_PREVIEW_AWS_SECRET_ACCESS_KEY }}
+     aws-region: ${{ vars.HELM_PREVIEW_AWS_REGION }}
+ 
+ - name: Upload to S3
+   uses: aws-actions/aws-cli@v1
+   with:
+     args: s3 cp ${{env.PREVIEW_BUILD_FOLDER}} s3://${{env.AWS_BUCKET}}/${{ env.HELM_SUB_FOLDER }} --recursive
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63f679c and 3b83cdd.

📒 Files selected for processing (1)
  • .github/workflows/chart-preview.yml (1 hunks)
🔇 Additional comments (1)
.github/workflows/chart-preview.yml (1)

34-34: LGTM! Good practice to pin the Ubuntu version.

Using ubuntu-22.04 instead of ubuntu-latest provides better stability and reproducibility for the workflow. This is an LTS release which ensures long-term support and security updates.

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