Pipeline: Breaking changes to ClusterTasks from v0.10 to v0.12

Created on 11 Jun 2020  路  1Comment  路  Source: tektoncd/pipeline

Expected Behavior

The following ClusterTask has one param:

apiVersion: tekton.dev/v1alpha1
kind: ClusterTask
metadata:
  name: test
spec:
  inputs:
    params:
    - name: DOCKERFILE
      description: Path to the Dockerfile to build.
      type: string
      default: ./Dockerfile
  outputs:
    resources:
    - name: IMAGE
      type: image
  steps:
  - name: build-and-push
    workingdir: /workspace
    command: ["/kaniko/executor"]
    image: gcr.io/kaniko-project/executor:v0.17.1
    args:
    - --dockerfile=$(inputs.params.DOCKERFILE)
    - --context=/workspace/source/
    - --destination=$(outputs.resources.IMAGE.url)

Note it's using the deprecated spec.inputs.params field, which has been replaced with spec.params.

Expected behavior is: I should be able to reapply this ClusterTask over and over.

Actual Behavior

After applying once, the Tekton mutates the ClusterTask and moves spec.inputs.params to spec.params. A subsequent apply fails because now there's spec.inputs.params and spec.params.

$ k apply -f test.yaml
Error from server (BadRequest): error when applying patch:
{"spec":{"inputs":{"params":[{"default":"./Dockerfile","description":"Path to the Dockerfile to build.","name":"DOCKERFILE","type":"string"}]},"outputs":{"resources":[{"name":"IMAGE","type":"image"}]},"steps":[{"args":["--dockerfile=$(inputs.params.DOCKERFILE)","--context=/workspace/source/","--destination=$(outputs.resources.IMAGE.url)"],"command":["/kaniko/executor"],"image":"gcr.io/kaniko-project/executor:v0.17.1","name":"build-and-push","workingdir":"/workspace"}]}}
to:
Resource: "tekton.dev/v1alpha1, Resource=clustertasks", GroupVersionKind: "tekton.dev/v1alpha1, Kind=ClusterTask"
Name: "test", Namespace: ""
for: "test.yaml": admission webhook "validation.webhook.pipeline.tekton.dev" denied the request: validation failed: expected exactly one, got both: inputs.params, params

Steps to Reproduce the Problem

  1. Install tekton pipelines v0.10.x
  2. Apply yaml
  3. Upgrade to tekton pipelines v0.12.x
  4. Apply yaml (does not work)

Additional Info

  • Kubernetes version:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:52:00Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.8-gke.15", GitCommit:"9cabee15e0922c3b36724de4866a98f6c2da5e6a", GitTreeState:"clean", BuildDate:"2020-05-01T21:47:04Z", GoVersion:"go1.13.8b4", Compiler:"gc", Platform:"linux/amd64"}
  • Tekton Pipeline version: v0.12.1
kinbug

Most helpful comment

/kind bug

This is a known issue with upgrading versions unfortunately, documented as part of the beta release here ("Submitting the same v1alpha1 Tasks more than once results in errors."). The current advice is to use kubectl replace instead of kubectl apply when repeatedly submitting alpha resources against versions of Tekton 0.11+.

I'm going to close this for now but please reopen if you think there's more to be done here.

>All comments

/kind bug

This is a known issue with upgrading versions unfortunately, documented as part of the beta release here ("Submitting the same v1alpha1 Tasks more than once results in errors."). The current advice is to use kubectl replace instead of kubectl apply when repeatedly submitting alpha resources against versions of Tekton 0.11+.

I'm going to close this for now but please reopen if you think there's more to be done here.

Was this page helpful?
0 / 5 - 0 ratings