Skip to content

cel eval is not validating json already validated #1765

@alansenairj

Description

@alansenairj

Expected Behavior

cel-eval -e expressiont.txt -r payload.json: true or false

Actual Behavior

error making eval context: failed to parse the body as JSON: unexpected end of JSON input

body.object_kind == 'push' && (body.ref == 'refs/heads/develop' || body.ref == 'refs/heads/staging')
or
object_kind == 'push' && (ref == 'refs/heads/develop'

payload file:

POST / HTTP/1.1
Content-Type: application/json
User-Agent: insomnia/9.3.2
X-Gitlab-Event: Push Hook
X-Gitlab-Token: nononono
Host: localhost:8080
Content-Length: 4373

{
	"object_kind": "push",
	"event_name": "push",
	"before": "36988bdb67e6fc4df847c37c4b040823ffa401d8",
	"after": "143f0123a00e035a850b9f991a0214b5844b9e24",
	"ref": "refs/heads/develop",

<... bla bla bla validated>

}

Steps to Reproduce the Problem

  1. get webhook payload from gitlab
  2. validate paylod in insomnia or json lint at https://jsonlint.com/
  3. not filtering!
  4. error making eval context: failed to parse the body as JSON: unexpected end of JSON input (???)

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    (paste your output here)
    
  • 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}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions