pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

DryRun Validate should return the mutated Object

Open chitrangpatel opened this issue 1 year ago • 2 comments

Expected Behavior

After fetching the resource using remote resolution, we perform a dry-run to validate the resource (Task, Pipeline, StepAction). If there is a mutating admissions webhook that is provider by the user on the cluster then the dry-run will first send the object through the mutations before the validation webhook. This means that the remote resource will be correctly validated after the mutations.

We should be capturing the mutated object and replacing that in the PipelineRun/TaskRun Status.Spec.

Actual Behavior

However, we currently only validate the mutated spec but it is not what we insert into the TaskRun/PipelineRun Status.Spec. We still insert the original remote content.

Solution

The function: https://github.com/tektoncd/pipeline/blob/89ff1377c163e393473ab8e969ab553c12f91ceb/pkg/reconciler/apiserver/apiserver.go#L28 should also return the mutated object along with the validation error. In turn, the controller should use the mutated object instead of the original object.

chitrangpatel avatar Jun 19 '24 15:06 chitrangpatel

/assign

chitrangpatel avatar Jun 19 '24 15:06 chitrangpatel

cc @vdemeester

chitrangpatel avatar Jun 19 '24 15:06 chitrangpatel