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

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

Closed
hittyt opened this issue Jun 5, 2024 · 0 comments · Fixed by #8024
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@hittyt
Copy link
Contributor

hittyt commented Jun 5, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
1 participant