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

bal 2027 fix build image ee include sentry #2385

Merged
merged 11 commits into from
May 15, 2024

Conversation

liorzam
Copy link
Collaborator

@liorzam liorzam commented May 15, 2024

Description

Elaborate on the subject, motivation, and context.

Related issues

  • Provide a link to each related issue.

Breaking changes

  • Describe the breaking changes that this pull request introduces.

How these changes were tested

  • Describe the tests that you ran to verify your changes, including devices, operating systems, browsers and versions.

Examples and references

  • Links, screenshots, and other resources related to this change.

Checklist

  • [] I have read the contribution guidelines of this project
  • [] I have read the style guidelines of this project
  • [] I have performed a self-review of my own code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings and errors
  • [] New and existing tests pass locally with my changes

Summary by CodeRabbit

  • New Features

    • Introduced Docker image scanning for enhanced security.
    • Added conditional updates for HelmChart and data migration checks.
  • Improvements

    • Enhanced metadata logging to include request body.
    • Improved error handling in ValidationError class.
    • Added new configuration property in SentryModule for better version tracking.
  • Bug Fixes

    • Adjusted release steps to properly handle development release suffixes.

Copy link

changeset-bot bot commented May 15, 2024

⚠️ No Changeset found

Latest commit: 3c86410

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented May 15, 2024

Important

Auto Review Skipped

Review was skipped as selected files did not have any reviewable changes.

Files selected but had no reviewable changes (1)
  • .github/pull_request_template.md

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update brings significant improvements to the CI/CD workflow and Docker image management for the workflows service. It includes enhancements like Docker image scanning, conditional HelmChart updates, and checks for data migration based on branch existence. The Dockerfile now incorporates a SHORT_SHA argument for improved version tracking. Additionally, there are refinements in request metadata handling, error responses, and Sentry configuration.

Changes

File Path Change Summary
.github/workflows/publish-workflows-service.yml Added Docker image scan, conditional HelmChart updates, and data migration branch checks. Included SHORT_SHA in build args and adjusted release steps.
services/workflows-service/Dockerfile Introduced SHORT_SHA argument and environment variable for version tracking.
services/workflows-service/prisma/data-migrations Updated subproject commit hash.
services/workflows-service/src/common/utils/request-response/request.ts Enhanced getReqMetadataObj function to include req.body in metadata.
services/workflows-service/src/errors.ts Modified ValidationError class to improve error response handling.
services/workflows-service/src/sentry/sentry.module.ts Added _dist property to SentryModule for better configuration using SHORT_SHA.

