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

refactor: Jenkins Config YAML 기반 알림 플랫폼 유동적 지원 추가 완료 #632

Merged
merged 7 commits into from
Dec 20, 2024

Conversation

limehee
Copy link
Collaborator

@limehee limehee commented Dec 19, 2024

Summary

#624

알림 시스템을 개선하여 다중 플랫폼을 지원하도록 했습니다. Config YAML 설정에 따라 알림 플랫폼을 유동적으로 선택할 수 있게 되어, 유연한 알림 전송이 가능해졌습니다.

Tasks

  • Config YAML 구조 수정

    • Slack 및 Discord 설정을 분리하여 알림 플랫폼을 명시적으로 구분.
    • 새로운 플랫폼이 추가될 경우 확장 가능한 구조로 설계.
  • 알림 전송 로직 리팩터링

    • Slack 전용 sendSlackBuildNotification 메서드를 일반화하여 다중 플랫폼 지원.
    • 플랫폼별 알림 생성 로직을 분리하여 각 플랫폼에 적합한 메시지 포맷 생성.
  • 플랫폼별 메시지 포맷 구현

    • Slack: 기존 JSON 포맷 유지.
    • Discord: Embed 형태의 알림 포맷 작성.
  • 유동적인 플랫폼 선택

    • Config YAML에서 활성화된 플랫폼을 확인하여 해당 플랫폼에 알림을 전송하도록 구현.

Screenshot

Slack과 Discord 모두 알림이 정상적으로 동작하는 것을 확인했습니다.

image

image

변경된 YAML 구조

기존

slack:
    webhook-url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" # Slack webhook URL
    color-success: "#F2C744" # Slack message color for success
    color-failure: "#8D1E0E" # Slack message color for failure

변경

notifications:
  common:
    color-success: "#F2C744"  # Common hex color code for success messages across all notification platforms
    color-failure: "#8D1E0E"  # Common hex color code for failure messages across all notification platforms

  platforms:
    - platform: "slack"  # Name of the notification platform (e.g., Slack)
      enabled: true      # Enable (true) or disable (false) notifications for this platform
      webhook-url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"  # Webhook URL for sending messages to Slack

    - platform: "discord"  # Name of the notification platform (e.g., Discord)
      enabled: true        # Enable (true) or disable (false) notifications for this platform
      webhook-url: "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"  # Webhook URL for sending messages to Discord

@limehee limehee added 🔨 Refactor 코드 수정 및 개선 🌎 Intra 서버 인프라 및 도메인 관련 labels Dec 19, 2024
@limehee limehee self-assigned this Dec 19, 2024
@limehee limehee linked an issue Dec 19, 2024 that may be closed by this pull request
@limehee limehee requested review from Copilot, mingmingmon and SongJaeHoonn and removed request for Copilot December 19, 2024 10:36

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • jenkins/prod/Jenkinsfile: Language not supported
  • jenkins/stage/Jenkinsfile: Language not supported
Comments suppressed due to low confidence (2)

jenkins/prod/config.yml:3

  • [nitpick] The key 'notifications' is clear and well-named, but ensure that the naming conventions for nested keys (e.g., 'common', 'platforms') are consistent with the rest of the configuration file.
notifications:

jenkins/prod/config.yml:10

  • [nitpick] The key 'enabled' is clear and well-named, but ensure that the naming conventions for boolean keys are consistent with the rest of the configuration file.
enabled: true      # Enable (true) or disable (false) notifications for this platform
@SongJaeHoonn
Copy link
Contributor

기존에 Slack으로만 고정되어 있었던 설정 파일에서 더더욱 확장성 있게 변경된 것 같네요! 고생하셨습니다!

디스코드 오버로드가 귀엽네요

Copy link
Collaborator

@mingmingmon mingmingmon left a comment

Choose a reason for hiding this comment

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

작업 테스트까지 감사합니다!
확인완료했습니다👍👍

@mingmingmon mingmingmon merged commit 0e8239b into develop Dec 20, 2024
3 checks passed
@limehee limehee deleted the refactor/#624 branch December 23, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌎 Intra 서버 인프라 및 도메인 관련 🔨 Refactor 코드 수정 및 개선
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jenkins Config YAML 기반 알림 플랫폼 유동적 지원 추가
3 participants