# Manual workflow trigger EventSource.
#
# Webhook endpoints for triggering compile/deploy, training, and image builds.
# Each endpoint accepts a JSON POST body with workflow-specific parameters.
#
# Endpoints (all on port 12001):
#   POST /compile-deploy    — {"commit_sha": "HEAD"}
#   POST /train/dqn         — {"binary_tag": "latest"}
#   POST /train/ppo         — {"binary_tag": "latest"}
#   POST /train/supervised  — {"model": "tft", "binary_tag": "latest"}
#   POST /build-image       — {"dockerfile": "Dockerfile.ci-builder", "image_name": "ci-builder", "commit_sha": "HEAD"}
#
# Example:
#   curl -X POST http://workflow-trigger-eventsource-svc.foxhunt:12001/build-image \
#     -H 'Content-Type: application/json' \
#     -d '{"dockerfile": "Dockerfile.ci-builder", "image_name": "ci-builder", "commit_sha": "HEAD"}'
---
apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
  name: workflow-trigger
  namespace: foxhunt
  labels:
    app.kubernetes.io/name: workflow-trigger
    app.kubernetes.io/part-of: foxhunt
spec:
  eventBusName: default
  template:
    nodeSelector:
      k8s.scaleway.com/pool-name: platform
  webhook:
    compile-deploy:
      port: "12001"
      endpoint: /compile-deploy
      method: POST
    train-dqn:
      port: "12001"
      endpoint: /train/dqn
      method: POST
    train-ppo:
      port: "12001"
      endpoint: /train/ppo
      method: POST
    train-supervised:
      port: "12001"
      endpoint: /train/supervised
      method: POST
    build-image:
      port: "12001"
      endpoint: /build-image
      method: POST
