Open rwong2888 opened 2 years ago
This can be done, and here is the example Sensor
, it triggers a Workflow
based on a ClusterWorkflowTemplate
- cluster-workflow-template-submittable
.
Just be noted,
Workflow
will be running in argo-events
, but not in argo
ServiceAccount
with proper permission in argo-events
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: sensor-webhook-1
namespace: argo-events
spec:
template:
serviceAccountName: operate-workflow-sa
dependencies:
- name: test-dep
eventSourceName: es-webhook
eventName: example
triggers:
- template:
name: webhook-workflow-trigger-1
k8s:
group: argoproj.io
version: v1alpha1
resource: workflows
operation: create
source:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: cluster-wftmpl-triggered-by-sensor-1-
# namespace: argo-events
spec:
serviceAccountName: workflow-pods-sa # default is `default`
nodeSelector:
usage: generic-workload
entrypoint: whalesay-template
arguments:
parameters:
- name: message
value: "from workflow not cluster template"
workflowTemplateRef:
name: cluster-workflow-template-submittable
clusterScope: true
parameters:
- src:
dependencyName: test-dep
dataKey: body.message
dest: spec.arguments.parameters.0.value
That is not exactly what I want... Your source is a Workflow, I'd like to point to my git repo that points to a path of a clusterworkflow template or workflow template, but have it execute a workflow based on that. Is that possible?
In this case, you may need to update the title to make it clear. What do you need - create a Workflow
based on a YAML file from a Git repo. When we say WorkflowTemplate
or ClusterWorkflowTemplate
, usually we are referring to the already created resources in the cluster, but not the YAML files.
Updated the title
@rwong2888 I think this is what you want https://github.com/argoproj/argo-events/blob/master/examples/tutorials/03-trigger-sources/sensor-git.yaml
Although this will trigger a workflow. I don't understand why do you want to trigger a template. Because template can just live in the cluster. workflow is the one need to be triggered.
@maxisam , that is not quite what I want to accomplish. It's a bit of duplicate work to create a workflow that is the same as a (cluster)workflow template.
Would like the ability to trigger argo workflow with cluster workflow template or workflow template