<#4431 Flyte webhooks> Pull request opened by <pin...
# flyte-github
a
#4431 Flyte webhooks Pull request opened by pingsutw TL;DR Add a new webhook processor capable of parsing the workflow event and sending the message to an external service, such as Slack. 1. Flyteadmin sends a task or workflow external event to
SNS
2. SNS push the event to SQS 3. FlyteAdmin webhook processor pulls the event from SQS 4. Parse the event, and then render the payload template ({{ name }} succeeded) 5. Send the event to external service by calling the webhook endpoint For GCP users, we push the envent to pub/sub service Note: if you have two webhooks in the admin config, sns should push the message to two different sqs. Each webhook processor will pull the event from a different sqs. TODO: 1. Update flytekit notification interface in the Launch plan
Copy code
lp = LaunchPlan.create(
    "ray_workflow",
    ray_workflow,
    default_inputs={"n": 4},
    notifications=[
        Webhook(
            phases=[WorkflowExecutionPhase.SUCCEEDED],
            payload="{{ workflow.name }} succeeded",
            name="slack",  # Webhook name, slack, team, etc
        )
    ],
)
2. Read the webhook URL from the secret since some webhook contains sensitive information. e.g. slack 3. (TBD, for on-prom users) Add a kafka processor that can pull the message from kafka, and then send the message to slack. 4. (TBD) use webhook in the task level? Type ☐ Bug Fix ☑︎ Feature ☐ Plugin Are all requirements met? ☐ Code completed ☐ Smoke tested ☐ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description webhook config
Copy code
externalEvents:
  enable: true
  type: "aws"
  aws:
    region: "us-west-2"
  eventsPublisher:
    topicName: "arn:aws:sns:us-west-2:590375264460:webhook"
    eventTypes:
      - all
webhooknotifications:
  aws:
    region: "us-west-2"
  webhooks:
    name: slack
    url: https://hooks.slack.com/services/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
    payload: "{{ name }} succeeded"
    processor:
      queueName: webhook
      accountId: "590375264460"
Tracking Issue #2317 Follow-up issue NA flyteorg/flyte Codecov: 59.70% (-0.12%) compared to 4f2a164 GitHub Actions: Integration Test GitHub Actions: Unit Tests (flyteplugins) / Run Unit Test GitHub Actions: Unit Tests (flyteadmin) / Run Unit Test GitHub Actions: Lint (flyteadmin) / Run Lint GitHub Actions: Check Go Generate (flyteadmin) / Go Generate GitHub Actions: Build Images / Build & Push Image (flytescheduler) / Push to Github Registry GitHub Actions: Build Images / Build & Push Image (flyteadmin) / Push to Github Registry ✅ 22 other checks have passed 22/30 successful checks