Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#761 would this behavior applies to CEL overlays too? #890

Closed
praveen4g0 opened this issue Jan 7, 2021 · 6 comments
Closed

#761 would this behavior applies to CEL overlays too? #890

praveen4g0 opened this issue Jan 7, 2021 · 6 comments
Labels
kind/question Issues or PRs that are questions around the project or a particular feature

Comments

@praveen4g0
Copy link

praveen4g0 commented Jan 7, 2021

Kind: Question

eg:

apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: example-with-multiple-overlays
spec:
  serviceAccountName: pipeline
  triggers:
    - name: cel-trig
      interceptors:
        - cel:
            overlays:
            - key: truncated_sha
              expression: "body.pull_request.head.sha.truncate(7)"
            - key: branch_name
              expression: "body.ref.split('/')[2]"
      bindings:
      - name: sha
        value: $(extensions.truncated_sha)
      - name: branch
        value: $(extensions.branch_name)
      template:
        spec:
          params:
            - name: sha
            - name: branch
              default: master
          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.sha). Branch is $(tt.params.branch)"

what happens when user hit sink url, with a payload, where body doesn't contains field ref ?

Actual:

  • It ends up with below error
"level":"info","ts":"2021-01-07T12:06:26.168Z","logger":"eventlistener","caller":"sink/sink.go:215","msg":"interceptor stopped trigger processing: %!w(*status.Error=&{0xc000979620})","knative.dev/controller":"eventlistener","/triggers-eventid":"757sq","/trigger":"cel-trig"}

Expected:

  • Trigger template should get default value (master), or at least with some appropriate error log.

Environment Details:

tkn version
Client version: 0.13.1
Pipeline version: v0.19.0
Triggers version: v0.10.2
@bigkevmcd
Copy link
Member

Your CEL expression is generating an error, so it's not getting to the TriggerTemplate...

You could try something like this as an expression:

has(body.ref) ? body.ref.split('/')[2] : 'main'

@dibyom
Copy link
Member

dibyom commented Jan 13, 2021

/kind question

@tekton-robot tekton-robot added the kind/question Issues or PRs that are questions around the project or a particular feature label Jan 13, 2021
jmcshane pushed a commit to jmcshane/triggers that referenced this issue Feb 6, 2021
I was reading through this test to get a handle for the type of expressions I could
use in overlays and filter expressions and noticed that there weren't any tests
demonstrating the capabilities discussed in tektoncd#890.

This change adds two tests within the existing structure of the cel_test to help
this file be used as a place to go for example expressions that should work or,
alternative, fail.
jmcshane pushed a commit to jmcshane/triggers that referenced this issue Feb 6, 2021
I was reading through this test to get a handle for the type of expressions I could
use in overlays and filter expressions and noticed that there weren't any tests
demonstrating the capabilities discussed in tektoncd#890.

This change adds two tests within the existing structure of the cel_test to help
this file be used as a place to go for example expressions that should work or,
alternatively, fail.
tekton-robot pushed a commit that referenced this issue Feb 9, 2021
I was reading through this test to get a handle for the type of expressions I could
use in overlays and filter expressions and noticed that there weren't any tests
demonstrating the capabilities discussed in #890.

This change adds two tests within the existing structure of the cel_test to help
this file be used as a place to go for example expressions that should work or,
alternatively, fail.
@dibyom
Copy link
Member

dibyom commented Mar 24, 2021

Closing since the issue seems to have been with the CEL expression.

@jmcshane
Copy link
Contributor

jmcshane commented Apr 12, 2021

@dibyom is this issue supposed to be closed?

@dibyom
Copy link
Member

dibyom commented Apr 12, 2021

Yup 🤦

/close

@tekton-robot
Copy link

@dibyom: Closing this issue.

In response to this:

Yup 🤦

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Issues or PRs that are questions around the project or a particular feature
Projects
None yet
Development

No branches or pull requests

5 participants