Skip to content

Commit

Permalink
Change all ducktype status to v1
Browse files Browse the repository at this point in the history
This commit changes all the ducktype status to v1 as they are the same
type and the status_types in the knative package does not impelment
apis.Convertible.
  • Loading branch information
JeromeJu authored and tekton-robot committed Nov 29, 2022
1 parent 3ba9e02 commit 83af167
Show file tree
Hide file tree
Showing 34 changed files with 180 additions and 1,400 deletions.
14 changes: 7 additions & 7 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2160,8 +2160,8 @@ with those declared in the pipeline.</p>
<td>
<code>Status</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1beta1#Status">
knative.dev/pkg/apis/duck/v1beta1.Status
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#Status">
knative.dev/pkg/apis/duck/v1.Status
</a>
</em>
</td>
Expand Down Expand Up @@ -9525,8 +9525,8 @@ with those declared in the pipeline.</p>
<td>
<code>Status</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1beta1#Status">
knative.dev/pkg/apis/duck/v1beta1.Status
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#Status">
knative.dev/pkg/apis/duck/v1.Status
</a>
</em>
</td>
Expand Down Expand Up @@ -12956,8 +12956,8 @@ Kubernetes core/v1.ResourceRequirements
<td>
<code>Status</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1beta1#Status">
knative.dev/pkg/apis/duck/v1beta1.Status
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#Status">
knative.dev/pkg/apis/duck/v1.Status
</a>
</em>
</td>
Expand Down Expand Up @@ -13824,7 +13824,7 @@ string
<h3 id="tekton.dev/v1beta1.CustomRunStatus">CustomRunStatus
</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.CustomRun">CustomRun</a>)
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.CustomRun">CustomRun</a>, <a href="#tekton.dev/v1beta1.CustomRunStatusFields">CustomRunStatusFields</a>)
</p>
<div>
<p>CustomRunStatus defines the observed state of CustomRun</p>
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1/pipelinerun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/clock"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

