Closed ggallen closed 1 year ago
Trying to use a label containing a forward slash (/) in a TriggerBinding JSONPath value does not work.
TriggerBinding
The label value is retrieved correctly and the trigger fires.
bindings: - kind: TriggerBinding name: instance value: $(body.build.metadata.labels['agogos.redhat.com/instance'])
...
template: spec: params:
2. This content in the `CloudEvent`:
{ "build": { "apiVersion": "agogos.redhat.com/v1alpha1", "kind": "Build", "metadata": { "creationTimestamp": "2023-07-07T21:28:04Z", "finalizers": [ "builds.agogos.redhat.com/finalizer" ], "generateName": "dummy-component-dep-", "generation": 1, "labels": { "agogos.redhat.com/instance": "b8059400-30c9-4010-bdb4-08f0606601ca" }, "name": "dummy-component-dep-n679w", "namespace": "gallen", "resourceVersion": "153135", "uid": "06977b16-9b6b-4edd-9073-e4aa92c1d725" } } }
3.
Kubernetes version:
Output of kubectl version:
kubectl version
[gallen@localhost agogos] (AGOGOS-90)$ kubectl version --output yaml clientVersion: buildDate: "2023-01-18T15:58:16Z" compiler: gc gitCommit: 8f94681cd294aa8cfd3407b8191f6c70214973a4 gitTreeState: clean gitVersion: v1.26.1 goVersion: go1.19.5 major: "1" minor: "26" platform: linux/amd64 kustomizeVersion: v4.5.7 serverVersion: buildDate: "2023-01-18T15:51:25Z" compiler: gc gitCommit: 8f94681cd294aa8cfd3407b8191f6c70214973a4 gitTreeState: clean gitVersion: v1.26.1 goVersion: go1.19.5 major: "1" minor: "26" platform: linux/amd64
Tekton Pipeline version:
Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
tkn version
kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
Pipelines: v0.47.2 Triggers: v0.24.1
After escaping the key, I don't get this error.
- name: instance value: $(body.build.metadata.labels['agogos\.redhat\.com\/instance']) ``
I will create a documentation for this.
Expected Behavior
Trying to use a label containing a forward slash (/) in a
TriggerBinding
JSONPath value does not work.Actual Behavior
The label value is retrieved correctly and the trigger fires.
Steps to Reproduce the Problem
...
template: spec: params:
{ "build": { "apiVersion": "agogos.redhat.com/v1alpha1", "kind": "Build", "metadata": { "creationTimestamp": "2023-07-07T21:28:04Z", "finalizers": [ "builds.agogos.redhat.com/finalizer" ], "generateName": "dummy-component-dep-", "generation": 1, "labels": { "agogos.redhat.com/instance": "b8059400-30c9-4010-bdb4-08f0606601ca" }, "name": "dummy-component-dep-n679w", "namespace": "gallen", "resourceVersion": "153135", "uid": "06977b16-9b6b-4edd-9073-e4aa92c1d725" } } }
Additional Info
Kubernetes version:
Output of
kubectl version
:Tekton Pipeline version:
Output of
tkn version
orkubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
Pipelines: v0.47.2 Triggers: v0.24.1