From a8b74fbee54397a99fe0babb463243d92e48a517 Mon Sep 17 00:00:00 2001 From: Jerop Date: Wed, 22 Jun 2022 22:13:03 -0400 Subject: [PATCH] =?UTF-8?q?Finish=20up=20removal=20of=20`Conditions`=20?= =?UTF-8?q?=F0=9F=A7=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In https://github.com/tektoncd/pipeline/pull/4942, we removed `Conditions`. However, there was some logic that was left over. In this change, we clean up the remaining logic for `Conditions`. Issue: https://github.com/tektoncd/pipeline/issues/3377 --- pkg/apis/pipeline/register.go | 6 ------ pkg/reconciler/pipelinerun/pipelinerun.go | 3 --- .../pipelinerun/resources/pipelinerunstate.go | 9 ++------- test/pipelinefinally_test.go | 18 ------------------ 4 files changed, 2 insertions(+), 34 deletions(-) diff --git a/pkg/apis/pipeline/register.go b/pkg/apis/pipeline/register.go index 50159ef4478..a95b23e72ac 100644 --- a/pkg/apis/pipeline/register.go +++ b/pkg/apis/pipeline/register.go @@ -40,12 +40,6 @@ const ( // PipelineTaskLabelKey is used as the label identifier for a PipelineTask PipelineTaskLabelKey = GroupName + "/pipelineTask" - // ConditionCheckKey is used as the label identifier for a ConditionCheck - ConditionCheckKey = GroupName + "/conditionCheck" - - // ConditionNameKey is used as the label identifier for a Condition - ConditionNameKey = GroupName + "/conditionName" - // RunKey is used as the label identifier for a Run RunKey = GroupName + "/run" diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index d69efe2f011..82e96af75c1 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -89,9 +89,6 @@ const ( // ReasonCouldntGetResource indicates that the reason for the failure status is that the // associated PipelineRun's bound PipelineResources couldn't all be retrieved ReasonCouldntGetResource = "CouldntGetResource" - // ReasonCouldntGetCondition indicates that the reason for the failure status is that the - // associated Pipeline's Conditions couldn't all be retrieved - ReasonCouldntGetCondition = "CouldntGetCondition" // ReasonParameterMissing indicates that the reason for the failure status is that the // associated PipelineRun didn't provide all the required parameters ReasonParameterMissing = "ParameterMissing" diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go b/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go index 01713529bb1..b4fb44b1468 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go @@ -321,14 +321,9 @@ func (state PipelineRunState) getRetryableTasks(candidateTasks sets.String) []*R isCancelled = isCancelled || status.Reason == v1alpha1.RunReasonCancelled } } - if status.IsFalse() { - if !(isCancelled || status.Reason == ReasonConditionCheckFailed) { - if t.hasRemainingRetries() { - tasks = append(tasks, t) - } - } + if status.IsFalse() && !isCancelled && t.hasRemainingRetries() { + tasks = append(tasks, t) } - } } return tasks diff --git a/test/pipelinefinally_test.go b/test/pipelinefinally_test.go index c732f772881..c5afe638c09 100644 --- a/test/pipelinefinally_test.go +++ b/test/pipelinefinally_test.go @@ -266,10 +266,6 @@ spec: t.Errorf("Error waiting for TaskRun to succeed: %v", err) } dagTask2EndTime = taskrunItem.Status.CompletionTime - case n == "dagtask3": - if !isSkipped(t, n, taskrunItem.Status.Conditions) { - t.Fatalf("dag task %s should have skipped due to condition failure", n) - } case n == "dagtask4": t.Fatalf("task %s should have skipped due to when expression", n) case n == "dagtask5": @@ -720,20 +716,6 @@ func isCancelled(t *testing.T, taskRunName string, conds duckv1beta1.Conditions) return false } -func isSkipped(t *testing.T, taskRunName string, conds duckv1beta1.Conditions) bool { - t.Helper() - for _, c := range conds { - if c.Type == apis.ConditionSucceeded { - if c.Status != corev1.ConditionFalse && c.Reason != resources.ReasonConditionCheckFailed { - t.Errorf("TaskRun status %q is not skipped due to condition failure, got %q", taskRunName, c.Status) - } - return true - } - } - t.Errorf("TaskRun status %q had no Succeeded condition", taskRunName) - return false -} - func getSuccessTask(t *testing.T, namespace string) *v1beta1.Task { return parse.MustParseTask(t, fmt.Sprintf(` metadata: