Skip to content

A panic occurs when validating optional workspace during the execution of pipelinerun with CustomRun #8561

@l-qing

Description

@l-qing

Expected Behavior

PipelineRun can execute normally, and the controller does not panic.

Actual Behavior

The controller has panicked.

Steps to Reproduce the Problem

  1. Install Tekton Pipelines
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.68.0/release.yaml
  1. (Optional) Install Pipelines-in-Pipelines component
# Ref: https://github.com/tektoncd/experimental/tree/main/pipelines-in-pipelines
kubectl apply --filename https://storage.googleapis.com/tekton-releases-nightly/pipelines-in-pipelines/latest/release.yaml
  1. run the pipelinerun
cat <<'EOF' | kubectl apply -f -
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: build-app
  namespace: default
spec:
  workspaces:
    - name: source
      optional: true
  params:
    - name: step
      type: string
  tasks:
    - name: step-1
      workspaces:
        - name: source
          workspace: source
      params:
        - name: step
          value: $(params.step)
      taskSpec:
        results:
          - name: outputValue
            description: the sum of the first and second operand
        workspaces:
          - name: source
            optional: true
        params:
          - name: step
            type: string
        steps:
          - name: echo
            image: ubuntu
            imagePullPolicy: IfNotPresent
            workingDir: $(workspaces.source.path)
            script: |
              $(params.step)

              echo -n "`date`: $(context.taskRun.name)" | tee $(results.outputValue.path)
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: build-apps
spec:
  workspaces:
    - name: source
      volumeClaimTemplate:
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
  pipelineSpec:
    workspaces:
      - name: source
        description: Workspace for shared code source
        optional: true      # <- This configuration will trigger a panic.
    tasks:
      - name: build-app-1
        taskRef:
          apiVersion: tekton.dev/v1beta1
          kind: Pipeline
          name: build-app
        params:
          - name: step
            value: |
              #!/usr/bin/env bash
              ls -artl
        workspaces:
          - name: source
            workspace: source
EOF

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: v1.32.1
Kustomize Version: v5.5.0
Server Version: v1.28.8
WARNING: version difference between client (1.32) and server (1.28) exceeds the supported minor version skew of +/-1
  • 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}'

Client version: 0.39.1
Pipeline version: v0.68.0

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions