tektoncd / pipeline

A cloud-native Pipeline resource.

Home Page:https://tekton.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matrix: invalid param type when consuming results from CustomRun on task matrix.params field

hittyt opened this issue · comments

Expected Behavior

I expect the validation to pass and the tasks to run successfully.

Actual Behavior

A reconciliation error is preventing the pipeline from executing successfully.
Received an error message stating:

'[User error] Failed to validate matrix "parameters of type array only
      are allowed, but param \"arch\" has type \"string\" in pipelineTask \"matrix-job\""
      with error %!w(MISSING)'

Steps to Reproduce the Problem

We have the pipelinerun data segment as following:

  pipelineSpec:
    displayName: test
    tasks:
    - displayName: prepare
      name: prepare
      taskSpec:
        steps:
        - args:
          - -step-name=arch
          command:
          - /user/bin/entry
          image: busybox
          name: arch
    - name: matrix-job-eval
      params:
      - name: expression
        value: '{"matrix-param-arch":"${{jobs.prepare.outputs.arch}}"}'
      runAfter:
      - prepare
      taskRef:
        ## matrix-job-eval is a customrun
        apiVersion: spel.taskline.dev/v1alpha1
        kind: SpEL
    - displayName: matrix-job
      matrix:
        params:
        - name: arch
          value: $(tasks.matrix-job-eval.results.matrix-param-arch)
      name: matrix-job
      runAfter:
      - matrix-job-eval
      taskSpec:
        params:
        - name: arch
          type: string
        spec: null
        steps:
        - args:
          - arch=$(params.arch)
          command:
          - /user/bin/consume-arch
          image: busybox
          name: step-0

Note: it's not a full resource yaml data for the consideration of sensitive data, but I believe it's enough to show the problem.

What's going on here is that matrix-job-eval task is a customrun and will emit a array semantic result:

  results:
  - name: matrix-param-arch
    value: '[ "arm", "amd64" ]'

We expect matrix-job task could fan out to 2 taskruns according to the matrix-param-arch value, but we just got the user error I mentioned above.

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.3-alibaba.126-dc14a4e28076cf", GitCommit:"dc14a4e28076cfaf6c0bf010c837eec6029bd97f", GitTreeState:"clean", BuildDate:"2023-11-06T11:02:05Z", GoVersion:"go1.16.9", Compiler:"gc", 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}'

v0.57.0