Files
launchpad/apps/overlays/upc-dev/slack-relay/README.md
danijel.simeunovic 60dfba9f7b
scan.yaml / test (push) Successful in 6s
slack relay namespace
2026-10-20 23:13:47 +02:00

4.5 KiB

slack-relay (upc-dev)

slack-relay receives signed outgoing webhooks from ai-git-bot and posts them to Slack as Block Kit messages. ai-git-bot has no templating of its own — it sends a fixed {schemaVersion, eventType, repository, data} envelope — and Slack wants text/blocks, so something has to translate between them.

Deployed from the shared forteapp chart in forte-helm; there is no chart in this repo.

Image git.forteapps.net/forte/slack-relay
Chart forte-helm/forteapp
Values helm-prod-values/slack-relay/values.yaml
Secret slack-relay-secrets (SealedSecret)
Endpoint http://slack-relay-app.slack-relay.svc.cluster.local:3000/hooks/ai-git-bot

The service is ClusterIP-only — no ingress, no certificate, nothing exposed outside the cluster. The HMAC signature is therefore the only authentication: any pod can reach the endpoint, but only a caller holding AIGITBOT_WEBHOOK_SECRET can make it post.

1. Seal the secret

The plaintext template lives in the gitignored private/upc-dev/slack-relay-secrets.yaml, with AIGITBOT_WEBHOOK_SECRET already generated. Paste the Slack incoming webhook URL into it, then:

kubeseal --format=yaml --namespace=slack-relay \
  < private/upc-dev/slack-relay-secrets.yaml \
  > apps/overlays/upc-dev/slack-relay/slack-relay-secrets-sealed.yaml

Then add slack-relay-secrets-sealed.yaml to kustomization.yaml and commit.

namespace.yaml in this directory exists for ordering: the app-of-apps applies the SealedSecret, so the namespace has to be created by the same sync rather than by the child Application's chart (namespace.create: false in the values). Without it the parent sync fails with namespaces "slack-relay" not found.

Key Purpose
SLACK_WEBHOOK_URL Slack incoming webhook; fixed to one channel at install time
AIGITBOT_WEBHOOK_SECRET Must match the endpoint secret configured in ai-git-bot

To post via a bot token instead (multi-channel routing, threading), swap SLACK_WEBHOOK_URL for SLACK_BOT_TOKEN + SLACK_CHANNEL in the secret and add SLACK_MODE=bot to app.extraEnv in the values file.

2. Configure the ai-git-bot endpoint

System settings → Outgoing webhooks → add endpoint:

  • URL: http://slack-relay-app.slack-relay.svc.cluster.local:3000/hooks/ai-git-bot
  • Secret: the AIGITBOT_WEBHOOK_SECRET value
  • Events: prworkflow.completed, prworkflow.failed, prworkflow.agentreview.finding.detected, issueassignment.completed, issueassignment.failed (skip the *.started events unless you want the noise)
  • Scope: leave empty for all bots and repositories

3. Verify

Port-forward the service, then post a signed event. No Node needed — the signature is an HMAC that openssl can compute:

kubectl -n slack-relay port-forward svc/slack-relay-app 3000:3000 &

SECRET=$(kubectl -n slack-relay get secret slack-relay-secrets \
  -o jsonpath='{.data.AIGITBOT_WEBHOOK_SECRET}' | base64 -d)

BODY='{"schemaVersion":1,"id":"smoke-1","eventType":"prworkflow.completed","timestamp":"2026-10-20T12:00:00Z","integration":{"botName":"review-bot","platform":"gitea"},"repository":{"owner":"Forte","name":"launchpad","pullRequest":42},"data":{"workflowKey":"review","status":"SUCCESS","durationMs":41230}}'

curl -i -X POST http://localhost:3000/hooks/ai-git-bot \
  -H 'Content-Type: application/json' \
  -H "X-EventHook-Signature-256: sha256=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -r | cut -d' ' -f1)" \
  --data "$BODY"

200 {"status":"delivered"} means the message reached Slack. Re-running with the same id returns {"status":"duplicate"} — bump the id to send another. The same request is in scripts/send-test-event.js in the slack-relay repo if Node is available.

The real check afterwards is ai-git-bot's own delivery log, which shows the response code per delivery.

Reading the logs

The relay logs one JSON line per delivery. The status it returns is a signal to ai-git-bot's retry loop: 502 means "Slack was down, retry me", while a permanent Slack rejection is answered with 200 and logged at error level, because retrying it could never succeed. So "msg":"slack rejected the message, dropping it" is the line to alert on — it means messages are being lost.

Image tag

The values file currently pins latest with pullPolicy: Always. Once the release workflow has produced a vX.Y.Z tag, switch to it: Renovate will then keep the values file current and rollbacks become possible.