-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support dataTemplate and contextTemplate for Trigger Parameters (…
…#543) * add dataTemplate and contextTemplate options to trigger parameters * fix comment in api doc, add some test cases, return error from template if evaluates to empty string or <no value> * add example Co-authored-by: Vaibhav <[email protected]>
- Loading branch information
1 parent
3f1f2b4
commit cad2834
Showing
6 changed files
with
244 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Sensor | ||
metadata: | ||
name: trigger-template | ||
labels: | ||
sensors.argoproj.io/sensor-controller-instanceid: argo-events | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: sensor | ||
image: argoproj/sensor:v0.13.0-rc | ||
imagePullPolicy: Always | ||
serviceAccountName: argo-events-sa | ||
dependencies: | ||
- name: test-dep | ||
gatewayName: webhook-gateway | ||
eventName: example | ||
subscription: | ||
http: | ||
port: 9300 | ||
triggers: | ||
- template: | ||
name: templated-workflow-trigger | ||
k8s: | ||
group: argoproj.io | ||
version: v1alpha1 | ||
resource: workflows | ||
operation: create | ||
source: | ||
resource: | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: webhook- | ||
spec: | ||
entrypoint: whalesay | ||
arguments: | ||
parameters: | ||
- name: message | ||
templates: | ||
- name: whalesay | ||
serviceAccountName: argo-events-sa | ||
inputs: | ||
parameters: | ||
- name: message | ||
- name: subject | ||
container: | ||
image: docker/whalesay:latest | ||
command: [cowsay] | ||
args: ["{{inputs.parameters.message}} from {{inputs.parameters.subject}}"] | ||
parameters: | ||
# Retrieve the 'message' key from the payload | ||
- src: | ||
dependencyName: test-dep | ||
dataTemplate: "{{ .Input.message }}" | ||
dest: spec.arguments.parameters.0.value | ||
# Title case the context subject | ||
- src: | ||
dependencyName: test-dep | ||
contextTemplate: "{{ .Input.subject | title }}" | ||
dest: spec.arguments.parameters.1.value | ||
# You can also form arbitrary values that don't derive from the | ||
# dependency input | ||
- src: | ||
dependencyName: test-dep | ||
dataTemplate: "{{ now | unixEpoch }}-" | ||
dest: metadata.generateName | ||
operation: append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters