Skip to content

Commit

Permalink
Finish up removal of Conditions 🧹
Browse files Browse the repository at this point in the history
In #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: #3377
  • Loading branch information
jerop authored and tekton-robot committed Jun 23, 2022
1 parent b05985c commit 3fd7138
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
6 changes: 0 additions & 6 deletions pkg/apis/pipeline/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 0 additions & 3 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 2 additions & 7 deletions pkg/reconciler/pipelinerun/resources/pipelinerunstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 0 additions & 18 deletions test/pipelinefinally_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3fd7138

Please sign in to comment.