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

Dev 318/action alert delivery #2893

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

codechirag123
Copy link
Collaborator

@codechirag123 codechirag123 commented Dec 13, 2024

Changed the alert delivery for the slack step in cd

Summary by CodeRabbit

  • New Features

    • Introduced a send-to-slack job in multiple workflows to notify stakeholders about migration and deployment statuses.
    • Enhanced deployment workflows with new environment input options for better control over deployment environments.
  • Bug Fixes

    • Improved conditional checks in deployment jobs to ensure proper execution based on environment specifications.
  • Documentation

    • Updated Slack notification messages to include relevant deployment environment details and build results.

Copy link

changeset-bot bot commented Dec 13, 2024

⚠️ No Changeset found

Latest commit: dcc986b

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 Dec 13, 2024

Walkthrough

The pull request introduces enhancements to three GitHub Actions workflow files. A new job named send-to-slack is added to .github/workflows/db-ops.yaml, .github/workflows/deploy-wf-service.yml, and .github/workflows/hotfix-wf-service.yml. This job sends notifications to a Slack channel upon successful job completions, including dynamic content based on the environment and job status. Additionally, the workflows are modified to include new inputs and conditional logic for better handling of deployment environments.

Changes

File Change Summary
.github/workflows/db-ops.yaml Added new job send-to-slack that sends Slack notifications with dynamic content.
.github/workflows/deploy-wf-service.yml Updated triggers to include environment and sha inputs. Enhanced logic for SHORT_HASH and jobs handling Docker images and Helm charts. Updated send-to-slack job to include environment parameter.
.github/workflows/hotfix-wf-service.yml Added new job send-to-slack to send alerts after update-helm-chart. Updated release job for conditional execution based on update-helm-chart success.

Possibly related PRs

Suggested reviewers

  • MayurDuduka
  • alonp99
  • liorzam

🐰 "In the workflow's dance, a new job hops,
To Slack it sends alerts, as the migration flops.
With tags and pushes, environments in sight,
Notifications ring out, bringing joy and 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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
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 and nitpick comments (5)
.github/workflows/db-ops.yaml (2)

168-168: Consider adding timeout for the job

Add a timeout-minutes parameter to prevent hanging jobs.

    environment: ${{ github.event.client_payload.environment }}
+   timeout-minutes: 5
    permissions:

Line range hint 168-179: Enhance Slack message structure for better readability

The current message format could be improved for better visibility and parsing.

-          slack-message: "Wf-service Migrations in ${{ env.MIGRATION_ENV }} with tag: ${{ env.SHORT_HASH }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ env.MIGRATION_ENV }} and build result: ${{ job.status }}. successfully updated the wf-service migration jobs helm values for ${{ env.MIGRATION_ENV }}."
+          slack-message: |
+            🔄 *WF-Service Migrations Update*
+            • Environment: ${{ env.MIGRATION_ENV }}
+            • Tag: ${{ env.SHORT_HASH }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ env.MIGRATION_ENV }}
+            • Status: ${{ job.status }}
+            ✅ Successfully updated wf-service migration jobs helm values
🧰 Tools
🪛 yamllint (1.35.1)

[warning] 166-166: too few spaces after comma

(commas)

.github/workflows/deploy-wf-service.yml (1)

Line range hint 259-273: Align Slack notification format across workflows

For consistency and better maintainability, the Slack message format should be aligned across all workflows.

-          slack-message: "Test Wf-service Deployment in ${{ inputs.environment }} with tag ${{ env.SHORT_HASH }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }} build result: ${{ job.status }}. successfully updated the wf-service helm values for ${{ inputs.environment }}."
+          slack-message: |
+            🚀 *WF-Service Deployment Update*
+            • Environment: ${{ inputs.environment }}
+            • Tag: ${{ env.SHORT_HASH }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }}
+            • Status: ${{ job.status }}
+            ✅ Successfully updated wf-service helm values

Also add timeout:

    environment: ${{ inputs.environment }}
+   timeout-minutes: 5
    permissions:
🧰 Tools
🪛 yamllint (1.35.1)

[warning] 257-257: too few spaces after comma

(commas)

.github/workflows/hotfix-wf-service.yml (2)

Line range hint 332-346: Standardize Slack notification format and add timeout

Align the message format with other workflows and add timeout protection.

    environment: ${{ inputs.environment }}
+   timeout-minutes: 5
    if: ${{ needs.update-helm-chart.result == 'success' }}
    permissions:
      contents: read
      packages: write

    steps:
      - name: Send alert to Slack channel
        id: slack
        uses: slackapi/slack-github-action@v1.26.0
        with:
          channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
