Open jangel97 opened 1 year ago
I tried to parse JSON payload as string, and then use jq in the task to read json payload, I was not successful. Did anyone successfully achieved this?
Something similar ask here https://github.com/tektoncd/triggers/issues/893
Its not supported today But its a good feature to add
This is a much needed feature. Its very hard to fetch each parameter from a json payload. In Jenkins we had something like multi line parameter. Not sure why ChatGpt is saying there is a type json.
hey @arjunsbabu43 Tekton pipelines does support object parameters as a beta feature but we have yet to build support for that in Triggers.
+1 for this feature
Its not supported today But its a good feature to add
This is much more than a good feature to add... at this point the triggers project is not compatible with the pipelines project at a fundamental level.
@khrm @savitaashture let's consider this for the next milestone?
Thank you, @dibyom. Do you have any information on the anticipated release date for Triggers v0.25?
A workaround for this is using CEL interceptor. Something like this:
- ref:
name: "cel"
params:
- name: "overlays"
value:
- key: list
expression: "body.list.marshalJSON()"
bindings:
- name: list
value: $(extensions.list)
template:
spec:
params:
- name: list
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: cel-trig-
spec:
taskSpec:
steps:
- image: ubuntu
script: |
#!/usr/bin/env bash
echo "SHA is : $(tt.params.list)"
Thanks @khrm will have a try and will let you know the results
I will add the workaround to the docs in this release.
@khrm will create a PR with workaround in the doc for now as we are moving this issue to next milestone
Only commenting to say this would be very much needed (this and support for object data type both in pipelines and triggers!).
Also, tried the workaround and it turns out to be tricky and not completely functional because what you get in your taskrun/pipelinerun cannot be easily manipulated with jq or other JSON tools (basically you'd get [foo, bar] instead of ["foo", "bar"]. And using the old-escape annotation trick prevents the triggertemplate from unmarshalling the data.
Hi,
I am trying to trigger the creation of VMs using a tekton pipeline. The idea is that there is an eventlistener which receives a HTTP POST request with the data required for the provisioning.
This is an example of the JSON payload that I need to pass to the pipelinerun:
I am unable to achieve to read an object parameter using TriggerTemplate
My tekton triggers look like this:
My tekton pipeline:
When spawning pipeline I see following error:
Is this supported in tekton?
Thanks,