Closed ScrapCodes closed 1 year ago
Not sure can the custom task reconcile both v1alpha1 and v1beta1 for this migration? If not we might want to have the commit number in the readme for the ones who still want to run custom task in v1alpha1 api.
While testing I have found following case to be not working.
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: pipelinerun-
spec:
pipelineSpec:
params:
- name: is-red-expr
type: string
tasks:
- name: is-red
taskRef:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
params:
- name: is-red-expr
value: “$(params.is-red-expr)"
params:
- name: is-red-expr
value: "{'blue': 0x000080, 'red': 0xFF0000}['red'] == 0xFF0000"
Error:
{"level":"error","logger":"cel-controller","caller":"cel/celrun.go:102","msg":"CEL expression is-red-expr could not be parsed when reconciling CustomRun default/pipelinerun-kkw4z-is-red: ERROR: <input>:1:1: Syntax error: token recognition error at: '“'\n | “{'blue': 0x000080, 'red': 0xFF0000}['red'] == 0xFF0000\"\n | ^\nERROR: <input>:1:56: Syntax error: token recognition error at: '\"'\n | “{'blue': 0x000080, 'red': 0xFF0000}['red'] == 0xFF0000\"\n | .......................................................^","commit":"7205f5d-dirty","knative.dev/controller":"github.com.tektoncd.experimental.cel.pkg.reconciler.cel.Reconciler","knative.dev/kind":"tekton.dev.CustomRun","knative.dev/traceid":"5c064244-2d5f-45ca-aa48-85a680c3e331","knative.dev/key":"default/pipelinerun-kkw4z-is-red","stacktrace":"github.com/tektoncd/experimental/cel/pkg/reconciler/cel.(*Reconciler).ReconcileKind\n\tgithub.com/tektoncd/experimental/cel/pkg/reconciler/cel/celrun.go:102\ngithub.com/tektoncd/pipeline/pkg/client/injection/reconciler/pipeline/v1beta1/customrun.(*reconcilerImpl).Reconcile\n\tgithub.com/tektoncd/pipeline@v0.44.0/pkg/client/injection/reconciler/pipeline/v1beta1/customrun/reconciler.go:239\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/pkg@v0.0.0-20221123011842-b78020c16606/controller/controller.go:542\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/pkg@v0.0.0-20221123011842-b78020c16606/controller/controller.go:491"}
Following example works:
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: pipelinerun-
spec:
pipelineSpec:
tasks:
- name: get-blue
taskRef:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
params:
- name: blue
value: "{'blue': 0x000080, 'red': 0xFF0000}['red'] == 0xFF0000"
Is this related to parameter substitution?
When "$(params.is-red-expr)"
was replaced by $(params.is-red-expr)
, it started working.
Hi @jerop @pritidesai can you review this PR? Thanks.
/lgtm
Thank you @ScrapCodes !
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: jerop, XinruZhang
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Changes
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
See the contribution guide for more details.