pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

New tkn not working with old pipeline release

Open piyush-garg opened this issue 1 year ago • 4 comments

Expected Behavior

tkn client with vendor 0.62, not working with 0.61 release

Actual Behavior

tkn client should work fine.

Steps to Reproduce the Problem

  1. Install Pipeline Release 0.61.x
  2. Create Task
apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: echo-task
spec:
  steps:
  - image: mirror.gcr.io/ubuntu
    script: echo hello
  1. Install tkn client 0.38.0
  2. Do tkn task start echo-task and you will error like
Error: admission webhook "webhook.pipeline.tekton.dev" denied the request: mutation failed: cannot decode incoming new object: json: unknown field "artifacts"

Additional Info

  • Kubernetes version:
1.30
  • 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}'

0.61

Can we add new field in spec such that empty json does not get added.

CLI reported issue https://github.com/tektoncd/cli/issues/2388

cc @vdemeester

piyush-garg avatar Aug 28 '24 12:08 piyush-garg

I think the fix might be to update: https://github.com/tektoncd/pipeline/blob/main/pkg/apis/pipeline/v1/taskrun_types.go#L300L303 and make it a pointer so that it can be set to nil(?)

Artifacts *Artifacts

This assumption is based on the fact that all other fields are either slices or pointers which I suppose can be set to nil.

chitrangpatel avatar Aug 28 '24 13:08 chitrangpatel

I think what's happening is that tkn start is supplying a field called Artifacts as if a user set it but its a status field and only intended to be set by the Tekton controller, not the end user.

chitrangpatel avatar Aug 28 '24 13:08 chitrangpatel

If this makes sense, I can provide a fix before making a release @vdemeester @piyush-garg

chitrangpatel avatar Aug 28 '24 13:08 chitrangpatel

@chitrangpatel yes, that the thing. tkn doesn't do anything specific, but as it is Artifact and not *Artifact, default value go sets in an empty array, which will be marshall with artifacts that is… not recognized in old versions. So yeah, we need a fix that changes it to a pointer, and we'll have to backport it to 0.62 as well I think.

vdemeester avatar Aug 28 '24 14:08 vdemeester

/assign @chitrangpatel

piyush-garg avatar Aug 29 '24 02:08 piyush-garg