Skip to content

Parameter substitution not working in ClusterTask.spec.steps.imagePullPolicy #3423

@itewk

Description

@itewk

Expected Behavior

This should work:

apiVersion: tekton.dev/v1beta1
kind: ClusterTask
metadata:
  name: tssc-setup
spec:
  params:
  - name: ciWorkersImageRegesitryURI
    type: string
    default: quay.io
  - name: ciWorkersImageRepositoryName
    type: string
    default: tssc
  - name: ciWorkersImageTag
    type: string
    default: latest
  - name: ciWorkersImagePullPolicy
    type: string
    default: IfNotPresent
  steps:
  - name: create-python-venv
    image: $(params.ciWorkersImageRegesitryURI)/$(params.ciWorkersImageRepositoryName)/tssc-base:$(params.ciWorkersImageTag)
    imagePullPolicy: $(params.ciWorkersImageRegesitryURI)
    script: |
      #!/usr/bin/env bash
      echo hello world

Actual Behavior

Get the following error:

status:
  completionTime: '2020-10-21T15:58:44Z'
  conditions:
    - lastTransitionTime: '2020-10-21T15:58:44Z'
      message: TaskRun tssc-tekton-pipeline-maven-8xnhn-tssc-setup-225w4 has failed
      reason: Failed
      status: 'False'
      type: Succeeded
  startTime: '2020-10-21T15:58:44Z'
  taskRuns:
    tssc-tekton-pipeline-maven-8xnhn-tssc-setup-225w4:
      pipelineTaskName: tssc-setup
      status:
        conditions:
          - lastTransitionTime: '2020-10-21T15:58:44Z'
            message: >-
              Missing or invalid Task ian-tekton-test2/tssc-setup: Pod
              "tssc-tekton-pipeline-maven-8xnhn-tssc-setup-225w4-pod-sn8w2" is
              invalid: spec.containers[0].imagePullPolicy: Unsupported value:
              "$(params.ciWorkersImagePullPolicy)": supported values: "Always",
              "IfNotPresent", "Never"
            reason: CouldntGetTask
            status: 'False'
            type: Succeeded
        podName: ''
        startTime: '2020-10-21T15:58:44Z'

It would apear from the error that for some reason variable substitution is not happenin gin the ClusterTask.spec.steps.imagePullPolicy value. I would have assumed that could do variable substitution in anything under ClusterTask.spec.steps.

Steps to Reproduce the Problem

  1. Create a cluster task with a step defining imagePullPolicy with a avlue from a parameter
  2. try to run the step

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8",   GitCommit:"9f2892aab98fe339f3bd70e3c470144299398ace", GitTreeState:"clean", BuildDate:"2020-08-13T16:12:48Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.3+012b3ec", GitCommit:"012b3ec", GitTreeState:"clean", BuildDate:"2020-07-24T07:23:10Z", GoVersion:"go1.13.4", 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}'

Installed via OpenShift Pipelines Operator, can't find a tekton-pipelines-controller

OpenShift Pipelines Operator: 1.1.1
OpenShift-Pipelines: v0.14.3
OpenShift-Pipelines-Triggers: v0.6.1
OpenShift-Pipelines-ClusterTasks: v0.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions