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.
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
$ 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"}
/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.
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 replaceinstead ofkubectl applywhen 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.