// +genclient
Expand Down Expand Up @@ -285,7 +285,7 @@ const (

// PipelineRunStatus defines the observed state of PipelineRun
type PipelineRunStatus struct {
duckv1beta1.Status `json:",inline"`
duckv1.Status `json:",inline"`

// PipelineRunStatusFields inlines the status fields.
PipelineRunStatusFields `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/pipelinerun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/clock"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

// +genclient
Expand Down Expand Up @@ -298,7 +298,7 @@ const (

// PipelineRunStatus defines the observed state of PipelineRun
type PipelineRunStatus struct {
duckv1beta1.Status `json:",inline"`
duckv1.Status `json:",inline"`

// PipelineRunStatusFields inlines the status fields.
PipelineRunStatusFields `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/taskrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/clock"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

// TaskRunSpec defines the desired state of TaskRun
Expand Down Expand Up @@ -133,7 +133,7 @@ var taskRunCondSet = apis.NewBatchConditionSet()

// TaskRunStatus defines the observed state of TaskRun
type TaskRunStatus struct {
duckv1beta1.Status `json:",inline"`
duckv1.Status `json:",inline"`

// TaskRunStatusFields inlines the status fields.
TaskRunStatusFields `json:",inline"`
Expand Down
18 changes: 9 additions & 9 deletions pkg/apis/pipeline/v1beta1/taskrun_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

func TestTaskRun_GetPipelineRunPVCName(t *testing.T) {
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestTaskRun_HasPipelineRun(t *testing.T) {
func TestTaskRunIsDone(t *testing.T) {
tr := &v1beta1.TaskRun{
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestTaskRunIsCancelledWithMessage(t *testing.T) {
func TestTaskRunIsTaskRunResultVerified(t *testing.T) {
tr := &v1beta1.TaskRun{
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionType(v1beta1.TaskRunConditionResultsVerified.String()),
Status: corev1.ConditionTrue,
Expand All @@ -175,7 +175,7 @@ func TestTaskRunIsTaskRunResultVerified(t *testing.T) {
func TestTaskRunEmptyIsTaskRunResultVerified(t *testing.T) {
tr := &v1beta1.TaskRun{
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{},
Status: duckv1.Status{},
},
}
if tr.IsTaskRunResultVerified() {
Expand All @@ -186,7 +186,7 @@ func TestTaskRunEmptyIsTaskRunResultVerified(t *testing.T) {
func TestTaskRunIsTaskRunResultDone(t *testing.T) {
tr := &v1beta1.TaskRun{
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionType(v1beta1.TaskRunConditionResultsVerified.String()),
Status: corev1.ConditionUnknown,
Expand All @@ -207,7 +207,7 @@ func TestTaskRunIsTaskRunResultDone(t *testing.T) {
func TestTaskRunEmptyIsTaskRunResultDone(t *testing.T) {
tr := &v1beta1.TaskRun{
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{},
Status: duckv1.Status{},
},
}
if tr.IsTaskRunResultDone() {
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestHasTimedOut(t *testing.T) {
name: "TaskRun not started",
taskRun: &v1beta1.TaskRun{
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Expand All @@ -312,7 +312,7 @@ func TestHasTimedOut(t *testing.T) {
},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Expand All @@ -333,7 +333,7 @@ func TestHasTimedOut(t *testing.T) {
},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Expand Down
30 changes: 15 additions & 15 deletions pkg/pipelinerunmetrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/metrics/metricstest" // Required to setup metrics env for testing
_ "knative.dev/pkg/metrics/testing"
)
Expand Down Expand Up @@ -125,8 +125,8 @@ func TestRecordPipelineRunDurationCount(t *testing.T) {
PipelineRef: &v1beta1.PipelineRef{Name: "pipeline-1"},
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionTrue,
}},
Expand Down Expand Up @@ -157,8 +157,8 @@ func TestRecordPipelineRunDurationCount(t *testing.T) {
PipelineRef: &v1beta1.PipelineRef{Name: "pipeline-1"},
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionTrue,
}},
Expand Down Expand Up @@ -192,8 +192,8 @@ func TestRecordPipelineRunDurationCount(t *testing.T) {
PipelineRef: &v1beta1.PipelineRef{Name: "pipeline-1"},
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionTrue,
}},
Expand All @@ -220,8 +220,8 @@ func TestRecordPipelineRunDurationCount(t *testing.T) {
PipelineRef: &v1beta1.PipelineRef{Name: "pipeline-1"},
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Reason: ReasonCancelled,
Expand Down Expand Up @@ -253,8 +253,8 @@ func TestRecordPipelineRunDurationCount(t *testing.T) {
PipelineRef: &v1beta1.PipelineRef{Name: "pipeline-1"},
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
}},
Expand Down Expand Up @@ -286,8 +286,8 @@ func TestRecordPipelineRunDurationCount(t *testing.T) {
Status: v1beta1.PipelineRunSpecStatusPending,
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
}},
Expand Down Expand Up @@ -341,8 +341,8 @@ func TestRecordRunningPipelineRunsCount(t *testing.T) {
return &v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("pipelinerun-")},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{{
Status: duckv1.Status{
Conditions: duckv1.Conditions{{
Type: apis.ConditionSucceeded,
Status: status,
}},
Expand Down
6 changes: 3 additions & 3 deletions pkg/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"time"

"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"

"knative.dev/pkg/kmeta"

Expand Down Expand Up @@ -1620,14 +1620,14 @@ _EOF_
trStatus: v1beta1.TaskRunStatus{
TaskRunStatusFields: v1beta1.TaskRunStatusFields{
RetriesStatus: []v1beta1.TaskRunStatus{{
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
}},
},
}, {
Status: duckv1beta1.Status{
Status: duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Expand Down
12 changes: 6 additions & 6 deletions pkg/pod/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/logging"
)

Expand Down Expand Up @@ -1551,26 +1551,26 @@ func TestMarkStatusSuccess(t *testing.T) {
}
}

func statusRunning() duckv1beta1.Status {
func statusRunning() duckv1.Status {
var trs v1beta1.TaskRunStatus
markStatusRunning(&trs, v1beta1.TaskRunReasonRunning.String(), "Not all Steps in the Task have finished executing")
return trs.Status
}

func statusFailure(reason, message string) duckv1beta1.Status {
func statusFailure(reason, message string) duckv1.Status {
var trs v1beta1.TaskRunStatus
markStatusFailure(&trs, reason, message)
return trs.Status
}

func statusSuccess() duckv1beta1.Status {
func statusSuccess() duckv1.Status {
var trs v1beta1.TaskRunStatus
markStatusSuccess(&trs)
return trs.Status
}

func statusPending(reason, message string) duckv1beta1.Status {
return duckv1beta1.Status{
func statusPending(reason, message string) duckv1.Status {
return duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Expand Down
20 changes: 10 additions & 10 deletions pkg/reconciler/events/cloudevent/cloud_event_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"k8s.io/client-go/tools/record"
clock "k8s.io/utils/clock/testing"
"knative.dev/pkg/apis"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/controller"
"knative.dev/pkg/logging"
rtesting "knative.dev/pkg/reconciler/testing"
Expand Down Expand Up @@ -107,8 +107,8 @@ func TestSendCloudEvents(t *testing.T) {
},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{apis.Condition{
Status: duckv1.Status{
Conditions: duckv1.Conditions{apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Reason: "somethingelse",
Expand Down Expand Up @@ -172,8 +172,8 @@ func TestSendCloudEvents(t *testing.T) {
},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{apis.Condition{
Status: duckv1.Status{
Conditions: duckv1.Conditions{apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Reason: "somethingelse",
Expand Down Expand Up @@ -265,8 +265,8 @@ func TestSendCloudEventsErrors(t *testing.T) {
},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{apis.Condition{
Status: duckv1.Status{
Conditions: duckv1.Conditions{apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Reason: "somethingelse",
Expand Down Expand Up @@ -301,8 +301,8 @@ func TestSendCloudEventsErrors(t *testing.T) {
},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{apis.Condition{
Status: duckv1.Status{
Conditions: duckv1.Conditions{apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Reason: "somethingelse",
Expand Down Expand Up @@ -546,7 +546,7 @@ func TestInitializeCloudEvents(t *testing.T) {

func TestSendCloudEventWithRetries(t *testing.T) {

objectStatus := duckv1beta1.Status{
objectStatus := duckv1.Status{
Conditions: []apis.Condition{{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionTrue,
Expand Down
Loading

0 comments on commit 83af167

Please sign in to comment.