Files
foxhunt/infra/k8s/argo/events/ci-pipeline-sensor.yaml
2026-03-14 01:10:34 +01:00

67 lines
2.2 KiB
YAML

apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: ci-pipeline-trigger
namespace: foxhunt
labels:
app.kubernetes.io/name: ci-pipeline-trigger
app.kubernetes.io/part-of: foxhunt
spec:
template:
serviceAccountName: argo-workflow
nodeSelector:
k8s.scaleway.com/pool-name: platform
eventBusName: default
dependencies:
- name: gitlab-push-dep
eventSourceName: gitlab-push
eventName: gitlab-push
filters:
data:
- path: body.ref
type: string
value:
- "refs/heads/main"
# Auto-compile (compile-and-deploy) is available via the manual webhook:
# curl -X POST http://workflow-trigger-eventsource-svc.foxhunt:12001/compile-deploy \
# -H 'Content-Type: application/json' -d '{"commit_sha": "<SHA>"}'
# To enable auto-compile on every push to main, add a second trigger here
# that submits compile-and-deploy with the same checkout_sha.
# Toggle: kubectl -n foxhunt patch configmap auto-compile-config \
# -p '{"data":{"enabled":"true"}}'
triggers:
- template:
name: ci-pipeline
argoWorkflow:
operation: submit
source:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: ci-pipeline-
namespace: foxhunt
spec:
serviceAccountName: argo-workflow
podGC:
strategy: OnPodCompletion
ttlStrategy:
secondsAfterCompletion: 3600
workflowTemplateRef:
name: ci-pipeline
arguments:
parameters:
- name: commit-sha
- name: commits-json
parameters:
- src:
dependencyName: gitlab-push-dep
dataKey: body.checkout_sha
dest: spec.arguments.parameters.0.value
- src:
dependencyName: gitlab-push-dep
dataKey: body.commits
dataTemplate: "{{ toJson .Input }}"
dest: spec.arguments.parameters.1.value