# Argo Events Sensor — hears the shared Gitea webhook for pushes to gitadmin/fxhnt master, and submits the
# fxhnt-cockpit WorkflowTemplate (ns foxhunt). Structurally identical to build-msp-portal (single dependency,
# single trigger) — the build-vs-deploy decision is made INSIDE the workflow via `git diff` (decide-mode step in
# fxhnt-cockpit-workflowtemplate.yaml), not via a sensor-side path filter. See
# docs/superpowers/plans/2026-07-21-fxhnt-cicd-pipeline.md Task 3 design note: the Sensor CRD here has an open
# schema, so trigger-level path-filter negation can't be reliably validated — keeping the sensor simple is the
# robust choice.
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
  name: build-fxhnt
  namespace: argo-events
  labels: { app.kubernetes.io/instance: build-pipeline }
spec:
  dependencies:
    - name: push-to-master
      eventSourceName: gitea-webhook
      eventName: push
      filters:
        dataLogicalOperator: and
        data:
          - path: body.ref
            type: string
            comparator: "="
            value: ["refs/heads/master"]
          - path: body.pusher.username
            type: string
            comparator: "!="
            value: ["argocd-image-updater"]
  template:
    serviceAccountName: argo-events-sa
  triggers:
    - template:
        name: submit-build
        argoWorkflow:
          operation: submit
          source:
            resource:
              apiVersion: argoproj.io/v1alpha1
              kind: Workflow
              metadata:
                generateName: build-fxhnt-
                namespace: foxhunt
              spec:
                workflowTemplateRef:
                  name: fxhnt-cockpit
                arguments:
                  parameters:
                    - name: commit-sha
                      value: ""
                    - name: mode
                      value: auto
          parameters:
            - src:
                dependencyName: push-to-master
                dataKey: body.after
              dest: spec.arguments.parameters.0.value