In the land of code, where changes flow,
A rabbit hopped, with updates in tow.
Docker scanned, and HelmCharts danced,
With branches checked, and errors enhanced.
Sentry watched with a careful eye,
As SHORT_SHA soared, up to the sky.
Together they sang, in harmony bright,
For a future of code, shining with 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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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
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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 093245b and aac832b.
Files selected for processing (6)
  • .github/workflows/publish-workflows-service.yml (7 hunks)
  • services/workflows-service/Dockerfile (2 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • services/workflows-service/src/common/utils/request-response/request.ts (1 hunks)
  • services/workflows-service/src/errors.ts (1 hunks)
  • services/workflows-service/src/sentry/sentry.module.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • services/workflows-service/prisma/data-migrations
Additional comments not posted (10)
services/workflows-service/Dockerfile (1)

10-11: The addition of the SHORT_SHA argument and environment variable looks good and is correctly implemented in both the development and production stages.

Also applies to: 28-29

services/workflows-service/src/common/utils/request-response/request.ts (1)

30-30: Adding req.body to the metadata object is a useful enhancement for logging and debugging purposes. Ensure that req.body does not contain sensitive information before logging.

services/workflows-service/src/sentry/sentry.module.ts (1)

24-24: The addition of the _dist property and its inclusion in the Sentry configuration is correctly implemented and enhances the Sentry setup.

Also applies to: 34-34, 45-45

services/workflows-service/src/errors.ts (1)

63-63: The modification to the getErrors method ensures that it returns the correct errors from the response object, which is a necessary improvement.

.github/workflows/publish-workflows-service.yml (6)

146-147: The addition of the SHORT_SHA build argument in the Docker build step is correctly implemented.


148-159: The new step for scanning Docker images using aquasecurity/trivy-action is a good addition for security. Ensure that the trivyignores file is properly configured.


180-182: The modification to the sparse-checkout paths to include kubernetes/helm/wf-service and setting sparse-checkout-cone-mode to true is correctly implemented.


Line range hint 195-205: The step for updating the workflow-service image version in the HelmChart is correctly implemented with a conditional check.


281-308: The new job for checking if a data migration branch exists is correctly implemented and adds a useful conditional check for the build process.


Line range hint 311-382: The new job for building and pushing the EE Docker image is correctly implemented with the necessary steps and conditional checks.

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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between aac832b and b09f267.
Files selected for processing (1)
  • .github/workflows/publish-workflows-service.yml (7 hunks)
Additional comments not posted (2)
.github/workflows/publish-workflows-service.yml (2)

146-146: Including the SHORT_SHA build argument is a good addition for tracking the commit in the Docker image.


148-159: Adding a Docker image scan with aquasecurity/trivy-action is a great practice for enhancing security.

Comment on lines +183 to +193
id: update_helm_check
shell: bash
run: |
if [ -f "kubernetes/helm/wf-service/${{ github.ref_name }}-custom-values.yaml" ]; then
echo "file_name=${{ github.ref_name }}-custom-values.yaml" >> "$GITHUB_OUTPUT"
elif [ "${{ github.event.inputs.deploy_to_dev }}" == "true" ]; then
echo "file_name=dev-custom-values.yaml" >> "$GITHUB_OUTPUT"
else
echo "skip_helm=true" >> "$GITHUB_OUTPUT"
fi

Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using ${{ github.ref_name }} and ${{ github.event.inputs.deploy_to_dev }} directly in the run: step to prevent potential code injection. Use environment variables instead.

- run: |
-   if [ -f "kubernetes/helm/wf-service/${{ github.ref_name }}-custom-values.yaml" ]; then
-     echo "file_name=${{ github.ref_name }}-custom-values.yaml" >> "$GITHUB_OUTPUT"
-   elif [ "${{ github.event.inputs.deploy_to_dev }}" == "true" ]; then
-     echo "file_name=dev-custom-values.yaml" >> "$GITHUB_OUTPUT"
-   else
-     echo "skip_helm=true" >> "$GITHUB_OUTPUT"
+ env:
+   GITHUB_REF_NAME: ${{ github.ref_name }}
+   DEPLOY_TO_DEV: ${{ github.event.inputs.deploy_to_dev }}
+ run: |
+   if [ -f "kubernetes/helm/wf-service/$GITHUB_REF_NAME-custom-values.yaml" ]; then
+     echo "file_name=$GITHUB_REF_NAME-custom-values.yaml" >> "$GITHUB_OUTPUT"
+   elif [ "$DEPLOY_TO_DEV" == "true" ]; then
+     echo "file_name=dev-custom-values.yaml" >> "$GITHUB_OUTPUT"
+   else
+     echo "skip_helm=true" >> "$GITHUB_OUTPUT"

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
id: update_helm_check
shell: bash
run: |
if [ -f "kubernetes/helm/wf-service/${{ github.ref_name }}-custom-values.yaml" ]; then
echo "file_name=${{ github.ref_name }}-custom-values.yaml" >> "$GITHUB_OUTPUT"
elif [ "${{ github.event.inputs.deploy_to_dev }}" == "true" ]; then
echo "file_name=dev-custom-values.yaml" >> "$GITHUB_OUTPUT"
else
echo "skip_helm=true" >> "$GITHUB_OUTPUT"
fi
id: update_helm_check
shell: bash
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
DEPLOY_TO_DEV: ${{ github.event.inputs.deploy_to_dev }}
run: |
if [ -f "kubernetes/helm/wf-service/$GITHUB_REF_NAME-custom-values.yaml" ]; then
echo "file_name=$GITHUB_REF_NAME-custom-values.yaml" >> "$GITHUB_OUTPUT"
elif [ "$DEPLOY_TO_DEV" == "true" ]; then
echo "file_name=dev-custom-values.yaml" >> "$GITHUB_OUTPUT"
else
echo "skip_helm=true" >> "$GITHUB_OUTPUT"
fi

Comment on lines +221 to +228
run: |
if [ "${{ github.event.inputs.deploy_to_dev }}" == "true" ]; then
suffix="-dev-${{ needs.build-and-push-image.outputs.sha_short }}"
else
suffix=""
fi
gh release create ${{ needs.build-and-push-image.outputs.version }}${suffix} --notes-start-tag ${{ needs.build-and-push-image.outputs.bumped_tag }}

Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using ${{ github.event.inputs.deploy_to_dev }} directly in the run: step to prevent potential code injection. Use environment variables instead.

- run: |
-   if [ "${{ github.event.inputs.deploy_to_dev }}" == "true" ]; then
-     suffix="-dev-${{ needs.build-and-push-image.outputs.sha_short }}"
-   else
-     suffix=""
-   fi
-   gh release create ${{ needs.build-and-push-image.outputs.version }}${suffix} --notes-start-tag ${{ needs.build-and-push-image.outputs.bumped_tag }}
+ env:
+   DEPLOY_TO_DEV: ${{ github.event.inputs.deploy_to_dev }}
+   SHA_SHORT: ${{ needs.build-and-push-image.outputs.sha_short }}
+   VERSION: ${{ needs.build-and-push-image.outputs.version }}
+   BUMPED_TAG: ${{ needs.build-and-push-image.outputs.bumped_tag }}
+ run: |
+   if [ "$DEPLOY_TO_DEV" == "true" ]; then
+     suffix="-dev-$SHA_SHORT"
+   else
+     suffix=""
+   fi
+   gh release create "$VERSION$suffix" --notes-start-tag "$BUMPED_TAG"

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
run: |
if [ "${{ github.event.inputs.deploy_to_dev }}" == "true" ]; then
suffix="-dev-${{ needs.build-and-push-image.outputs.sha_short }}"
else
suffix=""
fi
gh release create ${{ needs.build-and-push-image.outputs.version }}${suffix} --notes-start-tag ${{ needs.build-and-push-image.outputs.bumped_tag }}
env:
DEPLOY_TO_DEV: ${{ github.event.inputs.deploy_to_dev }}
SHA_SHORT: ${{ needs.build-and-push-image.outputs.sha_short }}
VERSION: ${{ needs.build-and-push-image.outputs.version }}
BUMPED_TAG: ${{ needs.build-and-push-image.outputs.bumped_tag }}
run: |
if [ "$DEPLOY_TO_DEV" == "true" ]; then
suffix="-dev-$SHA_SHORT"
else
suffix=""
fi
gh release create "$VERSION$suffix" --notes-start-tag "$BUMPED_TAG"

@liorzam liorzam merged commit 30767f5 into dev May 15, 2024
2 checks passed
@liorzam liorzam deleted the bal-2027-fix-build-image-ee-include-sentry branch May 15, 2024 19:07
@coderabbitai coderabbitai bot mentioned this pull request Oct 28, 2024
@Omri-Levy Omri-Levy mentioned this pull request Nov 4, 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.

2 participants