Skip to content

Commit

Permalink
[WIP] Swap v1 storage version
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeJu committed Mar 28, 2023
1 parent 545bdbb commit e08bd8d
Show file tree
Hide file tree
Showing 103 changed files with 6,785 additions and 6,375 deletions.
8 changes: 4 additions & 4 deletions docs/resolver-template/cmd/demoresolver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"context"
"errors"

pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1"
"github.com/tektoncd/pipeline/pkg/resolution/common"
"github.com/tektoncd/pipeline/pkg/resolution/resolver/framework"
Expand Down Expand Up @@ -52,15 +52,15 @@ func (r *resolver) GetSelector(context.Context) map[string]string {
}

// ValidateParams ensures parameters from a request are as expected.
func (r *resolver) ValidateParams(ctx context.Context, params []pipelinev1beta1.Param) error {
func (r *resolver) ValidateParams(ctx context.Context, params []pipelinev1.Param) error {
if len(params) > 0 {
return errors.New("no params allowed")
}
return nil
}

// Resolve uses the given params to resolve the requested file or resource.
func (r *resolver) Resolve(ctx context.Context, params []pipelinev1beta1.Param) (framework.ResolvedResource, error) {
func (r *resolver) Resolve(ctx context.Context, params []pipelinev1.Param) (framework.ResolvedResource, error) {
return &myResolvedResource{}, nil
}

Expand Down Expand Up @@ -95,6 +95,6 @@ func (*myResolvedResource) Annotations() map[string]string {

// Source is the source reference of the remote data that records where the remote
// file came from including the url, digest and the entrypoint. None atm.
func (*myResolvedResource) Source() *pipelinev1beta1.ConfigSource {
func (*myResolvedResource) Source() *pipelinev1.ConfigSource {
return nil
}
12 changes: 6 additions & 6 deletions pkg/apis/pipeline/v1alpha1/run_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
apisconfig "github.com/tektoncd/pipeline/pkg/apis/config"
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
runv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -38,7 +38,7 @@ type EmbeddedRunSpec struct {
runtime.TypeMeta `json:",inline"`

// +optional
Metadata v1beta1.PipelineTaskMetadata `json:"metadata,omitempty"`
Metadata v1.PipelineTaskMetadata `json:"metadata,omitempty"`

// Spec is a specification of a custom task
// +optional
Expand All @@ -48,14 +48,14 @@ type EmbeddedRunSpec struct {
// RunSpec defines the desired state of Run
type RunSpec struct {
// +optional
Ref *v1beta1.TaskRef `json:"ref,omitempty"`
Ref *v1.TaskRef `json:"ref,omitempty"`

// Spec is a specification of a custom task
// +optional
Spec *EmbeddedRunSpec `json:"spec,omitempty"`

// +optional
Params []v1beta1.Param `json:"params,omitempty"`
Params []v1.Param `json:"params,omitempty"`

// Used for cancelling a run (and maybe more later on)
// +optional
Expand Down Expand Up @@ -83,7 +83,7 @@ type RunSpec struct {

// Workspaces is a list of WorkspaceBindings from volumes to workspaces.
// +optional
Workspaces []v1beta1.WorkspaceBinding `json:"workspaces,omitempty"`
Workspaces []v1.WorkspaceBinding `json:"workspaces,omitempty"`
}

// RunSpecStatus defines the taskrun spec status the user can provide
Expand All @@ -108,7 +108,7 @@ const (

// GetParam gets the Param from the RunSpec with the given name
// TODO(jasonhall): Move this to a Params type so other code can use it?
func (rs RunSpec) GetParam(name string) *v1beta1.Param {
func (rs RunSpec) GetParam(name string) *v1.Param {
for _, p := range rs.Params {
if p.Name == name {
return &p
Expand Down
34 changes: 17 additions & 17 deletions pkg/apis/pipeline/v1alpha1/run_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/google/go-cmp/cmp"
apisconfig "github.com/tektoncd/pipeline/pkg/apis/config"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
Expand All @@ -42,7 +42,7 @@ func TestGetParams(t *testing.T) {
desc string
spec v1alpha1.RunSpec
name string
want *v1beta1.Param
want *v1.Param
}{{
desc: "no params",
spec: v1alpha1.RunSpec{},
Expand All @@ -51,28 +51,28 @@ func TestGetParams(t *testing.T) {
}, {
desc: "found",
spec: v1alpha1.RunSpec{
Params: []v1beta1.Param{{
Params: []v1.Param{{
Name: "first",
Value: *v1beta1.NewStructuredValues("blah"),
Value: *v1.NewStructuredValues("blah"),
}, {
Name: "foo",
Value: *v1beta1.NewStructuredValues("bar"),
Value: *v1.NewStructuredValues("bar"),
}},
},
name: "foo",
want: &v1beta1.Param{
want: &v1.Param{
Name: "foo",
Value: *v1beta1.NewStructuredValues("bar"),
Value: *v1.NewStructuredValues("bar"),
},
}, {
desc: "not found",
spec: v1alpha1.RunSpec{
Params: []v1beta1.Param{{
Params: []v1.Param{{
Name: "first",
Value: *v1beta1.NewStructuredValues("blah"),
Value: *v1.NewStructuredValues("blah"),
}, {
Name: "foo",
Value: *v1beta1.NewStructuredValues("bar"),
Value: *v1.NewStructuredValues("bar"),
}},
},
name: "bar",
Expand All @@ -83,21 +83,21 @@ func TestGetParams(t *testing.T) {
// the specified name.
desc: "multiple with same name",
spec: v1alpha1.RunSpec{
Params: []v1beta1.Param{{
Params: []v1.Param{{
Name: "first",
Value: *v1beta1.NewStructuredValues("blah"),
Value: *v1.NewStructuredValues("blah"),
}, {
Name: "foo",
Value: *v1beta1.NewStructuredValues("bar"),
Value: *v1.NewStructuredValues("bar"),
}, {
Name: "foo",
Value: *v1beta1.NewStructuredValues("second bar"),
Value: *v1.NewStructuredValues("second bar"),
}},
},
name: "foo",
want: &v1beta1.Param{
want: &v1.Param{
Name: "foo",
Value: *v1beta1.NewStructuredValues("bar"),
Value: *v1.NewStructuredValues("bar"),
},
}} {
t.Run(c.desc, func(t *testing.T) {
Expand Down Expand Up @@ -234,7 +234,7 @@ status:
},
Spec: v1alpha1.RunSpec{
Retries: 3,
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "example.dev/v0",
Kind: "Example",
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/pipeline/v1alpha1/run_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"fmt"

"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"github.com/tektoncd/pipeline/pkg/apis/validate"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
"k8s.io/apimachinery/pkg/api/equality"
Expand Down Expand Up @@ -78,9 +78,9 @@ func (rs *RunSpec) Validate(ctx context.Context) *apis.FieldError {
return apis.ErrInvalidValue(fmt.Sprintf("statusMessage should not be set if status is not set, but it is currently set to %s", rs.StatusMessage), "statusMessage")
}
}
if err := v1beta1.ValidateParameters(ctx, rs.Params).ViaField("spec.params"); err != nil {
if err := v1.ValidateParameters(ctx, rs.Params).ViaField("spec.params"); err != nil {
return err
}

return v1beta1.ValidateWorkspaceBindings(ctx, rs.Workspaces).ViaField("spec.workspaces")
return v1.ValidateWorkspaceBindings(ctx, rs.Workspaces).ViaField("spec.workspaces")
}
44 changes: 22 additions & 22 deletions pkg/apis/pipeline/v1alpha1/run_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestRun_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "apiVersion",
Kind: "kind",
},
Expand All @@ -94,7 +94,7 @@ func TestRun_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "",
},
},
Expand All @@ -107,7 +107,7 @@ func TestRun_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "",
},
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestRun_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Expand All @@ -167,16 +167,16 @@ func TestRun_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Params: []v1beta1.Param{{
Params: []v1.Param{{
Name: "foo",
Value: *v1beta1.NewStructuredValues("foo"),
Value: *v1.NewStructuredValues("foo"),
}, {
Name: "foo",
Value: *v1beta1.NewStructuredValues("foo"),
Value: *v1.NewStructuredValues("foo"),
}},
},
},
Expand All @@ -202,7 +202,7 @@ func TestRun_Valid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
Name: "blah",
Expand All @@ -216,7 +216,7 @@ func TestRun_Valid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Expand All @@ -229,7 +229,7 @@ func TestRun_Valid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Expand Down Expand Up @@ -259,16 +259,16 @@ func TestRun_Valid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Params: []v1beta1.Param{{
Params: []v1.Param{{
Name: "foo",
Value: *v1beta1.NewStructuredValues("foo"),
Value: *v1.NewStructuredValues("foo"),
}, {
Name: "bar",
Value: *v1beta1.NewStructuredValues("bar"),
Value: *v1.NewStructuredValues("bar"),
}},
},
},
Expand All @@ -279,11 +279,11 @@ func TestRun_Valid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Workspaces: []v1beta1.WorkspaceBinding{{
Workspaces: []v1.WorkspaceBinding{{
Name: "workspace",
EmptyDir: &corev1.EmptyDirVolumeSource{},
}},
Expand All @@ -310,11 +310,11 @@ func TestRun_Workspaces_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Workspaces: []v1beta1.WorkspaceBinding{{
Workspaces: []v1.WorkspaceBinding{{
Name: "workspace",
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
ClaimName: "",
Expand All @@ -330,11 +330,11 @@ func TestRun_Workspaces_Invalid(t *testing.T) {
Name: "temp",
},
Spec: v1alpha1.RunSpec{
Ref: &v1beta1.TaskRef{
Ref: &v1.TaskRef{
APIVersion: "blah",
Kind: "blah",
},
Workspaces: []v1beta1.WorkspaceBinding{{
Workspaces: []v1.WorkspaceBinding{{
Name: "workspace",
EmptyDir: &corev1.EmptyDirVolumeSource{},
}, {
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/resolution/v1beta1/resolution_request_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1beta1

import (
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)
Expand Down Expand Up @@ -63,7 +63,7 @@ type ResolutionRequestSpec struct {
// path to file, the kind of authentication to leverage, etc.
// +optional
// +listType=atomic
Params []pipelinev1beta1.Param `json:"params,omitempty"`
Params []pipelinev1.Param `json:"params,omitempty"`
}

// ResolutionRequestStatus are all the fields in a ResolutionRequest's
Expand All @@ -82,7 +82,7 @@ type ResolutionRequestStatusFields struct {
Data string `json:"data"`
// Source is the source reference of the remote data that records the url, digest
// and the entrypoint.
Source *pipelinev1beta1.ConfigSource `json:"source"`
Source *pipelinev1.ConfigSource `json:"source"`
}

// GetStatus implements KRShaped.
Expand Down
Loading

0 comments on commit e08bd8d

Please sign in to comment.