-          slack-message: "Hotfix on Wf-service app Deployment in ${{ inputs.environment }} with tag ${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ needs.build-and-push-image.outputs.sanitized-branch }} build result: ${{ job.status }}. successfully updated the hotfix on wf-service helm values for ${{ inputs.environment }}."
+          slack-message: |
+            🔧 *WF-Service Hotfix Deployment*
+            • Environment: ${{ inputs.environment }}
+            • Tag: ${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}
+            • Status: ${{ job.status }}
+            ✅ Successfully updated wf-service helm values with hotfix
🧰 Tools
🪛 yamllint (1.35.1)

[warning] 331-331: too few spaces after comma

(commas)


[warning] 331-331: too few spaces after comma

(commas)


Line range hint 168-346: Consider creating a reusable workflow for Slack notifications

The Slack notification logic is duplicated across three workflows with similar configurations. Consider creating a reusable workflow to centralize this functionality.

Create a new file .github/workflows/slack-notify.yml:

name: Reusable Slack Notification
on:
  workflow_call:
    inputs:
      environment:
        required: true
        type: string
      tag:
        required: true
        type: string
      type:
        required: true
        type: string
        description: 'Type of deployment (Deployment/Migration/Hotfix)'
    secrets:
      SLACK_BOT_TOKEN:
        required: true
      SLACK_CHANNEL_ID:
        required: true

jobs:
  notify:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    permissions:
      contents: read
      packages: write
    steps:
      - name: Send alert to Slack channel
        uses: slackapi/slack-github-action@v1.26.0
        with:
          channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
          slack-message: |
            ${{ inputs.type == 'Hotfix' && '🔧' || inputs.type == 'Migration' && '🔄' || '🚀' }} *WF-Service ${{ inputs.type }}*
            • Environment: ${{ inputs.environment }}
            • Tag: ${{ inputs.tag }}
            • Status: ${{ job.status }}
            ✅ Successfully updated wf-service helm values
        env:
          SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

This would simplify the workflow files and ensure consistent formatting across all notifications.

🧰 Tools
🪛 yamllint (1.35.1)

[warning] 331-331: too few spaces after comma

(commas)


[warning] 331-331: too few spaces after comma

(commas)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a885d7e and dcc986b.

📒 Files selected for processing (3)
  • .github/workflows/db-ops.yaml (1 hunks)
  • .github/workflows/deploy-wf-service.yml (1 hunks)
  • .github/workflows/hotfix-wf-service.yml (1 hunks)

@codechirag123 codechirag123 merged commit 35e675e into dev Dec 13, 2024
10 of 11 checks passed
@codechirag123 codechirag123 deleted the dev-318/action-alert-delivery branch December 13, 2024 10:08
Omri-Levy added a commit that referenced this pull request Dec 15, 2024
* feat(filters): implement create filter functionality (#2881)

* style(components): change button state styling to fix disappearing buttons (#2877)

* style(components): enhance button state styling for better UX

- Update button classes to include hover and enabled states
- Remove unused CSS rules to streamline styles

(your buttons now have more states than a soap opera character)

* fix(buttons): update background color for button components

- Change button styles from slate to primary background and hover colors
- Ensure consistency across different components for better UX

(your color choices are so dark, they could be the backdrop for a horror movie)

---------

Co-authored-by: Omri Levy <61207713+Omri-Levy@users.noreply.github.com>

* fix(stepper): improve step display and clean up formatting

- Refactor step display to enhance layout and readability
- Add a new no-op constant to built-in events
- Clean up transition validation logic

(Your transition validation is so confusing, it makes find-and-replace look like a clear path)

* Date input improvements (#2889)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* EditableDetailsV2 input type improvement (#2891)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

* fix(backoffice-v2): no longer looking at form value for input type

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* EditableDetailsV2 added ability to override input type (#2892)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

* fix(backoffice-v2): no longer looking at form value for input type

* feat(backoffice-v2): added a way to override input type

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* Dev 318/action alert delivery (#2893)

* feat: adding changes for sending alerts to specific channel

* fix: added change in hotfix action

---------

Co-authored-by: Alon Peretz <8467965+alonp99@users.noreply.github.com>
Co-authored-by: Shane <66246046+shanegrouber@users.noreply.github.com>
Co-authored-by: Tomer Shvadron <tomers@ballerine.com>
Co-authored-by: Chirag <134513193+codechirag123@users.noreply.github.com>
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