From 1874f92bd1c4a4f5b3ce4195cc78d4a53073c6b7 Mon Sep 17 00:00:00 2001 From: Quan Zhang Date: Wed, 8 Nov 2023 12:30:08 -0500 Subject: [PATCH] remove example --- .../v1/pipelineruns/alpha/param-enum.yaml | 33 ------------------- pkg/reconciler/pipelinerun/pipelinerun.go | 9 +++-- 2 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 examples/v1/pipelineruns/alpha/param-enum.yaml diff --git a/examples/v1/pipelineruns/alpha/param-enum.yaml b/examples/v1/pipelineruns/alpha/param-enum.yaml deleted file mode 100644 index 58d5fda4281..00000000000 --- a/examples/v1/pipelineruns/alpha/param-enum.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: tekton.dev/v1 -kind: Pipeline -metadata: - name: pipeline-param-enum -spec: - params: - - name: message - enum: ["v1", "v2", "v3"] - default: "v1" - tasks: - - name: task1 - params: - - name: message - value: $(params.message) - taskSpec: - params: - - name: message - steps: - - name: build - image: bash:3.2 - script: | - echo "$(params.message)" ---- -apiVersion: tekton.dev/v1 -kind: PipelineRun -metadata: - name: pipelinerun-param-enum -spec: - pipelineRef: - name: pipeline-param-enum - params: - - name: message - value: "v2" \ No newline at end of file diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index c0d6b3d4fb4..5fc1a80be96 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -390,11 +390,10 @@ func (c *Reconciler) resolvePipelineState( if config.FromContextOrDefaults(ctx).FeatureFlags.EnableParamEnum { for _, tr := range resolvedTask.TaskRuns { - if len(tr.Status.Conditions) > 0 { - cond := resolvedTask.TaskRuns[0].Status.Conditions[0] - if cond.Status == corev1.ConditionFalse && cond.Reason == v1.TaskRunReasonInvalidParamValue { - pr.Status.MarkFailed(v1.PipelineRunReasonInvalidParamValue.String(), - "Invalid param value in the referenced Task from PipelineTask \"%s\": %s", resolvedTask.PipelineTask.Name, cond.Message) + for _, cond := range tr.Status.Conditions { + if cond.Type == apis.ConditionSucceeded && cond.Status == corev1.ConditionFalse && cond.Reason == v1.TaskRunReasonInvalidParamValue { + err = fmt.Errorf("invalid param value in the referenced Task from PipelineTask \"%s\": %s", resolvedTask.PipelineTask.Name, cond.Message) + pr.Status.MarkFailed(v1.PipelineRunReasonInvalidParamValue.String(), err.Error()) return nil, controller.NewPermanentError(err) } }