From e8e04c8b428cd65e5c7ac6ce4b890a062a0a31ee Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 19 Feb 2020 08:44:46 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Expose=20v1alpha2=20through=20the=20webhook?= =?UTF-8?q?=20=E2=9B=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vincent Demeester --- cmd/webhook/main.go | 12 +++++++++--- config/300-clustertask.yaml | 7 +++++++ config/300-pipeline.yaml | 7 +++++++ config/300-pipelinerun.yaml | 7 +++++++ config/300-task.yaml | 7 +++++++ config/300-taskrun.yaml | 7 +++++++ 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 0f3f60fb8e9..551cf3f4a6e 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -22,6 +22,7 @@ import ( defaultconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/contexts" "k8s.io/apimachinery/pkg/runtime/schema" "knative.dev/pkg/configmap" @@ -38,6 +39,7 @@ import ( ) var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ + // v1alpha1 v1alpha1.SchemeGroupVersion.WithKind("Pipeline"): &v1alpha1.Pipeline{}, v1alpha1.SchemeGroupVersion.WithKind("Task"): &v1alpha1.Task{}, v1alpha1.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha1.ClusterTask{}, @@ -45,6 +47,12 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ v1alpha1.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha1.PipelineRun{}, v1alpha1.SchemeGroupVersion.WithKind("Condition"): &v1alpha1.Condition{}, v1alpha1.SchemeGroupVersion.WithKind("PipelineResource"): &v1alpha1.PipelineResource{}, + // v1alpha2 + v1alpha2.SchemeGroupVersion.WithKind("Pipeline"): &v1alpha2.Pipeline{}, + v1alpha2.SchemeGroupVersion.WithKind("Task"): &v1alpha2.Task{}, + v1alpha2.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha2.ClusterTask{}, + v1alpha2.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha2.TaskRun{}, + v1alpha2.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha2.PipelineRun{}, } func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { @@ -65,9 +73,7 @@ func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher // A function that infuses the context passed to Validate/SetDefaults with custom metadata. func(ctx context.Context) context.Context { - // FIXME(vdemeester) uncomment that for auto-conversion - // return v1alpha2.WithUpgradeViaDefaulting(store.ToContext(ctx)) - return contexts.WithDefaultConfigurationName(store.ToContext(ctx)) + return contexts.WithUpgradeViaDefaulting(store.ToContext(ctx)) }, // Whether to disallow unknown fields. diff --git a/config/300-clustertask.yaml b/config/300-clustertask.yaml index 77ec11966b9..8a58f066642 100644 --- a/config/300-clustertask.yaml +++ b/config/300-clustertask.yaml @@ -17,6 +17,13 @@ metadata: name: clustertasks.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: ClusterTask plural: clustertasks diff --git a/config/300-pipeline.yaml b/config/300-pipeline.yaml index 3419f424ee2..025aff50645 100644 --- a/config/300-pipeline.yaml +++ b/config/300-pipeline.yaml @@ -17,6 +17,13 @@ metadata: name: pipelines.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: Pipeline plural: pipelines diff --git a/config/300-pipelinerun.yaml b/config/300-pipelinerun.yaml index 3e822020a56..6402ee01bea 100644 --- a/config/300-pipelinerun.yaml +++ b/config/300-pipelinerun.yaml @@ -17,6 +17,13 @@ metadata: name: pipelineruns.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: PipelineRun plural: pipelineruns diff --git a/config/300-task.yaml b/config/300-task.yaml index 00f04eee937..e5f01bdf2e3 100644 --- a/config/300-task.yaml +++ b/config/300-task.yaml @@ -17,6 +17,13 @@ metadata: name: tasks.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: Task plural: tasks diff --git a/config/300-taskrun.yaml b/config/300-taskrun.yaml index 2f0deec788e..a26188829d4 100644 --- a/config/300-taskrun.yaml +++ b/config/300-taskrun.yaml @@ -17,6 +17,13 @@ metadata: name: taskruns.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: TaskRun plural: taskruns From 900dfd2b9c5a63fc5ccc16a36bed3a5a282ddeed Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 19 Feb 2020 08:44:55 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Make=20reconcilers=20work=20with=20the=20au?= =?UTF-8?q?to-converted=20struct=20=E2=9B=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this commit, the reconcilers (PipelineRun and TaskRun) now uses the v1alpha2 part of the struct instead of the old one. In a gist, this means - `TaskRun.Inputs.Params` becomes `TaskRun.Params` - `TaskRun.Inputs.Resources` becomes `TaskRun.Resources.Inputs` - `TaskRun.Outputs.Resources` becomes `TaskRun.Resources.Outputs` Kubernetes can only store one version of the CRD, and before 1.17 does not support conversion webhook per-se. *Note* that once we have conversion webhook it will be simpler ; support for conversion webhook should land soon-ish in knative.dev/pkg which will allow us to easily switch to it. > 1. Pick a conversion strategy. Since custom resource objects need to > be able to be served at both versions, that means they will > sometimes be served at a different version than their storage > version. In order for this to be possible, the custom resource > objects must sometimes be converted between the version they are > stored at and the version they are served at. If the conversion > involves schema changes and requires custom logic, a conversion > webhook should be used. If there are no schema changes, the default > None conversion strategy may be used and only the apiVersion field > will be modified when serving different versions. > 2. If using conversion webhooks, create and deploy the conversion > webhook. See the Webhook conversion for more details. As written above, we can only store one version on the CRD and we want to serve multilple. To keep the latest API the cleanest (here `v1alpha2`), we are using `v1alpha1` and making sure that `v1alpha1` struct are compatible (aka a `v1alpha2` struct can be serialized in a `v1alpha1` struct so that it can be stored). This is what the auto-conversion role is : - take a version and convert it to the most recent version (here `v1alpha2`) - then store it as the lowest version (here `v1alpha1`) For the controller this means we still work with `v1alpha1` struct *but* with only the part that is compatible with `v1alpha2`. One follow-up will be to rename the `v1alpha1` field that are not used anymore, prepending them with `Deprecated`. Signed-off-by: Vincent Demeester --- go.mod | 2 - .../pipeline/v1alpha1/conversion_error.go | 22 +- pkg/apis/pipeline/v1alpha1/task_defaults.go | 14 + pkg/apis/pipeline/v1alpha1/task_types.go | 4 +- pkg/apis/pipeline/v1alpha1/task_validation.go | 47 +- .../pipeline/v1alpha1/taskrun_defaults.go | 14 +- pkg/apis/pipeline/v1alpha1/taskrun_types.go | 9 +- .../pipeline/v1alpha1/taskrun_validation.go | 10 + .../v1alpha1/zz_generated.deepcopy.go | 63 +-- .../pipeline/v1alpha2/conversion_error.go | 51 +++ .../pipeline/v1alpha2/pipelinerun_types.go | 12 + pkg/apis/pipeline/v1alpha2/task_validation.go | 32 +- pkg/apis/pipeline/v1alpha2/taskrun_types.go | 28 +- .../v1alpha2/zz_generated.deepcopy.go | 16 + pkg/reconciler/pipelinerun/pipelinerun.go | 27 +- .../pipelinerun/pipelinerun_test.go | 33 +- .../resources/input_output_steps.go | 8 +- .../resources/input_output_steps_test.go | 4 +- .../resources/pipelinerunresolution.go | 16 +- .../resources/pipelinerunresolution_test.go | 59 ++- .../pipelinerun/resources/pipelinespec.go | 8 +- .../resources/pipelinespec_test.go | 9 +- pkg/reconciler/taskrun/resources/apply.go | 26 +- .../taskrun/resources/apply_test.go | 162 +++---- .../taskrun/resources/image_exporter.go | 14 +- .../taskrun/resources/image_exporter_test.go | 74 ++-- .../taskrun/resources/input_resource_test.go | 400 +++++++++-------- .../taskrun/resources/input_resources.go | 15 +- .../taskrun/resources/output_resource.go | 13 +- .../taskrun/resources/output_resource_test.go | 414 ++++++++++-------- .../resources/taskresourceresolution.go | 3 +- pkg/reconciler/taskrun/resources/taskspec.go | 10 +- .../taskrun/resources/taskspec_test.go | 9 +- pkg/reconciler/taskrun/taskrun.go | 30 +- pkg/reconciler/taskrun/validate_resources.go | 43 +- .../taskrun/validate_resources_test.go | 64 +-- test/builder/task.go | 114 +++++ test/builder/task_test.go | 5 +- 38 files changed, 1141 insertions(+), 743 deletions(-) create mode 100644 pkg/apis/pipeline/v1alpha2/conversion_error.go diff --git a/go.mod b/go.mod index 883969f96b0..bff22a7ca31 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.13 require ( cloud.google.com/go v0.47.0 // indirect - cloud.google.com/go/storage v1.0.0 contrib.go.opencensus.io/exporter/stackdriver v0.12.8 // indirect github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher v0.0.0-20191203181535-308b93ad1f39 github.com/cloudevents/sdk-go v1.0.0 @@ -45,7 +44,6 @@ require ( golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect golang.org/x/tools v0.0.0-20200214144324-88be01311a71 // indirect - google.golang.org/api v0.15.0 google.golang.org/appengine v1.6.5 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v2 v2.2.5 // indirect diff --git a/pkg/apis/pipeline/v1alpha1/conversion_error.go b/pkg/apis/pipeline/v1alpha1/conversion_error.go index 7282ea9e1ca..c2ab76388a8 100644 --- a/pkg/apis/pipeline/v1alpha1/conversion_error.go +++ b/pkg/apis/pipeline/v1alpha1/conversion_error.go @@ -17,8 +17,7 @@ limitations under the License. package v1alpha1 import ( - "fmt" - + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "knative.dev/pkg/apis" ) @@ -26,26 +25,13 @@ const ( // ConditionTypeConvertible is a Warning condition that is set on // resources when they cannot be converted to warn of a forthcoming // breakage. - ConditionTypeConvertible apis.ConditionType = "Convertible" + ConditionTypeConvertible apis.ConditionType = v1alpha2.ConditionTypeConvertible ) // CannotConvertError is returned when a field cannot be converted. -type CannotConvertError struct { - Message string - Field string -} +type CannotConvertError = v1alpha2.CannotConvertError var _ error = (*CannotConvertError)(nil) -// Error implements error -func (cce *CannotConvertError) Error() string { - return cce.Message -} - // ConvertErrorf creates a CannotConvertError from the field name and format string. -func ConvertErrorf(field, msg string, args ...interface{}) error { - return &CannotConvertError{ - Message: fmt.Sprintf(msg, args...), - Field: field, - } -} +var ConvertErrorf = v1alpha2.ConvertErrorf diff --git a/pkg/apis/pipeline/v1alpha1/task_defaults.go b/pkg/apis/pipeline/v1alpha1/task_defaults.go index 53a69b4de0b..2baa6bfd3e6 100644 --- a/pkg/apis/pipeline/v1alpha1/task_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/task_defaults.go @@ -19,6 +19,8 @@ package v1alpha1 import ( "context" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/contexts" "knative.dev/pkg/apis" ) @@ -30,6 +32,18 @@ func (t *Task) SetDefaults(ctx context.Context) { // SetDefaults set any defaults for the task spec func (ts *TaskSpec) SetDefaults(ctx context.Context) { + if contexts.IsUpgradeViaDefaulting(ctx) { + v := v1alpha2.TaskSpec{} + if ts.ConvertUp(ctx, &v) == nil { + alpha := TaskSpec{} + if alpha.ConvertDown(ctx, &v) == nil { + *ts = alpha + } + } + } + for i := range ts.Params { + ts.Params[i].SetDefaults(ctx) + } if ts.Inputs != nil { ts.Inputs.SetDefaults(ctx) } diff --git a/pkg/apis/pipeline/v1alpha1/task_types.go b/pkg/apis/pipeline/v1alpha1/task_types.go index 544e6e0b77c..2fdb63e488c 100644 --- a/pkg/apis/pipeline/v1alpha1/task_types.go +++ b/pkg/apis/pipeline/v1alpha1/task_types.go @@ -105,9 +105,7 @@ type Inputs struct { // the Task definition, and when provided as an Input, the Name will be the // path to the volume mounted containing this Resource as an input (e.g. // an input Resource named `workspace` will be mounted at `/workspace`). -type TaskResource struct { - ResourceDeclaration `json:",inline"` -} +type TaskResource = v1alpha2.TaskResource // Outputs allow a task to declare what data the Build/Task will be producing, // i.e. results such as logs and artifacts such as images. diff --git a/pkg/apis/pipeline/v1alpha1/task_validation.go b/pkg/apis/pipeline/v1alpha1/task_validation.go index a48def044fc..ec5f00276db 100644 --- a/pkg/apis/pipeline/v1alpha1/task_validation.go +++ b/pkg/apis/pipeline/v1alpha1/task_validation.go @@ -22,6 +22,7 @@ import ( "path/filepath" "strings" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/substitution" corev1 "k8s.io/api/core/v1" @@ -79,9 +80,18 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { } } + // Validate Resources declaration + if err := ts.Resources.Validate(ctx); err != nil { + return err + } + // Validate that the parameters type are correct + if err := v1alpha2.ValidateParameterTypes(ts.Params); err != nil { + return err + } + // A task doesn't have to have inputs or outputs, but if it does they must be valid. // A task can't duplicate input or output names. - + // Deprecated if ts.Inputs != nil { for _, resource := range ts.Inputs.Resources { if err := validateResourceType(resource, fmt.Sprintf("taskspec.Inputs.Resources.%s.Type", resource.Name)); err != nil { @@ -95,6 +105,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { return err } } + // Deprecated if ts.Outputs != nil { for _, resource := range ts.Outputs.Resources { if err := validateResourceType(resource, fmt.Sprintf("taskspec.Outputs.Resources.%s.Type", resource.Name)); err != nil { @@ -117,10 +128,19 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { } } - if err := validateInputParameterVariables(ts.Steps, ts.Inputs); err != nil { + if err := v1alpha2.ValidateParameterVariables(ts.Steps, ts.Params); err != nil { + return err + } + // Deprecated + if err := validateInputParameterVariables(ts.Steps, ts.Inputs, ts.Params); err != nil { + return err + } + + if err := v1alpha2.ValidateResourcesVariables(ts.Steps, ts.Resources); err != nil { return err } - if err := validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs); err != nil { + // Deprecated + if err := validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs, ts.Resources); err != nil { return err } return nil @@ -251,10 +271,17 @@ func validateInputParameterTypes(inputs *Inputs) *apis.FieldError { return nil } -func validateInputParameterVariables(steps []Step, inputs *Inputs) *apis.FieldError { +func validateInputParameterVariables(steps []Step, inputs *Inputs, params []v1alpha2.ParamSpec) *apis.FieldError { parameterNames := map[string]struct{}{} arrayParameterNames := map[string]struct{}{} + for _, p := range params { + parameterNames[p.Name] = struct{}{} + if p.Type == ParamTypeArray { + arrayParameterNames[p.Name] = struct{}{} + } + } + // Deprecated if inputs != nil { for _, p := range inputs.Params { parameterNames[p.Name] = struct{}{} @@ -270,13 +297,23 @@ func validateInputParameterVariables(steps []Step, inputs *Inputs) *apis.FieldEr return validateArrayUsage(steps, "params", arrayParameterNames) } -func validateResourceVariables(steps []Step, inputs *Inputs, outputs *Outputs) *apis.FieldError { +func validateResourceVariables(steps []Step, inputs *Inputs, outputs *Outputs, resources *v1alpha2.TaskResources) *apis.FieldError { resourceNames := map[string]struct{}{} + if resources != nil { + for _, r := range resources.Inputs { + resourceNames[r.Name] = struct{}{} + } + for _, r := range resources.Outputs { + resourceNames[r.Name] = struct{}{} + } + } + // Deprecated if inputs != nil { for _, r := range inputs.Resources { resourceNames[r.Name] = struct{}{} } } + // Deprecated if outputs != nil { for _, r := range outputs.Resources { resourceNames[r.Name] = struct{}{} diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go index cd6310228f3..d3415d6d603 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go @@ -21,6 +21,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/contexts" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -31,7 +32,8 @@ var _ apis.Defaultable = (*TaskRun)(nil) const managedByLabelKey = "app.kubernetes.io/managed-by" func (tr *TaskRun) SetDefaults(ctx context.Context) { - tr.Spec.SetDefaults(ctx) + ctx = apis.WithinParent(ctx, tr.ObjectMeta) + tr.Spec.SetDefaults(apis.WithinSpec(ctx)) // If the TaskRun doesn't have a managed-by label, apply the default // specified in the config. @@ -45,6 +47,16 @@ func (tr *TaskRun) SetDefaults(ctx context.Context) { } func (trs *TaskRunSpec) SetDefaults(ctx context.Context) { + if contexts.IsUpgradeViaDefaulting(ctx) { + v := v1alpha2.TaskRunSpec{} + if trs.ConvertUp(ctx, &v) == nil { + alpha := TaskRunSpec{} + if alpha.ConvertDown(ctx, &v) == nil { + *trs = alpha + } + } + } + cfg := config.FromContextOrDefaults(ctx) if trs.TaskRef != nil && trs.TaskRef.Kind == "" { trs.TaskRef.Kind = NamespacedTaskKind diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_types.go b/pkg/apis/pipeline/v1alpha1/taskrun_types.go index 90be2f90448..b34f099b61d 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_types.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_types.go @@ -80,14 +80,7 @@ type TaskRunInputs struct { // TaskResourceBinding points to the PipelineResource that // will be used for the Task input or output called Name. -type TaskResourceBinding struct { - PipelineResourceBinding - // Paths will probably be removed in #1284, and then PipelineResourceBinding can be used instead. - // The optional Path field corresponds to a path on disk at which the Resource can be found - // (used when providing the resource via mounted volume, overriding the default logic to fetch the Resource). - // +optional - Paths []string `json:"paths,omitempty"` -} +type TaskResourceBinding = v1alpha2.TaskResourceBinding // TaskRunOutputs holds the output values that this task was invoked with. type TaskRunOutputs struct { diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_validation.go b/pkg/apis/pipeline/v1alpha1/taskrun_validation.go index 1ce4bd15f15..f443254de8a 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_validation.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_validation.go @@ -59,19 +59,29 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) *apis.FieldError { } } + // Deprecated // check for input resources if err := ts.Inputs.Validate(ctx, "spec.Inputs"); err != nil { return err } + // Deprecated // check for output resources if err := ts.Outputs.Validate(ctx, "spec.Outputs"); err != nil { return err } + // Validate Resources + if err := ts.Resources.Validate(ctx); err != nil { + return err + } + if err := validateWorkspaceBindings(ctx, ts.Workspaces); err != nil { return err } + if err := validateParameters(ts.Params); err != nil { + return err + } if ts.Timeout != nil { // timeout should be a valid duration of at least 0. diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index e4075156188..7cd2bc85249 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -28,22 +28,6 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CannotConvertError) DeepCopyInto(out *CannotConvertError) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CannotConvertError. -func (in *CannotConvertError) DeepCopy() *CannotConvertError { - if in == nil { - return nil - } - out := new(CannotConvertError) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterTask) DeepCopyInto(out *ClusterTask) { *out = *in @@ -218,7 +202,7 @@ func (in *Inputs) DeepCopyInto(out *Inputs) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]TaskResource, len(*in)) + *out = make([]v1alpha2.TaskResource, len(*in)) copy(*out, *in) } if in.Params != nil { @@ -251,7 +235,7 @@ func (in *Outputs) DeepCopyInto(out *Outputs) { } if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]TaskResource, len(*in)) + *out = make([]v1alpha2.TaskResource, len(*in)) copy(*out, *in) } return @@ -653,45 +637,6 @@ func (in *TaskList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TaskResource) DeepCopyInto(out *TaskResource) { - *out = *in - out.ResourceDeclaration = in.ResourceDeclaration - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResource. -func (in *TaskResource) DeepCopy() *TaskResource { - if in == nil { - return nil - } - out := new(TaskResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TaskResourceBinding) DeepCopyInto(out *TaskResourceBinding) { - *out = *in - in.PipelineResourceBinding.DeepCopyInto(&out.PipelineResourceBinding) - if in.Paths != nil { - in, out := &in.Paths, &out.Paths - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResourceBinding. -func (in *TaskResourceBinding) DeepCopy() *TaskResourceBinding { - if in == nil { - return nil - } - out := new(TaskResourceBinding) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TaskRun) DeepCopyInto(out *TaskRun) { *out = *in @@ -725,7 +670,7 @@ func (in *TaskRunInputs) DeepCopyInto(out *TaskRunInputs) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]TaskResourceBinding, len(*in)) + *out = make([]v1alpha2.TaskResourceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -788,7 +733,7 @@ func (in *TaskRunOutputs) DeepCopyInto(out *TaskRunOutputs) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]TaskResourceBinding, len(*in)) + *out = make([]v1alpha2.TaskResourceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/pkg/apis/pipeline/v1alpha2/conversion_error.go b/pkg/apis/pipeline/v1alpha2/conversion_error.go new file mode 100644 index 00000000000..be489604de6 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/conversion_error.go @@ -0,0 +1,51 @@ +/* +Copyright 2020 The Tekton Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + + "knative.dev/pkg/apis" +) + +const ( + // ConditionTypeConvertible is a Warning condition that is set on + // resources when they cannot be converted to warn of a forthcoming + // breakage. + ConditionTypeConvertible apis.ConditionType = "Convertible" +) + +// CannotConvertError is returned when a field cannot be converted. +type CannotConvertError struct { + Message string + Field string +} + +var _ error = (*CannotConvertError)(nil) + +// Error implements error +func (cce *CannotConvertError) Error() string { + return cce.Message +} + +// ConvertErrorf creates a CannotConvertError from the field name and format string. +func ConvertErrorf(field, msg string, args ...interface{}) error { + return &CannotConvertError{ + Message: fmt.Sprintf(msg, args...), + Field: field, + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go index d5790b9f203..975a176c80e 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go @@ -211,6 +211,18 @@ func (pr *PipelineRunStatus) SetCondition(newCond *apis.Condition) { } } +// MarkResourceNotConvertible adds a Warning-severity condition to the resource noting +// that it cannot be converted to a higher version. +func (pr *PipelineRunStatus) MarkResourceNotConvertible(err *CannotConvertError) { + pipelineRunCondSet.Manage(pr).SetCondition(apis.Condition{ + Type: ConditionTypeConvertible, + Status: corev1.ConditionFalse, + Severity: apis.ConditionSeverityWarning, + Reason: err.Field, + Message: err.Message, + }) +} + // PipelineRunStatusFields holds the fields of PipelineRunStatus' status. // This is defined separately and inlined so that other types can readily // consume these fields via duck typing. diff --git a/pkg/apis/pipeline/v1alpha2/task_validation.go b/pkg/apis/pipeline/v1alpha2/task_validation.go index 1663dc30452..bbbf3005063 100644 --- a/pkg/apis/pipeline/v1alpha2/task_validation.go +++ b/pkg/apis/pipeline/v1alpha2/task_validation.go @@ -71,7 +71,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { } // Validate that the parameters type are correct - if err := validateParameterTypes(ts.Params); err != nil { + if err := ValidateParameterTypes(ts.Params); err != nil { return err } @@ -86,11 +86,13 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { } } - // FIXME(vdemeester) validate param variables - if err := validateParameterVariables(ts.Steps, ts.Params); err != nil { + if err := ValidateParameterVariables(ts.Steps, ts.Params); err != nil { + return err + } + + if err := ValidateResourcesVariables(ts.Steps, ts.Resources); err != nil { return err } - // FIXME(vdemeester) validate resource return nil } @@ -190,7 +192,7 @@ func validateSteps(steps []Step) *apis.FieldError { return nil } -func validateParameterTypes(params []ParamSpec) *apis.FieldError { +func ValidateParameterTypes(params []ParamSpec) *apis.FieldError { for _, p := range params { // Ensure param has a valid type. validType := false @@ -218,7 +220,7 @@ func validateParameterTypes(params []ParamSpec) *apis.FieldError { return nil } -func validateParameterVariables(steps []Step, params []ParamSpec) *apis.FieldError { +func ValidateParameterVariables(steps []Step, params []ParamSpec) *apis.FieldError { parameterNames := map[string]struct{}{} arrayParameterNames := map[string]struct{}{} @@ -235,6 +237,24 @@ func validateParameterVariables(steps []Step, params []ParamSpec) *apis.FieldErr return validateArrayUsage(steps, "params", arrayParameterNames) } +func ValidateResourcesVariables(steps []Step, resources *TaskResources) *apis.FieldError { + if resources == nil { + return nil + } + resourceNames := map[string]struct{}{} + if resources.Inputs != nil { + for _, r := range resources.Inputs { + resourceNames[r.Name] = struct{}{} + } + } + if resources.Outputs != nil { + for _, r := range resources.Outputs { + resourceNames[r.Name] = struct{}{} + } + } + return validateVariables(steps, "resources.(?:inputs|outputs)", resourceNames) +} + func validateArrayUsage(steps []Step, prefix string, vars map[string]struct{}) *apis.FieldError { for _, step := range steps { if err := validateTaskNoArrayReferenced("name", step.Name, prefix, vars); err != nil { diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_types.go b/pkg/apis/pipeline/v1alpha2/taskrun_types.go index 4101b3b56c4..41511db13ed 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_types.go +++ b/pkg/apis/pipeline/v1alpha2/taskrun_types.go @@ -99,6 +99,18 @@ type TaskRunStatus struct { TaskRunStatusFields `json:",inline"` } +// MarkResourceNotConvertible adds a Warning-severity condition to the resource noting +// that it cannot be converted to a higher version. +func (trs *TaskRunStatus) MarkResourceNotConvertible(err *CannotConvertError) { + taskRunCondSet.Manage(trs).SetCondition(apis.Condition{ + Type: ConditionTypeConvertible, + Status: corev1.ConditionFalse, + Severity: apis.ConditionSeverityWarning, + Reason: err.Field, + Message: err.Message, + }) +} + // TaskRunStatusFields holds the fields of TaskRun's status. This is defined // separately and inlined so that other types can readily consume these fields // via duck typing. @@ -152,24 +164,24 @@ type TaskRunResult struct { } // GetCondition returns the Condition matching the given type. -func (tr *TaskRunStatus) GetCondition(t apis.ConditionType) *apis.Condition { - return taskRunCondSet.Manage(tr).GetCondition(t) +func (trs *TaskRunStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return taskRunCondSet.Manage(trs).GetCondition(t) } // InitializeConditions will set all conditions in taskRunCondSet to unknown for the TaskRun // and set the started time to the current time -func (tr *TaskRunStatus) InitializeConditions() { - if tr.StartTime.IsZero() { - tr.StartTime = &metav1.Time{Time: time.Now()} +func (trs *TaskRunStatus) InitializeConditions() { + if trs.StartTime.IsZero() { + trs.StartTime = &metav1.Time{Time: time.Now()} } - taskRunCondSet.Manage(tr).InitializeConditions() + taskRunCondSet.Manage(trs).InitializeConditions() } // SetCondition sets the condition, unsetting previous conditions with the same // type as necessary. -func (tr *TaskRunStatus) SetCondition(newCond *apis.Condition) { +func (trs *TaskRunStatus) SetCondition(newCond *apis.Condition) { if newCond != nil { - taskRunCondSet.Manage(tr).SetCondition(*newCond) + taskRunCondSet.Manage(trs).SetCondition(*newCond) } } diff --git a/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go index a7399d8a03c..0d5d6c52e08 100644 --- a/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go @@ -49,6 +49,22 @@ func (in *ArrayOrString) DeepCopy() *ArrayOrString { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CannotConvertError) DeepCopyInto(out *CannotConvertError) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CannotConvertError. +func (in *CannotConvertError) DeepCopy() *CannotConvertError { + if in == nil { + return nil + } + out := new(CannotConvertError) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CloudEventDelivery) DeepCopyInto(out *CloudEventDelivery) { *out = *in diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 3bae8402058..98749f8eb37 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -27,6 +27,7 @@ import ( apisconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/artifacts" listers "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" resourcelisters "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" @@ -235,9 +236,21 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1alpha1.PipelineRun) er // and may not have had all of the assumed default specified. pr.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) + if err := pr.ConvertUp(ctx, &v1alpha2.PipelineRun{}); err != nil { + if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + pr.Status.MarkResourceNotConvertible(ce) + return nil + } + return err + } + getPipelineFunc := c.getPipelineFunc(pr) - pipelineMeta, pipelineSpec, err := resources.GetPipelineData(pr, getPipelineFunc) + pipelineMeta, pipelineSpec, err := resources.GetPipelineData(ctx, pr, getPipelineFunc) if err != nil { + if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + pr.Status.MarkResourceNotConvertible(ce) + return nil + } c.Logger.Errorf("Failed to determine Pipeline spec to use for pipelinerun %s: %v", pr.Name, err) pr.Status.SetCondition(&apis.Condition{ Type: apis.ConditionSucceeded, @@ -345,7 +358,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1alpha1.PipelineRun) er // Apply parameter substitution from the PipelineRun pipelineSpec = resources.ApplyParameters(pipelineSpec, pr) - pipelineState, err := resources.ResolvePipelineRun( + pipelineState, err := resources.ResolvePipelineRun(ctx, *pr, func(name string) (v1alpha1.TaskInterface, error) { return c.taskLister.Tasks(pr.Namespace).Get(name) @@ -556,9 +569,7 @@ func (c *Reconciler) createTaskRun(rprt *resources.ResolvedPipelineRunTask, pr * Annotations: getTaskrunAnnotations(pr), }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: rprt.PipelineTask.Params, - }, + Params: rprt.PipelineTask.Params, ServiceAccountName: pr.GetServiceAccountName(rprt.PipelineTask.Name), Timeout: getTaskRunTimeout(pr, rprt), PodTemplate: pr.Spec.PodTemplate, @@ -721,9 +732,9 @@ func (c *Reconciler) makeConditionCheckContainer(rprt *resources.ResolvedPipelin Spec: v1alpha1.TaskRunSpec{ TaskSpec: taskSpec, ServiceAccountName: pr.GetServiceAccountName(rprt.PipelineTask.Name), - Inputs: v1alpha1.TaskRunInputs{ - Params: rcc.PipelineTaskCondition.Params, - Resources: rcc.ToTaskResourceBindings(), + Params: rcc.PipelineTaskCondition.Params, + Resources: &v1alpha2.TaskRunResources{ + Inputs: rcc.ToTaskResourceBindings(), }, Timeout: getTaskRunTimeout(pr, rprt), PodTemplate: pr.Spec.PodTemplate, diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index 27dfd774736..d3710d74b7f 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -228,25 +228,24 @@ func TestReconcile(t *testing.T) { tb.TaskRunSpec( tb.TaskRunTaskRef("unit-test-task"), tb.TaskRunServiceAccountName("test-sa"), - tb.TaskRunInputs( - tb.TaskRunInputsParam("foo", "somethingfun"), - tb.TaskRunInputsParam("bar", "somethingmorefun"), - tb.TaskRunInputsParam("templatedparam", "$(inputs.workspace.revision)"), - tb.TaskRunInputsResource("workspace", tb.TaskResourceBindingRef("some-repo")), - ), - tb.TaskRunOutputs( - tb.TaskRunOutputsResource("image-to-use", tb.TaskResourceBindingResourceSpec( - &v1alpha1.PipelineResourceSpec{ - Type: v1alpha1.PipelineResourceTypeImage, - Params: []v1alpha1.ResourceParam{{ - Name: "url", - Value: "gcr.io/sven", - }}, - }, - ), + tb.TaskRunParam("foo", "somethingfun"), + tb.TaskRunParam("bar", "somethingmorefun"), + tb.TaskRunParam("templatedparam", "$(inputs.workspace.revision)"), + tb.TaskRunResources( + tb.TaskRunResourcesInput("workspace", tb.TaskResourceBindingRef("some-repo")), + tb.TaskRunResourcesOutput("image-to-use", + tb.TaskResourceBindingResourceSpec( + &v1alpha1.PipelineResourceSpec{ + Type: v1alpha1.PipelineResourceTypeImage, + Params: []v1alpha1.ResourceParam{{ + Name: "url", + Value: "gcr.io/sven", + }}, + }, + ), tb.TaskResourceBindingPaths("/pvc/unit-test-1/image-to-use"), ), - tb.TaskRunOutputsResource("workspace", tb.TaskResourceBindingRef("some-repo"), + tb.TaskRunResourcesOutput("workspace", tb.TaskResourceBindingRef("some-repo"), tb.TaskResourceBindingPaths("/pvc/unit-test-1/workspace"), ), ), diff --git a/pkg/reconciler/pipelinerun/resources/input_output_steps.go b/pkg/reconciler/pipelinerun/resources/input_output_steps.go index 5b0e3bff3bf..eec7460b67c 100644 --- a/pkg/reconciler/pipelinerun/resources/input_output_steps.go +++ b/pkg/reconciler/pipelinerun/resources/input_output_steps.go @@ -20,6 +20,7 @@ import ( "path/filepath" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" ) // GetOutputSteps will add the correct `path` to the output resources for pt @@ -101,11 +102,14 @@ func WrapSteps(tr *v1alpha1.TaskRunSpec, pt *v1alpha1.PipelineTask, inputs, outp if pt == nil { return } + if tr.Resources == nil { + tr.Resources = &v1alpha2.TaskRunResources{} + } if pt.Resources != nil { // Add presteps to setup updated input - tr.Inputs.Resources = append(tr.Inputs.Resources, GetInputSteps(inputs, pt.Resources.Inputs, storageBasePath)...) + tr.Resources.Inputs = append(tr.Resources.Inputs, GetInputSteps(inputs, pt.Resources.Inputs, storageBasePath)...) } // Add poststeps to setup outputs - tr.Outputs.Resources = append(tr.Outputs.Resources, GetOutputSteps(outputs, pt.Name, storageBasePath)...) + tr.Resources.Outputs = append(tr.Resources.Outputs, GetOutputSteps(outputs, pt.Name, storageBasePath)...) } diff --git a/pkg/reconciler/pipelinerun/resources/input_output_steps_test.go b/pkg/reconciler/pipelinerun/resources/input_output_steps_test.go index 2b21bd62c11..13d6eac458f 100644 --- a/pkg/reconciler/pipelinerun/resources/input_output_steps_test.go +++ b/pkg/reconciler/pipelinerun/resources/input_output_steps_test.go @@ -347,10 +347,10 @@ func TestWrapSteps(t *testing.T) { sort.SliceStable(expectedtaskInputResources, func(i, j int) bool { return expectedtaskInputResources[i].Name < expectedtaskInputResources[j].Name }) sort.SliceStable(expectedtaskOuputResources, func(i, j int) bool { return expectedtaskOuputResources[i].Name < expectedtaskOuputResources[j].Name }) - if d := cmp.Diff(taskRunSpec.Inputs.Resources, expectedtaskInputResources, cmpopts.SortSlices(func(x, y v1alpha1.TaskResourceBinding) bool { return x.Name < y.Name })); d != "" { + if d := cmp.Diff(taskRunSpec.Resources.Inputs, expectedtaskInputResources, cmpopts.SortSlices(func(x, y v1alpha1.TaskResourceBinding) bool { return x.Name < y.Name })); d != "" { t.Errorf("error comparing input resources: %s", d) } - if d := cmp.Diff(taskRunSpec.Outputs.Resources, expectedtaskOuputResources, cmpopts.SortSlices(func(x, y v1alpha1.TaskResourceBinding) bool { return x.Name < y.Name })); d != "" { + if d := cmp.Diff(taskRunSpec.Resources.Outputs, expectedtaskOuputResources, cmpopts.SortSlices(func(x, y v1alpha1.TaskResourceBinding) bool { return x.Name < y.Name })); d != "" { t.Errorf("error comparing output resources: %s", d) } } diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go index a1d44457cf5..bc7fdc2a05b 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go @@ -17,6 +17,7 @@ limitations under the License. package resources import ( + "context" "fmt" "reflect" @@ -26,6 +27,8 @@ import ( "knative.dev/pkg/apis" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/contexts" "github.com/tektoncd/pipeline/pkg/list" "github.com/tektoncd/pipeline/pkg/names" "github.com/tektoncd/pipeline/pkg/reconciler/pipeline/dag" @@ -271,6 +274,7 @@ func (e *ConditionNotFoundError) Error() string { // will return an error, otherwise it returns a list of all of the Tasks retrieved. // It will retrieve the Resources needed for the TaskRun using the mapping of providedResources. func ResolvePipelineRun( + ctx context.Context, pipelineRun v1alpha1.PipelineRun, getTask resources.GetTask, getTaskRun resources.GetTaskRun, @@ -316,6 +320,10 @@ func ResolvePipelineRun( } else { spec = *pt.TaskSpec } + spec.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) + if err := spec.ConvertUp(ctx, &v1alpha2.TaskSpec{}); err != nil { + return nil, err + } rtr, err := ResolvePipelineTaskResources(pt, &spec, taskName, kind, providedResources) if err != nil { return nil, fmt.Errorf("couldn't match referenced resources with declared resources: %w", err) @@ -543,10 +551,10 @@ func ResolvePipelineTaskResources(pt v1alpha1.PipelineTask, ts *v1alpha1.TaskSpe if resource, ok := providedResources[taskInput.Resource]; ok { rtr.Inputs[taskInput.Name] = resource } else { - if ts.Inputs == nil { + if ts.Resources == nil || ts.Resources.Inputs == nil { return nil, fmt.Errorf("pipelineTask tried to use input resource %s not present in declared resources", taskInput.Resource) } - for _, r := range ts.Inputs.Resources { + for _, r := range ts.Resources.Inputs { if r.Name == taskInput.Name && !r.Optional { return nil, fmt.Errorf("pipelineTask tried to use input resource %s not present in declared resources", taskInput.Resource) } @@ -557,10 +565,10 @@ func ResolvePipelineTaskResources(pt v1alpha1.PipelineTask, ts *v1alpha1.TaskSpe if resource, ok := providedResources[taskOutput.Resource]; ok { rtr.Outputs[taskOutput.Name] = resource } else { - if ts.Outputs == nil { + if ts.Resources == nil || ts.Resources.Outputs == nil { return nil, fmt.Errorf("pipelineTask tried to use output resource %s not present in declared resources", taskOutput.Resource) } - for _, r := range ts.Outputs.Resources { + for _, r := range ts.Resources.Outputs { if r.Name == taskOutput.Name && !r.Optional { return nil, fmt.Errorf("pipelineTask tried to use output resource %s not present in declared resources", taskOutput.Resource) } diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go index acfc06c4cc5..bdcb40fe8bc 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go @@ -17,6 +17,7 @@ limitations under the License. package resources import ( + "context" "errors" "fmt" "testing" @@ -453,7 +454,7 @@ var taskCancelled = PipelineRunState{{ }, }} -var taskWithOptionalResources = &v1alpha1.Task{ +var taskWithOptionalResourcesDeprecated = &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "task", }, @@ -486,6 +487,38 @@ var taskWithOptionalResources = &v1alpha1.Task{ }, }, } +var taskWithOptionalResources = &v1alpha1.Task{ + ObjectMeta: metav1.ObjectMeta{ + Name: "task", + }, + Spec: v1alpha1.TaskSpec{ + TaskSpec: v1alpha2.TaskSpec{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "step1", + }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "optional-input", + Type: "git", + Optional: true, + }}, {ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "required-input", + Type: "git", + Optional: false, + }}}, + Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "optional-output", + Type: "git", + Optional: true, + }}, {ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "required-output", + Type: "git", + Optional: false, + }}}, + }, + }, + }, +} func DagFromState(state PipelineRunState) (*dag.Graph, error) { pts := []v1alpha1.PipelineTask{} @@ -1182,7 +1215,7 @@ func TestResolvePipelineRun(t *testing.T) { getClusterTask := func(name string) (v1alpha1.TaskInterface, error) { return nil, nil } getCondition := func(name string) (*v1alpha1.Condition, error) { return nil, nil } - pipelineState, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, p.Spec.Tasks, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, p.Spec.Tasks, providedResources) if err != nil { t.Fatalf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -1261,7 +1294,7 @@ func TestResolvePipelineRun_PipelineTaskHasNoResources(t *testing.T) { Name: "pipelinerun", }, } - pipelineState, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun without Resources: %v", err) } @@ -1308,7 +1341,7 @@ func TestResolvePipelineRun_TaskDoesntExist(t *testing.T) { Name: "pipelinerun", }, } - _, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) + _, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) switch err := err.(type) { case nil: t.Fatalf("Expected error getting non-existent Tasks for Pipeline %s but got none", p.Name) @@ -1354,7 +1387,7 @@ func TestResolvePipelineRun_ResourceBindingsDontExist(t *testing.T) { Name: "pipelinerun", }, } - _, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, tt.p.Spec.Tasks, providedResources) + _, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, tt.p.Spec.Tasks, providedResources) if err == nil { t.Fatalf("Expected error when bindings are in incorrect state for Pipeline %s but got none", p.Name) } @@ -1404,7 +1437,7 @@ func TestResolvePipelineRun_withExistingTaskRuns(t *testing.T) { getClusterTask := func(name string) (v1alpha1.TaskInterface, error) { return nil, nil } getTaskRun := func(name string) (*v1alpha1.TaskRun, error) { return nil, nil } getCondition := func(name string) (*v1alpha1.Condition, error) { return nil, nil } - pipelineState, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, p.Spec.Tasks, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, p.Spec.Tasks, providedResources) if err != nil { t.Fatalf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -1452,12 +1485,12 @@ func TestResolvedPipelineRun_PipelineTaskHasOptionalResources(t *testing.T) { }, } - getTask := func(name string) (v1alpha1.TaskInterface, error) { return taskWithOptionalResources, nil } + getTask := func(name string) (v1alpha1.TaskInterface, error) { return taskWithOptionalResourcesDeprecated, nil } getTaskRun := func(name string) (*v1alpha1.TaskRun, error) { return nil, nil } getClusterTask := func(name string) (v1alpha1.TaskInterface, error) { return nil, nil } getCondition := func(name string) (*v1alpha1.Condition, error) { return nil, nil } - pipelineState, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, p.Spec.Tasks, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, p.Spec.Tasks, providedResources) if err != nil { t.Fatalf("Error getting tasks for fake pipeline %s: %s", p.ObjectMeta.Name, err) } @@ -1558,7 +1591,7 @@ func TestResolveConditionChecks(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - pipelineState, err := ResolvePipelineRun(pr, getTask, tc.getTaskRun, getClusterTask, getCondition, pts, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, tc.getTaskRun, getClusterTask, getCondition, pts, providedResources) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun without Conditions: %v", err) } @@ -1649,7 +1682,7 @@ func TestResolveConditionChecks_MultipleConditions(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - pipelineState, err := ResolvePipelineRun(pr, getTask, tc.getTaskRun, getClusterTask, getCondition, pts, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, tc.getTaskRun, getClusterTask, getCondition, pts, providedResources) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun without Conditions: %v", err) } @@ -1693,7 +1726,7 @@ func TestResolveConditionChecks_ConditionDoesNotExist(t *testing.T) { }, } - _, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) + _, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) switch err := err.(type) { case nil: @@ -1762,7 +1795,7 @@ func TestResolveConditionCheck_UseExistingConditionCheckName(t *testing.T) { }, } - pipelineState, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, pts, providedResources) if err != nil { t.Fatalf("Did not expect error when resolving PipelineRun without Conditions: %v", err) } @@ -1837,7 +1870,7 @@ func TestResolvedConditionCheck_WithResources(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - pipelineState, err := ResolvePipelineRun(pr, getTask, getTaskRun, getClusterTask, getCondition, pts, tc.providedResources) + pipelineState, err := ResolvePipelineRun(context.Background(), pr, getTask, getTaskRun, getClusterTask, getCondition, pts, tc.providedResources) if tc.wantErr { if err == nil { diff --git a/pkg/reconciler/pipelinerun/resources/pipelinespec.go b/pkg/reconciler/pipelinerun/resources/pipelinespec.go index 800663ddfb7..c3bc2845e1b 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinespec.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinespec.go @@ -17,9 +17,11 @@ limitations under the License. package resources import ( + "context" "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -29,7 +31,7 @@ type GetPipeline func(string) (v1alpha1.PipelineInterface, error) // GetPipelineData will retrieve the Pipeline metadata and Spec associated with the // provided PipelineRun. This can come from a reference Pipeline or from the PipelineRun's // metadata and embedded PipelineSpec. -func GetPipelineData(pipelineRun *v1alpha1.PipelineRun, getPipeline GetPipeline) (*metav1.ObjectMeta, *v1alpha1.PipelineSpec, error) { +func GetPipelineData(ctx context.Context, pipelineRun *v1alpha1.PipelineRun, getPipeline GetPipeline) (*metav1.ObjectMeta, *v1alpha1.PipelineSpec, error) { pipelineMeta := metav1.ObjectMeta{} pipelineSpec := v1alpha1.PipelineSpec{} switch { @@ -41,6 +43,10 @@ func GetPipelineData(pipelineRun *v1alpha1.PipelineRun, getPipeline GetPipeline) } pipelineMeta = t.PipelineMetadata() pipelineSpec = t.PipelineSpec() + + if err := pipelineSpec.ConvertUp(ctx, &v1alpha2.PipelineSpec{}); err != nil { + return nil, nil, err + } case pipelineRun.Spec.PipelineSpec != nil: pipelineMeta = pipelineRun.ObjectMeta pipelineSpec = *pipelineRun.Spec.PipelineSpec diff --git a/pkg/reconciler/pipelinerun/resources/pipelinespec_test.go b/pkg/reconciler/pipelinerun/resources/pipelinespec_test.go index bd38a79c89c..9f2655cf83a 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinespec_test.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinespec_test.go @@ -17,6 +17,7 @@ limitations under the License. package resources import ( + "context" "errors" "testing" @@ -49,7 +50,7 @@ func TestGetPipelineSpec_Ref(t *testing.T) { }, } gt := func(n string) (v1alpha1.PipelineInterface, error) { return pipeline, nil } - pipelineMeta, pipelineSpec, err := GetPipelineData(pr, gt) + pipelineMeta, pipelineSpec, err := GetPipelineData(context.Background(), pr, gt) if err != nil { t.Fatalf("Did not expect error getting pipeline spec but got: %s", err) @@ -81,7 +82,7 @@ func TestGetPipelineSpec_Embedded(t *testing.T) { }, } gt := func(n string) (v1alpha1.PipelineInterface, error) { return nil, errors.New("shouldn't be called") } - pipelineMeta, pipelineSpec, err := GetPipelineData(pr, gt) + pipelineMeta, pipelineSpec, err := GetPipelineData(context.Background(), pr, gt) if err != nil { t.Fatalf("Did not expect error getting pipeline spec but got: %s", err) @@ -103,7 +104,7 @@ func TestGetPipelineSpec_Invalid(t *testing.T) { }, } gt := func(n string) (v1alpha1.PipelineInterface, error) { return nil, errors.New("shouldn't be called") } - _, _, err := GetPipelineData(tr, gt) + _, _, err := GetPipelineData(context.Background(), tr, gt) if err == nil { t.Fatalf("Expected error resolving spec with no embedded or referenced pipeline spec but didn't get error") } @@ -121,7 +122,7 @@ func TestGetPipelineSpec_Error(t *testing.T) { }, } gt := func(n string) (v1alpha1.PipelineInterface, error) { return nil, errors.New("something went wrong") } - _, _, err := GetPipelineData(tr, gt) + _, _, err := GetPipelineData(context.Background(), tr, gt) if err == nil { t.Fatalf("Expected error when unable to find referenced Pipeline but got none") } diff --git a/pkg/reconciler/taskrun/resources/apply.go b/pkg/reconciler/taskrun/resources/apply.go index 482a5a78a4f..2618e7d8f43 100644 --- a/pkg/reconciler/taskrun/resources/apply.go +++ b/pkg/reconciler/taskrun/resources/apply.go @@ -40,21 +40,31 @@ func ApplyParameters(spec *v1alpha1.TaskSpec, tr *v1alpha1.TaskRun, defaults ... for _, p := range defaults { if p.Default != nil { if p.Default.Type == v1alpha1.ParamTypeString { + stringReplacements[fmt.Sprintf("params.%s", p.Name)] = p.Default.StringVal + // FIXME(vdemeester) Remove that with deprecating v1alpha1 stringReplacements[fmt.Sprintf("inputs.params.%s", p.Name)] = p.Default.StringVal } else { + arrayReplacements[fmt.Sprintf("params.%s", p.Name)] = p.Default.ArrayVal + // FIXME(vdemeester) Remove that with deprecating v1alpha1 arrayReplacements[fmt.Sprintf("inputs.params.%s", p.Name)] = p.Default.ArrayVal } } } // Set and overwrite params with the ones from the TaskRun - for _, p := range tr.Spec.Inputs.Params { + for _, p := range tr.Spec.Params { if p.Value.Type == v1alpha1.ParamTypeString { + stringReplacements[fmt.Sprintf("params.%s", p.Name)] = p.Value.StringVal + // FIXME(vdemeester) Remove that with deprecating v1alpha1 stringReplacements[fmt.Sprintf("inputs.params.%s", p.Name)] = p.Value.StringVal } else { + arrayReplacements[fmt.Sprintf("params.%s", p.Name)] = p.Value.ArrayVal + // FIXME(vdemeester) Remove that with deprecating v1alpha1 arrayReplacements[fmt.Sprintf("inputs.params.%s", p.Name)] = p.Value.ArrayVal } } + fmt.Println("stringReplacements", stringReplacements) + fmt.Println("arrayReplacements", arrayReplacements) return ApplyReplacements(spec, stringReplacements, arrayReplacements) } @@ -64,18 +74,24 @@ func ApplyResources(spec *v1alpha1.TaskSpec, resolvedResources map[string]v1alph replacements := map[string]string{} for name, r := range resolvedResources { for k, v := range r.Replacements() { + replacements[fmt.Sprintf("resources.%s.%s.%s", replacementStr, name, k)] = v + // FIXME(vdemeester) Remove that with deprecating v1alpha1 replacements[fmt.Sprintf("%s.resources.%s.%s", replacementStr, name, k)] = v } } // We always add replacements for 'path' - if spec.Inputs != nil { - for _, r := range spec.Inputs.Resources { + if spec.Resources != nil && spec.Resources.Inputs != nil { + for _, r := range spec.Resources.Inputs { + replacements[fmt.Sprintf("resources.inputs.%s.path", r.Name)] = v1alpha1.InputResourcePath(r.ResourceDeclaration) + // FIXME(vdemeester) Remove that with deprecating v1alpha1 replacements[fmt.Sprintf("inputs.resources.%s.path", r.Name)] = v1alpha1.InputResourcePath(r.ResourceDeclaration) } } - if spec.Outputs != nil { - for _, r := range spec.Outputs.Resources { + if spec.Resources != nil && spec.Resources.Outputs != nil { + for _, r := range spec.Resources.Outputs { + replacements[fmt.Sprintf("resources.outputs.%s.path", r.Name)] = v1alpha1.OutputResourcePath(r.ResourceDeclaration) + // FIXME(vdemeester) Remove that with deprecating v1alpha1 replacements[fmt.Sprintf("outputs.resources.%s.path", r.Name)] = v1alpha1.OutputResourcePath(r.ResourceDeclaration) } } diff --git a/pkg/reconciler/taskrun/resources/apply_test.go b/pkg/reconciler/taskrun/resources/apply_test.go index 5e468fd802f..65cbf7da3bf 100644 --- a/pkg/reconciler/taskrun/resources/apply_test.go +++ b/pkg/reconciler/taskrun/resources/apply_test.go @@ -160,26 +160,24 @@ var ( }, }, }}, - }, - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "workspace", - }, - }}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "imageToUse-ab", - TargetPath: "/foo/builtImage", - }, - }, { - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "imageToUse-re", - TargetPath: "foo/builtImage", - }, - }}, + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "workspace", + }, + }}, + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "imageToUse-ab", + TargetPath: "/foo/builtImage", + }, + }, { + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "imageToUse-re", + TargetPath: "foo/builtImage", + }, + }}, + }, }, } @@ -190,13 +188,13 @@ var ( Image: "someImage", Args: []string{"$(outputs.resources.bucket.path)"}, }}}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "bucket", - }, - }}, + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "bucket", + }, + }}, + }, }, } @@ -250,85 +248,73 @@ var ( arrayTaskRun0Elements = &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "array-param", - Value: v1alpha1.ArrayOrString{ - Type: v1alpha1.ParamTypeArray, - ArrayVal: []string{}, - }}, - }, + Params: []v1alpha1.Param{{ + Name: "array-param", + Value: v1alpha1.ArrayOrString{ + Type: v1alpha1.ParamTypeArray, + ArrayVal: []string{}, + }}, }, }, } arrayTaskRun1Elements = &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "array-param", - Value: *builder.ArrayOrString("foo"), - }}, - }, + Params: []v1alpha1.Param{{ + Name: "array-param", + Value: *builder.ArrayOrString("foo"), + }}, }, } arrayTaskRun3Elements = &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "array-param", - Value: *builder.ArrayOrString("foo", "bar", "third"), - }}, - }, + Params: []v1alpha1.Param{{ + Name: "array-param", + Value: *builder.ArrayOrString("foo", "bar", "third"), + }}, }, } arrayTaskRunMultipleArrays = &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "array-param", - Value: *builder.ArrayOrString("foo", "bar", "third"), - }, { - Name: "another-array-param", - Value: *builder.ArrayOrString("part1", "part2"), - }}, - }, + Params: []v1alpha1.Param{{ + Name: "array-param", + Value: *builder.ArrayOrString("foo", "bar", "third"), + }, { + Name: "another-array-param", + Value: *builder.ArrayOrString("part1", "part2"), + }}, }, } arrayTaskRunWith1StringParam = &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "array-param", - Value: *builder.ArrayOrString("middlefirst", "middlesecond"), - }, { - Name: "normal-param", - Value: *builder.ArrayOrString("foo"), - }}, - }, + Params: []v1alpha1.Param{{ + Name: "array-param", + Value: *builder.ArrayOrString("middlefirst", "middlesecond"), + }, { + Name: "normal-param", + Value: *builder.ArrayOrString("foo"), + }}, }, } arrayTaskRunMultipleArraysAndStrings = &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "array-param1", - Value: *builder.ArrayOrString("1-param1", "2-param1", "3-param1", "4-param1"), - }, { - Name: "array-param2", - Value: *builder.ArrayOrString("1-param2", "2-param2", "2-param3"), - }, { - Name: "string-param1", - Value: *builder.ArrayOrString("foo"), - }, { - Name: "string-param2", - Value: *builder.ArrayOrString("bar"), - }}, - }, + Params: []v1alpha1.Param{{ + Name: "array-param1", + Value: *builder.ArrayOrString("1-param1", "2-param1", "3-param1", "4-param1"), + }, { + Name: "array-param2", + Value: *builder.ArrayOrString("1-param2", "2-param2", "2-param3"), + }, { + Name: "string-param1", + Value: *builder.ArrayOrString("foo"), + }, { + Name: "string-param2", + Value: *builder.ArrayOrString("bar"), + }}, }, } @@ -486,15 +472,13 @@ func TestApplyArrayParameters(t *testing.T) { func TestApplyParameters(t *testing.T) { tr := &v1alpha1.TaskRun{ Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Params: []v1alpha1.Param{{ - Name: "myimage", - Value: *builder.ArrayOrString("bar"), - }, { - Name: "FOO", - Value: *builder.ArrayOrString("world"), - }}, - }, + Params: []v1alpha1.Param{{ + Name: "myimage", + Value: *builder.ArrayOrString("bar"), + }, { + Name: "FOO", + Value: *builder.ArrayOrString("world"), + }}, }, } dp := []v1alpha1.ParamSpec{{ diff --git a/pkg/reconciler/taskrun/resources/image_exporter.go b/pkg/reconciler/taskrun/resources/image_exporter.go index 6a7784f427d..7b599a12b6e 100644 --- a/pkg/reconciler/taskrun/resources/image_exporter.go +++ b/pkg/reconciler/taskrun/resources/image_exporter.go @@ -38,9 +38,9 @@ func AddOutputImageDigestExporter( ) error { output := []*image.Resource{} - if len(tr.Spec.Outputs.Resources) > 0 { - for _, trb := range tr.Spec.Outputs.Resources { - boundResource, err := getBoundResource(trb.Name, tr.Spec.Outputs.Resources) + if tr.Spec.Resources != nil && len(tr.Spec.Resources.Outputs) > 0 { + for _, trb := range tr.Spec.Resources.Outputs { + boundResource, err := getBoundResource(trb.Name, tr.Spec.Resources.Outputs) if err != nil { return fmt.Errorf("failed to get bound resource: %w while adding output image digest exporter", err) } @@ -54,7 +54,11 @@ func AddOutputImageDigestExporter( if err != nil { return fmt.Errorf("invalid Image Resource for taskRun %q resource %v; error: %w", tr.Name, boundResource, err) } - for _, o := range taskSpec.Outputs.Resources { + if taskSpec.Resources == nil { + // Shouldn't happens as it would be a validation error before + return fmt.Errorf("invalid Image Resource for taskrun %q resource %v; doesn't exists in the task", tr.Name, boundResource) + } + for _, o := range taskSpec.Resources.Outputs { if o.Name == boundResource.Name { if o.TargetPath == "" { imageResource.OutputImageDir = filepath.Join(outputDir, boundResource.Name) @@ -68,6 +72,7 @@ func AddOutputImageDigestExporter( } } + fmt.Println(output) if len(output) > 0 { augmentedSteps := []v1alpha1.Step{} imagesJSON, err := json.Marshal(output) @@ -80,7 +85,6 @@ func AddOutputImageDigestExporter( taskSpec.Steps = augmentedSteps } - } return nil diff --git a/pkg/reconciler/taskrun/resources/image_exporter_test.go b/pkg/reconciler/taskrun/resources/image_exporter_test.go index e635973e1f9..a9ba08e2526 100644 --- a/pkg/reconciler/taskrun/resources/image_exporter_test.go +++ b/pkg/reconciler/taskrun/resources/image_exporter_test.go @@ -45,21 +45,20 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, - }, - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-image", - Type: "image", - }}}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-image", - Type: "image", - }, - }}, + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-image", + Type: "image", + }, + }}, + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-image", + Type: "image", + }, + }}, + }, }, }, }, @@ -69,8 +68,8 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-image", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -78,9 +77,7 @@ func TestAddOutputImageDigestExporter(t *testing.T) { }, }, }}, - }, - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-image", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -114,21 +111,20 @@ func TestAddOutputImageDigestExporter(t *testing.T) { }}, {Container: corev1.Container{ Name: "step2", }}}, - }, - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-image", - Type: "image", - }}}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-image", - Type: "image", - }, - }}, + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-image", + Type: "image", + }, + }}, + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-image", + Type: "image", + }, + }}, + }, }, }, }, @@ -138,8 +134,8 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-image", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -147,9 +143,7 @@ func TestAddOutputImageDigestExporter(t *testing.T) { }, }, }}, - }, - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-image", ResourceRef: &v1alpha1.PipelineResourceRef{ diff --git a/pkg/reconciler/taskrun/resources/input_resource_test.go b/pkg/reconciler/taskrun/resources/input_resource_test.go index 014dfaaa7ee..d4a27ecb7fd 100644 --- a/pkg/reconciler/taskrun/resources/input_resource_test.go +++ b/pkg/reconciler/taskrun/resources/input_resource_test.go @@ -49,72 +49,60 @@ var ( inputResourceInterfaces map[string]v1alpha1.PipelineResourceInterface logger *zap.SugaredLogger - gitInputs = &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "gitspace", - Type: "git", - }}}, - } - multipleGitInputs = &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "gitspace", - Type: "git", - }}, { - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "git-duplicate-space", - Type: "git", - }}, - }, + gitInputs = []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "gitspace", + Type: "git", + }}} + multipleGitInputs = []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "gitspace", + Type: "git", + }}, { + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "git-duplicate-space", + Type: "git", + }}, } - gcsInputs = &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ + gcsInputs = []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "workspace", + Type: "gcs", + TargetPath: "gcs-dir", + }}} + multipleGcsInputs = []v1alpha1.TaskResource{ + { ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "workspace", Type: "gcs", TargetPath: "gcs-dir", - }}}, - } - multipleGcsInputs = &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{ - { - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "workspace", - Type: "gcs", - TargetPath: "gcs-dir", - }, - }, - { - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "workspace2", - Type: "gcs", - TargetPath: "gcs-dir", - }, }, }, - } - clusterInputs = &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "target-cluster", - Type: "cluster", - }}}, - } - optionalGitInputs = &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "gitspace", - Type: "git", - Optional: false, - }}, { + { ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "git-optional-space", - Type: "git", - Optional: true, - }}, + Name: "workspace2", + Type: "gcs", + TargetPath: "gcs-dir", + }, }, } + clusterInputs = []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "target-cluster", + Type: "cluster", + }}} + optionalGitInputs = []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "gitspace", + Type: "git", + Optional: false, + }}, { + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "git-optional-space", + Type: "git", + Optional: true, + }}, + } ) func setUp() { @@ -288,42 +276,49 @@ func setUp() { } func TestAddResourceToTask(t *testing.T) { - task := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: gitInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, + }}, } taskWithMultipleGitSources := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: multipleGitInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: multipleGitInputs, + }, + }}, } taskWithTargetPath := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "task-with-targetpath", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: gcsInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: gcsInputs, + }, + }}, } taskWithOptionalGitSources := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "build-from-repo-with-optional-source", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: optionalGitInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: optionalGitInputs, + }, + }}, } taskRun := &v1alpha1.TaskRun{ @@ -335,8 +330,8 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git", @@ -360,7 +355,6 @@ func TestAddResourceToTask(t *testing.T) { taskRun: taskRun, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-9l9zj", @@ -370,6 +364,9 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, }, }, }, { @@ -384,8 +381,8 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git-with-branch", @@ -398,7 +395,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-9l9zj", @@ -408,6 +404,9 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, }, }, }, { @@ -422,8 +421,8 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git-with-branch", @@ -443,7 +442,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: multipleGitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-mz4c7", @@ -460,6 +458,9 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: multipleGitInputs, + }, }, }, }, { @@ -474,8 +475,8 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git", @@ -488,7 +489,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-9l9zj", @@ -498,6 +498,9 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, }, }, }, { @@ -512,8 +515,8 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git-with-branch", @@ -526,7 +529,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-9l9zj", @@ -536,6 +538,9 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, }, }, }, { @@ -551,8 +556,8 @@ func TestAddResourceToTask(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git", @@ -566,7 +571,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-gitspace-mz4c7", @@ -584,6 +588,9 @@ func TestAddResourceToTask(t *testing.T) { PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ClaimName: "pipelinerun-pvc"}, }, }}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, }, }, }, { @@ -598,8 +605,8 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git-with-sslVerify-false", @@ -612,7 +619,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-sslVerify-false-9l9zj", @@ -622,6 +628,9 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-sslVerify-false"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, }, }, }, { @@ -633,8 +642,8 @@ func TestAddResourceToTask(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "storage1", @@ -647,7 +656,6 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gcsInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-storage1-9l9zj", @@ -666,6 +674,9 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Image: "google/cloud-sdk", }, }}, + Resources: &v1alpha2.TaskResources{ + Inputs: gcsInputs, + }, }, }, }, { @@ -681,8 +692,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "storage1", @@ -696,7 +707,6 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gcsInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-workspace-mz4c7", @@ -714,6 +724,9 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ClaimName: "pipelinerun-pvc"}, }, }}, + Resources: &v1alpha2.TaskResources{ + Inputs: gcsInputs, + }, }, }, }, { @@ -725,8 +738,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "storage-gcs-invalid", @@ -747,8 +760,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "storage-gcs-invalid", @@ -767,15 +780,15 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "workspace-invalid", Type: "git", }}}, }, - }, + }}, }, taskRun: taskRun, wantErr: true, @@ -786,9 +799,11 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: clusterInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: clusterInputs, + }, + }}, }, taskRun: &v1alpha1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ @@ -799,8 +814,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir TaskRef: &v1alpha1.TaskRef{ Name: "build-from-repo", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "target-cluster", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -813,7 +828,6 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: clusterInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "kubeconfig-9l9zj", @@ -823,6 +837,9 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir "-clusterConfig", `{"name":"cluster3","type":"cluster","url":"http://10.10.10.10","revision":"","username":"","password":"","namespace":"namespace1","token":"","Insecure":false,"cadata":"bXktY2EtY2VydAo=","secrets":null}`, }, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: clusterInputs, + }, }, }, }, { @@ -832,9 +849,11 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: clusterInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: clusterInputs, + }, + }}, }, taskRun: &v1alpha1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ @@ -845,8 +864,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir TaskRef: &v1alpha1.TaskRef{ Name: "build-from-repo", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "target-cluster", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -859,7 +878,6 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: clusterInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "kubeconfig-9l9zj", @@ -880,6 +898,9 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "CADATA", }}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: clusterInputs, + }, }, }, }, { @@ -894,8 +915,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git-with-branch", @@ -908,7 +929,6 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: optionalGitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-9l9zj", @@ -918,6 +938,9 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: optionalGitInputs, + }, }, }, }} { @@ -939,20 +962,18 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir } func TestStorageInputResource(t *testing.T) { - gcsStorageInputs := &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "gcs-input-resource", - Type: "storage", - }}}, + gcsStorageInputs := []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "gcs-input-resource", + Type: "storage", + }}, } - optionalStorageInputs := &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "gcs-input-resource", - Type: "storage", - Optional: true, - }}}, + optionalStorageInputs := []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "gcs-input-resource", + Type: "storage", + Optional: true, + }}, } for _, c := range []struct { @@ -964,15 +985,15 @@ func TestStorageInputResource(t *testing.T) { }{{ desc: "inputs with no resource spec and resource ref", task: &v1alpha1.Task{ - Spec: v1alpha1.TaskSpec{ - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "gcs-input-resource", Type: "storage", }}}, }, - }, + }}, }, taskRun: &v1alpha1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ @@ -980,8 +1001,8 @@ func TestStorageInputResource(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "gcs-input-resource", }, @@ -993,9 +1014,11 @@ func TestStorageInputResource(t *testing.T) { }, { desc: "inputs with resource spec and no resource ref", task: &v1alpha1.Task{ - Spec: v1alpha1.TaskSpec{ - Inputs: gcsStorageInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: gcsStorageInputs, + }, + }}, }, taskRun: &v1alpha1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ @@ -1003,8 +1026,8 @@ func TestStorageInputResource(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "gcs-input-resource", ResourceSpec: &v1alpha1.PipelineResourceSpec{ @@ -1024,7 +1047,6 @@ func TestStorageInputResource(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gcsStorageInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-gcs-input-resource-9l9zj", @@ -1043,6 +1065,9 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource Image: "google/cloud-sdk", }, }}, + Resources: &v1alpha2.TaskResources{ + Inputs: gcsStorageInputs, + }, }, }, }, { @@ -1068,9 +1093,11 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource Name: "get-storage", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: gcsStorageInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: gcsStorageInputs, + }, + }}, }, taskRun: &v1alpha1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ @@ -1078,8 +1105,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "gcs-input-resource", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1092,7 +1119,6 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: gcsStorageInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-storage-gcs-keys-9l9zj", @@ -1117,6 +1143,9 @@ gsutil rsync -d -r gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, }, }}, + Resources: &v1alpha2.TaskResources{ + Inputs: gcsStorageInputs, + }, Volumes: []corev1.Volume{{ Name: "volume-storage-gcs-keys-secret-name", VolumeSource: corev1.VolumeSource{Secret: &corev1.SecretVolumeSource{SecretName: "secret-name"}}, @@ -1129,9 +1158,11 @@ gsutil rsync -d -r gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, { desc: "optional inputs with no resource spec and no resource ref", task: &v1alpha1.Task{ - Spec: v1alpha1.TaskSpec{ - Inputs: optionalStorageInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: optionalStorageInputs, + }, + }}, }, taskRun: &v1alpha1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ @@ -1139,17 +1170,19 @@ gsutil rsync -d -r gs://fake-bucket/rules.zip /workspace/gcs-input-resource Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: nil, - Params: nil, + Params: nil, + Resources: &v1alpha2.TaskRunResources{ + Inputs: nil, }, }, }, wantErr: false, want: &v1alpha1.TaskSpec{ - Inputs: optionalStorageInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: nil, + Resources: &v1alpha2.TaskResources{ + Inputs: optionalStorageInputs, + }, }, }, }} { @@ -1174,27 +1207,33 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: gitInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, + }}, } taskWithTargetPath := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "task-with-targetpath", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: gcsInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: gcsInputs, + }, + }}, } taskWithMultipleGcsInputs := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "task-with-multiple-gcs-inputs", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{ - Inputs: multipleGcsInputs, - }, + Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: multipleGcsInputs, + }, + }}, } gcsVolumes := []corev1.Volume{ @@ -1233,8 +1272,8 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "the-git", @@ -1247,7 +1286,6 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }, }, want: &v1alpha1.TaskSpec{ - Inputs: gitInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "artifact-dest-mkdir-gitspace-9l9zj", @@ -1261,6 +1299,9 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Env: gcsEnv, VolumeMounts: gcsVolumeMounts, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gitInputs, + }, Volumes: gcsVolumes, }, }, @@ -1277,8 +1318,8 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "storage1", @@ -1291,7 +1332,6 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }, }, want: &v1alpha1.TaskSpec{ - Inputs: gcsInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "artifact-dest-mkdir-workspace-mssqb", @@ -1305,6 +1345,9 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Env: gcsEnv, VolumeMounts: gcsVolumeMounts, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: gcsInputs, + }, Volumes: gcsVolumes, }, }, @@ -1321,8 +1364,8 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ Name: "storage1", @@ -1343,7 +1386,6 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }, }, want: &v1alpha1.TaskSpec{ - Inputs: multipleGcsInputs, TaskSpec: v1alpha2.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "artifact-dest-mkdir-workspace-vr6ds", @@ -1368,6 +1410,9 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Env: gcsEnv, VolumeMounts: gcsVolumeMounts, }}}, + Resources: &v1alpha2.TaskResources{ + Inputs: multipleGcsInputs, + }, Volumes: gcsVolumes, }, }, @@ -1400,7 +1445,10 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { func mockResolveTaskResources(taskRun *v1alpha1.TaskRun) map[string]v1alpha1.PipelineResourceInterface { resolved := make(map[string]v1alpha1.PipelineResourceInterface) - for _, r := range taskRun.Spec.Inputs.Resources { + if taskRun.Spec.Resources == nil { + return resolved + } + for _, r := range taskRun.Spec.Resources.Inputs { var i v1alpha1.PipelineResourceInterface switch { case r.ResourceRef != nil && r.ResourceRef.Name != "": diff --git a/pkg/reconciler/taskrun/resources/input_resources.go b/pkg/reconciler/taskrun/resources/input_resources.go index 6f139a0ed55..d68ebdfde17 100644 --- a/pkg/reconciler/taskrun/resources/input_resources.go +++ b/pkg/reconciler/taskrun/resources/input_resources.go @@ -53,8 +53,7 @@ func AddInputResource( inputResources map[string]v1alpha1.PipelineResourceInterface, logger *zap.SugaredLogger, ) (*v1alpha1.TaskSpec, error) { - - if taskSpec.Inputs == nil { + if taskSpec == nil || taskSpec.Resources == nil || taskSpec.Resources.Inputs == nil { return taskSpec, nil } taskSpec = taskSpec.DeepCopy() @@ -73,9 +72,15 @@ func AddInputResource( } // Iterate in reverse through the list, each element prepends but we want the first one to remain first. - for i := len(taskSpec.Inputs.Resources) - 1; i >= 0; i-- { - input := taskSpec.Inputs.Resources[i] - boundResource, err := getBoundResource(input.Name, taskRun.Spec.Inputs.Resources) + for i := len(taskSpec.Resources.Inputs) - 1; i >= 0; i-- { + input := taskSpec.Resources.Inputs[i] + if taskRun.Spec.Resources == nil { + if input.Optional { + continue + } + return nil, fmt.Errorf("couldnt find resource named %q, no bounded resources", input.Name) + } + boundResource, err := getBoundResource(input.Name, taskRun.Spec.Resources.Inputs) // Continue if the declared resource is optional and not specified in TaskRun // boundResource is nil if the declared resource in Task does not have any resource specified in the TaskRun if input.Optional && boundResource == nil { diff --git a/pkg/reconciler/taskrun/resources/output_resource.go b/pkg/reconciler/taskrun/resources/output_resource.go index 177a0896906..f1f7ffe82bf 100644 --- a/pkg/reconciler/taskrun/resources/output_resource.go +++ b/pkg/reconciler/taskrun/resources/output_resource.go @@ -53,8 +53,7 @@ func AddOutputResources( outputResources map[string]v1alpha1.PipelineResourceInterface, logger *zap.SugaredLogger, ) (*v1alpha1.TaskSpec, error) { - - if taskSpec == nil || taskSpec.Outputs == nil { + if taskSpec == nil || taskSpec.Resources == nil || taskSpec.Resources.Outputs == nil { return taskSpec, nil } @@ -66,8 +65,14 @@ func AddOutputResources( return nil, err } needsPvc := false - for _, output := range taskSpec.Outputs.Resources { - boundResource, err := getBoundResource(output.Name, taskRun.Spec.Outputs.Resources) + for _, output := range taskSpec.Resources.Outputs { + if taskRun.Spec.Resources == nil { + if output.Optional { + continue + } + return nil, fmt.Errorf("couldnt find resource named %q, no bounded resources", output.Name) + } + boundResource, err := getBoundResource(output.Name, taskRun.Spec.Resources.Outputs) // Continue if the declared resource is optional and not specified in TaskRun // boundResource is nil if the declared resource in Task does not have any resource specified in the TaskRun if output.Optional && boundResource == nil { diff --git a/pkg/reconciler/taskrun/resources/output_resource_test.go b/pkg/reconciler/taskrun/resources/output_resource_test.go index 1e22b80d729..210ab80eac4 100644 --- a/pkg/reconciler/taskrun/resources/output_resource_test.go +++ b/pkg/reconciler/taskrun/resources/output_resource_test.go @@ -21,6 +21,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/apis/resource" "github.com/tektoncd/pipeline/pkg/artifacts" "github.com/tektoncd/pipeline/pkg/logging" @@ -121,8 +122,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -130,9 +131,7 @@ func TestValidOutputResources(t *testing.T) { }, }, }}, - }, - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -150,19 +149,19 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -211,8 +210,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -230,12 +229,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -284,8 +285,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -303,12 +304,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "image", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "image", + }}}, + }, }, }, }, @@ -327,8 +330,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -345,12 +348,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -372,8 +377,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -381,9 +386,7 @@ func TestValidOutputResources(t *testing.T) { }, }, }}, - }, - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -401,20 +404,20 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - TargetPath: "faraway-disk", - }}}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + TargetPath: "faraway-disk", + }}}, + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + }}}, + }, }, }, }, @@ -480,8 +483,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -499,12 +502,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + }}}, + }, }, }, }, @@ -563,8 +568,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -582,12 +587,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + }}}, + }, }, }, }, @@ -625,8 +632,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -643,12 +650,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + }}}, + }, }, }, }, @@ -690,8 +699,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -708,12 +717,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "image", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "image", + }}}, + }, }, }, }, @@ -735,8 +746,8 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -753,13 +764,15 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "image", - TargetPath: "/workspace", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "image", + TargetPath: "/workspace", + }}}, + }, }, }, }, @@ -776,8 +789,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -794,12 +807,14 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "image", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "image", + }}}, + }, }, }, }, @@ -816,8 +831,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -841,16 +856,18 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "image", - }}, { - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace-1", - Type: "image", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "image", + }}, { + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace-1", + Type: "image", + }}}, + }, }, }, }, @@ -905,8 +922,8 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Inputs: v1alpha1.TaskRunInputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -914,9 +931,7 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { }, }, }}, - }, - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -934,19 +949,19 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Inputs: &v1alpha1.Inputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, - }, - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Inputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -973,8 +988,8 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -992,12 +1007,14 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -1020,8 +1037,8 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1038,12 +1055,14 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -1114,12 +1133,14 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + }}}, + }, }, }, }, @@ -1133,8 +1154,8 @@ func TestInvalidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1155,12 +1176,14 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + }}}, + }, }, }, }, @@ -1183,8 +1206,8 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Outputs: v1alpha1.TaskRunOutputs{ - Resources: []v1alpha1.TaskResourceBinding{{ + Resources: &v1alpha2.TaskRunResources{ + Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1201,12 +1224,14 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ - ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "storage", - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "storage", + }}}, + }, }, }, }, @@ -1219,12 +1244,14 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - Optional: true, - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + Optional: true, + }}}, + }, }, }, }, @@ -1247,12 +1274,14 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - Outputs: &v1alpha1.Outputs{ - Resources: []v1alpha1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ - Name: "source-workspace", - Type: "git", - Optional: false, - }}}, + TaskSpec: v1alpha2.TaskSpec{ + Resources: &v1alpha2.TaskResources{ + Outputs: []v1alpha1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source-workspace", + Type: "git", + Optional: false, + }}}, + }, }, }, }, @@ -1281,7 +1310,10 @@ func TestInvalidOutputResources(t *testing.T) { func resolveOutputResources(taskRun *v1alpha1.TaskRun) map[string]v1alpha1.PipelineResourceInterface { resolved := make(map[string]v1alpha1.PipelineResourceInterface) - for _, r := range taskRun.Spec.Outputs.Resources { + if taskRun.Spec.Resources == nil { + return resolved + } + for _, r := range taskRun.Spec.Resources.Outputs { var i v1alpha1.PipelineResourceInterface if name := r.ResourceRef.Name; name != "" { i = outputResources[name] diff --git a/pkg/reconciler/taskrun/resources/taskresourceresolution.go b/pkg/reconciler/taskrun/resources/taskresourceresolution.go index 880490a19c1..31546992cd7 100644 --- a/pkg/reconciler/taskrun/resources/taskresourceresolution.go +++ b/pkg/reconciler/taskrun/resources/taskresourceresolution.go @@ -21,6 +21,7 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -44,7 +45,7 @@ type GetResource func(string) (*v1alpha1.PipelineResource, error) // ResolveTaskResources looks up PipelineResources referenced by inputs and outputs and returns // a structure that unites the resolved references and the Task Spec. If referenced PipelineResources // can't be found, an error is returned. -func ResolveTaskResources(ts *v1alpha1.TaskSpec, taskName string, kind v1alpha1.TaskKind, inputs []v1alpha1.TaskResourceBinding, outputs []v1alpha1.TaskResourceBinding, gr GetResource) (*ResolvedTaskResources, error) { +func ResolveTaskResources(ts *v1alpha1.TaskSpec, taskName string, kind v1alpha1.TaskKind, inputs []v1alpha2.TaskResourceBinding, outputs []v1alpha2.TaskResourceBinding, gr GetResource) (*ResolvedTaskResources, error) { rtr := ResolvedTaskResources{ TaskName: taskName, TaskSpec: ts, diff --git a/pkg/reconciler/taskrun/resources/taskspec.go b/pkg/reconciler/taskrun/resources/taskspec.go index 049ccb537d4..b2d19f09660 100644 --- a/pkg/reconciler/taskrun/resources/taskspec.go +++ b/pkg/reconciler/taskrun/resources/taskspec.go @@ -17,9 +17,12 @@ limitations under the License. package resources import ( + "context" "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/contexts" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -33,7 +36,7 @@ type GetClusterTask func(name string) (v1alpha1.TaskInterface, error) // GetTaskData will retrieve the Task metadata and Spec associated with the // provided TaskRun. This can come from a reference Task or from the TaskRun's // metadata and embedded TaskSpec. -func GetTaskData(taskRun *v1alpha1.TaskRun, getTask GetTask) (*metav1.ObjectMeta, *v1alpha1.TaskSpec, error) { +func GetTaskData(ctx context.Context, taskRun *v1alpha1.TaskRun, getTask GetTask) (*metav1.ObjectMeta, *v1alpha1.TaskSpec, error) { taskMeta := metav1.ObjectMeta{} taskSpec := v1alpha1.TaskSpec{} switch { @@ -45,6 +48,11 @@ func GetTaskData(taskRun *v1alpha1.TaskRun, getTask GetTask) (*metav1.ObjectMeta } taskMeta = t.TaskMetadata() taskSpec = t.TaskSpec() + taskSpec.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) + + if err := taskSpec.ConvertUp(ctx, &v1alpha2.TaskSpec{}); err != nil { + return nil, nil, err + } case taskRun.Spec.TaskSpec != nil: taskMeta = taskRun.ObjectMeta taskSpec = *taskRun.Spec.TaskSpec diff --git a/pkg/reconciler/taskrun/resources/taskspec_test.go b/pkg/reconciler/taskrun/resources/taskspec_test.go index 9a95ebd7c5d..a5f74996211 100644 --- a/pkg/reconciler/taskrun/resources/taskspec_test.go +++ b/pkg/reconciler/taskrun/resources/taskspec_test.go @@ -17,6 +17,7 @@ limitations under the License. package resources import ( + "context" "errors" "testing" @@ -48,7 +49,7 @@ func TestGetTaskSpec_Ref(t *testing.T) { }, } gt := func(n string) (v1alpha1.TaskInterface, error) { return task, nil } - taskMeta, taskSpec, err := GetTaskData(tr, gt) + taskMeta, taskSpec, err := GetTaskData(context.Background(), tr, gt) if err != nil { t.Fatalf("Did not expect error getting task spec but got: %s", err) @@ -77,7 +78,7 @@ func TestGetTaskSpec_Embedded(t *testing.T) { }, } gt := func(n string) (v1alpha1.TaskInterface, error) { return nil, errors.New("shouldn't be called") } - taskMeta, taskSpec, err := GetTaskData(tr, gt) + taskMeta, taskSpec, err := GetTaskData(context.Background(), tr, gt) if err != nil { t.Fatalf("Did not expect error getting task spec but got: %s", err) @@ -99,7 +100,7 @@ func TestGetTaskSpec_Invalid(t *testing.T) { }, } gt := func(n string) (v1alpha1.TaskInterface, error) { return nil, errors.New("shouldn't be called") } - _, _, err := GetTaskData(tr, gt) + _, _, err := GetTaskData(context.Background(), tr, gt) if err == nil { t.Fatalf("Expected error resolving spec with no embedded or referenced task spec but didn't get error") } @@ -117,7 +118,7 @@ func TestGetTaskSpec_Error(t *testing.T) { }, } gt := func(n string) (v1alpha1.TaskInterface, error) { return nil, errors.New("something went wrong") } - _, _, err := GetTaskData(tr, gt) + _, _, err := GetTaskData(context.Background(), tr, gt) if err == nil { t.Fatalf("Expected error when unable to find referenced Task but got none") } diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index cb347e57706..e0ef3b694e0 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -27,6 +27,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/apis/resource" listers "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" resourcelisters "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" @@ -231,6 +232,14 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error // and may not have had all of the assumed default specified. tr.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) + if err := tr.ConvertUp(ctx, &v1alpha2.TaskRun{}); err != nil { + if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + tr.Status.MarkResourceNotConvertible(ce) + return nil + } + return err + } + // If the taskrun is cancelled, kill resources and update status if tr.IsCancelled() { before := tr.Status.GetCondition(apis.ConditionSucceeded) @@ -241,8 +250,12 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error } getTaskFunc, kind := c.getTaskFunc(tr) - taskMeta, taskSpec, err := resources.GetTaskData(tr, getTaskFunc) + taskMeta, taskSpec, err := resources.GetTaskData(ctx, tr, getTaskFunc) if err != nil { + if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + tr.Status.MarkResourceNotConvertible(ce) + return nil + } c.Logger.Errorf("Failed to determine Task spec to use for taskrun %s: %v", tr.Name, err) tr.Status.SetCondition(&apis.Condition{ Type: apis.ConditionSucceeded, @@ -284,7 +297,13 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error return nil } - rtr, err := resources.ResolveTaskResources(taskSpec, taskMeta.Name, kind, tr.Spec.Inputs.Resources, tr.Spec.Outputs.Resources, c.resourceLister.PipelineResources(tr.Namespace).Get) + inputs := []v1alpha2.TaskResourceBinding{} + outputs := []v1alpha2.TaskResourceBinding{} + if tr.Spec.Resources != nil { + inputs = tr.Spec.Resources.Inputs + outputs = tr.Spec.Resources.Outputs + } + rtr, err := resources.ResolveTaskResources(taskSpec, taskMeta.Name, kind, inputs, outputs, c.resourceLister.PipelineResources(tr.Namespace).Get) if err != nil { c.Logger.Errorf("Failed to resolve references for taskrun %s: %v", tr.Name, err) tr.Status.SetCondition(&apis.Condition{ @@ -296,7 +315,7 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error return nil } - if err := ValidateResolvedTaskResources(tr.Spec.Inputs.Params, rtr); err != nil { + if err := ValidateResolvedTaskResources(tr.Spec.Params, rtr); err != nil { c.Logger.Errorf("TaskRun %q resources are invalid: %v", tr.Name, err) tr.Status.SetCondition(&apis.Condition{ Type: apis.ConditionSucceeded, @@ -503,7 +522,6 @@ func (c *Reconciler) createPod(tr *v1alpha1.TaskRun, rtr *resources.ResolvedTask } // Get actual resource - err = resources.AddOutputImageDigestExporter(c.Images.ImageDigestExporterImage, tr, ts, c.resourceLister.PipelineResources(tr.Namespace).Get) if err != nil { c.Logger.Errorf("Failed to create a pod for taskrun: %s due to output image resource error %v", tr.Name, err) @@ -523,8 +541,8 @@ func (c *Reconciler) createPod(tr *v1alpha1.TaskRun, rtr *resources.ResolvedTask } var defaults []v1alpha1.ParamSpec - if ts.Inputs != nil { - defaults = append(defaults, ts.Inputs.Params...) + if len(ts.Params) > 0 { + defaults = append(defaults, ts.Params...) } // Apply parameter substitution from the taskrun. ts = resources.ApplyParameters(ts, tr, defaults...) diff --git a/pkg/reconciler/taskrun/validate_resources.go b/pkg/reconciler/taskrun/validate_resources.go index a5137a30493..567dbfa3097 100644 --- a/pkg/reconciler/taskrun/validate_resources.go +++ b/pkg/reconciler/taskrun/validate_resources.go @@ -20,25 +20,12 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/list" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" ) -func validateInputResources(inputs *v1alpha1.Inputs, providedResources map[string]*v1alpha1.PipelineResource) error { - if inputs != nil { - return validateResources(inputs.Resources, providedResources) - } - return validateResources([]v1alpha1.TaskResource{}, providedResources) -} - -func validateOutputResources(outputs *v1alpha1.Outputs, providedResources map[string]*v1alpha1.PipelineResource) error { - if outputs != nil { - return validateResources(outputs.Resources, providedResources) - } - return validateResources([]v1alpha1.TaskResource{}, providedResources) -} - -func validateResources(requiredResources []v1alpha1.TaskResource, providedResources map[string]*v1alpha1.PipelineResource) error { +func validateResources(requiredResources []v1alpha2.TaskResource, providedResources map[string]*v1alpha1.PipelineResource) error { required := make([]string, 0, len(requiredResources)) optional := make([]string, 0, len(requiredResources)) for _, resource := range requiredResources { @@ -77,15 +64,13 @@ func validateResources(requiredResources []v1alpha1.TaskResource, providedResour return nil } -func validateParams(inputs *v1alpha1.Inputs, params []v1alpha1.Param) error { +func validateParams(paramSpecs []v1alpha2.ParamSpec, params []v1alpha1.Param) error { var neededParams []string paramTypes := make(map[string]v1alpha1.ParamType) - if inputs != nil { - neededParams = make([]string, 0, len(inputs.Params)) - for _, inputResourceParam := range inputs.Params { - neededParams = append(neededParams, inputResourceParam.Name) - paramTypes[inputResourceParam.Name] = inputResourceParam.Type - } + neededParams = make([]string, 0, len(paramSpecs)) + for _, inputResourceParam := range paramSpecs { + neededParams = append(neededParams, inputResourceParam.Name) + paramTypes[inputResourceParam.Name] = inputResourceParam.Type } providedParams := make([]string, 0, len(params)) for _, param := range params { @@ -94,7 +79,7 @@ func validateParams(inputs *v1alpha1.Inputs, params []v1alpha1.Param) error { missingParams := list.DiffLeft(neededParams, providedParams) var missingParamsNoDefaults []string for _, param := range missingParams { - for _, inputResourceParam := range inputs.Params { + for _, inputResourceParam := range paramSpecs { if inputResourceParam.Name == param && inputResourceParam.Default == nil { missingParamsNoDefaults = append(missingParamsNoDefaults, param) } @@ -125,13 +110,19 @@ func validateParams(inputs *v1alpha1.Inputs, params []v1alpha1.Param) error { // ValidateResolvedTaskResources validates task inputs, params and output matches taskrun func ValidateResolvedTaskResources(params []v1alpha1.Param, rtr *resources.ResolvedTaskResources) error { - if err := validateParams(rtr.TaskSpec.Inputs, params); err != nil { + if err := validateParams(rtr.TaskSpec.Params, params); err != nil { return fmt.Errorf("invalid input params: %w", err) } - if err := validateInputResources(rtr.TaskSpec.Inputs, rtr.Inputs); err != nil { + inputs := []v1alpha2.TaskResource{} + outputs := []v1alpha2.TaskResource{} + if rtr.TaskSpec.Resources != nil { + inputs = rtr.TaskSpec.Resources.Inputs + outputs = rtr.TaskSpec.Resources.Outputs + } + if err := validateResources(inputs, rtr.Inputs); err != nil { return fmt.Errorf("invalid input resources: %w", err) } - if err := validateOutputResources(rtr.TaskSpec.Outputs, rtr.Outputs); err != nil { + if err := validateResources(outputs, rtr.Outputs); err != nil { return fmt.Errorf("invalid output resources: %w", err) } diff --git a/pkg/reconciler/taskrun/validate_resources_test.go b/pkg/reconciler/taskrun/validate_resources_test.go index 10550360a09..a71ed8c5d41 100644 --- a/pkg/reconciler/taskrun/validate_resources_test.go +++ b/pkg/reconciler/taskrun/validate_resources_test.go @@ -29,13 +29,11 @@ func TestValidateResolvedTaskResources_ValidResources(t *testing.T) { rtr := tb.ResolvedTaskResources( tb.ResolvedTaskResourcesTaskSpec( tb.Step("myimage", tb.StepCommand("mycmd")), - tb.TaskInputs( - tb.InputsResource("resource-to-build", v1alpha1.PipelineResourceTypeGit), - tb.InputsResource("optional-resource-to-build", v1alpha1.PipelineResourceTypeGit, tb.ResourceOptional(true)), - ), - tb.TaskOutputs( - tb.OutputsResource("resource-to-provide", v1alpha1.PipelineResourceTypeImage), - tb.OutputsResource("optional-resource-to-provide", v1alpha1.PipelineResourceTypeImage, tb.ResourceOptional(true)), + tb.TaskResources( + tb.TaskResourcesInput("resource-to-build", v1alpha1.PipelineResourceTypeGit), + tb.TaskResourcesInput("optional-resource-to-build", v1alpha1.PipelineResourceTypeGit, tb.ResourceOptional(true)), + tb.TaskResourcesOutput("resource-to-provide", v1alpha1.PipelineResourceTypeImage), + tb.TaskResourcesOutput("optional-resource-to-provide", v1alpha1.PipelineResourceTypeImage, tb.ResourceOptional(true)), ), ), tb.ResolvedTaskResourcesInputs("resource-to-build", tb.PipelineResource("example-resource", "foo", @@ -60,7 +58,8 @@ func TestValidateResolvedTaskResources_ValidResources(t *testing.T) { func TestValidateResolvedTaskResources_ValidParams(t *testing.T) { rtr := tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( tb.Step("myimage", tb.StepCommand("mycmd")), - tb.TaskInputs(tb.InputsParamSpec("foo", v1alpha1.ParamTypeString), tb.InputsParamSpec("bar", v1alpha1.ParamTypeString)), + tb.TaskParam("foo", v1alpha1.ParamTypeString), + tb.TaskParam("bar", v1alpha1.ParamTypeString), )) p := []v1alpha1.Param{{ Name: "foo", @@ -123,81 +122,90 @@ func TestValidateResolvedTaskResources_InvalidResources(t *testing.T) { }{{ name: "bad-inputkey", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("testinput", v1alpha1.PipelineResourceTypeGit)), + tb.TaskResources(tb.TaskResourcesInput("testinput", v1alpha1.PipelineResourceTypeGit)), + // tb.TaskResources(tb.TaskResourcesInput()), ), tb.ResolvedTaskResourcesInputs("wrong-resource-name", r)), }, { name: "bad-outputkey", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskOutputs(tb.OutputsResource("testoutput", v1alpha1.PipelineResourceTypeGit)), + tb.TaskResources(tb.TaskResourcesOutput("testoutput", v1alpha1.PipelineResourceTypeGit)), ), tb.ResolvedTaskResourcesOutputs("wrong-resource-name", r)), }, { name: "input-resource-mismatch", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("testimageinput", v1alpha1.PipelineResourceTypeImage)), + tb.TaskResources(tb.TaskResourcesInput("testimageinput", v1alpha1.PipelineResourceTypeImage)), ), tb.ResolvedTaskResourcesInputs("testimageinput", r)), }, { name: "input-resource-missing", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("testimageinput", v1alpha1.PipelineResourceTypeImage)), + tb.TaskResources(tb.TaskResourcesInput("testimageinput", v1alpha1.PipelineResourceTypeImage)), )), }, { name: "output-resource-mismatch", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskOutputs(tb.OutputsResource("testimageoutput", v1alpha1.PipelineResourceTypeImage)), + tb.TaskResources(tb.TaskResourcesOutput("testimageoutput", v1alpha1.PipelineResourceTypeImage)), ), tb.ResolvedTaskResourcesOutputs("testimageoutput", r)), }, { name: "output-resource-missing", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskOutputs(tb.OutputsResource("testimageoutput", v1alpha1.PipelineResourceTypeImage)), + tb.TaskResources(tb.TaskResourcesOutput("testimageoutput", v1alpha1.PipelineResourceTypeImage)), )), }, { name: "extra-input-resource", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("testoutput", v1alpha1.PipelineResourceTypeGit))), + tb.TaskResources(tb.TaskResourcesInput("testoutput", v1alpha1.PipelineResourceTypeGit))), tb.ResolvedTaskResourcesInputs("testoutput", r), tb.ResolvedTaskResourcesInputs("someextrainput", r), ), }, { name: "extra-output-resource", - rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskOutputs(tb.OutputsResource("testoutput", v1alpha1.PipelineResourceTypeGit))), + rtr: tb.ResolvedTaskResources( + tb.ResolvedTaskResourcesTaskSpec( + tb.TaskResources(tb.TaskResourcesOutput("testoutput", v1alpha1.PipelineResourceTypeGit)), + ), tb.ResolvedTaskResourcesOutputs("testoutput", r), tb.ResolvedTaskResourcesOutputs("someextraoutput", r), ), }, { name: "extra-input-resource-none-required", - rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskOutputs(tb.OutputsResource("testoutput", v1alpha1.PipelineResourceTypeGit))), + rtr: tb.ResolvedTaskResources( + tb.ResolvedTaskResourcesTaskSpec( + tb.TaskResources(tb.TaskResourcesOutput("testoutput", v1alpha1.PipelineResourceTypeGit)), + ), tb.ResolvedTaskResourcesOutputs("testoutput", r), tb.ResolvedTaskResourcesInputs("someextrainput", r), ), }, { name: "extra-output-resource-none-required", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("testinput", v1alpha1.PipelineResourceTypeGit))), + tb.TaskResources(tb.TaskResourcesInput("testinput", v1alpha1.PipelineResourceTypeGit))), tb.ResolvedTaskResourcesInputs("testinput", r), tb.ResolvedTaskResourcesOutputs("someextraoutput", r), ), }, { name: "required-input-resource-missing", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("requiredgitinput", v1alpha1.PipelineResourceTypeGit, + tb.TaskResources(tb.TaskResourcesInput("requiredgitinput", v1alpha1.PipelineResourceTypeGit, tb.ResourceOptional(false)))), ), }, { name: "required-output-resource-missing", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskOutputs(tb.OutputsResource("requiredgitoutput", v1alpha1.PipelineResourceTypeGit, - tb.ResourceOptional(false)))), + tb.TaskResources(tb.TaskResourcesOutput( + "requiredgitoutput", v1alpha1.PipelineResourceTypeGit, + tb.ResourceOptional(false)), + )), ), }, { name: "required-input-and-output-resource-missing", rtr: tb.ResolvedTaskResources(tb.ResolvedTaskResourcesTaskSpec( - tb.TaskInputs(tb.InputsResource("requiredimageinput", v1alpha1.PipelineResourceTypeImage, - tb.ResourceOptional(false))), - tb.TaskOutputs(tb.OutputsResource("requiredimageoutput", v1alpha1.PipelineResourceTypeImage, - tb.ResourceOptional(false)))), - ), + tb.TaskResources( + tb.TaskResourcesInput("requiredimageinput", v1alpha1.PipelineResourceTypeImage, + tb.ResourceOptional(false)), + tb.TaskResourcesOutput("requiredimageoutput", v1alpha1.PipelineResourceTypeImage, + tb.ResourceOptional(false)), + ), + )), }} for _, tc := range tcs { diff --git a/test/builder/task.go b/test/builder/task.go index d7652666b25..78e9d6debe8 100644 --- a/test/builder/task.go +++ b/test/builder/task.go @@ -21,6 +21,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,6 +37,9 @@ type ClusterTaskOp func(*v1alpha1.ClusterTask) // TaskSpeOp is an operation which modify a TaskSpec struct. type TaskSpecOp func(*v1alpha1.TaskSpec) +// TaskResourcesOp is an operation which modify a TaskResources struct. +type TaskResourcesOp func(*v1alpha2.TaskResources) + // InputsOp is an operation which modify an Inputs struct. type InputsOp func(*v1alpha1.Inputs) @@ -48,6 +52,9 @@ type TaskRunOp func(*v1alpha1.TaskRun) // TaskRunSpecOp is an operation which modify a TaskRunSpec struct. type TaskRunSpecOp func(*v1alpha1.TaskRunSpec) +// TaskRunResourcesOp is an operation which modify a TaskRunResources struct. +type TaskRunResourcesOp func(*v1alpha2.TaskRunResources) + // TaskResourceOp is an operation which modify a TaskResource struct. type TaskResourceOp func(*v1alpha1.TaskResource) @@ -211,6 +218,60 @@ func VolumeSource(s corev1.VolumeSource) VolumeOp { } } +// TaskParam sets the Params to the TaskSpec +func TaskParam(name string, pt v1alpha1.ParamType, ops ...ParamSpecOp) TaskSpecOp { + return func(spec *v1alpha1.TaskSpec) { + ps := &v1alpha1.ParamSpec{Name: name, Type: pt} + for _, op := range ops { + op(ps) + } + spec.Params = append(spec.Params, *ps) + } +} + +// TaskResources sets the Resources to the TaskSpec +func TaskResources(ops ...TaskResourcesOp) TaskSpecOp { + return func(spec *v1alpha1.TaskSpec) { + r := &v1alpha2.TaskResources{} + for _, op := range ops { + op(r) + } + spec.Resources = r + } +} + +// TaskResourcesInput adds a TaskResource as Inputs to the TaskResources +func TaskResourcesInput(name string, resourceType v1alpha1.PipelineResourceType, ops ...TaskResourceOp) TaskResourcesOp { + return func(r *v1alpha2.TaskResources) { + i := &v1alpha2.TaskResource{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: name, + Type: resourceType, + }, + } + for _, op := range ops { + op(i) + } + r.Inputs = append(r.Inputs, *i) + } +} + +// TaskResourcesOutput adds a TaskResource as Outputs to the TaskResources +func TaskResourcesOutput(name string, resourceType v1alpha1.PipelineResourceType, ops ...TaskResourceOp) TaskResourcesOp { + return func(r *v1alpha2.TaskResources) { + o := &v1alpha2.TaskResource{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: name, + Type: resourceType, + }, + } + for _, op := range ops { + op(o) + } + r.Outputs = append(r.Outputs, *o) + } +} + // TaskInputs sets inputs to the TaskSpec. // Any number of Inputs modifier can be passed to transform it. func TaskInputs(ops ...InputsOp) TaskSpecOp { @@ -546,6 +607,7 @@ func TaskRunSelfLink(selflink string) TaskRunOp { func TaskRunSpec(ops ...TaskRunSpecOp) TaskRunOp { return func(tr *v1alpha1.TaskRun) { spec := &tr.Spec + spec.Resources = &v1alpha2.TaskRunResources{} // Set a default timeout spec.Timeout = &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute} for _, op := range ops { @@ -613,6 +675,58 @@ func TaskRunServiceAccountName(sa string) TaskRunSpecOp { } } +// TaskRunParam sets the Params to the TaskSpec +func TaskRunParam(name, value string, additionalValues ...string) TaskRunSpecOp { + arrayOrString := ArrayOrString(value, additionalValues...) + return func(spec *v1alpha1.TaskRunSpec) { + spec.Params = append(spec.Params, v1alpha1.Param{ + Name: name, + Value: *arrayOrString, + }) + } +} + +// TaskRunResources sets the TaskRunResources to the TaskRunSpec +func TaskRunResources(ops ...TaskRunResourcesOp) TaskRunSpecOp { + return func(spec *v1alpha1.TaskRunSpec) { + r := &v1alpha2.TaskRunResources{} + for _, op := range ops { + op(r) + } + spec.Resources = r + } +} + +// TaskRunResourcesInput adds a TaskRunResource as Inputs to the TaskRunResources +func TaskRunResourcesInput(name string, ops ...TaskResourceBindingOp) TaskRunResourcesOp { + return func(r *v1alpha2.TaskRunResources) { + binding := &v1alpha1.TaskResourceBinding{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + Name: name, + }, + } + for _, op := range ops { + op(binding) + } + r.Inputs = append(r.Inputs, *binding) + } +} + +// TaskRunResourcesOutput adds a TaskRunResource as Outputs to the TaskRunResources +func TaskRunResourcesOutput(name string, ops ...TaskResourceBindingOp) TaskRunResourcesOp { + return func(r *v1alpha2.TaskRunResources) { + binding := &v1alpha1.TaskResourceBinding{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + Name: name, + }, + } + for _, op := range ops { + op(binding) + } + r.Outputs = append(r.Outputs, *binding) + } +} + // TaskRunInputs sets inputs to the TaskRunSpec. // Any number of TaskRunInputs modifier can be passed to transform it. func TaskRunInputs(ops ...TaskRunInputsOp) TaskRunSpecOp { diff --git a/test/builder/task_test.go b/test/builder/task_test.go index e00fc015516..8dde503d36b 100644 --- a/test/builder/task_test.go +++ b/test/builder/task_test.go @@ -265,7 +265,8 @@ func TestTaskRunWithTaskRef(t *testing.T) { Paths: []string{"output-folder"}, }}, }, - Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + Resources: &v1alpha2.TaskRunResources{}, + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, TaskRef: &v1alpha1.TaskRef{ Name: "task-output", Kind: v1alpha1.ClusterTaskKind, @@ -343,6 +344,7 @@ func TestTaskRunWithTaskSpec(t *testing.T) { Params: nil, }, }, + Resources: &v1alpha2.TaskRunResources{}, ServiceAccountName: "sa", Status: v1alpha1.TaskRunSpecStatusCancelled, Timeout: &metav1.Duration{Duration: 2 * time.Minute}, @@ -394,6 +396,7 @@ func TestTaskRunWithPodTemplate(t *testing.T) { "label": "value", }, }, + Resources: &v1alpha2.TaskRunResources{}, ServiceAccountName: "sa", Status: v1alpha1.TaskRunSpecStatusCancelled, Timeout: &metav1.Duration{Duration: 2 * time.Minute}, From 5b60eb808251bddaa24c8f343c7c5adaa2f153d4 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 19 Feb 2020 08:45:01 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Add=20v1alpha2=20yaml=20tests=20?= =?UTF-8?q?=F0=9F=90=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - move current examples in `examples/v1alpha1` - copy and migrate those examples for `v1alpha1` (in `examples/v1alpha2`) Signed-off-by: Vincent Demeester --- .../pipelineruns/clustertask-pipelinerun.yaml | 0 ...l-pipelinerun-with-optional-resources.yaml | 0 .../pipelineruns/conditional-pipelinerun.yaml | 0 .../pipelineruns/demo-optional-resources.yaml | 0 .../{ => v1alpha1}/pipelineruns/no-ci/.keep | 0 .../pipelineruns/no-ci/limitrange.yaml | 0 .../pipelineruns/no-ci/pipeline-timeout.yaml | 0 .../pipelineruns/output-pipelinerun.yaml | 0 ...inerun-with-pipelinespec-and-taskspec.yaml | 0 .../pipelinerun-with-pipelinespec.yaml | 0 .../pipelinerun-with-resourcespec.yaml | 0 .../pipelineruns/pipelinerun.yaml | 0 .../pipelineruns/workspaces.yaml | 0 .../taskruns/build-gcs-targz.yaml | 0 .../taskruns/build-gcs-zip.yaml | 0 .../taskruns/build-push-kaniko.yaml | 0 .../{ => v1alpha1}/taskruns/cloud-event.yaml | 0 .../{ => v1alpha1}/taskruns/clustertask.yaml | 0 .../{ => v1alpha1}/taskruns/configmap.yaml | 0 .../{ => v1alpha1}/taskruns/custom-env.yaml | 0 .../taskruns/custom-volume.yaml | 0 .../{ => v1alpha1}/taskruns/dind-sidecar.yaml | 0 .../{ => v1alpha1}/taskruns/docker-creds.yaml | 0 .../{ => v1alpha1}/taskruns/gcs-resource.yaml | 0 .../{ => v1alpha1}/taskruns/git-resource.yaml | 0 .../taskruns/git-ssh-creds.yaml | 0 .../{ => v1alpha1}/taskruns/git-volume.yaml | 0 .../{ => v1alpha1}/taskruns/home-is-set.yaml | 0 .../{ => v1alpha1}/taskruns/home-volume.yaml | 0 examples/{ => v1alpha1}/taskruns/no-ci/.keep | 0 .../taskruns/no-ci/limitrange.yaml | 0 .../optional-resources-with-clustertask.yaml | 0 .../taskruns/optional-resources.yaml | 0 .../taskruns/pull-private-image.yaml | 0 .../{ => v1alpha1}/taskruns/pullrequest.yaml | 0 .../{ => v1alpha1}/taskruns/secret-env.yaml | 0 .../taskruns/secret-volume-params.yaml | 0 .../taskruns/secret-volume.yaml | 0 .../taskruns/sidecar-interp.yaml | 0 .../taskruns/sidecar-ready-script.yaml | 0 .../taskruns/sidecar-ready.yaml | 0 .../taskruns/step-by-digest.yaml | 0 .../{ => v1alpha1}/taskruns/step-script.yaml | 0 .../taskruns/steps-run-in-order.yaml | 0 .../taskruns/steptemplate-env-merge.yaml | 0 .../taskruns/task-multiple-output-image.yaml | 0 .../taskruns/task-output-image.yaml | 0 .../{ => v1alpha1}/taskruns/task-result.yaml | 0 .../taskruns/task-volume-args.yaml | 0 .../taskruns/template-volume.yaml | 0 .../taskruns/unnamed-steps.yaml | 0 .../{ => v1alpha1}/taskruns/workingdir.yaml | 0 .../taskruns/workspace-readonly.yaml | 0 .../taskruns/workspace-volume.yaml | 0 .../{ => v1alpha1}/taskruns/workspace.yaml | 0 .../pipelineruns/clustertask-pipelinerun.yaml | 30 ++ ...l-pipelinerun-with-optional-resources.yaml | 85 ++++++ .../pipelineruns/conditional-pipelinerun.yaml | 94 +++++++ .../pipelineruns/demo-optional-resources.yaml | 127 +++++++++ examples/v1alpha2/pipelineruns/no-ci/.keep | 0 .../pipelineruns/no-ci/limitrange.yaml | 57 ++++ .../pipelineruns/no-ci/pipeline-timeout.yaml | 55 ++++ .../pipelineruns/output-pipelinerun.yaml | 104 +++++++ ...inerun-with-pipelinespec-and-taskspec.yaml | 79 ++++++ .../pipelinerun-with-pipelinespec.yaml | 53 ++++ .../pipelinerun-with-resourcespec.yaml | 97 +++++++ .../v1alpha2/pipelineruns/pipelinerun.yaml | 258 ++++++++++++++++++ .../v1alpha2/pipelineruns/workspaces.yaml | 135 +++++++++ .../v1alpha2/taskruns/build-gcs-targz.yaml | 25 ++ examples/v1alpha2/taskruns/build-gcs-zip.yaml | 25 ++ .../v1alpha2/taskruns/build-push-kaniko.yaml | 81 ++++++ examples/v1alpha2/taskruns/cloud-event.yaml | 182 ++++++++++++ examples/v1alpha2/taskruns/clustertask.yaml | 17 ++ examples/v1alpha2/taskruns/configmap.yaml | 32 +++ examples/v1alpha2/taskruns/custom-env.yaml | 14 + examples/v1alpha2/taskruns/custom-volume.yaml | 26 ++ examples/v1alpha2/taskruns/dind-sidecar.yaml | 61 +++++ examples/v1alpha2/taskruns/docker-creds.yaml | 42 +++ examples/v1alpha2/taskruns/gcs-resource.yaml | 23 ++ examples/v1alpha2/taskruns/git-resource.yaml | 71 +++++ examples/v1alpha2/taskruns/git-ssh-creds.yaml | 50 ++++ examples/v1alpha2/taskruns/git-volume.yaml | 21 ++ examples/v1alpha2/taskruns/home-is-set.yaml | 11 + examples/v1alpha2/taskruns/home-volume.yaml | 26 ++ examples/v1alpha2/taskruns/no-ci/.keep | 0 .../v1alpha2/taskruns/no-ci/limitrange.yaml | 47 ++++ .../optional-resources-with-clustertask.yaml | 34 +++ .../v1alpha2/taskruns/optional-resources.yaml | 130 +++++++++ .../v1alpha2/taskruns/pull-private-image.yaml | 50 ++++ examples/v1alpha2/taskruns/pullrequest.yaml | 33 +++ examples/v1alpha2/taskruns/secret-env.yaml | 25 ++ .../taskruns/secret-volume-params.yaml | 33 +++ examples/v1alpha2/taskruns/secret-volume.yaml | 26 ++ .../v1alpha2/taskruns/sidecar-interp.yaml | 33 +++ .../taskruns/sidecar-ready-script.yaml | 28 ++ examples/v1alpha2/taskruns/sidecar-ready.yaml | 38 +++ .../v1alpha2/taskruns/step-by-digest.yaml | 11 + examples/v1alpha2/taskruns/step-script.yaml | 88 ++++++ .../v1alpha2/taskruns/steps-run-in-order.yaml | 12 + .../taskruns/steptemplate-env-merge.yaml | 65 +++++ .../taskruns/task-multiple-output-image.yaml | 118 ++++++++ .../v1alpha2/taskruns/task-output-image.yaml | 90 ++++++ examples/v1alpha2/taskruns/task-result.yaml | 24 ++ .../v1alpha2/taskruns/task-volume-args.yaml | 33 +++ .../v1alpha2/taskruns/template-volume.yaml | 27 ++ examples/v1alpha2/taskruns/unnamed-steps.yaml | 13 + examples/v1alpha2/taskruns/workingdir.yaml | 19 ++ .../v1alpha2/taskruns/workspace-readonly.yaml | 47 ++++ .../v1alpha2/taskruns/workspace-volume.yaml | 27 ++ examples/v1alpha2/taskruns/workspace.yaml | 93 +++++++ test/e2e-common.sh | 20 +- test/e2e-tests-yaml.sh | 23 +- 112 files changed, 3050 insertions(+), 18 deletions(-) rename examples/{ => v1alpha1}/pipelineruns/clustertask-pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/conditional-pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/demo-optional-resources.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/no-ci/.keep (100%) rename examples/{ => v1alpha1}/pipelineruns/no-ci/limitrange.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/no-ci/pipeline-timeout.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/output-pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun-with-pipelinespec.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun-with-resourcespec.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/workspaces.yaml (100%) rename examples/{ => v1alpha1}/taskruns/build-gcs-targz.yaml (100%) rename examples/{ => v1alpha1}/taskruns/build-gcs-zip.yaml (100%) rename examples/{ => v1alpha1}/taskruns/build-push-kaniko.yaml (100%) rename examples/{ => v1alpha1}/taskruns/cloud-event.yaml (100%) rename examples/{ => v1alpha1}/taskruns/clustertask.yaml (100%) rename examples/{ => v1alpha1}/taskruns/configmap.yaml (100%) rename examples/{ => v1alpha1}/taskruns/custom-env.yaml (100%) rename examples/{ => v1alpha1}/taskruns/custom-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/dind-sidecar.yaml (100%) rename examples/{ => v1alpha1}/taskruns/docker-creds.yaml (100%) rename examples/{ => v1alpha1}/taskruns/gcs-resource.yaml (100%) rename examples/{ => v1alpha1}/taskruns/git-resource.yaml (100%) rename examples/{ => v1alpha1}/taskruns/git-ssh-creds.yaml (100%) rename examples/{ => v1alpha1}/taskruns/git-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/home-is-set.yaml (100%) rename examples/{ => v1alpha1}/taskruns/home-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/no-ci/.keep (100%) rename examples/{ => v1alpha1}/taskruns/no-ci/limitrange.yaml (100%) rename examples/{ => v1alpha1}/taskruns/optional-resources-with-clustertask.yaml (100%) rename examples/{ => v1alpha1}/taskruns/optional-resources.yaml (100%) rename examples/{ => v1alpha1}/taskruns/pull-private-image.yaml (100%) rename examples/{ => v1alpha1}/taskruns/pullrequest.yaml (100%) rename examples/{ => v1alpha1}/taskruns/secret-env.yaml (100%) rename examples/{ => v1alpha1}/taskruns/secret-volume-params.yaml (100%) rename examples/{ => v1alpha1}/taskruns/secret-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/sidecar-interp.yaml (100%) rename examples/{ => v1alpha1}/taskruns/sidecar-ready-script.yaml (100%) rename examples/{ => v1alpha1}/taskruns/sidecar-ready.yaml (100%) rename examples/{ => v1alpha1}/taskruns/step-by-digest.yaml (100%) rename examples/{ => v1alpha1}/taskruns/step-script.yaml (100%) rename examples/{ => v1alpha1}/taskruns/steps-run-in-order.yaml (100%) rename examples/{ => v1alpha1}/taskruns/steptemplate-env-merge.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-multiple-output-image.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-output-image.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-result.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-volume-args.yaml (100%) rename examples/{ => v1alpha1}/taskruns/template-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/unnamed-steps.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workingdir.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workspace-readonly.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workspace-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workspace.yaml (100%) create mode 100644 examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml create mode 100644 examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/demo-optional-resources.yaml create mode 100644 examples/v1alpha2/pipelineruns/no-ci/.keep create mode 100644 examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml create mode 100644 examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml create mode 100644 examples/v1alpha2/pipelineruns/output-pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/workspaces.yaml create mode 100644 examples/v1alpha2/taskruns/build-gcs-targz.yaml create mode 100644 examples/v1alpha2/taskruns/build-gcs-zip.yaml create mode 100644 examples/v1alpha2/taskruns/build-push-kaniko.yaml create mode 100644 examples/v1alpha2/taskruns/cloud-event.yaml create mode 100644 examples/v1alpha2/taskruns/clustertask.yaml create mode 100644 examples/v1alpha2/taskruns/configmap.yaml create mode 100644 examples/v1alpha2/taskruns/custom-env.yaml create mode 100644 examples/v1alpha2/taskruns/custom-volume.yaml create mode 100644 examples/v1alpha2/taskruns/dind-sidecar.yaml create mode 100644 examples/v1alpha2/taskruns/docker-creds.yaml create mode 100644 examples/v1alpha2/taskruns/gcs-resource.yaml create mode 100644 examples/v1alpha2/taskruns/git-resource.yaml create mode 100644 examples/v1alpha2/taskruns/git-ssh-creds.yaml create mode 100644 examples/v1alpha2/taskruns/git-volume.yaml create mode 100644 examples/v1alpha2/taskruns/home-is-set.yaml create mode 100644 examples/v1alpha2/taskruns/home-volume.yaml create mode 100644 examples/v1alpha2/taskruns/no-ci/.keep create mode 100644 examples/v1alpha2/taskruns/no-ci/limitrange.yaml create mode 100644 examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml create mode 100644 examples/v1alpha2/taskruns/optional-resources.yaml create mode 100644 examples/v1alpha2/taskruns/pull-private-image.yaml create mode 100644 examples/v1alpha2/taskruns/pullrequest.yaml create mode 100644 examples/v1alpha2/taskruns/secret-env.yaml create mode 100644 examples/v1alpha2/taskruns/secret-volume-params.yaml create mode 100644 examples/v1alpha2/taskruns/secret-volume.yaml create mode 100644 examples/v1alpha2/taskruns/sidecar-interp.yaml create mode 100644 examples/v1alpha2/taskruns/sidecar-ready-script.yaml create mode 100644 examples/v1alpha2/taskruns/sidecar-ready.yaml create mode 100644 examples/v1alpha2/taskruns/step-by-digest.yaml create mode 100644 examples/v1alpha2/taskruns/step-script.yaml create mode 100644 examples/v1alpha2/taskruns/steps-run-in-order.yaml create mode 100644 examples/v1alpha2/taskruns/steptemplate-env-merge.yaml create mode 100644 examples/v1alpha2/taskruns/task-multiple-output-image.yaml create mode 100644 examples/v1alpha2/taskruns/task-output-image.yaml create mode 100644 examples/v1alpha2/taskruns/task-result.yaml create mode 100644 examples/v1alpha2/taskruns/task-volume-args.yaml create mode 100644 examples/v1alpha2/taskruns/template-volume.yaml create mode 100644 examples/v1alpha2/taskruns/unnamed-steps.yaml create mode 100644 examples/v1alpha2/taskruns/workingdir.yaml create mode 100644 examples/v1alpha2/taskruns/workspace-readonly.yaml create mode 100644 examples/v1alpha2/taskruns/workspace-volume.yaml create mode 100644 examples/v1alpha2/taskruns/workspace.yaml diff --git a/examples/pipelineruns/clustertask-pipelinerun.yaml b/examples/v1alpha1/pipelineruns/clustertask-pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/clustertask-pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/clustertask-pipelinerun.yaml diff --git a/examples/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml b/examples/v1alpha1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml similarity index 100% rename from examples/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml rename to examples/v1alpha1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml diff --git a/examples/pipelineruns/conditional-pipelinerun.yaml b/examples/v1alpha1/pipelineruns/conditional-pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/conditional-pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/conditional-pipelinerun.yaml diff --git a/examples/pipelineruns/demo-optional-resources.yaml b/examples/v1alpha1/pipelineruns/demo-optional-resources.yaml similarity index 100% rename from examples/pipelineruns/demo-optional-resources.yaml rename to examples/v1alpha1/pipelineruns/demo-optional-resources.yaml diff --git a/examples/pipelineruns/no-ci/.keep b/examples/v1alpha1/pipelineruns/no-ci/.keep similarity index 100% rename from examples/pipelineruns/no-ci/.keep rename to examples/v1alpha1/pipelineruns/no-ci/.keep diff --git a/examples/pipelineruns/no-ci/limitrange.yaml b/examples/v1alpha1/pipelineruns/no-ci/limitrange.yaml similarity index 100% rename from examples/pipelineruns/no-ci/limitrange.yaml rename to examples/v1alpha1/pipelineruns/no-ci/limitrange.yaml diff --git a/examples/pipelineruns/no-ci/pipeline-timeout.yaml b/examples/v1alpha1/pipelineruns/no-ci/pipeline-timeout.yaml similarity index 100% rename from examples/pipelineruns/no-ci/pipeline-timeout.yaml rename to examples/v1alpha1/pipelineruns/no-ci/pipeline-timeout.yaml diff --git a/examples/pipelineruns/output-pipelinerun.yaml b/examples/v1alpha1/pipelineruns/output-pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/output-pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/output-pipelinerun.yaml diff --git a/examples/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml b/examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml diff --git a/examples/pipelineruns/pipelinerun-with-pipelinespec.yaml b/examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun-with-pipelinespec.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec.yaml diff --git a/examples/pipelineruns/pipelinerun-with-resourcespec.yaml b/examples/v1alpha1/pipelineruns/pipelinerun-with-resourcespec.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun-with-resourcespec.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun-with-resourcespec.yaml diff --git a/examples/pipelineruns/pipelinerun.yaml b/examples/v1alpha1/pipelineruns/pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun.yaml diff --git a/examples/pipelineruns/workspaces.yaml b/examples/v1alpha1/pipelineruns/workspaces.yaml similarity index 100% rename from examples/pipelineruns/workspaces.yaml rename to examples/v1alpha1/pipelineruns/workspaces.yaml diff --git a/examples/taskruns/build-gcs-targz.yaml b/examples/v1alpha1/taskruns/build-gcs-targz.yaml similarity index 100% rename from examples/taskruns/build-gcs-targz.yaml rename to examples/v1alpha1/taskruns/build-gcs-targz.yaml diff --git a/examples/taskruns/build-gcs-zip.yaml b/examples/v1alpha1/taskruns/build-gcs-zip.yaml similarity index 100% rename from examples/taskruns/build-gcs-zip.yaml rename to examples/v1alpha1/taskruns/build-gcs-zip.yaml diff --git a/examples/taskruns/build-push-kaniko.yaml b/examples/v1alpha1/taskruns/build-push-kaniko.yaml similarity index 100% rename from examples/taskruns/build-push-kaniko.yaml rename to examples/v1alpha1/taskruns/build-push-kaniko.yaml diff --git a/examples/taskruns/cloud-event.yaml b/examples/v1alpha1/taskruns/cloud-event.yaml similarity index 100% rename from examples/taskruns/cloud-event.yaml rename to examples/v1alpha1/taskruns/cloud-event.yaml diff --git a/examples/taskruns/clustertask.yaml b/examples/v1alpha1/taskruns/clustertask.yaml similarity index 100% rename from examples/taskruns/clustertask.yaml rename to examples/v1alpha1/taskruns/clustertask.yaml diff --git a/examples/taskruns/configmap.yaml b/examples/v1alpha1/taskruns/configmap.yaml similarity index 100% rename from examples/taskruns/configmap.yaml rename to examples/v1alpha1/taskruns/configmap.yaml diff --git a/examples/taskruns/custom-env.yaml b/examples/v1alpha1/taskruns/custom-env.yaml similarity index 100% rename from examples/taskruns/custom-env.yaml rename to examples/v1alpha1/taskruns/custom-env.yaml diff --git a/examples/taskruns/custom-volume.yaml b/examples/v1alpha1/taskruns/custom-volume.yaml similarity index 100% rename from examples/taskruns/custom-volume.yaml rename to examples/v1alpha1/taskruns/custom-volume.yaml diff --git a/examples/taskruns/dind-sidecar.yaml b/examples/v1alpha1/taskruns/dind-sidecar.yaml similarity index 100% rename from examples/taskruns/dind-sidecar.yaml rename to examples/v1alpha1/taskruns/dind-sidecar.yaml diff --git a/examples/taskruns/docker-creds.yaml b/examples/v1alpha1/taskruns/docker-creds.yaml similarity index 100% rename from examples/taskruns/docker-creds.yaml rename to examples/v1alpha1/taskruns/docker-creds.yaml diff --git a/examples/taskruns/gcs-resource.yaml b/examples/v1alpha1/taskruns/gcs-resource.yaml similarity index 100% rename from examples/taskruns/gcs-resource.yaml rename to examples/v1alpha1/taskruns/gcs-resource.yaml diff --git a/examples/taskruns/git-resource.yaml b/examples/v1alpha1/taskruns/git-resource.yaml similarity index 100% rename from examples/taskruns/git-resource.yaml rename to examples/v1alpha1/taskruns/git-resource.yaml diff --git a/examples/taskruns/git-ssh-creds.yaml b/examples/v1alpha1/taskruns/git-ssh-creds.yaml similarity index 100% rename from examples/taskruns/git-ssh-creds.yaml rename to examples/v1alpha1/taskruns/git-ssh-creds.yaml diff --git a/examples/taskruns/git-volume.yaml b/examples/v1alpha1/taskruns/git-volume.yaml similarity index 100% rename from examples/taskruns/git-volume.yaml rename to examples/v1alpha1/taskruns/git-volume.yaml diff --git a/examples/taskruns/home-is-set.yaml b/examples/v1alpha1/taskruns/home-is-set.yaml similarity index 100% rename from examples/taskruns/home-is-set.yaml rename to examples/v1alpha1/taskruns/home-is-set.yaml diff --git a/examples/taskruns/home-volume.yaml b/examples/v1alpha1/taskruns/home-volume.yaml similarity index 100% rename from examples/taskruns/home-volume.yaml rename to examples/v1alpha1/taskruns/home-volume.yaml diff --git a/examples/taskruns/no-ci/.keep b/examples/v1alpha1/taskruns/no-ci/.keep similarity index 100% rename from examples/taskruns/no-ci/.keep rename to examples/v1alpha1/taskruns/no-ci/.keep diff --git a/examples/taskruns/no-ci/limitrange.yaml b/examples/v1alpha1/taskruns/no-ci/limitrange.yaml similarity index 100% rename from examples/taskruns/no-ci/limitrange.yaml rename to examples/v1alpha1/taskruns/no-ci/limitrange.yaml diff --git a/examples/taskruns/optional-resources-with-clustertask.yaml b/examples/v1alpha1/taskruns/optional-resources-with-clustertask.yaml similarity index 100% rename from examples/taskruns/optional-resources-with-clustertask.yaml rename to examples/v1alpha1/taskruns/optional-resources-with-clustertask.yaml diff --git a/examples/taskruns/optional-resources.yaml b/examples/v1alpha1/taskruns/optional-resources.yaml similarity index 100% rename from examples/taskruns/optional-resources.yaml rename to examples/v1alpha1/taskruns/optional-resources.yaml diff --git a/examples/taskruns/pull-private-image.yaml b/examples/v1alpha1/taskruns/pull-private-image.yaml similarity index 100% rename from examples/taskruns/pull-private-image.yaml rename to examples/v1alpha1/taskruns/pull-private-image.yaml diff --git a/examples/taskruns/pullrequest.yaml b/examples/v1alpha1/taskruns/pullrequest.yaml similarity index 100% rename from examples/taskruns/pullrequest.yaml rename to examples/v1alpha1/taskruns/pullrequest.yaml diff --git a/examples/taskruns/secret-env.yaml b/examples/v1alpha1/taskruns/secret-env.yaml similarity index 100% rename from examples/taskruns/secret-env.yaml rename to examples/v1alpha1/taskruns/secret-env.yaml diff --git a/examples/taskruns/secret-volume-params.yaml b/examples/v1alpha1/taskruns/secret-volume-params.yaml similarity index 100% rename from examples/taskruns/secret-volume-params.yaml rename to examples/v1alpha1/taskruns/secret-volume-params.yaml diff --git a/examples/taskruns/secret-volume.yaml b/examples/v1alpha1/taskruns/secret-volume.yaml similarity index 100% rename from examples/taskruns/secret-volume.yaml rename to examples/v1alpha1/taskruns/secret-volume.yaml diff --git a/examples/taskruns/sidecar-interp.yaml b/examples/v1alpha1/taskruns/sidecar-interp.yaml similarity index 100% rename from examples/taskruns/sidecar-interp.yaml rename to examples/v1alpha1/taskruns/sidecar-interp.yaml diff --git a/examples/taskruns/sidecar-ready-script.yaml b/examples/v1alpha1/taskruns/sidecar-ready-script.yaml similarity index 100% rename from examples/taskruns/sidecar-ready-script.yaml rename to examples/v1alpha1/taskruns/sidecar-ready-script.yaml diff --git a/examples/taskruns/sidecar-ready.yaml b/examples/v1alpha1/taskruns/sidecar-ready.yaml similarity index 100% rename from examples/taskruns/sidecar-ready.yaml rename to examples/v1alpha1/taskruns/sidecar-ready.yaml diff --git a/examples/taskruns/step-by-digest.yaml b/examples/v1alpha1/taskruns/step-by-digest.yaml similarity index 100% rename from examples/taskruns/step-by-digest.yaml rename to examples/v1alpha1/taskruns/step-by-digest.yaml diff --git a/examples/taskruns/step-script.yaml b/examples/v1alpha1/taskruns/step-script.yaml similarity index 100% rename from examples/taskruns/step-script.yaml rename to examples/v1alpha1/taskruns/step-script.yaml diff --git a/examples/taskruns/steps-run-in-order.yaml b/examples/v1alpha1/taskruns/steps-run-in-order.yaml similarity index 100% rename from examples/taskruns/steps-run-in-order.yaml rename to examples/v1alpha1/taskruns/steps-run-in-order.yaml diff --git a/examples/taskruns/steptemplate-env-merge.yaml b/examples/v1alpha1/taskruns/steptemplate-env-merge.yaml similarity index 100% rename from examples/taskruns/steptemplate-env-merge.yaml rename to examples/v1alpha1/taskruns/steptemplate-env-merge.yaml diff --git a/examples/taskruns/task-multiple-output-image.yaml b/examples/v1alpha1/taskruns/task-multiple-output-image.yaml similarity index 100% rename from examples/taskruns/task-multiple-output-image.yaml rename to examples/v1alpha1/taskruns/task-multiple-output-image.yaml diff --git a/examples/taskruns/task-output-image.yaml b/examples/v1alpha1/taskruns/task-output-image.yaml similarity index 100% rename from examples/taskruns/task-output-image.yaml rename to examples/v1alpha1/taskruns/task-output-image.yaml diff --git a/examples/taskruns/task-result.yaml b/examples/v1alpha1/taskruns/task-result.yaml similarity index 100% rename from examples/taskruns/task-result.yaml rename to examples/v1alpha1/taskruns/task-result.yaml diff --git a/examples/taskruns/task-volume-args.yaml b/examples/v1alpha1/taskruns/task-volume-args.yaml similarity index 100% rename from examples/taskruns/task-volume-args.yaml rename to examples/v1alpha1/taskruns/task-volume-args.yaml diff --git a/examples/taskruns/template-volume.yaml b/examples/v1alpha1/taskruns/template-volume.yaml similarity index 100% rename from examples/taskruns/template-volume.yaml rename to examples/v1alpha1/taskruns/template-volume.yaml diff --git a/examples/taskruns/unnamed-steps.yaml b/examples/v1alpha1/taskruns/unnamed-steps.yaml similarity index 100% rename from examples/taskruns/unnamed-steps.yaml rename to examples/v1alpha1/taskruns/unnamed-steps.yaml diff --git a/examples/taskruns/workingdir.yaml b/examples/v1alpha1/taskruns/workingdir.yaml similarity index 100% rename from examples/taskruns/workingdir.yaml rename to examples/v1alpha1/taskruns/workingdir.yaml diff --git a/examples/taskruns/workspace-readonly.yaml b/examples/v1alpha1/taskruns/workspace-readonly.yaml similarity index 100% rename from examples/taskruns/workspace-readonly.yaml rename to examples/v1alpha1/taskruns/workspace-readonly.yaml diff --git a/examples/taskruns/workspace-volume.yaml b/examples/v1alpha1/taskruns/workspace-volume.yaml similarity index 100% rename from examples/taskruns/workspace-volume.yaml rename to examples/v1alpha1/taskruns/workspace-volume.yaml diff --git a/examples/taskruns/workspace.yaml b/examples/v1alpha1/taskruns/workspace.yaml similarity index 100% rename from examples/taskruns/workspace.yaml rename to examples/v1alpha1/taskruns/workspace.yaml diff --git a/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml b/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml new file mode 100644 index 00000000000..0fda9c8be35 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml @@ -0,0 +1,30 @@ +apiVersion: tekton.dev/v1alpha2 +kind: ClusterTask +metadata: + name: cluster-task-pipeline-4 +spec: + steps: + - name: task-two-step-one + image: ubuntu + command: ["/bin/bash"] + args: ['-c', 'echo success'] +--- +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: sample-pipeline-cluster-task-4 +spec: + tasks: + - name: cluster-task-pipeline-4 + taskRef: + name: cluster-task-pipeline-4 + kind: ClusterTask +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipeline-run-4 +spec: + pipelineRef: + name: sample-pipeline-cluster-task-4 + serviceAccountName: 'default' diff --git a/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml b/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml new file mode 100644 index 00000000000..9638d00f6f1 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml @@ -0,0 +1,85 @@ +apiVersion: tekton.dev/v1alpha1 +kind: Condition +metadata: + name: verify-no-file-exists-without-resource +spec: + params: + - name: "path" + resources: + - name: optional-workspace + type: git + optional: true + check: + image: alpine + script: 'test ! -f $(resources.optional-workspace.path)/$(params.path)' +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: pipeline-git-repo +spec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/tektoncd/pipeline +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: list-pipeline-repo-files +spec: + resources: + inputs: + - name: optional-workspace + type: git + optional: true + steps: + - name: run-ls + image: ubuntu + script: 'ls -al $(inputs.resources.optional-workspace.path)' +--- +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: pipeline-list-pipeline-repo-files +spec: + resources: + - name: pipeline-source-repo + type: git + params: + - name: "path" + default: "README.md" + tasks: + - name: list-pipeline-repo-files-1 + taskRef: + name: list-pipeline-repo-files + conditions: + - conditionRef: "verify-no-file-exists-without-resource" + params: + - name: "path" + value: "$(params.path)" +# NOTE: Resource "optional-workspace" is declared as optional in Condition +# No resource specified for the condition here since its optional +# "DO NOT UNCOMMENT THE FOLLOWING RESOURCE" +# resources: +# - name: optional-workspace +# resource: pipeline-source-repo + resources: + inputs: + - name: optional-workspace + resource: pipeline-source-repo +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-condtional-pr-without-condition-resource +spec: + pipelineRef: + name: pipeline-list-pipeline-repo-files + serviceAccountName: 'default' + resources: + - name: pipeline-source-repo + resourceRef: + name: pipeline-git-repo diff --git a/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml b/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml new file mode 100644 index 00000000000..9ac6f92f50e --- /dev/null +++ b/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml @@ -0,0 +1,94 @@ +apiVersion: tekton.dev/v1alpha1 +kind: Condition +metadata: + name: file-exists +spec: + params: + - name: "path" + resources: + - name: workspace + type: git + check: + image: alpine + script: 'test -f $(resources.workspace.path)/$(params.path)' +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: pipeline-git +spec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/tektoncd/pipeline +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: create-readme-file +spec: + resources: + outputs: + - name: workspace + type: git + steps: + - name: write-new-stuff + image: ubuntu + script: 'touch $(resources.outputs.workspace.path)/README.md' +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: echo-hello +spec: + steps: + - name: echo + image: ubuntu + script: 'echo hello' +--- +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: conditional-pipeline +spec: + resources: + - name: source-repo + type: git + params: + - name: "path" + default: "README.md" + tasks: + - name: first-create-file + taskRef: + name: create-readme-file + resources: + outputs: + - name: workspace + resource: source-repo + - name: then-check + conditions: + - conditionRef: "file-exists" + params: + - name: "path" + value: "$(params.path)" + resources: + - name: workspace + resource: source-repo + from: [first-create-file] + taskRef: + name: echo-hello +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: condtional-pr +spec: + pipelineRef: + name: conditional-pipeline + serviceAccountName: 'default' + resources: + - name: source-repo + resourceRef: + name: pipeline-git diff --git a/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml b/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml new file mode 100644 index 00000000000..450a25b3585 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml @@ -0,0 +1,127 @@ +apiVersion: tekton.dev/v1alpha1 +kind: Condition +metadata: + name: check-git-pipeline-resource +spec: + params: + - name: "path" + resources: + - name: git-repo + type: git + optional: true + check: + image: alpine + script: 'test -f $(resources.git-repo.path)/$(params.path)' +--- + +apiVersion: tekton.dev/v1alpha1 +kind: Condition +metadata: + name: check-image-pipeline-resource +spec: + resources: + - name: built-image + type: image + optional: true + check: + image: alpine + script: 'test ! -z $(resources.built-image.url)' +--- + +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-an-image +spec: + params: + - name: DOCKERFILE + description: The path to the dockerfile to build from GitHub Repo + default: "Dockerfile" + resources: + inputs: + - name: git-repo + type: git + optional: true + outputs: + - name: built-image + type: image + optional: true + steps: + - name: build-an-image + image: "gcr.io/kaniko-project/executor:latest" + command: + - /kaniko/executor + args: + - --dockerfile=$(params.DOCKERFILE) + - --destination=$(resources.outputs.built-image.url) +--- + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: demo-pipeline-to-build-an-image +spec: + resources: + - name: source-repo + type: git + optional: true + - name: web-image + type: image + optional: true + params: + - name: "path" + default: "README.md" + tasks: + - name: build-an-image + taskRef: + name: build-an-image + conditions: + - conditionRef: "check-git-pipeline-resource" + params: + - name: "path" + value: "$(params.path)" + resources: + - name: git-repo + resource: source-repo + - conditionRef: "check-image-pipeline-resource" + resources: + - name: built-image + resource: web-image + resources: + inputs: + - name: git-repo + resource: source-repo + outputs: + - name: built-image + resource: web-image + +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipeline-to-build-an-image-without-resources +spec: + pipelineRef: + name: demo-pipeline-to-build-an-image + serviceAccountName: 'default' +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipeline-to-build-an-image-without-image-resource +spec: + pipelineRef: + name: demo-pipeline-to-build-an-image + serviceAccountName: 'default' + resources: + - name: source-repo + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/tektoncd/pipeline +--- diff --git a/examples/v1alpha2/pipelineruns/no-ci/.keep b/examples/v1alpha2/pipelineruns/no-ci/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml b/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml new file mode 100644 index 00000000000..face542a97e --- /dev/null +++ b/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: LimitRange +metadata: + name: limit-mem-cpu-per-container +spec: + limits: + - max: + cpu: "800m" + memory: "1Gi" + min: + cpu: "100m" + memory: "99Mi" + default: + cpu: "700m" + memory: "900Mi" + defaultRequest: + cpu: "110m" + memory: "111Mi" + type: Container +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: echo-hello-world +spec: + steps: + - name: echo + image: ubuntu + command: + - echo + args: + - "hello world" +--- +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: pipeline-hello +spec: + tasks: + - name: hello-world-1 + taskRef: + name: echo-hello-world + - name: hello-world-2 + taskRef: + name: echo-hello-world + runAfter: + - hello-world-1 +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + generateName: pipeline-hello-run- +spec: + pipelineRef: + name: pipeline-hello + limitRangeName: "limit-mem-cpu-per-container" +status: {} diff --git a/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml b/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml new file mode 100644 index 00000000000..dd8483d24f0 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml @@ -0,0 +1,55 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-echo-message +spec: + params: + - name: MESSAGE + type: string + default: "Hello World" + steps: + - name: echo + image: ubuntu + command: + - sleep 90s + args: + - "$(inputs.params.MESSAGE)" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-timeout +spec: + # 1 hour and half timeout + timeout: 1h30m + pipelineSpec: + params: + - name: MORNING_GREETINGS + description: "morning greetings, default is Good Morning!" + type: string + default: "Good Morning!" + - name: NIGHT_GREETINGS + description: "Night greetings, default is Good Night!" + type: string + default: "Good Night!" + tasks: + # Task to display morning greetings + - name: echo-good-morning + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.MORNING_GREETINGS) + # Task to display night greetings + - name: echo-good-night + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.NIGHT_GREETINGS) + params: + - name: MORNING_GREETINGS + value: "Good Morning, Bob!" + - name: NIGHT_GREETINGS + value: "Good Night, Bob!" diff --git a/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml b/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml new file mode 100644 index 00000000000..b48eed397f1 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml @@ -0,0 +1,104 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-output-pipelinerun +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# Task writes "some stuff" to a predefined path in the workspace git PipelineResource +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: create-file +spec: + resources: + inputs: + - name: workspace + type: git + targetPath: damnworkspace + outputs: + - name: workspace + type: git + steps: + - name: read-docs-old + image: ubuntu + command: ["/bin/bash"] + args: ['-c', 'ls -la /workspace/damnworkspace/docs/README.md'] # tests that targetpath works + - name: write-new-stuff + image: ubuntu + command: ['bash'] + args: ['-c', 'ln -s /workspace/damnworkspace /workspace/output/workspace && echo some stuff > /workspace/output/workspace/stuff'] +--- +# Reads a file from a predefined path in the workspace git PipelineResource +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: check-stuff-file-exists +spec: + params: + - name: args + type: array + resources: + inputs: + - name: workspace + type: git + targetPath: newworkspace + steps: + - name: read + image: ubuntu + command: ["/bin/bash"] + args: ['$(params.args)'] # tests that new targetpath and previous task output is dumped +--- +# The Output of the first Task (git resource) create-file is given as an `Input` +# to the next `Task` check-stuff-file-exists using`from` clause. + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: output-pipeline +spec: + resources: + - name: source-repo + type: git + tasks: + - name: first-create-file # 1. create file + taskRef: + name: create-file + resources: + inputs: + - name: workspace + resource: source-repo + outputs: + - name: workspace + resource: source-repo + - name: then-check # 2. check file exists + taskRef: + name: check-stuff-file-exists + params: + - name: args + value: + - '-c' + - 'cat /workspace/newworkspace/stuff' + resources: + inputs: + - name: workspace + resource: source-repo + from: [first-create-file] +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: output-pipeline-run +spec: + pipelineRef: + name: output-pipeline + serviceAccountName: 'default' + resources: + - name: source-repo + resourceRef: + name: skaffold-git-output-pipelinerun diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml new file mode 100644 index 00000000000..568be978a9d --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml @@ -0,0 +1,79 @@ +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-with-taskspec-to-echo-good-morning +spec: + pipelineSpec: + tasks: + - name: echo-good-morning + taskSpec: + steps: + - name: echo + image: ubuntu + script: | + #!/usr/bin/env bash + echo "Good Morning!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-with-taskspec-to-echo-message +spec: + pipelineSpec: + params: + - name: MESSAGE + description: "Message, default is Hello World!" + type: string + default: "Hello World!" + tasks: + - name: echo-message + taskSpec: + params: + - name: MESSAGE + type: string + default: "Hello World!" + steps: + - name: echo + image: ubuntu + script: | + #!/usr/bin/env bash + echo "$(params.MESSAGE)" + params: + - name: MESSAGE + value: $(params.MESSAGE) + params: + - name: MESSAGE + value: "Good Morning!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-with-taskspec-to-echo-greetings +spec: + pipelineSpec: + params: + - name: GREETINGS + description: "Greetings, default is Hello World!" + type: string + default: "Hello World!" + tasks: + - name: echo-greetings + taskSpec: + params: + - name: MESSAGE + type: string + default: "Hello World!" + steps: + - name: echo + image: ubuntu + script: | + #!/usr/bin/env bash + echo "$(params.MESSAGE)" + params: + - name: MESSAGE + value: $(params.GREETINGS) + params: + - name: GREETINGS + value: "Good Morning!" diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml new file mode 100644 index 00000000000..5cd0da41e31 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml @@ -0,0 +1,53 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-echo-message +spec: + params: + - name: MESSAGE + type: string + default: "Hello World" + steps: + - name: echo + image: ubuntu + command: + - echo + args: + - "$(params.MESSAGE)" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-echo-greetings +spec: + pipelineSpec: + params: + - name: MORNING_GREETINGS + description: "morning greetings, default is Good Morning!" + type: string + default: "Good Morning!" + - name: NIGHT_GREETINGS + description: "Night greetings, default is Good Night!" + type: string + default: "Good Night!" + tasks: + # Task to display morning greetings + - name: echo-good-morning + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.MORNING_GREETINGS) + # Task to display night greetings + - name: echo-good-night + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.NIGHT_GREETINGS) + params: + - name: MORNING_GREETINGS + value: "Good Morning, Bob!" + - name: NIGHT_GREETINGS + value: "Good Night, Bob!" diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml b/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml new file mode 100644 index 00000000000..1471f09a357 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml @@ -0,0 +1,97 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-to-list-files +spec: + resources: + inputs: + - name: pipeline-git + type: git + outputs: + - name: pipeline-git + type: git + steps: + - name: list + image: ubuntu + command: + - bash + args: + - -c + - | + ls -al $(resources.inputs.pipeline-git.path) +--- + +apiVersion: tekton.dev/v1alpha1 +kind: Condition +metadata: + name: always-true-sample-condition +spec: + resources: + - name: pipeline-git + type: git + check: + image: ubuntu + command: + - bash + args: + - -c + - | + echo "Hello from Tekton Pipeline!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: pipeline-to-list-files +spec: + resources: + - name: pipeline-git + type: git + params: + - name: "path" + default: "README.md" + tasks: + - name: list-files + taskRef: + name: task-to-list-files + resources: + inputs: + - name: pipeline-git + resource: pipeline-git + outputs: + - name: pipeline-git + resource: pipeline-git + - name: conditional-list-files + taskRef: + name: task-to-list-files + conditions: + - conditionRef: always-true-sample-condition + resources: + - name: pipeline-git + resource: pipeline-git + resources: + inputs: + - name: pipeline-git + resource: pipeline-git + outputs: + - name: pipeline-git + resource: pipeline-git +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipelinerun-with-resourcespec +spec: + pipelineRef: + name: pipeline-to-list-files + serviceAccountName: 'default' + resources: + - name: pipeline-git + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/tektoncd/pipeline diff --git a/examples/v1alpha2/pipelineruns/pipelinerun.yaml b/examples/v1alpha2/pipelineruns/pipelinerun.yaml new file mode 100644 index 00000000000..5ae420bcf13 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun.yaml @@ -0,0 +1,258 @@ +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-app +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-app +--- +# This demo modifies the cluster (deploys to it) you must use a service +# account with permission to admin the cluster (or make your default user an admin +# of the `default` namespace with default-cluster-admin. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + generateName: default-cluster-admin- +subjects: + - kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-pipelinerun +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-web +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-pipelinerun +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: unit-tests +spec: + resources: + inputs: + - name: workspace + type: git + targetPath: go/src/github.com/GoogleContainerTools/skaffold + steps: + - name: run-tests + image: golang + env: + - name: GOPATH + value: /workspace/go + workingDir: /workspace/go/src/github.com/GoogleContainerTools/skaffold + command: + - echo + args: + - "pass" +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-push +spec: + params: + - name: pathToDockerFile + description: The path to the dockerfile to build + default: /workspace/workspace/Dockerfile + - name: pathToContext + description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts) + default: /workspace/workspace + resources: + inputs: + - name: workspace + type: git + outputs: + - name: builtImage + type: image + steps: + - name: build-and-push + image: gcr.io/kaniko-project/executor:v0.15.0 + # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential + env: + - name: "DOCKER_CONFIG" + value: "/tekton/home/.docker/" + command: + - /kaniko/executor + args: + - --dockerfile=$(params.pathToDockerFile) + - --destination=$(resources.outputs.builtImage.url) + - --context=$(params.pathToContext) +--- +# This task deploys with kubectl apply -f +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: demo-deploy-kubectl +spec: + params: + - name: path + description: Path to the manifest to apply + - name: yqArg + description: Okay this is a hack, but I didn't feel right hard-codeing `-d1` down below + - name: yamlPathToImage + description: The path to the image to replace in the yaml manifest (arg to yq) + resources: + inputs: + - name: workspace + type: git + - name: image + type: image + steps: + - name: replace-image + image: mikefarah/yq + command: ['yq'] + args: + - "w" + - "-i" + - "$(params.yqArg)" + - "$(params.path)" + - "$(params.yamlPathToImage)" + - "$(resources.inputs.image.url)" + - name: run-kubectl + image: lachlanevenson/k8s-kubectl + command: ['kubectl'] + args: + - 'apply' + - '-f' + - '$(params.path)' +--- +# This Pipeline Builds two microservice images(https://github.com/GoogleContainerTools/skaffold/tree/master/examples/microservices) +# from the Skaffold repo (https://github.com/GoogleContainerTools/skaffold) and deploys them to the repo currently running Tekton Pipelines. + +# **Note** : It does this using the k8s `Deployment` in the skaffold repos's existing yaml +# files, so at the moment there is no guarantee that the image that are built and +# pushed are the ones that are deployed (that would require using the digest of +# the built image, see https://github.com/tektoncd/pipeline/issues/216). + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: demo-pipeline +spec: + resources: + - name: source-repo + type: git + - name: web-image + type: image + - name: app-image + type: image + tasks: + - name: skaffold-unit-tests + taskRef: + name: unit-tests + resources: + inputs: + - name: workspace + resource: source-repo + - name: build-skaffold-web + runAfter: [skaffold-unit-tests] + taskRef: + name: build-push + params: + - name: pathToDockerFile + value: Dockerfile + - name: pathToContext + value: /workspace/workspace/examples/microservices/leeroy-web + resources: + inputs: + - name: workspace + resource: source-repo + outputs: + - name: builtImage + resource: web-image + - name: build-skaffold-app + runAfter: [skaffold-unit-tests] + taskRef: + name: build-push + params: + - name: pathToDockerFile + value: Dockerfile + - name: pathToContext + value: /workspace/workspace/examples/microservices/leeroy-app + resources: + inputs: + - name: workspace + resource: source-repo + outputs: + - name: builtImage + resource: app-image + - name: deploy-app + taskRef: + name: demo-deploy-kubectl + resources: + inputs: + - name: workspace + resource: source-repo + - name: image + resource: app-image + from: + - build-skaffold-app + params: + - name: path + value: /workspace/workspace/examples/microservices/leeroy-app/kubernetes/deployment.yaml + - name: yqArg + value: "-d1" + - name: yamlPathToImage + value: "spec.template.spec.containers[0].image" + - name: deploy-web + taskRef: + name: demo-deploy-kubectl + resources: + inputs: + - name: workspace + resource: source-repo + - name: image + resource: web-image + from: + - build-skaffold-web + params: + - name: path + value: /workspace/workspace/examples/microservices/leeroy-web/kubernetes/deployment.yaml + - name: yqArg + value: "-d1" + - name: yamlPathToImage + value: "spec.template.spec.containers[0].image" +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipeline-run-1 +spec: + pipelineRef: + name: demo-pipeline + serviceAccountName: 'default' + resources: + - name: source-repo + resourceRef: + name: skaffold-git-pipelinerun + - name: web-image + resourceRef: + name: skaffold-image-leeroy-web-pipelinerun + - name: app-image + resourceRef: + name: skaffold-image-leeroy-app diff --git a/examples/v1alpha2/pipelineruns/workspaces.yaml b/examples/v1alpha2/pipelineruns/workspaces.yaml new file mode 100644 index 00000000000..f7dca7a78d6 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/workspaces.yaml @@ -0,0 +1,135 @@ +# In this contrived example 3 different kinds of workspace volume are used to thread +# data through a pipeline's tasks. +# 1. A ConfigMap is used as source of recipe data. +# 2. A Secret is used to store a password. +# 3. A PVC is used to share data from one task to the next. +# +# The end result is a pipeline that first checks if the password is correct and, if so, +# copies data out of a recipe store onto a shared volume. The recipe data is then read +# by a subsequent task and printed to screen. +apiVersion: v1 +kind: ConfigMap +metadata: + name: sensitive-recipe-storage +data: + brownies: | + 1. Heat oven to 325 degrees F + 2. Melt 1/2 cup butter w/ 1/2 cup cocoa, stirring smooth. + 3. Remove from heat, allow to cool for a few minutes. + 4. Transfer to bowl. + 5. Whisk in 2 eggs, one at a time. + 6. Stir in vanilla. + 7. Separately combine 1 cup sugar, 1/4 cup flour, 1 cup chopped + walnuts and pinch of salt + 8. Combine mixtures. + 9. Bake in greased pan for 30 minutes. Watch carefully for + appropriate level of gooeyness. +--- +apiVersion: v1 +kind: Secret +metadata: + name: secret-password +type: Opaque +data: + password: aHVudGVyMg== +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: shared-task-storage +spec: + resources: + requests: + storage: 16Mi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: fetch-secure-data +spec: + workspaces: + - name: super-secret-password + - name: secure-store + - name: filedrop + steps: + - name: fetch-and-write + image: ubuntu + script: | + if [ "hunter2" = "$(cat $(workspaces.super-secret-password.path)/password)" ]; then + cp $(workspaces.secure-store.path)/recipe.txt $(workspaces.filedrop.path) + else + echo "wrong password!" + exit 1 + fi +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: print-data +spec: + workspaces: + - name: storage + readOnly: true + params: + - name: filename + steps: + - name: print-secrets + image: ubuntu + script: cat $(workspaces.storage.path)/$(params.filename) +--- +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: fetch-and-print-recipe +spec: + workspaces: + - name: password-vault + - name: recipe-store + - name: shared-data + tasks: + - name: fetch-the-recipe + taskRef: + name: fetch-secure-data + workspaces: + - name: super-secret-password + workspace: password-vault + - name: secure-store + workspace: recipe-store + - name: filedrop + workspace: shared-data + - name: print-the-recipe + taskRef: + name: print-data + # Note: this is currently required to ensure order of write / read on PVC is correct. + runAfter: + - fetch-the-recipe + params: + - name: filename + value: recipe.txt + workspaces: + - name: storage + workspace: shared-data +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + generateName: recipe-time- +spec: + pipelineRef: + name: fetch-and-print-recipe + workspaces: + - name: password-vault + secret: + secretName: secret-password + - name: recipe-store + configMap: + name: sensitive-recipe-storage + items: + - key: brownies + path: recipe.txt + - name: shared-data + persistentVolumeClaim: + claimName: shared-task-storage diff --git a/examples/v1alpha2/taskruns/build-gcs-targz.yaml b/examples/v1alpha2/taskruns/build-gcs-targz.yaml new file mode 100644 index 00000000000..78a82ab1b73 --- /dev/null +++ b/examples/v1alpha2/taskruns/build-gcs-targz.yaml @@ -0,0 +1,25 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: build-gcs-targz- +spec: + taskSpec: + resources: + inputs: + - name: source + type: storage + steps: + - image: ubuntu + script: cat source/file.txt + resources: + inputs: + - name: source + resourceSpec: + type: storage + params: + - name: location + value: gs://build-crd-tests/archive.tar.gz + - name: artifactType + value: TarGzArchive + - name: type + value: build-gcs diff --git a/examples/v1alpha2/taskruns/build-gcs-zip.yaml b/examples/v1alpha2/taskruns/build-gcs-zip.yaml new file mode 100644 index 00000000000..fd721f7a8b3 --- /dev/null +++ b/examples/v1alpha2/taskruns/build-gcs-zip.yaml @@ -0,0 +1,25 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: build-gcs-zip- +spec: + taskSpec: + resources: + inputs: + - name: source + type: storage + steps: + - image: ubuntu + script: cat source/file.txt + resources: + inputs: + - name: source + resourceSpec: + type: storage + params: + - name: location + value: gs://build-crd-tests/archive.zip + - name: artifactType + value: ZipArchive + - name: type + value: build-gcs diff --git a/examples/v1alpha2/taskruns/build-push-kaniko.yaml b/examples/v1alpha2/taskruns/build-push-kaniko.yaml new file mode 100644 index 00000000000..3e511ab670d --- /dev/null +++ b/examples/v1alpha2/taskruns/build-push-kaniko.yaml @@ -0,0 +1,81 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-build-push-kaniko +spec: + type: image + params: + - name: url + value: localhost:5000/leeroy-web +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-build-push-kaniko +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# Builds an image via kaniko and pushes it to registry. +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-push-kaniko +spec: + params: + - name: pathToDockerFile + description: The path to the dockerfile to build + default: /workspace/workspace/Dockerfile + - name: pathToContext + description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts) + default: /workspace/workspace + resources: + inputs: + - name: workspace + type: git + outputs: + - name: builtImage + type: image + steps: + - name: build-and-push + image: gcr.io/kaniko-project/executor:v0.15.0 + # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential + env: + - name: "DOCKER_CONFIG" + value: "/tekton/home/.docker/" + args: + - --dockerfile=$(inputs.params.pathToDockerFile) + - --destination=$(outputs.resources.builtImage.url) + - --context=$(inputs.params.pathToContext) + - --oci-layout-path=$(inputs.resources.builtImage.path) + securityContext: + runAsUser: 0 + sidecars: + - image: registry + name: registry +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: build-push-kaniko +spec: + taskRef: + name: build-push-kaniko + resources: + inputs: + - name: workspace + resourceRef: + name: skaffold-git-build-push-kaniko + outputs: + - name: builtImage + resourceRef: + name: skaffold-image-leeroy-web-build-push-kaniko + params: + - name: pathToDockerFile + value: Dockerfile + - name: pathToContext + value: /workspace/workspace/examples/microservices/leeroy-web diff --git a/examples/v1alpha2/taskruns/cloud-event.yaml b/examples/v1alpha2/taskruns/cloud-event.yaml new file mode 100644 index 00000000000..ab0073d8d59 --- /dev/null +++ b/examples/v1alpha2/taskruns/cloud-event.yaml @@ -0,0 +1,182 @@ +apiVersion: v1 +kind: Service +metadata: + name: sink +spec: + selector: + app: cloudevent + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + app: cloudevent + name: message-sink +spec: + containers: + - env: + - name: PORT + value: "8080" + name: cloudeventlistener + image: python:3-alpine + imagePullPolicy: IfNotPresent + command: ["/bin/sh"] + args: + - -ce + - | + cat <

POST!

') + + def do_GET(self): + with open("content.txt", mode="rb") as f: + content = f.read() + self.send_response(200 if content else 404) + self.send_header('Content-type', 'text/plain') + self.end_headers() + self.wfile.write(content) + + if __name__ == "__main__": + open("content.txt", 'a').close() + httpd = HTTPServer(('', $PORT), GetAndPostHandler) + print('Starting httpd...') + httpd.serve_forever() + EOF + ports: + - containerPort: 8080 + name: user-port + protocol: TCP +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: send-cloud-event-task + +spec: + resources: + outputs: + - name: myimage + type: image + - name: notification + type: cloudEvent + steps: + - name: wait-for-sink + image: python:3-alpine + imagePullPolicy: IfNotPresent + script: | + #!/usr/bin/env python3 + import http.client + import json + import sys + import time + + while True: + conn = http.client.HTTPConnection("sink:8080") + try: + conn.request("GET", "/") + break + except: + # Perhaps the service is not setup yet, so service name does not + # resolve or it does not accept connections on 8080 yet + print("Not yet...") + time.sleep(10) + - name: build-index-json + image: busybox + script: | + set -e + cat < $(resources.outputs.myimage.path)/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" + } + ] + } +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: poll-for-content-task +spec: + steps: + - name: polling + image: python:3-alpine + imagePullPolicy: IfNotPresent + script: | + #!/usr/bin/env python3 + import http.client + import json + import sys + import time + + while True: + conn = http.client.HTTPConnection("sink:8080") + try: + conn.request("GET", "/") + except: + # Perhaps the service is not setup yet, so service name does not + # resolve or it does not accept connections on 8080 yet + print("Not yet...") + time.sleep(10) + continue + response = conn.getresponse() + if response.status == 200: + print("Got it!") + taskrun = json.loads(response.read().decode('utf-8')) + digest = taskrun['taskRun']['status']['resourcesResult'][0]['value'] + image_name = taskrun['taskRun']['status']['resourcesResult'][0]['resourceRef']['name'] + print("Got digest %s for image %s" % (digest, image_name)) + if image_name == "myimage" and digest: + break + else: + sys.exit(1) + else: + print("Not yet...") + time.sleep(10) +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: send-cloud-event +spec: + resources: + outputs: + - name: myimage + resourceSpec: + type: image + params: + - name: url + value: fake-registry/test/fake-image + - name: notification + resourceSpec: + type: cloudEvent + params: + - name: targetURI + value: http://sink.default:8080 + taskRef: + name: send-cloud-event-task +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: poll-for-content-run +spec: + taskRef: + name: poll-for-content-task diff --git a/examples/v1alpha2/taskruns/clustertask.yaml b/examples/v1alpha2/taskruns/clustertask.yaml new file mode 100644 index 00000000000..b31eed920d4 --- /dev/null +++ b/examples/v1alpha2/taskruns/clustertask.yaml @@ -0,0 +1,17 @@ +apiVersion: tekton.dev/v1alpha2 +kind: ClusterTask +metadata: + name: clustertask +spec: + steps: + - image: ubuntu + script: echo hello +--- +apiVersion: tekton.dev/v1alpha1 +kind: TaskRun +metadata: + generateName: clustertask- +spec: + taskRef: + name: clustertask + kind: ClusterTask diff --git a/examples/v1alpha2/taskruns/configmap.yaml b/examples/v1alpha2/taskruns/configmap.yaml new file mode 100644 index 00000000000..cd0c80ea2cb --- /dev/null +++ b/examples/v1alpha2/taskruns/configmap.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-for-testing-configmaps +data: + test.data: tasks are my jam +--- +apiVersion: tekton.dev/v1alpha1 +kind: TaskRun +metadata: + generateName: configmap- +spec: + taskSpec: + steps: + - name: secret + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $(cat /config/test.data) == $TEST_DATA ]] + env: + - name: TEST_DATA + valueFrom: + configMapKeyRef: + name: config-for-testing-configmaps + key: test.data + volumeMounts: + - name: config-volume + mountPath: /config + volumes: + - name: config-volume + configMap: + name: config-for-testing-configmaps diff --git a/examples/v1alpha2/taskruns/custom-env.yaml b/examples/v1alpha2/taskruns/custom-env.yaml new file mode 100644 index 00000000000..0636ffaffe8 --- /dev/null +++ b/examples/v1alpha2/taskruns/custom-env.yaml @@ -0,0 +1,14 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: custom-env- +spec: + taskSpec: + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + [[ $MY_VAR1 == foo ]] + env: + - name: MY_VAR1 + value: foo diff --git a/examples/v1alpha2/taskruns/custom-volume.yaml b/examples/v1alpha2/taskruns/custom-volume.yaml new file mode 100644 index 00000000000..6f560d893f8 --- /dev/null +++ b/examples/v1alpha2/taskruns/custom-volume.yaml @@ -0,0 +1,26 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: custom-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: | + #!/usr/bin/env bash + echo some stuff > /im/a/custom/mount/path/file + volumeMounts: + - name: custom + mountPath: /im/a/custom/mount/path + - name: read + image: ubuntu + script: | + #!/usr/bin/env bash + cat /short/and/stout/file | grep stuff + volumeMounts: + - name: custom + mountPath: /short/and/stout + volumes: + - name: custom + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/dind-sidecar.yaml b/examples/v1alpha2/taskruns/dind-sidecar.yaml new file mode 100644 index 00000000000..aea99e26646 --- /dev/null +++ b/examples/v1alpha2/taskruns/dind-sidecar.yaml @@ -0,0 +1,61 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: dind-sidecar- +spec: + taskSpec: + steps: + - image: docker + name: client + env: + # Connect to the sidecar over TCP, with TLS. + - name: DOCKER_HOST + value: tcp://localhost:2376 + # Verify TLS. + - name: DOCKER_TLS_VERIFY + value: '1' + # Use the certs generated by the sidecar daemon. + - name: DOCKER_CERT_PATH + value: /certs/client + script: | + #!/usr/bin/env sh + # Run a Docker container. + docker run busybox echo hello + + # Write a Dockerfile and `docker build` it. + cat > Dockerfile << EOF + FROM ubuntu + RUN apt-get update + ENTRYPOINT ["echo", "hello"] + EOF + docker build -t hello . && docker run hello + docker images + + # ...then run it! + docker run hello + volumeMounts: + - mountPath: /certs/client + name: dind-certs + + sidecars: + - image: docker:dind + name: server + securityContext: + privileged: true + env: + # Write generated certs to the path shared with the client. + - name: DOCKER_TLS_CERTDIR + value: /certs + volumeMounts: + - mountPath: /certs/client + name: dind-certs + # Wait for the dind daemon to generate the certs it will share with the + # client. + readinessProbe: + periodSeconds: 1 + exec: + command: ['ls', '/certs/client/ca.pem'] + + volumes: + - name: dind-certs + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/docker-creds.yaml b/examples/v1alpha2/taskruns/docker-creds.yaml new file mode 100644 index 00000000000..65f793372a1 --- /dev/null +++ b/examples/v1alpha2/taskruns/docker-creds.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Secret +metadata: + name: docker-basic + annotations: + tekton.dev/docker-0: https://us.gcr.io + tekton.dev/docker-1: https://eu.gcr.io + tekton.dev/docker-2: https://asia.gcr.io + tekton.dev/docker-3: https://gcr.io + tekton.dev/docker-4: https://reduce-chance-of-selecting-gcr.io +type: kubernetes.io/basic-auth +data: + # Generated by: + # echo -n _json_key | base64 + username: X2pzb25fa2V5 + # Generated by: + # cat /tmp/key.json | base64 -w 0 + # This service account is JUST a storage reader on gcr.io/build-crd-testing + # (it is the same as test/serviceaccount/secret.yaml) + password: ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAiYnVpbGQtY3JkLXRlc3RpbmciLAogICJwcml2YXRlX2tleV9pZCI6ICIwNTAyYTQxYTgxMmZiNjRjZTU2YTY4ZWM1ODMyYWIwYmExMWMxMWU2IiwKICAicHJpdmF0ZV9rZXkiOiAiLS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tXG5NSUlFdlFJQkFEQU5CZ2txaGtpRzl3MEJBUUVGQUFTQ0JLY3dnZ1NqQWdFQUFvSUJBUUM5WDRFWU9BUmJ4UU04XG5EMnhYY2FaVGsrZ1k4ZWp1OTh0THFDUXFUckdNVzlSZVQyeE9ZNUF5Z2FsUFArcDd5WEVja3dCRC9IaE0wZ2xJXG43TVRMZGVlS1dyK3JBMUx3SFp5V0ZXN0gwT25mN3duWUhFSExXVW1jM0JDT1JFRHRIUlo3WnJQQmYxSFRBQS8zXG5Nblc1bFpIU045b2p6U1NGdzZBVnU2ajZheGJCSUlKNzU0THJnS2VBWXVyd2ZJUTJSTFR1MjAxazJJcUxZYmhiXG4zbVNWRzVSK3RiS3oxQ3ZNNTNuSENiN0NmdVZlV3NyQThrazd4SHJyTFFLTW1JOXYyc2dSdWd5TUF6d3ovNnpOXG5oNS9pTXh4Z2VxNVc4eGtWeDNKMm5ZOEpKZEhhZi9UNkFHc09ORW80M3B4ZWlRVmpuUmYvS24xMFRDYzJFc0lZXG5TNDlVc1o3QkFnTUJBQUVDZ2dFQUF1cGxkdWtDUVF1RDVVL2dhbUh0N0dnVzNBTVYxOGVxbkhuQ2EyamxhaCtTXG5BZVVHbmhnSmpOdkUrcE1GbFN2NXVmMnAySzRlZC9veEQ2K0NwOVpYRFJqZ3ZmdEl5cWpsemJ3dkZjZ3p3TnVEXG55Z1VrdXA3SGVjRHNEOFR0ZUFvYlQvVnB3cTZ6S01yQndDdk5rdnk2YlZsb0VqNXgzYlhzYXhlOTVETy95cHU2XG53MFc5N3p4d3dESlk2S1FjSVdNamhyR3h2d1g3bmlVQ2VNNGxlV0JEeUd0dzF6ZUpuNGhFYzZOM2FqUWFjWEtjXG4rNFFseGNpYW1ZcVFXYlBudHhXUWhoUXpjSFdMaTJsOWNGYlpENyt1SkxGNGlONnk4bVZOVTNLM0sxYlJZclNEXG5SVXAzYVVWQlhtRmcrWi8ycHVWTCttVTNqM0xMV1l5Qk9rZXZ1T21kZ1FLQmdRRGUzR0lRa3lXSVMxNFRkTU9TXG5CaUtCQ0R5OGg5NmVoTDBIa0RieU9rU3RQS2RGOXB1RXhaeGh5N29qSENJTTVGVnJwUk4yNXA0c0V6d0ZhYyt2XG5KSUZnRXZxN21YZm1YaVhJTmllUG9FUWFDbm54RHhXZ21yMEhVS0VtUzlvTWRnTGNHVStrQ1ZHTnN6N0FPdW0wXG5LcVkzczIyUTlsUTY3Rk95cWl1OFdGUTdRUUtCZ1FEWmlGaFRFWmtQRWNxWmpud0pwVEI1NlpXUDlLVHNsWlA3XG53VTRiemk2eSttZXlmM01KKzRMMlN5SGMzY3BTTWJqdE5PWkN0NDdiOTA4RlVtTFhVR05oY3d1WmpFUXhGZXkwXG5tNDFjUzVlNFA0OWI5bjZ5TEJqQnJCb3FzMldCYWwyZWdkaE5KU3NDV29pWlA4L1pUOGVnWHZoN2I5MWp6b0syXG5xMlBVbUE0RGdRS0JnQVdMMklqdkVJME95eDJTMTFjbi9lM1dKYVRQZ05QVEc5MDNVcGErcW56aE9JeCtNYXFoXG5QRjRXc3VBeTBBb2dHSndnTkpiTjhIdktVc0VUdkE1d3l5TjM5WE43dzBjaGFyRkwzN29zVStXT0F6RGpuamNzXG5BcTVPN0dQR21YdWI2RUJRQlBKaEpQMXd5NHYvSzFmSGcvRjQ3cTRmNDBMQUpPa2FZUkpENUh6QkFvR0JBTlVoXG5uSUJQSnFxNElNdlE2Y0M5ZzhCKzF4WURlYTkvWWsxdytTbVBHdndyRVh5M0dLeDRLN2xLcGJQejdtNFgzM3N4XG5zRVUvK1kyVlFtd1JhMXhRbS81M3JLN1YybDVKZi9ENDAwalJtNlpmU0FPdmdEVHJ0Wm5VR0pNcno5RTd1Tnc3XG5sZ1VIM0pyaXZ5Ri9meE1JOHFzelFid1hQMCt4bnlxQXhFQWdkdUtCQW9HQUlNK1BTTllXQ1pYeERwU0hJMThkXG5qS2tvQWJ3Mk1veXdRSWxrZXVBbjFkWEZhZDF6c1hRR2RUcm1YeXY3TlBQKzhHWEJrbkJMaTNjdnhUaWxKSVN5XG51Y05yQ01pcU5BU24vZHE3Y1dERlVBQmdqWDE2SkgyRE5GWi9sL1VWRjNOREFKalhDczFYN3lJSnlYQjZveC96XG5hU2xxbElNVjM1REJEN3F4Unl1S3Nnaz1cbi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS1cbiIsCiAgImNsaWVudF9lbWFpbCI6ICJwdWxsLXNlY3JldC10ZXN0aW5nQGJ1aWxkLWNyZC10ZXN0aW5nLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwKICAiY2xpZW50X2lkIjogIjEwNzkzNTg2MjAzMzAyNTI1MTM1MiIsCiAgImF1dGhfdXJpIjogImh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbS9vL29hdXRoMi9hdXRoIiwKICAidG9rZW5fdXJpIjogImh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbS9vL29hdXRoMi90b2tlbiIsCiAgImF1dGhfcHJvdmlkZXJfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9vYXV0aDIvdjEvY2VydHMiLAogICJjbGllbnRfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9yb2JvdC92MS9tZXRhZGF0YS94NTA5L3B1bGwtc2VjcmV0LXRlc3RpbmclNDBidWlsZC1jcmQtdGVzdGluZy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIKfQo= +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: robot-docker-basic +secrets: +- name: docker-basic +imagePullSecrets: +- name: docker-basic +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: docker-creds +spec: + serviceAccountName: robot-docker-basic + taskSpec: + steps: + - name: test + image: quay.io/rhpipeline/skopeo:alpine + # Test pulling a private builder container. + script: skopeo copy docker://gcr.io/build-crd-testing/secret-sauce dir:///tmp/ diff --git a/examples/v1alpha2/taskruns/gcs-resource.yaml b/examples/v1alpha2/taskruns/gcs-resource.yaml new file mode 100644 index 00000000000..0927ce4e4be --- /dev/null +++ b/examples/v1alpha2/taskruns/gcs-resource.yaml @@ -0,0 +1,23 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: gcs-resource- +spec: + taskSpec: + resources: + inputs: + - name: source + type: storage + steps: + - image: alpine + script: unzip source/archive.zip && cat file.txt + resources: + inputs: + - name: source + resourceSpec: + type: storage + params: + - name: location + value: gs://build-crd-tests/archive.zip + - name: type + value: gcs diff --git a/examples/v1alpha2/taskruns/git-resource.yaml b/examples/v1alpha2/taskruns/git-resource.yaml new file mode 100644 index 00000000000..e0a2f10b6fa --- /dev/null +++ b/examples/v1alpha2/taskruns/git-resource.yaml @@ -0,0 +1,71 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-resource-tag- +spec: + taskSpec: + resources: + inputs: + - name: skaffold + type: git + steps: + - image: ubuntu + script: cat skaffold/README.md + resources: + inputs: + - name: skaffold + resourceSpec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-resource-branch- +spec: + taskSpec: + resources: + inputs: + - name: skaffold + type: git + steps: + - image: ubuntu + script: cat skaffold/README.md + resources: + inputs: + - name: skaffold + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-resource-ref- +spec: + taskSpec: + resources: + inputs: + - name: skaffold + type: git + steps: + - image: ubuntu + script: cat skaffold/README.md + resources: + inputs: + - name: skaffold + resourceSpec: + type: git + params: + - name: revision + value: pull/2932/head + - name: url + value: https://github.com/GoogleContainerTools/skaffold diff --git a/examples/v1alpha2/taskruns/git-ssh-creds.yaml b/examples/v1alpha2/taskruns/git-ssh-creds.yaml new file mode 100644 index 00000000000..ea0acedebcc --- /dev/null +++ b/examples/v1alpha2/taskruns/git-ssh-creds.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: Secret +metadata: + name: git-ssh + annotations: + tekton.dev/git-0: github.com +type: kubernetes.io/ssh-auth +data: + # Generated by: + # cat id_rsa | base64 -w 0 + # This deploy key has read-only permissions on github.com/knative/build + ssh-privatekey: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlKSndJQkFBS0NBZ0VBc0YrY3ZIdUlKRjBwNWZNVDBUUVZhMWpTZVBNVlhtUWhGa1F0andsamJFSXVKaVh5CmVrU1I0WUtDbFZIZVo0M2VOa2p5SzFwTDVmVnZnY3J2bkVUMXE5dmFmOThtNzdHWjZUdnJGY0RyZjViZDFIZGUKTU1MTFZRRU8vN1lkcEJFeVJ1UjA4RXRzbWp0RUVaNERVZnBUWGQ5RnAyTU5UWTYwVzFpa0p0Mm53dGhWVlF0OApubFcxTTRvc1d0SHE1OVFDbnhqUkVmNzNhdHdtUTZ6enlXcCtJM3ZBRFRJUmZpTWcvSjc0UDJHOWlwL0U1U0YrCnNuRmRnU2x0cjhyd0tmTE5jTDVYandOSE53aHErQ2NJRHBUZGhuVTBUaEFZNlRsa25KWFJudXRicGNRajA4MjAKMyt1aXRxaXhJcnIwQmkrU2NDQ21GNERxZGdRUXIwRzdieXRKemJkdjJOL3dGbGFpWmVOTWtXSVd5TzRpdnU4TQoxbGUyajVHeDZFaVQ0TG5sNitoRHd3aXozUGR4Y1I0S0VxZzVqRmQ3QjNDcHQ0cUswRDFHVVhnMmx1ZHRsMU40CjVoNUJaNEZZcWF0VU1LQkVjeHd4ekZVVE1iNFZmdFhuMEJOSHkyVXlxUkx6VnBMZWgyRHRYcmtaZnRnTlFCeFAKNkNKc2FnYkpuRmZ1Mk1IaTh5VkE3UFZnUXExS3hPWnF0c0JKb3RvSzJXb0lONldpbnl0d0lwUFhsblJrZ3duYgo4dVBZdmhoZDB0ZVllZ2pYNW85azcwaDhFOEFpZGtqaFpKRkwzakRjc0NFdGJQSWtBMHp3bCs0UFN5aWV2UXpVCldFTkFTSzhXc1NxSk40bUtNSEJMbDU2WWZpTnBJNXVEUGx6eC9hS3hnQis2RExYL25GRzB0Y2ZTYlJFQ0F3RUEKQVFLQ0FnQnRjQlpZR2FxakxhK213RXFHbi9PK2RSRzcvTkZBalk2K096V3RzRnlodXZyWnJ1Z2pGOU1SQTZNMQpOZVJ6aXVMYitpMVIyeWlIR3VEQ3Y0SW9DOTRJY2xYRXpGbGpsMmJ5QXJ6ZTlhTHF1MWtQMGJWL09nOWl3bEpsCk5zSnpvRHY3SXh5d1VZeWtzcXVNNXVnV2dPWWp0RHVMSG5vTnFzT2Nmb2IwbXNyU3F0dGY5czJ2ald6dSt3aUUKbmdaTkxROG5Xd1czVGVhRnh1NXpSYWpMVEtuU0tLSkZUZER1M0t0R05QbkNra3BDN3RvRWR1RWZwaG9uMytYdwprMUtzSkwxMi9KUmw1OW5UZXdTc3o4TS9FUDNYeFhmY0RENzQwQ1R1eUVPV2dXR1BuUUhDRmJ6cXlGSmhWcEQ3CkJOZ1Awb3JoeWxCayt4Z0FmSXRCdzk2aW4xQ2VMZHZKek9TdDNXSUVrY0w3ZVB0bkpzWVpBa1J4eFU1NWF6ajEKbFJHNWRWN010ZzgwWXJTcDdoYXIxamhTQ0JjVzZMUHdueTdXK1psWEd6VG9Gb1o2clIwdytJdGRjNGpPSEhtTgpRVk9tWFd3SFJuZm5rQWZlNXdDQkZQbXpMT2tYbnloWjdaNWxmVlJQaE9lT0hlV09NeHJvWFZoRmJPcTFxemo1Cm85a1dMVGxwTk42YXhrOW41R1N6NlZDVDRHSW1iOUsyWmpQUklOMktQZ3Vxd0RRSFVmd0ViZ0NnTkVUOG5wc2UKelYxRnRpRUJaeVJPa2RwdDhDd2NrbGxHc0Nab0dIa3Z1OXlRSytMUldvV2xJS041WGJXYVljaW01VVhIZlIzUgp4ZGx2QmgxNDl2MW02Y3haMWpzNUFJM09Xb0lpaXlaWjdKUGUxbUIycDE2dUlsUGhsUUtDQVFFQTRNZmNPRVluCkdrQVEzaEdKMm5ia0ZzZ1hJemJrQkQvanIrY1JHd1pjeitBZ2x0cXFZRnQ2Rzh3eElBMGd2V1BLNDFhR1UzU1AKdHVjUEF6VjVEYlR3WklFdjVpY3kycHJlbHJ1ZTB4RkV4WWRZNFFCVGRiVFM4TE9ZWncxTEZpTGRXb1VKVlhiWApTaE4rSktpSDVpM3J1K2dwTHArT0ZHUSthWFdQSFp0TjdjTUZidEpUUkNQUlZqUkVHb25qejY3c2NNcWxZNjAyCkYxaFlURGRkTGNnNnhiN0M3ZmdXc25pdEh4ZWY5UHZFUlZSUWdyRW9RT3lOcFczL0VOU1RQN1IzTzhnNnNHTXYKUXI4SDd1a3RGUlAxUVRqSGNvdmtrdm9aaERHOHRGREd4T0FhbFMxK2phQVpBMmNVdEI4VU5ueHpqMFJFNE43VAp3OHZST3NHbjJ2aG9vd0tDQVFFQXlONmV1d0FFdllpanVlV21pYWNJTUQ0bExaL3JjLzF6T0RUQ3grWm05SHBCCjZyUGMvMG8yR3lGV2Y2aVN3UjhOWlVyM2dvREh6ck8vTHdZUTNyUEhhZFpkRGRFVWh5UXBHeDFuOG9ONXhSU0sKVkVkdnVESkF4SnhHdXRWYk9sNzlDUitadjBqa3hGY2xaOTBaSGdhVEl5TnBlK1dIcTI3Mm1oaENaOXNmK0RTMgppM2V2MEkrQ0t6eXppV2NUdzJKL0ROSlpIN0ZnUlc0U1M3OXBLcDFPOXk0a2hQMk0xQU9nVUp4eFBta0xMc05oCk45dlB0QmpXMENZZmxiei9zWjBYZEVtL1hEUE9xNWVXc0tsZm5XcnpzR3ZZVHRvZkxpN1pVekJhMjRyc1AzT3UKT0JqeFVQWDBhTnQ2bVlOSWVSQkNkVk9BZlFsbGFqSW1hVENNNXZQcXV3S0NBUUF1RXFrZjI3aytGeTJkNXVoagpvQVRtYW9MYmsrK3VzMDIvQzFTbFBtdWRyQ25oNGRZVVJBdkdVTmNzNDZQM1RkSVRRUFB0ZlRITDRwWmdLUUN6Ci80ZGFnbVJILzNiYitleHY1dXNLQmpzYlpiK2c5c2tra2ppK1g0RjRkZkFUREhoa2ltbzhXMHlMZ1cxVXBEcWUKd29EVUZpVUN5bTk3M0lReVo0YzdJVThhMGVOMk1LUWlqbGpsRzNkdUhSOVZ2VnYzVG9JUjZUbnlGUWljTHFqcApybVhsakZFMko2aTNVaWJoL1p5cXdVUWNsY2llMFNNWUU2U0E2UWZqOGo1d1MxUTVLN1JqM1NDZHhMd2lpeWJUCmNERFArb3hlL1MrUHRMV3dNK1dpNi8raDhQRmg3RjVKTnl5SlZ3S1dYTnh1d3BtSkh3d2pMMmttYzh0aUNMbVkKRjF5VEFvSUJBRWpJdWRWaW5WVWNKTTlnVW1jQWVpd1k2Sm5PbjU5bzBBNG11QWw5Q0FOQUpaQm8yZ1E3SEwzWgo1NkRjTVVqKytuaWdvR3pPUXhnMzgyZVRtQnRLSTFETFZ1NkJ1eUY0emRoQVlJRDBlUFFiakVBYm5uU3M2T0VWCkMxLzVuVlBhUlcrLzNwTDhVOEI5SDFXeVBMNnZmVE0zU3FxVk1nTEJjMlBFdEpNelNETkV6bnhjd3YwY2N2czkKeElSZU1FQVUrWnBvd2RpRkNqQStRU3puVDdFY1RSZXR4WmZXMCtlaTVMMHc0cXZObmpxMG13NkZmSTV5amF2ZwpsSU5LZDVBaEx2VjVIM2pHWVBXMk9Pa01obFBoQkNvQitlQWdrem5GeWdPbHV0WmdVVmh3ajBsT2FHcUFwSzQyCkVRZDlGWTZnZ0tSSXZIOFNINGhLWWJhdDIvQjNvNjhDZ2dFQVNnUGZubVdZcXpQTlpwYXh4VFZ3NXl0cXovMGcKUHlhcW41elhDSHFsdDluNkZFYWdRVjE4bjl0bUZzTWtnOFd4MHp1TjY5ajNvcXVDaWVDSkVRTTFDR05GUWg2MQpEV0xrd210R1FPNXZxc0VhcXpLZk9yWktnYTJ5L3BuejY2SkNlUW83UlJEdVVZVHpPY3NpQmtxNmNUNHFLQjY0ClBCVlVhQTROQkVCZlRoc1o5dDhpWHFDQWhUQnVlTDdhQ3pHV0ZjR1k5dndrZkJHNjNacURXbVlqZkZwRGlqSWIKL21ySnJVTTB0a09HcUhESk5aUWhpZXc1VHF6NWp3VElyTDY3YUdZNFpuNEVyODFlb3JOZnpEeDVnak1NYnoweQoyTGZoN1c0MFlWMDA4ZmZJTk5BbXA4VjNqay9qcWFUSFlWYlFQNGxhdTRIWkc5Q2g1Q1VpSmFvN2xBPT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K + # Generated by: + # ssh-keyscan github.com | base64 -w 0 + known_hosts: Z2l0aHViLmNvbSBzc2gtcnNhIEFBQUFCM056YUMxeWMyRUFBQUFCSXdBQUFRRUFxMkE3aFJHbWRubTl0VURiTzlJRFN3Qks2VGJRYStQWFlQQ1B5NnJiVHJUdHc3UEhrY2NLcnBwMHlWaHA1SGRFSWNLcjZwTGxWREJmT0xYOVFVc3lDT1Ywd3pmaklKTmxHRVlzZGxMSml6SGhibjJtVWp2U0FIUXFaRVRZUDgxZUZ6TFFOblBIdDRFVlZVaDdWZkRFU1U4NEtlem1ENVFsV3BYTG12VTMxL3lNZitTZTh4aEhUdktTQ1pJRkltV3dvRzZtYlVvV2Y5bnpwSW9hU2pCK3dlcXFVVW1wYWFhc1hWYWw3MkorVVgyQisyUlBXM1JjVDBlT3pRZ3FsSkwzUktyVEp2ZHNqRTNKRUF2R3EzbEdIU1pYeTI4RzNza3VhMlNtVmkvdzR5Q0U2Z2JPRHFuVFdsZzcrd0M2MDR5ZEdYQThWSmlTNWFwNDNKWGlVRkZBYVE9PQo= +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: robot-git-ssh +secrets: +- name: git-ssh +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: git-ssh-creds +spec: + serviceAccountName: robot-git-ssh + resources: + inputs: + - name: gitssh + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: git@github.com:tektoncd/pipeline.git + taskSpec: + resources: + inputs: + - name: gitssh + type: git + steps: + - name: config + image: ubuntu + script: | + #!/usr/bin/env bash + cat /workspace/gitssh/README.md diff --git a/examples/v1alpha2/taskruns/git-volume.yaml b/examples/v1alpha2/taskruns/git-volume.yaml new file mode 100644 index 00000000000..792aa32161a --- /dev/null +++ b/examples/v1alpha2/taskruns/git-volume.yaml @@ -0,0 +1,21 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-volume- +spec: + taskSpec: + steps: + - name: git + image: gcr.io/cloud-builders/git + workingDir: /path/to/git/rules_docker + args: ["status"] + volumeMounts: + - name: source + mountPath: /path/to/git + + volumes: + - name: source + gitRepo: # https://kubernetes.io/docs/concepts/storage/volumes/#gitrepo + # gitRepo is deprecated. + repository: "https://github.com/bazelbuild/rules_docker.git" + revision: "3caddbe7f75fde6afb2e2c63654b5bbeeeedf2ac" diff --git a/examples/v1alpha2/taskruns/home-is-set.yaml b/examples/v1alpha2/taskruns/home-is-set.yaml new file mode 100644 index 00000000000..54d6509317a --- /dev/null +++ b/examples/v1alpha2/taskruns/home-is-set.yaml @@ -0,0 +1,11 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: home-is-set- +spec: + taskSpec: + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + [[ $HOME == /tekton/home ]] diff --git a/examples/v1alpha2/taskruns/home-volume.yaml b/examples/v1alpha2/taskruns/home-volume.yaml new file mode 100644 index 00000000000..bd8ede7d878 --- /dev/null +++ b/examples/v1alpha2/taskruns/home-volume.yaml @@ -0,0 +1,26 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: home-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: echo some stuff > /tekton/home/stuff + - name: read + image: ubuntu + script: cat /tekton/home/stuff + - name: override-homevol + image: ubuntu + # /tekton/home/stuff *doesn't* exist, because the specified volumeMount + # conflicts with it, and the user's explicit declaration wins the tie. + script: | + #!/usr/bin/env bash + [[ ! -f /tekton/home/stuff ]] + volumeMounts: + - name: empty + mountPath: /tekton/home + volumes: + - name: empty + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/no-ci/.keep b/examples/v1alpha2/taskruns/no-ci/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/examples/v1alpha2/taskruns/no-ci/limitrange.yaml b/examples/v1alpha2/taskruns/no-ci/limitrange.yaml new file mode 100644 index 00000000000..0c94e246cd5 --- /dev/null +++ b/examples/v1alpha2/taskruns/no-ci/limitrange.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: LimitRange +metadata: + name: limit-mem-cpu-per-container +spec: + limits: + - max: + cpu: "800m" + memory: "1Gi" + min: + cpu: "100m" + memory: "99Mi" + default: + cpu: "700m" + memory: "900Mi" + defaultRequest: + cpu: "110m" + memory: "111Mi" + type: Container +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: echo-hello-world +spec: + steps: + - name: echo + image: ubuntu + command: + - echo + args: + - "hello world" +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: echo-hello-world-run- +spec: + inputs: {} + outputs: {} + serviceAccountName: "" + taskRef: + name: echo-hello-world + timeout: 1h0m0s + limitRangeName: "limit-mem-cpu-per-container" +status: + podName: "" diff --git a/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml b/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml new file mode 100644 index 00000000000..b13793aa60c --- /dev/null +++ b/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml @@ -0,0 +1,34 @@ +apiVersion: tekton.dev/v1alpha2 +kind: ClusterTask +metadata: + name: clustertask-with-optional-resources +spec: + params: + - name: filename + type: string + default: "README.md" + resources: + inputs: + - name: git-repo + type: git + optional: true + outputs: + - name: optionalimage + type: image + optional: true + steps: + - name: task-echo-success + image: ubuntu + script: | + #!/usr/bin/env bash + echo "success" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: clustertask-without-resources +spec: + taskRef: + name: clustertask-with-optional-resources + kind: ClusterTask diff --git a/examples/v1alpha2/taskruns/optional-resources.yaml b/examples/v1alpha2/taskruns/optional-resources.yaml new file mode 100644 index 00000000000..de59343c202 --- /dev/null +++ b/examples/v1alpha2/taskruns/optional-resources.yaml @@ -0,0 +1,130 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-check-optional-resources +spec: + params: + - name: filename + type: string + default: "README.md" + resources: + inputs: + - name: git-repo + type: git + description: "The input is code from a git repository" + optional: true + outputs: + - name: optionalimage + type: image + description: "The output is a Docker image" + optional: true + steps: + - name: check-git-repo + image: ubuntu + script: | + #!/usr/bin/env bash + if [ -d $(resources.inputs.git-repo.path) ]; then + echo "Git repo was cloned at $(resources.inputs.git-repo.path)" + if [ -f $(resources.inputs.git-repo.path)/$(inputs.params.filename) ]; then + echo "$(inputs.params.filename) does exist at $(resources.inputs.git-repo.path)" + else + echo "$(inputs.params.filename) does not exist at $(resources.inputs.git-repo.path)" + fi + else + echo "Git repo was not cloned at $(resources.inputs.git-repo.path)" + fi + if [ "$(outputs.resources.optionalimage.url)" == "" ]; then + echo "Image URL: $(outputs.resources.optionalimage.url)" + else + echo "No image URL specified." + fi + echo "Yay, Input and Output Resources can be Optional!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-with-resources +spec: + params: + - name: filename + value: "README.md" + resources: + inputs: + - name: git-repo + resourceSpec: + type: git + params: + - name: url + value: https://github.com/tektoncd/pipeline.git + outputs: + - name: optionalimage + resourceSpec: + type: image + params: + - name: url + value: gcr.io/foo/bar + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-invalid-filename +spec: + params: + - name: filename + value: "invalid.md" + resources: + inputs: + - name: git-repo + resourceSpec: + type: git + params: + - name: url + value: https://github.com/tektoncd/pipeline.git + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-without-resources +spec: + params: + - name: filename + value: "README.md" + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-without-resources-and-params +spec: + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-outputs-resources-with-input-resources +spec: + params: + - name: filename + value: "README.md" + resources: + inputs: + - name: git-repo + resourceSpec: + type: git + params: + - name: url + value: https://github.com/tektoncd/pipeline.git + taskRef: + name: task-check-optional-resources +--- diff --git a/examples/v1alpha2/taskruns/pull-private-image.yaml b/examples/v1alpha2/taskruns/pull-private-image.yaml new file mode 100644 index 00000000000..f28ee46a87e --- /dev/null +++ b/examples/v1alpha2/taskruns/pull-private-image.yaml @@ -0,0 +1,50 @@ +# Copyright 2019 The Tekton Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Secret +metadata: + name: test-readonly-credentials +type: kubernetes.io/dockercfg +data: + # Generated by: + # kubectl create secret docker-registry regsecret --docker-server=https://gcr.io \ + # --docker-username=_json_key --docker-password="$(cat /tmp/key.json)" \ + # --docker-email=noreply@google.com --dry-run -o yaml + # This service account is JUST a storage reader on gcr.io/build-crd-testing + .dockercfg: eyJodHRwczovL2djci5pbyI6eyJ1c2VybmFtZSI6Il9qc29uX2tleSIsInBhc3N3b3JkIjoie1xuICBcInR5cGVcIjogXCJzZXJ2aWNlX2FjY291bnRcIixcbiAgXCJwcm9qZWN0X2lkXCI6IFwiYnVpbGQtY3JkLXRlc3RpbmdcIixcbiAgXCJwcml2YXRlX2tleV9pZFwiOiBcIjA1MDJhNDFhODEyZmI2NGNlNTZhNjhlYzU4MzJhYjBiYTExYzExZTZcIixcbiAgXCJwcml2YXRlX2tleVwiOiBcIi0tLS0tQkVHSU4gUFJJVkFURSBLRVktLS0tLVxcbk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQzlYNEVZT0FSYnhRTThcXG5EMnhYY2FaVGsrZ1k4ZWp1OTh0THFDUXFUckdNVzlSZVQyeE9ZNUF5Z2FsUFArcDd5WEVja3dCRC9IaE0wZ2xJXFxuN01UTGRlZUtXcityQTFMd0haeVdGVzdIME9uZjd3bllIRUhMV1VtYzNCQ09SRUR0SFJaN1pyUEJmMUhUQUEvM1xcbk1uVzVsWkhTTjlvanpTU0Z3NkFWdTZqNmF4YkJJSUo3NTRMcmdLZUFZdXJ3ZklRMlJMVHUyMDFrMklxTFliaGJcXG4zbVNWRzVSK3RiS3oxQ3ZNNTNuSENiN0NmdVZlV3NyQThrazd4SHJyTFFLTW1JOXYyc2dSdWd5TUF6d3ovNnpOXFxuaDUvaU14eGdlcTVXOHhrVngzSjJuWThKSmRIYWYvVDZBR3NPTkVvNDNweGVpUVZqblJmL0tuMTBUQ2MyRXNJWVxcblM0OVVzWjdCQWdNQkFBRUNnZ0VBQXVwbGR1a0NRUXVENVUvZ2FtSHQ3R2dXM0FNVjE4ZXFuSG5DYTJqbGFoK1NcXG5BZVVHbmhnSmpOdkUrcE1GbFN2NXVmMnAySzRlZC9veEQ2K0NwOVpYRFJqZ3ZmdEl5cWpsemJ3dkZjZ3p3TnVEXFxueWdVa3VwN0hlY0RzRDhUdGVBb2JUL1Zwd3E2ektNckJ3Q3ZOa3Z5NmJWbG9FajV4M2JYc2F4ZTk1RE8veXB1NlxcbncwVzk3enh3d0RKWTZLUWNJV01qaHJHeHZ3WDduaVVDZU00bGVXQkR5R3R3MXplSm40aEVjNk4zYWpRYWNYS2NcXG4rNFFseGNpYW1ZcVFXYlBudHhXUWhoUXpjSFdMaTJsOWNGYlpENyt1SkxGNGlONnk4bVZOVTNLM0sxYlJZclNEXFxuUlVwM2FVVkJYbUZnK1ovMnB1VkwrbVUzajNMTFdZeUJPa2V2dU9tZGdRS0JnUURlM0dJUWt5V0lTMTRUZE1PU1xcbkJpS0JDRHk4aDk2ZWhMMEhrRGJ5T2tTdFBLZEY5cHVFeFp4aHk3b2pIQ0lNNUZWcnBSTjI1cDRzRXp3RmFjK3ZcXG5KSUZnRXZxN21YZm1YaVhJTmllUG9FUWFDbm54RHhXZ21yMEhVS0VtUzlvTWRnTGNHVStrQ1ZHTnN6N0FPdW0wXFxuS3FZM3MyMlE5bFE2N0ZPeXFpdThXRlE3UVFLQmdRRFppRmhURVprUEVjcVpqbndKcFRCNTZaV1A5S1RzbFpQN1xcbndVNGJ6aTZ5K21leWYzTUorNEwyU3lIYzNjcFNNYmp0Tk9aQ3Q0N2I5MDhGVW1MWFVHTmhjd3VaakVReEZleTBcXG5tNDFjUzVlNFA0OWI5bjZ5TEJqQnJCb3FzMldCYWwyZWdkaE5KU3NDV29pWlA4L1pUOGVnWHZoN2I5MWp6b0syXFxucTJQVW1BNERnUUtCZ0FXTDJJanZFSTBPeXgyUzExY24vZTNXSmFUUGdOUFRHOTAzVXBhK3FuemhPSXgrTWFxaFxcblBGNFdzdUF5MEFvZ0dKd2dOSmJOOEh2S1VzRVR2QTV3eXlOMzlYTjd3MGNoYXJGTDM3b3NVK1dPQXpEam5qY3NcXG5BcTVPN0dQR21YdWI2RUJRQlBKaEpQMXd5NHYvSzFmSGcvRjQ3cTRmNDBMQUpPa2FZUkpENUh6QkFvR0JBTlVoXFxubklCUEpxcTRJTXZRNmNDOWc4QisxeFlEZWE5L1lrMXcrU21QR3Z3ckVYeTNHS3g0SzdsS3BiUHo3bTRYMzNzeFxcbnNFVS8rWTJWUW13UmExeFFtLzUzcks3VjJsNUpmL0Q0MDBqUm02WmZTQU92Z0RUcnRablVHSk1yejlFN3VOdzdcXG5sZ1VIM0pyaXZ5Ri9meE1JOHFzelFid1hQMCt4bnlxQXhFQWdkdUtCQW9HQUlNK1BTTllXQ1pYeERwU0hJMThkXFxuaktrb0FidzJNb3l3UUlsa2V1QW4xZFhGYWQxenNYUUdkVHJtWHl2N05QUCs4R1hCa25CTGkzY3Z4VGlsSklTeVxcbnVjTnJDTWlxTkFTbi9kcTdjV0RGVUFCZ2pYMTZKSDJETkZaL2wvVVZGM05EQUpqWENzMVg3eUlKeVhCNm94L3pcXG5hU2xxbElNVjM1REJEN3F4Unl1S3Nnaz1cXG4tLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tXFxuXCIsXG4gIFwiY2xpZW50X2VtYWlsXCI6IFwicHVsbC1zZWNyZXQtdGVzdGluZ0BidWlsZC1jcmQtdGVzdGluZy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbVwiLFxuICBcImNsaWVudF9pZFwiOiBcIjEwNzkzNTg2MjAzMzAyNTI1MTM1MlwiLFxuICBcImF1dGhfdXJpXCI6IFwiaHR0cHM6Ly9hY2NvdW50cy5nb29nbGUuY29tL28vb2F1dGgyL2F1dGhcIixcbiAgXCJ0b2tlbl91cmlcIjogXCJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvdG9rZW5cIixcbiAgXCJhdXRoX3Byb3ZpZGVyX3g1MDlfY2VydF91cmxcIjogXCJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9vYXV0aDIvdjEvY2VydHNcIixcbiAgXCJjbGllbnRfeDUwOV9jZXJ0X3VybFwiOiBcImh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3JvYm90L3YxL21ldGFkYXRhL3g1MDkvcHVsbC1zZWNyZXQtdGVzdGluZyU0MGJ1aWxkLWNyZC10ZXN0aW5nLmlhbS5nc2VydmljZWFjY291bnQuY29tXCJcbn0iLCJlbWFpbCI6Im5vcmVwbHlAZ29vZ2xlLmNvbSIsImF1dGgiOiJYMnB6YjI1ZmEyVjVPbnNLSUNBaWRIbHdaU0k2SUNKelpYSjJhV05sWDJGalkyOTFiblFpTEFvZ0lDSndjbTlxWldOMFgybGtJam9nSW1KMWFXeGtMV055WkMxMFpYTjBhVzVuSWl3S0lDQWljSEpwZG1GMFpWOXJaWGxmYVdRaU9pQWlNRFV3TW1FME1XRTRNVEptWWpZMFkyVTFObUUyT0dWak5UZ3pNbUZpTUdKaE1URmpNVEZsTmlJc0NpQWdJbkJ5YVhaaGRHVmZhMlY1SWpvZ0lpMHRMUzB0UWtWSFNVNGdVRkpKVmtGVVJTQkxSVmt0TFMwdExWeHVUVWxKUlhaUlNVSkJSRUZPUW1kcmNXaHJhVWM1ZHpCQ1FWRkZSa0ZCVTBOQ1MyTjNaMmRUYWtGblJVRkJiMGxDUVZGRE9WZzBSVmxQUVZKaWVGRk5PRnh1UkRKNFdHTmhXbFJySzJkWk9HVnFkVGs0ZEV4eFExRnhWSEpIVFZjNVVtVlVNbmhQV1RWQmVXZGhiRkJRSzNBM2VWaEZZMnQzUWtRdlNHaE5NR2RzU1Z4dU4wMVVUR1JsWlV0WGNpdHlRVEZNZDBoYWVWZEdWemRJTUU5dVpqZDNibGxJUlVoTVYxVnRZek5DUTA5U1JVUjBTRkphTjFweVVFSm1NVWhVUVVFdk0xeHVUVzVYTld4YVNGTk9PVzlxZWxOVFJuYzJRVloxTm1vMllYaGlRa2xKU2pjMU5FeHlaMHRsUVZsMWNuZG1TVkV5VWt4VWRUSXdNV3N5U1hGTVdXSm9ZbHh1TTIxVFZrYzFVaXQwWWt0Nk1VTjJUVFV6YmtoRFlqZERablZXWlZkemNrRTRhMnMzZUVoeWNreFJTMDF0U1RsMk1uTm5VblZuZVUxQmVuZDZMelo2VGx4dWFEVXZhVTE0ZUdkbGNUVlhPSGhyVm5nelNqSnVXVGhLU21SSVlXWXZWRFpCUjNOUFRrVnZORE53ZUdWcFVWWnFibEptTDB0dU1UQlVRMk15UlhOSldWeHVVelE1VlhOYU4wSkJaMDFDUVVGRlEyZG5SVUZCZFhCc1pIVnJRMUZSZFVRMVZTOW5ZVzFJZERkSFoxY3pRVTFXTVRobGNXNUlia05oTW1wc1lXZ3JVMXh1UVdWVlIyNW9aMHBxVG5aRkszQk5SbXhUZGpWMVpqSndNa3MwWldRdmIzaEVOaXREY0RsYVdFUlNhbWQyWm5SSmVYRnFiSHBpZDNaR1kyZDZkMDUxUkZ4dWVXZFZhM1Z3TjBobFkwUnpSRGhVZEdWQmIySlVMMVp3ZDNFMmVrdE5ja0ozUTNaT2EzWjVObUpXYkc5RmFqVjRNMkpZYzJGNFpUazFSRTh2ZVhCMU5seHVkekJYT1RkNmVIZDNSRXBaTmt0UlkwbFhUV3BvY2tkNGRuZFlOMjVwVlVObFRUUnNaVmRDUkhsSGRIY3hlbVZLYmpSb1JXTTJUak5oYWxGaFkxaExZMXh1S3pSUmJIaGphV0Z0V1hGUlYySlFiblI0VjFGb2FGRjZZMGhYVEdreWJEbGpSbUphUkRjcmRVcE1SalJwVGpaNU9HMVdUbFV6U3pOTE1XSlNXWEpUUkZ4dVVsVndNMkZWVmtKWWJVWm5LMW92TW5CMVZrd3JiVlV6YWpOTVRGZFplVUpQYTJWMmRVOXRaR2RSUzBKblVVUmxNMGRKVVd0NVYwbFRNVFJVWkUxUFUxeHVRbWxMUWtORWVUaG9PVFpsYUV3d1NHdEVZbmxQYTFOMFVFdGtSamx3ZFVWNFduaG9lVGR2YWtoRFNVMDFSbFp5Y0ZKT01qVndOSE5GZW5kR1lXTXJkbHh1U2tsR1owVjJjVGR0V0dadFdHbFlTVTVwWlZCdlJWRmhRMjV1ZUVSNFYyZHRjakJJVlV0RmJWTTViMDFrWjB4alIxVXJhME5XUjA1emVqZEJUM1Z0TUZ4dVMzRlpNM015TWxFNWJGRTJOMFpQZVhGcGRUaFhSbEUzVVZGTFFtZFJSRnBwUm1oVVJWcHJVRVZqY1ZwcWJuZEtjRlJDTlRaYVYxQTVTMVJ6YkZwUU4xeHVkMVUwWW5wcE5ua3JiV1Y1WmpOTlNpczBUREpUZVVoak0yTndVMDFpYW5ST1QxcERkRFEzWWprd09FWlZiVXhZVlVkT2FHTjNkVnBxUlZGNFJtVjVNRnh1YlRReFkxTTFaVFJRTkRsaU9XNDJlVXhDYWtKeVFtOXhjekpYUW1Gc01tVm5aR2hPU2xOelExZHZhVnBRT0M5YVZEaGxaMWgyYURkaU9URnFlbTlMTWx4dWNUSlFWVzFCTkVSblVVdENaMEZYVERKSmFuWkZTVEJQZVhneVV6RXhZMjR2WlROWFNtRlVVR2RPVUZSSE9UQXpWWEJoSzNGdWVtaFBTWGdyVFdGeGFGeHVVRVkwVjNOMVFYa3dRVzluUjBwM1owNUtZazQ0U0haTFZYTkZWSFpCTlhkNWVVNHpPVmhPTjNjd1kyaGhja1pNTXpkdmMxVXJWMDlCZWtScWJtcGpjMXh1UVhFMVR6ZEhVRWR0V0hWaU5rVkNVVUpRU21oS1VERjNlVFIyTDBzeFpraG5MMFkwTjNFMFpqUXdURUZLVDJ0aFdWSktSRFZJZWtKQmIwZENRVTVWYUZ4dWJrbENVRXB4Y1RSSlRYWlJObU5ET1djNFFpc3hlRmxFWldFNUwxbHJNWGNyVTIxUVIzWjNja1ZZZVROSFMzZzBTemRzUzNCaVVIbzNiVFJZTXpOemVGeHVjMFZWTHl0Wk1sWlJiWGRTWVRGNFVXMHZOVE55U3pkV01tdzFTbVl2UkRRd01HcFNiVFphWmxOQlQzWm5SRlJ5ZEZwdVZVZEtUWEo2T1VVM2RVNTNOMXh1YkdkVlNETktjbWwyZVVZdlpuaE5TVGh4YzNwUlluZFlVREFyZUc1NWNVRjRSVUZuWkhWTFFrRnZSMEZKVFN0UVUwNVpWME5hV0hoRWNGTklTVEU0WkZ4dWFrdHJiMEZpZHpKTmIzbDNVVWxzYTJWMVFXNHhaRmhHWVdReGVuTllVVWRrVkhKdFdIbDJOMDVRVUNzNFIxaENhMjVDVEdrelkzWjRWR2xzU2tsVGVWeHVkV05PY2tOTmFYRk9RVk51TDJSeE4yTlhSRVpWUVVKbmFsZ3hOa3BJTWtST1Jsb3ZiQzlWVmtZelRrUkJTbXBZUTNNeFdEZDVTVXA1V0VJMmIzZ3ZlbHh1WVZOc2NXeEpUVll6TlVSQ1JEZHhlRko1ZFV0eloyczlYRzR0TFMwdExVVk9SQ0JRVWtsV1FWUkZJRXRGV1MwdExTMHRYRzRpTEFvZ0lDSmpiR2xsYm5SZlpXMWhhV3dpT2lBaWNIVnNiQzF6WldOeVpYUXRkR1Z6ZEdsdVowQmlkV2xzWkMxamNtUXRkR1Z6ZEdsdVp5NXBZVzB1WjNObGNuWnBZMlZoWTJOdmRXNTBMbU52YlNJc0NpQWdJbU5zYVdWdWRGOXBaQ0k2SUNJeE1EYzVNelU0TmpJd016TXdNalV5TlRFek5USWlMQW9nSUNKaGRYUm9YM1Z5YVNJNklDSm9kSFJ3Y3pvdkwyRmpZMjkxYm5SekxtZHZiMmRzWlM1amIyMHZieTl2WVhWMGFESXZZWFYwYUNJc0NpQWdJblJ2YTJWdVgzVnlhU0k2SUNKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwdmJ5OXZZWFYwYURJdmRHOXJaVzRpTEFvZ0lDSmhkWFJvWDNCeWIzWnBaR1Z5WDNnMU1EbGZZMlZ5ZEY5MWNtd2lPaUFpYUhSMGNITTZMeTkzZDNjdVoyOXZaMnhsWVhCcGN5NWpiMjB2YjJGMWRHZ3lMM1l4TDJObGNuUnpJaXdLSUNBaVkyeHBaVzUwWDNnMU1EbGZZMlZ5ZEY5MWNtd2lPaUFpYUhSMGNITTZMeTkzZDNjdVoyOXZaMnhsWVhCcGN5NWpiMjB2Y205aWIzUXZkakV2YldWMFlXUmhkR0V2ZURVd09TOXdkV3hzTFhObFkzSmxkQzEwWlhOMGFXNW5KVFF3WW5WcGJHUXRZM0prTFhSbGMzUnBibWN1YVdGdExtZHpaWEoyYVdObFlXTmpiM1Z1ZEM1amIyMGlDbjA9In19 +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: test-build-robot +secrets: +- name: test-readonly-credentials +imagePullSecrets: +- name: test-readonly-credentials +--- +# This example contains embedded taskSpec. This taskrun requires the secrets and service accounts to be able to pull the +# private image. Required secret and service account for this run is configured in test-build-robot SA and test-readonly-credentials secret. +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: pull-private-image- +spec: + serviceAccountName: test-build-robot + taskSpec: + steps: + - name: pull + # Private image is just Ubuntu + image: quay.io/rhpipeline/skopeo:alpine + script: skopeo copy docker://gcr.io/build-crd-testing/secret-sauce dir:///tmp/ diff --git a/examples/v1alpha2/taskruns/pullrequest.yaml b/examples/v1alpha2/taskruns/pullrequest.yaml new file mode 100644 index 00000000000..465e7656453 --- /dev/null +++ b/examples/v1alpha2/taskruns/pullrequest.yaml @@ -0,0 +1,33 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: pullrequest- +spec: + resources: + inputs: + - name: pr + resourceSpec: + type: pullRequest + params: + - name: url + # I just picked a random PR. The first couple didn't have any interesting comments or labels. + value: https://github.com/tektoncd/pipeline/pull/100 + taskSpec: + resources: + inputs: + - name: pr + type: pullRequest + steps: + - name: dump-workspace + image: ubuntu + script: find $(resources.inputs.pr.path)/* -type f | xargs tail -n +1 + + - name: ensure-approved + image: ubuntu + script: | + if [ -f "$(resources.inputs.pr.path)/labels/approved" ]; then + echo "PR is approved!" + else + echo "PR is not approved!" + exit 1 + fi diff --git a/examples/v1alpha2/taskruns/secret-env.yaml b/examples/v1alpha2/taskruns/secret-env.yaml new file mode 100644 index 00000000000..f0360e3ab95 --- /dev/null +++ b/examples/v1alpha2/taskruns/secret-env.yaml @@ -0,0 +1,25 @@ +kind: Secret +apiVersion: v1 +metadata: + name: secret-env-password +stringData: + ninja: SECRET_PASSWORD +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: secret-env +spec: + taskSpec: + steps: + - name: secret + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] + env: + - name: SECRET_PASSWORD + valueFrom: + secretKeyRef: + name: secret-env-password + key: ninja diff --git a/examples/v1alpha2/taskruns/secret-volume-params.yaml b/examples/v1alpha2/taskruns/secret-volume-params.yaml new file mode 100644 index 00000000000..6052ee8644e --- /dev/null +++ b/examples/v1alpha2/taskruns/secret-volume-params.yaml @@ -0,0 +1,33 @@ +kind: Secret +apiVersion: v1 +metadata: + name: secret-vol-param-password +stringData: + ninja: SECRET_PASSWORD +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: secret-volume-params +spec: + taskSpec: + params: + - name: SCNAME + description: Name of secret + type: string + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + SECRET_PASSWORD=$(cat /var/secret/ninja) + [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] + volumeMounts: + - name: secret-volume + mountPath: /var/secret + volumes: + - name: secret-volume + secret: + secretName: "$(params.SCNAME)" + params: + - name: SCNAME + value: secret-vol-param-password diff --git a/examples/v1alpha2/taskruns/secret-volume.yaml b/examples/v1alpha2/taskruns/secret-volume.yaml new file mode 100644 index 00000000000..14d0984e677 --- /dev/null +++ b/examples/v1alpha2/taskruns/secret-volume.yaml @@ -0,0 +1,26 @@ +kind: Secret +apiVersion: v1 +metadata: + name: secret-vol-password +stringData: + ninja: SECRET_PASSWORD +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: secret-volume +spec: + taskSpec: + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + SECRET_PASSWORD=$(cat /var/secret/ninja) + [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] + volumeMounts: + - name: secret-volume + mountPath: /var/secret + volumes: + - name: secret-volume + secret: + secretName: secret-vol-password diff --git a/examples/v1alpha2/taskruns/sidecar-interp.yaml b/examples/v1alpha2/taskruns/sidecar-interp.yaml new file mode 100644 index 00000000000..6aa642cbf04 --- /dev/null +++ b/examples/v1alpha2/taskruns/sidecar-interp.yaml @@ -0,0 +1,33 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: sidecar-interp- +spec: + taskSpec: + params: + - name: some-input + default: foo + volumes: + - name: shared + emptyDir: {} + sidecars: + - name: value-sidecar + image: ubuntu + command: + - /bin/bash + args: + - -c + - "echo $(params.some-input) > /shared/value && sleep infinity" + volumeMounts: + - name: shared + mountPath: /shared + steps: + - name: check-value + image: ubuntu + script: | + #!/bin/bash + VALUE=$(cat /shared/value) + [[ $VALUE == 'foo' ]] + volumeMounts: + - name: shared + mountPath: /shared diff --git a/examples/v1alpha2/taskruns/sidecar-ready-script.yaml b/examples/v1alpha2/taskruns/sidecar-ready-script.yaml new file mode 100644 index 00000000000..e36e7548af8 --- /dev/null +++ b/examples/v1alpha2/taskruns/sidecar-ready-script.yaml @@ -0,0 +1,28 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: sidecar-ready- +spec: + taskSpec: + sidecars: + - name: slow-sidecar + image: ubuntu + script: | + echo "hello from sidecar" > /shared/message + volumeMounts: + - name: shared + mountPath: /shared + + steps: + - name: check-ready + image: ubuntu + script: cat /shared/message + volumeMounts: + - name: shared + mountPath: /shared + + # Sidecars don't have /workspace mounted by default, so we have to define + # our own shared volume. + volumes: + - name: shared + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/sidecar-ready.yaml b/examples/v1alpha2/taskruns/sidecar-ready.yaml new file mode 100644 index 00000000000..11869605b0d --- /dev/null +++ b/examples/v1alpha2/taskruns/sidecar-ready.yaml @@ -0,0 +1,38 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: sidecar-ready- +spec: + taskSpec: + sidecars: + - name: slow-sidecar + image: ubuntu + command: ['sleep', 'infinity'] + # The sidecar takes 5s to report as Ready, even after it starts. If the + # step runs as soon as the sidecar starts, it will fail because + # /shared/ready isn't available yet. + readinessProbe: + exec: + command: + - sh + - -c + - sleep 5 && touch /shared/ready + volumeMounts: + - name: shared + mountPath: /shared + + steps: + - name: check-ready + image: ubuntu + # The step will only succeed if the sidecar has written this file, which + # it does 5s after it starts, before it reports Ready. + script: cat /shared/ready + volumeMounts: + - name: shared + mountPath: /shared + + # Sidecars don't have /workspace mounted by default, so we have to define + # our own shared volume. + volumes: + - name: shared + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/step-by-digest.yaml b/examples/v1alpha2/taskruns/step-by-digest.yaml new file mode 100644 index 00000000000..33d64fc3201 --- /dev/null +++ b/examples/v1alpha2/taskruns/step-by-digest.yaml @@ -0,0 +1,11 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: step-by-digest- +spec: + taskSpec: + steps: + # Step images can be specified by digest. + - image: busybox@sha256:1303dbf110c57f3edf68d9f5a16c082ec06c4cf7604831669faf2c712260b5a0 + # NB: command is not set, so it must be looked up from the registry. + args: ['-c', 'echo hello'] diff --git a/examples/v1alpha2/taskruns/step-script.yaml b/examples/v1alpha2/taskruns/step-script.yaml new file mode 100644 index 00000000000..cfd77f6150e --- /dev/null +++ b/examples/v1alpha2/taskruns/step-script.yaml @@ -0,0 +1,88 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: step-script- +spec: + taskSpec: + params: + - name: PARAM + default: param-value + + steps: + - name: noshebang + image: ubuntu + script: echo "no shebang" + - name: bash + image: ubuntu + env: + - name: FOO + value: foooooooo + script: | + #!/usr/bin/env bash + set -euxo pipefail + echo "Hello from Bash!" + echo FOO is ${FOO} + echo substring is ${FOO:2:4} + for i in {1..10}; do + echo line $i + done + + - name: place-file + image: ubuntu + script: | + #!/usr/bin/env bash + echo "echo Hello from script file" > /workspace/hello + chmod +x /workspace/hello + - name: run-file + image: ubuntu + script: | + #!/usr/bin/env bash + /workspace/hello + + - name: contains-eof + image: ubuntu + script: | + #!/usr/bin/env bash + cat > file << EOF + this file has some contents + EOF + cat file + + - name: node + image: node + script: | + #!/usr/bin/env node + console.log("Hello from Node!") + + - name: python + image: python + script: | + #!/usr/bin/env python3 + print("Hello from Python!") + + - name: perl + image: perl + script: | + #!/usr/bin/perl + print "Hello from Perl!" + + # Test that param values are replaced. + - name: params-applied + image: python + script: | + #!/usr/bin/env python3 + v = '$(params.PARAM)' + if v != 'param-value': + print('Param values not applied') + print('Got: ', v) + exit(1) + + # Test that args are allowed and passed to the script as expected. + - name: args-allowed + image: ubuntu + args: ['hello', 'world'] + script: | + #!/usr/bin/env bash + [[ $# == 2 ]] + [[ $1 == "hello" ]] + [[ $2 == "world" ]] diff --git a/examples/v1alpha2/taskruns/steps-run-in-order.yaml b/examples/v1alpha2/taskruns/steps-run-in-order.yaml new file mode 100644 index 00000000000..6f7082bb67c --- /dev/null +++ b/examples/v1alpha2/taskruns/steps-run-in-order.yaml @@ -0,0 +1,12 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: steps-run-in-order- +spec: + taskSpec: + steps: + - image: busybox + # NB: command is not set, so it must be looked up from the registry. + args: ['-c', 'sleep 3 && touch foo'] + - image: busybox + args: ['-c', 'ls', 'foo'] diff --git a/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml b/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml new file mode 100644 index 00000000000..bf393ae2d4a --- /dev/null +++ b/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml @@ -0,0 +1,65 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: steptemplate-env-merge- +spec: + params: + - name: FOO + value: foo + - name: BAR + value: bar + taskSpec: + # This template will be applied to all steps + stepTemplate: + env: + - name: QUX + value: original + params: + - name: FOO + description: FOO variable + - name: BAR + description: BAR variable + - name: FOOBAR + description: FOOBAR variable + default: foobar + steps: + # Test the environment variables are set in the task + - name: foo + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $FOO == "foo" ]] + env: + - name: FOO + value: $(params.FOO) + - name: foobar + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $FOOBAR == "foobar" ]] + env: + - name: FOOBAR + value: $(params.FOOBAR) + - name: bar + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $BAR == "bar" ]] + env: + - name: BAR + value: $(params.BAR) + # Use the env var from the stepTemplate + - name: qux-no-override + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $QUX == "original" ]] + # Override the env var in the stepTemplate + - name: qux-override + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $QUX == "override" ]] + env: + - name: QUX + value: override diff --git a/examples/v1alpha2/taskruns/task-multiple-output-image.yaml b/examples/v1alpha2/taskruns/task-multiple-output-image.yaml new file mode 100644 index 00000000000..796a4eaa008 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-multiple-output-image.yaml @@ -0,0 +1,118 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-1 +spec: + type: image + params: + - name: url + value: gcr.io/dlorenc-vmtest2/leeroy-web # Replace this URL with $KO_DOCKER_REPO +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-2 +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-web # Replace this URL with $KO_DOCKER_REPO +--- +# This demo modifies the cluster (deploys to it) you must use a service +# account with permission to admin the cluster (or make your default user an admin +# of the `default` namespace with default-cluster-admin). +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + generateName: default-cluster-admin- +subjects: + - kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-multiple-output-image +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# This task is currently hardcoding a index.json file instead of +# building an image since kaniko and other easy to use tools don't +# support exporting this file yet +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: multiple-build-push-kaniko +spec: + resources: + inputs: + - name: sourcerepo + type: git + outputs: + - name: builtImage1 + type: image + - name: builtImage2 + type: image + steps: + - name: build-and-push-1 + image: busybox + script: | + set -ex + mkdir -p /tekton/home/image-outputs/builtImage1 + cat < /tekton/home/image-outputs/builtImage1/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" + } + ] + } + - name: build-and-push-2 + image: busybox + script: | + set -e + mkdir -p /tekton/home/image-outputs/builtImage2 + cat < /tekton/home/image-outputs/builtImage2/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" + } + ] + } +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: multiple-build-push-kaniko-run +spec: + taskRef: + name: multiple-build-push-kaniko + resources: + inputs: + - name: sourcerepo + resourceRef: + name: skaffold-git-multiple-output-image + outputs: + - name: builtImage1 + resourceRef: + name: skaffold-image-leeroy-web-1 + - name: builtImage2 + resourceRef: + name: skaffold-image-leeroy-web-2 diff --git a/examples/v1alpha2/taskruns/task-output-image.yaml b/examples/v1alpha2/taskruns/task-output-image.yaml new file mode 100644 index 00000000000..95adeb88970 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-output-image.yaml @@ -0,0 +1,90 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-output-image +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-web # Replace this URL with $KO_DOCKER_REPO +--- +# This demo modifies the cluster (deploys to it) you must use a service +# account with permission to admin the cluster (or make your default user an admin +# of the `default` namespace with default-cluster-admin). +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + generateName: default-cluster-admin- +subjects: + - kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-output-image +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# This task is currently hardcoding a index.json file instead of +# building an image since kaniko and other easy to use tools don't +# support exporting this file yet +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-push-kaniko-output-image +spec: + resources: + inputs: + - name: sourcerepo + type: git + outputs: + - name: builtImage + type: image + targetPath: /workspace/sourcerepo + steps: + - name: build-and-push + image: busybox + script: | + set -e + cat < $(resources.inputs.sourcerepo.path)/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" + } + ] + } + - name: echo + image: busybox + script: cat $(resources.inputs.sourcerepo.path)/index.json +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: build-push-run-output-image +spec: + taskRef: + name: build-push-kaniko-output-image + resources: + inputs: + - name: sourcerepo + resourceRef: + name: skaffold-git-output-image + outputs: + - name: builtImage + resourceRef: + name: skaffold-image-leeroy-web-output-image diff --git a/examples/v1alpha2/taskruns/task-result.yaml b/examples/v1alpha2/taskruns/task-result.yaml new file mode 100644 index 00000000000..b33110bec64 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-result.yaml @@ -0,0 +1,24 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: print-date + annotations: + description: | + A simple task that prints the date. +spec: + results: + - name: current-date-unix-timestamp + description: The current date in unix timestamp format + - name: current-date-human-readable + description: The current date in humand readable format + steps: + - name: print-date-unix-timestamp + image: bash:latest + script: | + #!/usr/bin/env bash + date +%s | tee /tekton/results/current-date-unix-timestamp + - name: print-date-humman-readable + image: bash:latest + script: | + #!/usr/bin/env bash + date | tee /tekton/results/current-date-human-readable diff --git a/examples/v1alpha2/taskruns/task-volume-args.yaml b/examples/v1alpha2/taskruns/task-volume-args.yaml new file mode 100644 index 00000000000..fe33840537c --- /dev/null +++ b/examples/v1alpha2/taskruns/task-volume-args.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-for-testing-volume-args +data: + test.data: tasks are my jam +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: task-volume-args- +spec: + taskSpec: + params: + - name: CFGNAME + description: Name of config map + type: string + steps: + - name: read + image: ubuntu + script: | + #!/usr/bin/env bash + cat /configmap/test.data + volumeMounts: + - name: custom + mountPath: /configmap + volumes: + - name: custom + configMap: + name: "$(params.CFGNAME)" + params: + - name: CFGNAME + value: config-for-testing-volume-args diff --git a/examples/v1alpha2/taskruns/template-volume.yaml b/examples/v1alpha2/taskruns/template-volume.yaml new file mode 100644 index 00000000000..f588aeeabd1 --- /dev/null +++ b/examples/v1alpha2/taskruns/template-volume.yaml @@ -0,0 +1,27 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: template-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: | + #!/usr/bin/env bash + echo some stuff > /im/a/custom/mount/path/file + volumeMounts: + - name: custom + mountPath: /im/a/custom/mount/path + - name: read + image: ubuntu + script: | + #!/usr/bin/env bash + cat /short/and/stout/file + volumeMounts: + - name: custom + mountPath: /short/and/stout + podTemplate: + volumes: + - name: custom + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/unnamed-steps.yaml b/examples/v1alpha2/taskruns/unnamed-steps.yaml new file mode 100644 index 00000000000..b81a59aa1db --- /dev/null +++ b/examples/v1alpha2/taskruns/unnamed-steps.yaml @@ -0,0 +1,13 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: unnamed-steps- +spec: + taskSpec: + steps: + - image: ubuntu + script: 'true' + - image: ubuntu + script: 'true' + - image: ubuntu + script: 'true' diff --git a/examples/v1alpha2/taskruns/workingdir.yaml b/examples/v1alpha2/taskruns/workingdir.yaml new file mode 100644 index 00000000000..9795aa721b2 --- /dev/null +++ b/examples/v1alpha2/taskruns/workingdir.yaml @@ -0,0 +1,19 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: workingdir- +spec: + taskSpec: + steps: + - name: default + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $PWD == /workspace ]] + + - name: override + image: ubuntu + workingDir: '/a/path/too/far' + script: | + #!/usr/bin/env bash + [[ $PWD == /a/path/too/far ]] diff --git a/examples/v1alpha2/taskruns/workspace-readonly.yaml b/examples/v1alpha2/taskruns/workspace-readonly.yaml new file mode 100644 index 00000000000..3dabb0fa9cc --- /dev/null +++ b/examples/v1alpha2/taskruns/workspace-readonly.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: my-pvc-2 +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: workspaces-readonly- +spec: + workspaces: + - name: write-allowed + persistentVolumeClaim: + claimName: my-pvc-2 + - name: write-disallowed + persistentVolumeClaim: + claimName: my-pvc-2 + taskSpec: + workspaces: + - name: write-allowed + - name: write-disallowed + readOnly: true + steps: + - name: write-allowed + image: ubuntu + script: echo "hello" > $(workspaces.write-allowed.path)/foo + - name: read-allowed + image: ubuntu + script: cat $(workspaces.write-allowed.path)/foo | grep "hello" + - name: write-disallowed + image: ubuntu + script: + echo "goodbye" > $(workspaces.write-disallowed.path)/foo || touch write-failed.txt + test -f write-failed.txt + - name: read-again + # We should get "hello" when reading again because writing "goodbye" to + # the file should have been disallowed. + image: ubuntu + script: + cat $(workspaces.write-disallowed.path)/foo | grep "hello" diff --git a/examples/v1alpha2/taskruns/workspace-volume.yaml b/examples/v1alpha2/taskruns/workspace-volume.yaml new file mode 100644 index 00000000000..f756030daea --- /dev/null +++ b/examples/v1alpha2/taskruns/workspace-volume.yaml @@ -0,0 +1,27 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: workspace-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: echo some stuff > /workspace/stuff + - name: read + image: ubuntu + script: cat /workspace/stuff + + - name: override-workspace + image: ubuntu + # /workspace/stuff *doesn't* exist. + script: | + #!/usr/bin/env bash + [[ ! -f /workspace/stuff ]] + volumeMounts: + - name: empty + mountPath: /workspace + + volumes: + - name: empty + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/workspace.yaml b/examples/v1alpha2/taskruns/workspace.yaml new file mode 100644 index 00000000000..3ca1d9bcaca --- /dev/null +++ b/examples/v1alpha2/taskruns/workspace.yaml @@ -0,0 +1,93 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: my-pvc +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: my-configmap +data: + message: hello world +--- +apiVersion: v1 +kind: Secret +metadata: + name: my-secret +type: Opaque +stringData: + username: user +data: + message: aGVsbG8gc2VjcmV0 +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: custom-volume- +spec: + workspaces: + - name: custom + persistentVolumeClaim: + claimName: my-pvc + subPath: my-subdir + - name: custom2 + persistentVolumeClaim: + claimName: my-pvc + - name: custom3 + emptyDir: {} + subPath: testing + - name: custom4 + configMap: + name: my-configmap + items: + - key: message + path: my-message.txt + - name: custom5 + secret: + secretName: my-secret + taskSpec: + steps: + - name: write + image: ubuntu + script: echo $(workspaces.custom.volume) > $(workspaces.custom.path)/foo + - name: read + image: ubuntu + script: cat $(workspaces.custom.path)/foo | grep $(workspaces.custom.volume) + - name: write2 + image: ubuntu + script: echo $(workspaces.custom2.path) > $(workspaces.custom2.path)/foo + - name: read2 + image: ubuntu + script: cat $(workspaces.custom2.path)/foo | grep $(workspaces.custom2.path) + - name: write3 + image: ubuntu + script: echo $(workspaces.custom3.path) > $(workspaces.custom3.path)/foo + - name: read3 + image: ubuntu + script: cat $(workspaces.custom3.path)/foo | grep $(workspaces.custom3.path) + - name: readconfigmap + image: ubuntu + script: cat $(workspaces.custom4.path)/my-message.txt | grep "hello world" + - name: readsecret + image: ubuntu + script: | + #!/usr/bin/env bash + set -xe + cat $(workspaces.custom5.path)/username | grep "user" + cat $(workspaces.custom5.path)/message | grep "hello secret" + workspaces: + - name: custom + - name: custom2 + mountPath: /foo/bar/baz + - name: custom3 + - name: custom4 + mountPath: /baz/bar/quux + - name: custom5 + mountPath: /my/secret/volume diff --git a/test/e2e-common.sh b/test/e2e-common.sh index 97ff5977573..94c28911a9c 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -119,9 +119,9 @@ function run_tests() { } function run_yaml_tests() { - echo ">> Starting tests for the resource ${1}" - create_resources ${1} || fail_test "Could not create ${1} from the examples" - if ! run_tests ${1}; then + echo ">> Starting tests for the resource ${1}/${2}" + create_resources ${1}/${2} || fail_test "Could not create ${2}/${1} from the examples" + if ! run_tests ${2}; then return 1 fi return 0 @@ -142,9 +142,7 @@ function install_pipeline_crd_version() { function verify_pipeline_installation() { # Make sure that everything is cleaned up in the current namespace. - for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do - kubectl delete --ignore-not-found=true ${res}.tekton.dev --all - done + delete_pipeline_resources # Wait for pods to be running in the namespaces we are deploying to wait_until_pods_running tekton-pipelines || fail_test "Tekton Pipeline did not come up" @@ -155,9 +153,7 @@ function uninstall_pipeline_crd() { ko delete --ignore-not-found=true -f config/ # Make sure that everything is cleaned up in the current namespace. - for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do - kubectl delete --ignore-not-found=true ${res}.tekton.dev --all - done + delete_pipeline_resources } function uninstall_pipeline_crd_version() { @@ -165,7 +161,11 @@ function uninstall_pipeline_crd_version() { kubectl delete --ignore-not-found=true -f "https://github.com/tektoncd/pipeline/releases/download/$1/release.yaml" # Make sure that everything is cleaned up in the current namespace. - for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do + delete_pipeline_resources +} + +function delete_pipeline_resources() { + for res in conditions pipelineresources tasks clustertasks pipelines taskruns pipelineruns; do kubectl delete --ignore-not-found=true ${res}.tekton.dev --all done } diff --git a/test/e2e-tests-yaml.sh b/test/e2e-tests-yaml.sh index 064be59e4fd..9969442f6c6 100755 --- a/test/e2e-tests-yaml.sh +++ b/test/e2e-tests-yaml.sh @@ -33,14 +33,21 @@ install_pipeline_crd # Run the tests failed=0 -for test in taskrun pipelinerun; do - header "Running YAML e2e tests for ${test}s" - if ! run_yaml_tests ${test}; then - echo "ERROR: one or more YAML tests failed" - output_yaml_test_results ${test} - output_pods_logs ${test} - failed=1 - fi +for version in v1alpha1 v1alpha2; do + for test in taskrun pipelinerun; do + header "Running YAML e2e tests for ${version} ${test}s" + if ! run_yaml_tests ${version} ${test}; then + echo "ERROR: one or more YAML tests failed" + output_yaml_test_results ${test} + output_pods_logs ${test} + failed=1 + fi + done + # Clean resources + delete_pipeline_resources + for res in services pods configmaps secrets serviceaccounts persistentvolumeclaims; do + kubectl delete --ignore-not-found=true ${res} --all + done done (( failed )) && fail_test From 7cf986d80cad7d379c96b810d44aee258b000e2b Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 2 Mar 2020 15:02:45 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Rename=20v1alpha2=20to=20v1beta1=20?= =?UTF-8?q?=F0=9F=98=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's go directly to v1beta1 and do several RC releases 👼 Signed-off-by: Vincent Demeester --- cmd/webhook/main.go | 14 +- codecov.yml | 2 +- config/300-clustertask.yaml | 2 +- config/300-pipeline.yaml | 2 +- config/300-pipelinerun.yaml | 2 +- config/300-task.yaml | 2 +- config/300-taskrun.yaml | 2 +- .../pipelineruns/clustertask-pipelinerun.yaml | 6 +- ...l-pipelinerun-with-optional-resources.yaml | 6 +- .../pipelineruns/conditional-pipelinerun.yaml | 8 +- .../pipelineruns/demo-optional-resources.yaml | 8 +- .../pipelineruns/no-ci/.keep | 0 .../pipelineruns/no-ci/limitrange.yaml | 6 +- .../pipelineruns/no-ci/pipeline-timeout.yaml | 4 +- .../pipelineruns/output-pipelinerun.yaml | 10 +- ...inerun-with-pipelinespec-and-taskspec.yaml | 6 +- .../pipelinerun-with-pipelinespec.yaml | 4 +- .../pipelinerun-with-resourcespec.yaml | 6 +- .../pipelineruns/pipelinerun.yaml | 10 +- .../pipelineruns/workspaces.yaml | 8 +- .../taskruns/build-gcs-targz.yaml | 2 +- .../taskruns/build-gcs-zip.yaml | 2 +- .../taskruns/build-push-kaniko.yaml | 4 +- .../taskruns/cloud-event.yaml | 8 +- .../taskruns/clustertask.yaml | 4 +- .../taskruns/configmap.yaml | 2 +- .../taskruns/custom-env.yaml | 2 +- .../taskruns/custom-volume.yaml | 2 +- .../taskruns/dind-sidecar.yaml | 2 +- .../taskruns/docker-creds.yaml | 2 +- .../taskruns/gcs-resource.yaml | 2 +- .../taskruns/git-resource.yaml | 6 +- .../taskruns/git-ssh-creds.yaml | 2 +- .../taskruns/git-volume.yaml | 2 +- .../taskruns/home-is-set.yaml | 2 +- .../taskruns/home-volume.yaml | 2 +- .../taskruns/no-ci/.keep | 0 .../taskruns/no-ci/limitrange.yaml | 4 +- .../optional-resources-with-clustertask.yaml | 4 +- .../taskruns/optional-resources.yaml | 12 +- .../taskruns/pull-private-image.yaml | 2 +- .../taskruns/pullrequest.yaml | 2 +- .../taskruns/secret-env.yaml | 2 +- .../taskruns/secret-volume-params.yaml | 2 +- .../taskruns/secret-volume.yaml | 2 +- .../taskruns/sidecar-interp.yaml | 2 +- .../taskruns/sidecar-ready-script.yaml | 2 +- .../taskruns/sidecar-ready.yaml | 2 +- .../taskruns/step-by-digest.yaml | 2 +- .../taskruns/step-script.yaml | 2 +- .../taskruns/steps-run-in-order.yaml | 2 +- .../taskruns/steptemplate-env-merge.yaml | 2 +- .../taskruns/task-multiple-output-image.yaml | 4 +- .../taskruns/task-output-image.yaml | 4 +- .../taskruns/task-result.yaml | 2 +- .../taskruns/task-volume-args.yaml | 2 +- .../taskruns/template-volume.yaml | 2 +- .../taskruns/unnamed-steps.yaml | 2 +- .../taskruns/workingdir.yaml | 2 +- .../taskruns/workspace-readonly.yaml | 2 +- .../taskruns/workspace-volume.yaml | 2 +- .../taskruns/workspace.yaml | 2 +- hack/update-codegen.sh | 8 +- .../v1alpha1/cluster_task_conversion.go | 6 +- .../v1alpha1/cluster_task_conversion_test.go | 60 +- pkg/apis/pipeline/v1alpha1/condition_types.go | 6 +- .../pipeline/v1alpha1/conversion_error.go | 8 +- pkg/apis/pipeline/v1alpha1/param_types.go | 16 +- .../pipeline/v1alpha1/pipeline_conversion.go | 18 +- .../v1alpha1/pipeline_conversion_test.go | 26 +- pkg/apis/pipeline/v1alpha1/pipeline_types.go | 22 +- .../v1alpha1/pipeline_validation_test.go | 6 +- .../v1alpha1/pipelinerun_conversion.go | 12 +- .../v1alpha1/pipelinerun_conversion_test.go | 16 +- .../pipeline/v1alpha1/pipelinerun_types.go | 22 +- pkg/apis/pipeline/v1alpha1/resource_types.go | 12 +- .../pipeline/v1alpha1/resource_types_test.go | 16 +- pkg/apis/pipeline/v1alpha1/task_conversion.go | 24 +- .../pipeline/v1alpha1/task_conversion_test.go | 60 +- pkg/apis/pipeline/v1alpha1/task_defaults.go | 4 +- pkg/apis/pipeline/v1alpha1/task_types.go | 12 +- pkg/apis/pipeline/v1alpha1/task_validation.go | 12 +- .../pipeline/v1alpha1/task_validation_test.go | 32 +- .../pipeline/v1alpha1/taskrun_conversion.go | 30 +- .../v1alpha1/taskrun_conversion_test.go | 102 +-- .../pipeline/v1alpha1/taskrun_defaults.go | 4 +- pkg/apis/pipeline/v1alpha1/taskrun_types.go | 34 +- .../v1alpha1/taskrun_validation_test.go | 10 +- pkg/apis/pipeline/v1alpha1/workspace_types.go | 10 +- .../v1alpha1/zz_generated.deepcopy.go | 50 +- .../v1alpha2/pipeline_validation_test.go | 680 ------------------ .../cluster_task_conversion.go | 6 +- .../cluster_task_conversion_test.go | 2 +- .../cluster_task_defaults.go | 2 +- .../cluster_task_types.go | 2 +- .../cluster_task_validation.go | 2 +- .../{v1alpha2 => v1beta1}/condition_types.go | 2 +- .../{v1alpha2 => v1beta1}/conversion_error.go | 2 +- .../pipeline/{v1alpha2 => v1beta1}/doc.go | 2 +- .../pipeline/{v1alpha2 => v1beta1}/merge.go | 2 +- .../{v1alpha2 => v1beta1}/merge_test.go | 2 +- .../{v1alpha2 => v1beta1}/param_types.go | 2 +- .../{v1alpha2 => v1beta1}/param_types_test.go | 44 +- .../pipeline_conversion.go | 6 +- .../pipeline_conversion_test.go | 2 +- .../pipeline_defaults.go | 2 +- .../pipeline_interface.go | 2 +- .../{v1alpha2 => v1beta1}/pipeline_types.go | 2 +- .../pipeline_validation.go | 2 +- .../v1beta1/pipeline_validation_test.go | 680 ++++++++++++++++++ .../pipelinerun_conversion.go | 6 +- .../pipelinerun_conversion_test.go | 2 +- .../pipelinerun_defaults.go | 2 +- .../pipelinerun_defaults_test.go | 104 +-- .../pipelinerun_types.go | 2 +- .../pipelinerun_types_test.go | 60 +- .../pipelinerun_validation.go | 2 +- .../pipelinerun_validation_test.go | 68 +- .../pipeline/{v1alpha2 => v1beta1}/pod.go | 2 +- .../{v1alpha2 => v1beta1}/pod_test.go | 2 +- .../{v1alpha2 => v1beta1}/register.go | 4 +- .../{v1alpha2 => v1beta1}/resource_types.go | 2 +- .../resource_types_test.go | 46 +- .../resource_types_validation.go | 2 +- .../{v1alpha2 => v1beta1}/substitution.go | 2 +- .../{v1alpha2 => v1beta1}/task_conversion.go | 6 +- .../task_conversion_test.go | 2 +- .../{v1alpha2 => v1beta1}/task_defaults.go | 2 +- .../{v1alpha2 => v1beta1}/task_interface.go | 2 +- .../{v1alpha2 => v1beta1}/task_types.go | 2 +- .../{v1alpha2 => v1beta1}/task_validation.go | 2 +- .../task_validation_test.go | 210 +++--- .../taskrun_conversion.go | 6 +- .../taskrun_conversion_test.go | 2 +- .../{v1alpha2 => v1beta1}/taskrun_defaults.go | 2 +- .../taskrun_defaults_test.go | 112 +-- .../{v1alpha2 => v1beta1}/taskrun_types.go | 2 +- .../taskrun_types_test.go | 50 +- .../taskrun_validation.go | 2 +- .../taskrun_validation_test.go | 212 +++--- .../{v1alpha2 => v1beta1}/types_test.go | 14 +- .../{v1alpha2 => v1beta1}/workspace_types.go | 2 +- .../workspace_validation.go | 2 +- .../workspace_validation_test.go | 2 +- .../zz_generated.deepcopy.go | 2 +- pkg/client/clientset/versioned/clientset.go | 18 +- .../versioned/fake/clientset_generated.go | 10 +- .../clientset/versioned/fake/register.go | 4 +- .../clientset/versioned/scheme/register.go | 4 +- .../{v1alpha2 => v1beta1}/clustertask.go | 36 +- .../pipeline/{v1alpha2 => v1beta1}/doc.go | 2 +- .../{v1alpha2 => v1beta1}/fake/doc.go | 0 .../fake/fake_clustertask.go | 44 +- .../fake/fake_pipeline.go | 44 +- .../fake/fake_pipeline_client.go | 16 +- .../fake/fake_pipelinerun.go | 50 +- .../{v1alpha2 => v1beta1}/fake/fake_task.go | 44 +- .../fake/fake_taskrun.go | 50 +- .../generated_expansion.go | 2 +- .../{v1alpha2 => v1beta1}/pipeline.go | 36 +- .../{v1alpha2 => v1beta1}/pipeline_client.go | 40 +- .../{v1alpha2 => v1beta1}/pipelinerun.go | 42 +- .../pipeline/{v1alpha2 => v1beta1}/task.go | 36 +- .../pipeline/{v1alpha2 => v1beta1}/taskrun.go | 42 +- .../informers/externalversions/generic.go | 24 +- .../externalversions/pipeline/interface.go | 12 +- .../{v1alpha2 => v1beta1}/clustertask.go | 20 +- .../{v1alpha2 => v1beta1}/interface.go | 2 +- .../{v1alpha2 => v1beta1}/pipeline.go | 20 +- .../{v1alpha2 => v1beta1}/pipelinerun.go | 20 +- .../pipeline/{v1alpha2 => v1beta1}/task.go | 20 +- .../pipeline/{v1alpha2 => v1beta1}/taskrun.go | 20 +- .../clustertask/clustertask.go | 10 +- .../clustertask/fake/fake.go | 4 +- .../pipeline/fake/fake.go | 4 +- .../pipeline/pipeline.go | 10 +- .../pipelinerun/fake/fake.go | 4 +- .../pipelinerun/pipelinerun.go | 10 +- .../{v1alpha2 => v1beta1}/task/fake/fake.go | 4 +- .../{v1alpha2 => v1beta1}/task/task.go | 10 +- .../taskrun/fake/fake.go | 4 +- .../{v1alpha2 => v1beta1}/taskrun/taskrun.go | 10 +- .../{v1alpha2 => v1beta1}/clustertask.go | 18 +- .../expansion_generated.go | 2 +- .../{v1alpha2 => v1beta1}/pipeline.go | 24 +- .../{v1alpha2 => v1beta1}/pipelinerun.go | 24 +- .../pipeline/{v1alpha2 => v1beta1}/task.go | 24 +- .../pipeline/{v1alpha2 => v1beta1}/taskrun.go | 24 +- pkg/pod/pod_test.go | 24 +- pkg/reconciler/pipelinerun/pipelinerun.go | 10 +- .../pipelinerun/pipelinerun_test.go | 4 +- .../resources/conditionresolution.go | 4 +- .../resources/conditionresolution_test.go | 10 +- .../resources/input_output_steps.go | 4 +- .../resources/pipelinerunresolution.go | 4 +- .../resources/pipelinerunresolution_test.go | 18 +- .../pipelinerun/resources/pipelinespec.go | 4 +- .../taskrun/resources/apply_test.go | 22 +- .../taskrun/resources/image_exporter_test.go | 14 +- .../taskrun/resources/input_resource_test.go | 172 ++--- .../taskrun/resources/output_resource_test.go | 116 +-- .../resources/taskresourceresolution.go | 4 +- .../resources/taskresourceresolution_test.go | 6 +- pkg/reconciler/taskrun/resources/taskspec.go | 4 +- .../taskrun/resources/taskspec_test.go | 6 +- pkg/reconciler/taskrun/taskrun.go | 12 +- pkg/reconciler/taskrun/validate_resources.go | 10 +- pkg/workspace/apply_test.go | 34 +- test/builder/pipeline_test.go | 6 +- test/builder/task.go | 24 +- test/builder/task_test.go | 20 +- test/e2e-tests-yaml.sh | 2 +- test/retry_test.go | 4 +- test/start_time_test.go | 4 +- 214 files changed, 2317 insertions(+), 2317 deletions(-) rename examples/{v1alpha2 => v1beta1}/pipelineruns/clustertask-pipelinerun.yaml (84%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml (95%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/conditional-pipelinerun.yaml (93%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/demo-optional-resources.yaml (95%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/no-ci/.keep (100%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/no-ci/limitrange.yaml (90%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/no-ci/pipeline-timeout.yaml (95%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/output-pipelinerun.yaml (91%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml (94%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/pipelinerun-with-pipelinespec.yaml (94%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/pipelinerun-with-resourcespec.yaml (95%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/pipelinerun.yaml (97%) rename examples/{v1alpha2 => v1beta1}/pipelineruns/workspaces.yaml (96%) rename examples/{v1alpha2 => v1beta1}/taskruns/build-gcs-targz.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/build-gcs-zip.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/build-push-kaniko.yaml (96%) rename examples/{v1alpha2 => v1beta1}/taskruns/cloud-event.yaml (97%) rename examples/{v1alpha2 => v1beta1}/taskruns/clustertask.yaml (77%) rename examples/{v1alpha2 => v1beta1}/taskruns/configmap.yaml (95%) rename examples/{v1alpha2 => v1beta1}/taskruns/custom-env.yaml (87%) rename examples/{v1alpha2 => v1beta1}/taskruns/custom-volume.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/dind-sidecar.yaml (97%) rename examples/{v1alpha2 => v1beta1}/taskruns/docker-creds.yaml (99%) rename examples/{v1alpha2 => v1beta1}/taskruns/gcs-resource.yaml (93%) rename examples/{v1alpha2 => v1beta1}/taskruns/git-resource.yaml (93%) rename examples/{v1alpha2 => v1beta1}/taskruns/git-ssh-creds.yaml (99%) rename examples/{v1alpha2 => v1beta1}/taskruns/git-volume.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/home-is-set.yaml (85%) rename examples/{v1alpha2 => v1beta1}/taskruns/home-volume.yaml (95%) rename examples/{v1alpha2 => v1beta1}/taskruns/no-ci/.keep (100%) rename examples/{v1alpha2 => v1beta1}/taskruns/no-ci/limitrange.yaml (92%) rename examples/{v1alpha2 => v1beta1}/taskruns/optional-resources-with-clustertask.yaml (90%) rename examples/{v1alpha2 => v1beta1}/taskruns/optional-resources.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/pull-private-image.yaml (99%) rename examples/{v1alpha2 => v1beta1}/taskruns/pullrequest.yaml (96%) rename examples/{v1alpha2 => v1beta1}/taskruns/secret-env.yaml (93%) rename examples/{v1alpha2 => v1beta1}/taskruns/secret-volume-params.yaml (95%) rename examples/{v1alpha2 => v1beta1}/taskruns/secret-volume.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/sidecar-interp.yaml (95%) rename examples/{v1alpha2 => v1beta1}/taskruns/sidecar-ready-script.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/sidecar-ready.yaml (96%) rename examples/{v1alpha2 => v1beta1}/taskruns/step-by-digest.yaml (91%) rename examples/{v1alpha2 => v1beta1}/taskruns/step-script.yaml (98%) rename examples/{v1alpha2 => v1beta1}/taskruns/steps-run-in-order.yaml (89%) rename examples/{v1alpha2 => v1beta1}/taskruns/steptemplate-env-merge.yaml (97%) rename examples/{v1alpha2 => v1beta1}/taskruns/task-multiple-output-image.yaml (97%) rename examples/{v1alpha2 => v1beta1}/taskruns/task-output-image.yaml (97%) rename examples/{v1alpha2 => v1beta1}/taskruns/task-result.yaml (95%) rename examples/{v1alpha2 => v1beta1}/taskruns/task-volume-args.yaml (95%) rename examples/{v1alpha2 => v1beta1}/taskruns/template-volume.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/unnamed-steps.yaml (86%) rename examples/{v1alpha2 => v1beta1}/taskruns/workingdir.yaml (91%) rename examples/{v1alpha2 => v1beta1}/taskruns/workspace-readonly.yaml (97%) rename examples/{v1alpha2 => v1beta1}/taskruns/workspace-volume.yaml (94%) rename examples/{v1alpha2 => v1beta1}/taskruns/workspace.yaml (98%) delete mode 100644 pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/cluster_task_conversion.go (85%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/cluster_task_conversion_test.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/cluster_task_defaults.go (97%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/cluster_task_types.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/cluster_task_validation.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/condition_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/conversion_error.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/doc.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/merge.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/merge_test.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/param_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/param_types_test.go (83%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipeline_conversion.go (84%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipeline_conversion_test.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipeline_defaults.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipeline_interface.go (97%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipeline_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipeline_validation.go (99%) create mode 100644 pkg/apis/pipeline/v1beta1/pipeline_validation_test.go rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_conversion.go (85%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_conversion_test.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_defaults.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_defaults_test.go (72%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_types_test.go (81%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_validation.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pipelinerun_validation_test.go (78%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pod.go (97%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/pod_test.go (96%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/register.go (97%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/resource_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/resource_types_test.go (73%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/resource_types_validation.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/substitution.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_conversion.go (84%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_conversion_test.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_defaults.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_interface.go (97%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_validation.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/task_validation_test.go (79%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_conversion.go (84%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_conversion_test.go (98%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_defaults.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_defaults_test.go (67%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_types_test.go (86%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_validation.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/taskrun_validation_test.go (65%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/types_test.go (63%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/workspace_types.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/workspace_validation.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/workspace_validation_test.go (99%) rename pkg/apis/pipeline/{v1alpha2 => v1beta1}/zz_generated.deepcopy.go (99%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/clustertask.go (80%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/doc.go (97%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/doc.go (100%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/fake_clustertask.go (74%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/fake_pipeline.go (74%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/fake_pipeline_client.go (64%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/fake_pipelinerun.go (72%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/fake_task.go (75%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/fake/fake_taskrun.go (74%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/generated_expansion.go (97%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/pipeline.go (81%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/pipeline_client.go (59%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/pipelinerun.go (78%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/task.go (82%) rename pkg/client/clientset/versioned/typed/pipeline/{v1alpha2 => v1beta1}/taskrun.go (80%) rename pkg/client/informers/externalversions/pipeline/{v1alpha2 => v1beta1}/clustertask.go (83%) rename pkg/client/informers/externalversions/pipeline/{v1alpha2 => v1beta1}/interface.go (99%) rename pkg/client/informers/externalversions/pipeline/{v1alpha2 => v1beta1}/pipeline.go (84%) rename pkg/client/informers/externalversions/pipeline/{v1alpha2 => v1beta1}/pipelinerun.go (83%) rename pkg/client/informers/externalversions/pipeline/{v1alpha2 => v1beta1}/task.go (84%) rename pkg/client/informers/externalversions/pipeline/{v1alpha2 => v1beta1}/taskrun.go (84%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/clustertask/clustertask.go (80%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/clustertask/fake/fake.go (93%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/pipeline/fake/fake.go (93%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/pipeline/pipeline.go (81%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/pipelinerun/fake/fake.go (93%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/pipelinerun/pipelinerun.go (80%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/task/fake/fake.go (94%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/task/task.go (82%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/taskrun/fake/fake.go (93%) rename pkg/client/injection/informers/pipeline/{v1alpha2 => v1beta1}/taskrun/taskrun.go (81%) rename pkg/client/listers/pipeline/{v1alpha2 => v1beta1}/clustertask.go (77%) rename pkg/client/listers/pipeline/{v1alpha2 => v1beta1}/expansion_generated.go (99%) rename pkg/client/listers/pipeline/{v1alpha2 => v1beta1}/pipeline.go (80%) rename pkg/client/listers/pipeline/{v1alpha2 => v1beta1}/pipelinerun.go (80%) rename pkg/client/listers/pipeline/{v1alpha2 => v1beta1}/task.go (78%) rename pkg/client/listers/pipeline/{v1alpha2 => v1beta1}/taskrun.go (80%) diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 551cf3f4a6e..619fb2e194f 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -22,7 +22,7 @@ import ( defaultconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" "k8s.io/apimachinery/pkg/runtime/schema" "knative.dev/pkg/configmap" @@ -47,12 +47,12 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ v1alpha1.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha1.PipelineRun{}, v1alpha1.SchemeGroupVersion.WithKind("Condition"): &v1alpha1.Condition{}, v1alpha1.SchemeGroupVersion.WithKind("PipelineResource"): &v1alpha1.PipelineResource{}, - // v1alpha2 - v1alpha2.SchemeGroupVersion.WithKind("Pipeline"): &v1alpha2.Pipeline{}, - v1alpha2.SchemeGroupVersion.WithKind("Task"): &v1alpha2.Task{}, - v1alpha2.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha2.ClusterTask{}, - v1alpha2.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha2.TaskRun{}, - v1alpha2.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha2.PipelineRun{}, + // v1beta1 + v1beta1.SchemeGroupVersion.WithKind("Pipeline"): &v1beta1.Pipeline{}, + v1beta1.SchemeGroupVersion.WithKind("Task"): &v1beta1.Task{}, + v1beta1.SchemeGroupVersion.WithKind("ClusterTask"): &v1beta1.ClusterTask{}, + v1beta1.SchemeGroupVersion.WithKind("TaskRun"): &v1beta1.TaskRun{}, + v1beta1.SchemeGroupVersion.WithKind("PipelineRun"): &v1beta1.PipelineRun{}, } func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { diff --git a/codecov.yml b/codecov.yml index 3a52d809b18..f2511b21bd1 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,3 @@ ignore: - "pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go" -- "pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go" +- "pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go" diff --git a/config/300-clustertask.yaml b/config/300-clustertask.yaml index 8a58f066642..d51db7ed32e 100644 --- a/config/300-clustertask.yaml +++ b/config/300-clustertask.yaml @@ -21,7 +21,7 @@ spec: - name: v1alpha1 served: true storage: true - - name: v1alpha2 + - name: v1beta1 served: true storage: false names: diff --git a/config/300-pipeline.yaml b/config/300-pipeline.yaml index 025aff50645..8c8b45cc8d5 100644 --- a/config/300-pipeline.yaml +++ b/config/300-pipeline.yaml @@ -21,7 +21,7 @@ spec: - name: v1alpha1 served: true storage: true - - name: v1alpha2 + - name: v1beta1 served: true storage: false names: diff --git a/config/300-pipelinerun.yaml b/config/300-pipelinerun.yaml index 6402ee01bea..f5967048015 100644 --- a/config/300-pipelinerun.yaml +++ b/config/300-pipelinerun.yaml @@ -21,7 +21,7 @@ spec: - name: v1alpha1 served: true storage: true - - name: v1alpha2 + - name: v1beta1 served: true storage: false names: diff --git a/config/300-task.yaml b/config/300-task.yaml index e5f01bdf2e3..53dcc1fdb86 100644 --- a/config/300-task.yaml +++ b/config/300-task.yaml @@ -21,7 +21,7 @@ spec: - name: v1alpha1 served: true storage: true - - name: v1alpha2 + - name: v1beta1 served: true storage: false names: diff --git a/config/300-taskrun.yaml b/config/300-taskrun.yaml index a26188829d4..ba6bb1892f2 100644 --- a/config/300-taskrun.yaml +++ b/config/300-taskrun.yaml @@ -21,7 +21,7 @@ spec: - name: v1alpha1 served: true storage: true - - name: v1alpha2 + - name: v1beta1 served: true storage: false names: diff --git a/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml b/examples/v1beta1/pipelineruns/clustertask-pipelinerun.yaml similarity index 84% rename from examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml rename to examples/v1beta1/pipelineruns/clustertask-pipelinerun.yaml index 0fda9c8be35..d70960dbb12 100644 --- a/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml +++ b/examples/v1beta1/pipelineruns/clustertask-pipelinerun.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: ClusterTask metadata: name: cluster-task-pipeline-4 @@ -9,7 +9,7 @@ spec: command: ["/bin/bash"] args: ['-c', 'echo success'] --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: sample-pipeline-cluster-task-4 @@ -20,7 +20,7 @@ spec: name: cluster-task-pipeline-4 kind: ClusterTask --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: demo-pipeline-run-4 diff --git a/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml b/examples/v1beta1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml similarity index 95% rename from examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml rename to examples/v1beta1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml index 9638d00f6f1..2f7913fa884 100644 --- a/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml +++ b/examples/v1beta1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml @@ -25,7 +25,7 @@ spec: - name: url value: https://github.com/tektoncd/pipeline --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: list-pipeline-repo-files @@ -40,7 +40,7 @@ spec: image: ubuntu script: 'ls -al $(inputs.resources.optional-workspace.path)' --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: pipeline-list-pipeline-repo-files @@ -71,7 +71,7 @@ spec: - name: optional-workspace resource: pipeline-source-repo --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: demo-condtional-pr-without-condition-resource diff --git a/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml b/examples/v1beta1/pipelineruns/conditional-pipelinerun.yaml similarity index 93% rename from examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml rename to examples/v1beta1/pipelineruns/conditional-pipelinerun.yaml index 9ac6f92f50e..cb67198440f 100644 --- a/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml +++ b/examples/v1beta1/pipelineruns/conditional-pipelinerun.yaml @@ -24,7 +24,7 @@ spec: - name: url value: https://github.com/tektoncd/pipeline --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: create-readme-file @@ -38,7 +38,7 @@ spec: image: ubuntu script: 'touch $(resources.outputs.workspace.path)/README.md' --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: echo-hello @@ -48,7 +48,7 @@ spec: image: ubuntu script: 'echo hello' --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: conditional-pipeline @@ -80,7 +80,7 @@ spec: taskRef: name: echo-hello --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: condtional-pr diff --git a/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml b/examples/v1beta1/pipelineruns/demo-optional-resources.yaml similarity index 95% rename from examples/v1alpha2/pipelineruns/demo-optional-resources.yaml rename to examples/v1beta1/pipelineruns/demo-optional-resources.yaml index 450a25b3585..ea26fde0c9f 100644 --- a/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml +++ b/examples/v1beta1/pipelineruns/demo-optional-resources.yaml @@ -28,7 +28,7 @@ spec: script: 'test ! -z $(resources.built-image.url)' --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: build-an-image @@ -56,7 +56,7 @@ spec: - --destination=$(resources.outputs.built-image.url) --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: demo-pipeline-to-build-an-image @@ -97,7 +97,7 @@ spec: --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: demo-pipeline-to-build-an-image-without-resources @@ -107,7 +107,7 @@ spec: serviceAccountName: 'default' --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: demo-pipeline-to-build-an-image-without-image-resource diff --git a/examples/v1alpha2/pipelineruns/no-ci/.keep b/examples/v1beta1/pipelineruns/no-ci/.keep similarity index 100% rename from examples/v1alpha2/pipelineruns/no-ci/.keep rename to examples/v1beta1/pipelineruns/no-ci/.keep diff --git a/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml b/examples/v1beta1/pipelineruns/no-ci/limitrange.yaml similarity index 90% rename from examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml rename to examples/v1beta1/pipelineruns/no-ci/limitrange.yaml index face542a97e..0b8f6dfdce9 100644 --- a/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml +++ b/examples/v1beta1/pipelineruns/no-ci/limitrange.yaml @@ -18,7 +18,7 @@ spec: memory: "111Mi" type: Container --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: echo-hello-world @@ -31,7 +31,7 @@ spec: args: - "hello world" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: pipeline-hello @@ -46,7 +46,7 @@ spec: runAfter: - hello-world-1 --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: generateName: pipeline-hello-run- diff --git a/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml b/examples/v1beta1/pipelineruns/no-ci/pipeline-timeout.yaml similarity index 95% rename from examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml rename to examples/v1beta1/pipelineruns/no-ci/pipeline-timeout.yaml index dd8483d24f0..2a22ce01719 100644 --- a/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml +++ b/examples/v1beta1/pipelineruns/no-ci/pipeline-timeout.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: task-echo-message @@ -16,7 +16,7 @@ spec: - "$(inputs.params.MESSAGE)" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: pipelinerun-timeout diff --git a/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml b/examples/v1beta1/pipelineruns/output-pipelinerun.yaml similarity index 91% rename from examples/v1alpha2/pipelineruns/output-pipelinerun.yaml rename to examples/v1beta1/pipelineruns/output-pipelinerun.yaml index b48eed397f1..41e2cb7b7bd 100644 --- a/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml +++ b/examples/v1beta1/pipelineruns/output-pipelinerun.yaml @@ -11,7 +11,7 @@ spec: value: https://github.com/GoogleContainerTools/skaffold --- # Task writes "some stuff" to a predefined path in the workspace git PipelineResource -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: create-file @@ -35,7 +35,7 @@ spec: args: ['-c', 'ln -s /workspace/damnworkspace /workspace/output/workspace && echo some stuff > /workspace/output/workspace/stuff'] --- # Reads a file from a predefined path in the workspace git PipelineResource -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: check-stuff-file-exists @@ -52,12 +52,12 @@ spec: - name: read image: ubuntu command: ["/bin/bash"] - args: ['$(params.args)'] # tests that new targetpath and previous task output is dumped + args: ['$(inputs.params.args[*])'] # tests that new targetpath and previous task output is dumped --- # The Output of the first Task (git resource) create-file is given as an `Input` # to the next `Task` check-stuff-file-exists using`from` clause. -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: output-pipeline @@ -90,7 +90,7 @@ spec: resource: source-repo from: [first-create-file] --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: output-pipeline-run diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml b/examples/v1beta1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml similarity index 94% rename from examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml rename to examples/v1beta1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml index 568be978a9d..652c18db13b 100644 --- a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml +++ b/examples/v1beta1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: pipelinerun-with-taskspec-to-echo-good-morning @@ -15,7 +15,7 @@ spec: echo "Good Morning!" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: pipelinerun-with-taskspec-to-echo-message @@ -47,7 +47,7 @@ spec: value: "Good Morning!" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: pipelinerun-with-taskspec-to-echo-greetings diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml b/examples/v1beta1/pipelineruns/pipelinerun-with-pipelinespec.yaml similarity index 94% rename from examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml rename to examples/v1beta1/pipelineruns/pipelinerun-with-pipelinespec.yaml index 5cd0da41e31..d0b4b5e1d6e 100644 --- a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml +++ b/examples/v1beta1/pipelineruns/pipelinerun-with-pipelinespec.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: task-echo-message @@ -16,7 +16,7 @@ spec: - "$(params.MESSAGE)" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: pipelinerun-echo-greetings diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml b/examples/v1beta1/pipelineruns/pipelinerun-with-resourcespec.yaml similarity index 95% rename from examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml rename to examples/v1beta1/pipelineruns/pipelinerun-with-resourcespec.yaml index 1471f09a357..85f4c7a7af4 100644 --- a/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml +++ b/examples/v1beta1/pipelineruns/pipelinerun-with-resourcespec.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: task-to-list-files @@ -39,7 +39,7 @@ spec: echo "Hello from Tekton Pipeline!" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: pipeline-to-list-files @@ -78,7 +78,7 @@ spec: resource: pipeline-git --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: demo-pipelinerun-with-resourcespec diff --git a/examples/v1alpha2/pipelineruns/pipelinerun.yaml b/examples/v1beta1/pipelineruns/pipelinerun.yaml similarity index 97% rename from examples/v1alpha2/pipelineruns/pipelinerun.yaml rename to examples/v1beta1/pipelineruns/pipelinerun.yaml index 5ae420bcf13..ee6da1b863e 100644 --- a/examples/v1alpha2/pipelineruns/pipelinerun.yaml +++ b/examples/v1beta1/pipelineruns/pipelinerun.yaml @@ -48,7 +48,7 @@ spec: - name: url value: https://github.com/GoogleContainerTools/skaffold --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: unit-tests @@ -70,7 +70,7 @@ spec: args: - "pass" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: build-push @@ -104,7 +104,7 @@ spec: - --context=$(params.pathToContext) --- # This task deploys with kubectl apply -f -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: demo-deploy-kubectl @@ -149,7 +149,7 @@ spec: # pushed are the ones that are deployed (that would require using the digest of # the built image, see https://github.com/tektoncd/pipeline/issues/216). -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: demo-pipeline @@ -238,7 +238,7 @@ spec: - name: yamlPathToImage value: "spec.template.spec.containers[0].image" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: demo-pipeline-run-1 diff --git a/examples/v1alpha2/pipelineruns/workspaces.yaml b/examples/v1beta1/pipelineruns/workspaces.yaml similarity index 96% rename from examples/v1alpha2/pipelineruns/workspaces.yaml rename to examples/v1beta1/pipelineruns/workspaces.yaml index f7dca7a78d6..18ee2757067 100644 --- a/examples/v1alpha2/pipelineruns/workspaces.yaml +++ b/examples/v1beta1/pipelineruns/workspaces.yaml @@ -45,7 +45,7 @@ spec: accessModes: - ReadWriteOnce --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: fetch-secure-data @@ -65,7 +65,7 @@ spec: exit 1 fi --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: print-data @@ -80,7 +80,7 @@ spec: image: ubuntu script: cat $(workspaces.storage.path)/$(params.filename) --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: fetch-and-print-recipe @@ -113,7 +113,7 @@ spec: - name: storage workspace: shared-data --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: generateName: recipe-time- diff --git a/examples/v1alpha2/taskruns/build-gcs-targz.yaml b/examples/v1beta1/taskruns/build-gcs-targz.yaml similarity index 94% rename from examples/v1alpha2/taskruns/build-gcs-targz.yaml rename to examples/v1beta1/taskruns/build-gcs-targz.yaml index 78a82ab1b73..f5a88edfce9 100644 --- a/examples/v1alpha2/taskruns/build-gcs-targz.yaml +++ b/examples/v1beta1/taskruns/build-gcs-targz.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: build-gcs-targz- diff --git a/examples/v1alpha2/taskruns/build-gcs-zip.yaml b/examples/v1beta1/taskruns/build-gcs-zip.yaml similarity index 94% rename from examples/v1alpha2/taskruns/build-gcs-zip.yaml rename to examples/v1beta1/taskruns/build-gcs-zip.yaml index fd721f7a8b3..c6807f481f0 100644 --- a/examples/v1alpha2/taskruns/build-gcs-zip.yaml +++ b/examples/v1beta1/taskruns/build-gcs-zip.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: build-gcs-zip- diff --git a/examples/v1alpha2/taskruns/build-push-kaniko.yaml b/examples/v1beta1/taskruns/build-push-kaniko.yaml similarity index 96% rename from examples/v1alpha2/taskruns/build-push-kaniko.yaml rename to examples/v1beta1/taskruns/build-push-kaniko.yaml index 3e511ab670d..f873c7412af 100644 --- a/examples/v1alpha2/taskruns/build-push-kaniko.yaml +++ b/examples/v1beta1/taskruns/build-push-kaniko.yaml @@ -21,7 +21,7 @@ spec: value: https://github.com/GoogleContainerTools/skaffold --- # Builds an image via kaniko and pushes it to registry. -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: build-push-kaniko @@ -58,7 +58,7 @@ spec: - image: registry name: registry --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: build-push-kaniko diff --git a/examples/v1alpha2/taskruns/cloud-event.yaml b/examples/v1beta1/taskruns/cloud-event.yaml similarity index 97% rename from examples/v1alpha2/taskruns/cloud-event.yaml rename to examples/v1beta1/taskruns/cloud-event.yaml index ab0073d8d59..230dcce4ee0 100644 --- a/examples/v1alpha2/taskruns/cloud-event.yaml +++ b/examples/v1beta1/taskruns/cloud-event.yaml @@ -61,7 +61,7 @@ spec: name: user-port protocol: TCP --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: send-cloud-event-task @@ -110,7 +110,7 @@ spec: ] } --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: poll-for-content-task @@ -151,7 +151,7 @@ spec: print("Not yet...") time.sleep(10) --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: send-cloud-event @@ -173,7 +173,7 @@ spec: taskRef: name: send-cloud-event-task --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: poll-for-content-run diff --git a/examples/v1alpha2/taskruns/clustertask.yaml b/examples/v1beta1/taskruns/clustertask.yaml similarity index 77% rename from examples/v1alpha2/taskruns/clustertask.yaml rename to examples/v1beta1/taskruns/clustertask.yaml index b31eed920d4..10972427dab 100644 --- a/examples/v1alpha2/taskruns/clustertask.yaml +++ b/examples/v1beta1/taskruns/clustertask.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: ClusterTask metadata: name: clustertask @@ -7,7 +7,7 @@ spec: - image: ubuntu script: echo hello --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: clustertask- diff --git a/examples/v1alpha2/taskruns/configmap.yaml b/examples/v1beta1/taskruns/configmap.yaml similarity index 95% rename from examples/v1alpha2/taskruns/configmap.yaml rename to examples/v1beta1/taskruns/configmap.yaml index cd0c80ea2cb..4e19a02d695 100644 --- a/examples/v1alpha2/taskruns/configmap.yaml +++ b/examples/v1beta1/taskruns/configmap.yaml @@ -5,7 +5,7 @@ metadata: data: test.data: tasks are my jam --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: configmap- diff --git a/examples/v1alpha2/taskruns/custom-env.yaml b/examples/v1beta1/taskruns/custom-env.yaml similarity index 87% rename from examples/v1alpha2/taskruns/custom-env.yaml rename to examples/v1beta1/taskruns/custom-env.yaml index 0636ffaffe8..6789d6f63a9 100644 --- a/examples/v1alpha2/taskruns/custom-env.yaml +++ b/examples/v1beta1/taskruns/custom-env.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: custom-env- diff --git a/examples/v1alpha2/taskruns/custom-volume.yaml b/examples/v1beta1/taskruns/custom-volume.yaml similarity index 94% rename from examples/v1alpha2/taskruns/custom-volume.yaml rename to examples/v1beta1/taskruns/custom-volume.yaml index 6f560d893f8..a8651693fba 100644 --- a/examples/v1alpha2/taskruns/custom-volume.yaml +++ b/examples/v1beta1/taskruns/custom-volume.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: custom-volume- diff --git a/examples/v1alpha2/taskruns/dind-sidecar.yaml b/examples/v1beta1/taskruns/dind-sidecar.yaml similarity index 97% rename from examples/v1alpha2/taskruns/dind-sidecar.yaml rename to examples/v1beta1/taskruns/dind-sidecar.yaml index aea99e26646..648e506dc73 100644 --- a/examples/v1alpha2/taskruns/dind-sidecar.yaml +++ b/examples/v1beta1/taskruns/dind-sidecar.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: dind-sidecar- diff --git a/examples/v1alpha2/taskruns/docker-creds.yaml b/examples/v1beta1/taskruns/docker-creds.yaml similarity index 99% rename from examples/v1alpha2/taskruns/docker-creds.yaml rename to examples/v1beta1/taskruns/docker-creds.yaml index 65f793372a1..6dccd514b9e 100644 --- a/examples/v1alpha2/taskruns/docker-creds.yaml +++ b/examples/v1beta1/taskruns/docker-creds.yaml @@ -28,7 +28,7 @@ secrets: imagePullSecrets: - name: docker-basic --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: docker-creds diff --git a/examples/v1alpha2/taskruns/gcs-resource.yaml b/examples/v1beta1/taskruns/gcs-resource.yaml similarity index 93% rename from examples/v1alpha2/taskruns/gcs-resource.yaml rename to examples/v1beta1/taskruns/gcs-resource.yaml index 0927ce4e4be..401ebfb753c 100644 --- a/examples/v1alpha2/taskruns/gcs-resource.yaml +++ b/examples/v1beta1/taskruns/gcs-resource.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: gcs-resource- diff --git a/examples/v1alpha2/taskruns/git-resource.yaml b/examples/v1beta1/taskruns/git-resource.yaml similarity index 93% rename from examples/v1alpha2/taskruns/git-resource.yaml rename to examples/v1beta1/taskruns/git-resource.yaml index e0a2f10b6fa..40602dddf44 100644 --- a/examples/v1alpha2/taskruns/git-resource.yaml +++ b/examples/v1beta1/taskruns/git-resource.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: git-resource-tag- @@ -22,7 +22,7 @@ spec: - name: url value: https://github.com/GoogleContainerTools/skaffold --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: git-resource-branch- @@ -46,7 +46,7 @@ spec: - name: url value: https://github.com/GoogleContainerTools/skaffold --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: git-resource-ref- diff --git a/examples/v1alpha2/taskruns/git-ssh-creds.yaml b/examples/v1beta1/taskruns/git-ssh-creds.yaml similarity index 99% rename from examples/v1alpha2/taskruns/git-ssh-creds.yaml rename to examples/v1beta1/taskruns/git-ssh-creds.yaml index ea0acedebcc..c3db19b96d5 100644 --- a/examples/v1alpha2/taskruns/git-ssh-creds.yaml +++ b/examples/v1beta1/taskruns/git-ssh-creds.yaml @@ -21,7 +21,7 @@ metadata: secrets: - name: git-ssh --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: git-ssh-creds diff --git a/examples/v1alpha2/taskruns/git-volume.yaml b/examples/v1beta1/taskruns/git-volume.yaml similarity index 94% rename from examples/v1alpha2/taskruns/git-volume.yaml rename to examples/v1beta1/taskruns/git-volume.yaml index 792aa32161a..bdd607701a6 100644 --- a/examples/v1alpha2/taskruns/git-volume.yaml +++ b/examples/v1beta1/taskruns/git-volume.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: git-volume- diff --git a/examples/v1alpha2/taskruns/home-is-set.yaml b/examples/v1beta1/taskruns/home-is-set.yaml similarity index 85% rename from examples/v1alpha2/taskruns/home-is-set.yaml rename to examples/v1beta1/taskruns/home-is-set.yaml index 54d6509317a..7a6c94d8cbe 100644 --- a/examples/v1alpha2/taskruns/home-is-set.yaml +++ b/examples/v1beta1/taskruns/home-is-set.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: home-is-set- diff --git a/examples/v1alpha2/taskruns/home-volume.yaml b/examples/v1beta1/taskruns/home-volume.yaml similarity index 95% rename from examples/v1alpha2/taskruns/home-volume.yaml rename to examples/v1beta1/taskruns/home-volume.yaml index bd8ede7d878..dcf881c29f0 100644 --- a/examples/v1alpha2/taskruns/home-volume.yaml +++ b/examples/v1beta1/taskruns/home-volume.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: home-volume- diff --git a/examples/v1alpha2/taskruns/no-ci/.keep b/examples/v1beta1/taskruns/no-ci/.keep similarity index 100% rename from examples/v1alpha2/taskruns/no-ci/.keep rename to examples/v1beta1/taskruns/no-ci/.keep diff --git a/examples/v1alpha2/taskruns/no-ci/limitrange.yaml b/examples/v1beta1/taskruns/no-ci/limitrange.yaml similarity index 92% rename from examples/v1alpha2/taskruns/no-ci/limitrange.yaml rename to examples/v1beta1/taskruns/no-ci/limitrange.yaml index 0c94e246cd5..69cd449c941 100644 --- a/examples/v1alpha2/taskruns/no-ci/limitrange.yaml +++ b/examples/v1beta1/taskruns/no-ci/limitrange.yaml @@ -18,7 +18,7 @@ spec: memory: "111Mi" type: Container --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: echo-hello-world @@ -31,7 +31,7 @@ spec: args: - "hello world" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: echo-hello-world-run- diff --git a/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml b/examples/v1beta1/taskruns/optional-resources-with-clustertask.yaml similarity index 90% rename from examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml rename to examples/v1beta1/taskruns/optional-resources-with-clustertask.yaml index b13793aa60c..1ecae87cf8d 100644 --- a/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml +++ b/examples/v1beta1/taskruns/optional-resources-with-clustertask.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: ClusterTask metadata: name: clustertask-with-optional-resources @@ -24,7 +24,7 @@ spec: echo "success" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: clustertask-without-resources diff --git a/examples/v1alpha2/taskruns/optional-resources.yaml b/examples/v1beta1/taskruns/optional-resources.yaml similarity index 94% rename from examples/v1alpha2/taskruns/optional-resources.yaml rename to examples/v1beta1/taskruns/optional-resources.yaml index de59343c202..78f564d3c2b 100644 --- a/examples/v1alpha2/taskruns/optional-resources.yaml +++ b/examples/v1beta1/taskruns/optional-resources.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: task-check-optional-resources @@ -41,7 +41,7 @@ spec: echo "Yay, Input and Output Resources can be Optional!" --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: demo-optional-inputs-resources-with-resources @@ -68,7 +68,7 @@ spec: name: task-check-optional-resources --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: demo-optional-inputs-resources-invalid-filename @@ -88,7 +88,7 @@ spec: name: task-check-optional-resources --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: demo-optional-inputs-resources-without-resources @@ -100,7 +100,7 @@ spec: name: task-check-optional-resources --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: demo-optional-inputs-resources-without-resources-and-params @@ -109,7 +109,7 @@ spec: name: task-check-optional-resources --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: demo-optional-outputs-resources-with-input-resources diff --git a/examples/v1alpha2/taskruns/pull-private-image.yaml b/examples/v1beta1/taskruns/pull-private-image.yaml similarity index 99% rename from examples/v1alpha2/taskruns/pull-private-image.yaml rename to examples/v1beta1/taskruns/pull-private-image.yaml index f28ee46a87e..9e09f89ca2b 100644 --- a/examples/v1alpha2/taskruns/pull-private-image.yaml +++ b/examples/v1beta1/taskruns/pull-private-image.yaml @@ -36,7 +36,7 @@ imagePullSecrets: --- # This example contains embedded taskSpec. This taskrun requires the secrets and service accounts to be able to pull the # private image. Required secret and service account for this run is configured in test-build-robot SA and test-readonly-credentials secret. -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: pull-private-image- diff --git a/examples/v1alpha2/taskruns/pullrequest.yaml b/examples/v1beta1/taskruns/pullrequest.yaml similarity index 96% rename from examples/v1alpha2/taskruns/pullrequest.yaml rename to examples/v1beta1/taskruns/pullrequest.yaml index 465e7656453..c380d01997a 100644 --- a/examples/v1alpha2/taskruns/pullrequest.yaml +++ b/examples/v1beta1/taskruns/pullrequest.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: pullrequest- diff --git a/examples/v1alpha2/taskruns/secret-env.yaml b/examples/v1beta1/taskruns/secret-env.yaml similarity index 93% rename from examples/v1alpha2/taskruns/secret-env.yaml rename to examples/v1beta1/taskruns/secret-env.yaml index f0360e3ab95..70849d5705d 100644 --- a/examples/v1alpha2/taskruns/secret-env.yaml +++ b/examples/v1beta1/taskruns/secret-env.yaml @@ -5,7 +5,7 @@ metadata: stringData: ninja: SECRET_PASSWORD --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: secret-env diff --git a/examples/v1alpha2/taskruns/secret-volume-params.yaml b/examples/v1beta1/taskruns/secret-volume-params.yaml similarity index 95% rename from examples/v1alpha2/taskruns/secret-volume-params.yaml rename to examples/v1beta1/taskruns/secret-volume-params.yaml index 6052ee8644e..07c9e6b74d0 100644 --- a/examples/v1alpha2/taskruns/secret-volume-params.yaml +++ b/examples/v1beta1/taskruns/secret-volume-params.yaml @@ -5,7 +5,7 @@ metadata: stringData: ninja: SECRET_PASSWORD --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: secret-volume-params diff --git a/examples/v1alpha2/taskruns/secret-volume.yaml b/examples/v1beta1/taskruns/secret-volume.yaml similarity index 94% rename from examples/v1alpha2/taskruns/secret-volume.yaml rename to examples/v1beta1/taskruns/secret-volume.yaml index 14d0984e677..7dbf23be356 100644 --- a/examples/v1alpha2/taskruns/secret-volume.yaml +++ b/examples/v1beta1/taskruns/secret-volume.yaml @@ -5,7 +5,7 @@ metadata: stringData: ninja: SECRET_PASSWORD --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: secret-volume diff --git a/examples/v1alpha2/taskruns/sidecar-interp.yaml b/examples/v1beta1/taskruns/sidecar-interp.yaml similarity index 95% rename from examples/v1alpha2/taskruns/sidecar-interp.yaml rename to examples/v1beta1/taskruns/sidecar-interp.yaml index 6aa642cbf04..885966f8875 100644 --- a/examples/v1alpha2/taskruns/sidecar-interp.yaml +++ b/examples/v1beta1/taskruns/sidecar-interp.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: sidecar-interp- diff --git a/examples/v1alpha2/taskruns/sidecar-ready-script.yaml b/examples/v1beta1/taskruns/sidecar-ready-script.yaml similarity index 94% rename from examples/v1alpha2/taskruns/sidecar-ready-script.yaml rename to examples/v1beta1/taskruns/sidecar-ready-script.yaml index e36e7548af8..4256469d36e 100644 --- a/examples/v1alpha2/taskruns/sidecar-ready-script.yaml +++ b/examples/v1beta1/taskruns/sidecar-ready-script.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: sidecar-ready- diff --git a/examples/v1alpha2/taskruns/sidecar-ready.yaml b/examples/v1beta1/taskruns/sidecar-ready.yaml similarity index 96% rename from examples/v1alpha2/taskruns/sidecar-ready.yaml rename to examples/v1beta1/taskruns/sidecar-ready.yaml index 11869605b0d..eaa0406f91b 100644 --- a/examples/v1alpha2/taskruns/sidecar-ready.yaml +++ b/examples/v1beta1/taskruns/sidecar-ready.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: sidecar-ready- diff --git a/examples/v1alpha2/taskruns/step-by-digest.yaml b/examples/v1beta1/taskruns/step-by-digest.yaml similarity index 91% rename from examples/v1alpha2/taskruns/step-by-digest.yaml rename to examples/v1beta1/taskruns/step-by-digest.yaml index 33d64fc3201..c81d8b32f37 100644 --- a/examples/v1alpha2/taskruns/step-by-digest.yaml +++ b/examples/v1beta1/taskruns/step-by-digest.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: step-by-digest- diff --git a/examples/v1alpha2/taskruns/step-script.yaml b/examples/v1beta1/taskruns/step-script.yaml similarity index 98% rename from examples/v1alpha2/taskruns/step-script.yaml rename to examples/v1beta1/taskruns/step-script.yaml index cfd77f6150e..c45cb9f3cf4 100644 --- a/examples/v1alpha2/taskruns/step-script.yaml +++ b/examples/v1beta1/taskruns/step-script.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: step-script- diff --git a/examples/v1alpha2/taskruns/steps-run-in-order.yaml b/examples/v1beta1/taskruns/steps-run-in-order.yaml similarity index 89% rename from examples/v1alpha2/taskruns/steps-run-in-order.yaml rename to examples/v1beta1/taskruns/steps-run-in-order.yaml index 6f7082bb67c..a30dc90f3c6 100644 --- a/examples/v1alpha2/taskruns/steps-run-in-order.yaml +++ b/examples/v1beta1/taskruns/steps-run-in-order.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: steps-run-in-order- diff --git a/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml b/examples/v1beta1/taskruns/steptemplate-env-merge.yaml similarity index 97% rename from examples/v1alpha2/taskruns/steptemplate-env-merge.yaml rename to examples/v1beta1/taskruns/steptemplate-env-merge.yaml index bf393ae2d4a..e8cd40df04a 100644 --- a/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml +++ b/examples/v1beta1/taskruns/steptemplate-env-merge.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: steptemplate-env-merge- diff --git a/examples/v1alpha2/taskruns/task-multiple-output-image.yaml b/examples/v1beta1/taskruns/task-multiple-output-image.yaml similarity index 97% rename from examples/v1alpha2/taskruns/task-multiple-output-image.yaml rename to examples/v1beta1/taskruns/task-multiple-output-image.yaml index 796a4eaa008..49eaba09e4f 100644 --- a/examples/v1alpha2/taskruns/task-multiple-output-image.yaml +++ b/examples/v1beta1/taskruns/task-multiple-output-image.yaml @@ -49,7 +49,7 @@ spec: # This task is currently hardcoding a index.json file instead of # building an image since kaniko and other easy to use tools don't # support exporting this file yet -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: multiple-build-push-kaniko @@ -97,7 +97,7 @@ spec: ] } --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: multiple-build-push-kaniko-run diff --git a/examples/v1alpha2/taskruns/task-output-image.yaml b/examples/v1beta1/taskruns/task-output-image.yaml similarity index 97% rename from examples/v1alpha2/taskruns/task-output-image.yaml rename to examples/v1beta1/taskruns/task-output-image.yaml index 95adeb88970..02fac1fb8b5 100644 --- a/examples/v1alpha2/taskruns/task-output-image.yaml +++ b/examples/v1beta1/taskruns/task-output-image.yaml @@ -39,7 +39,7 @@ spec: # This task is currently hardcoding a index.json file instead of # building an image since kaniko and other easy to use tools don't # support exporting this file yet -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: build-push-kaniko-output-image @@ -72,7 +72,7 @@ spec: image: busybox script: cat $(resources.inputs.sourcerepo.path)/index.json --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: build-push-run-output-image diff --git a/examples/v1alpha2/taskruns/task-result.yaml b/examples/v1beta1/taskruns/task-result.yaml similarity index 95% rename from examples/v1alpha2/taskruns/task-result.yaml rename to examples/v1beta1/taskruns/task-result.yaml index b33110bec64..e8e528cf8dd 100644 --- a/examples/v1alpha2/taskruns/task-result.yaml +++ b/examples/v1beta1/taskruns/task-result.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: print-date diff --git a/examples/v1alpha2/taskruns/task-volume-args.yaml b/examples/v1beta1/taskruns/task-volume-args.yaml similarity index 95% rename from examples/v1alpha2/taskruns/task-volume-args.yaml rename to examples/v1beta1/taskruns/task-volume-args.yaml index fe33840537c..746824e5d92 100644 --- a/examples/v1alpha2/taskruns/task-volume-args.yaml +++ b/examples/v1beta1/taskruns/task-volume-args.yaml @@ -5,7 +5,7 @@ metadata: data: test.data: tasks are my jam --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: task-volume-args- diff --git a/examples/v1alpha2/taskruns/template-volume.yaml b/examples/v1beta1/taskruns/template-volume.yaml similarity index 94% rename from examples/v1alpha2/taskruns/template-volume.yaml rename to examples/v1beta1/taskruns/template-volume.yaml index f588aeeabd1..929f8ad3639 100644 --- a/examples/v1alpha2/taskruns/template-volume.yaml +++ b/examples/v1beta1/taskruns/template-volume.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: template-volume- diff --git a/examples/v1alpha2/taskruns/unnamed-steps.yaml b/examples/v1beta1/taskruns/unnamed-steps.yaml similarity index 86% rename from examples/v1alpha2/taskruns/unnamed-steps.yaml rename to examples/v1beta1/taskruns/unnamed-steps.yaml index b81a59aa1db..1afd50b6251 100644 --- a/examples/v1alpha2/taskruns/unnamed-steps.yaml +++ b/examples/v1beta1/taskruns/unnamed-steps.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: unnamed-steps- diff --git a/examples/v1alpha2/taskruns/workingdir.yaml b/examples/v1beta1/taskruns/workingdir.yaml similarity index 91% rename from examples/v1alpha2/taskruns/workingdir.yaml rename to examples/v1beta1/taskruns/workingdir.yaml index 9795aa721b2..c60618b1509 100644 --- a/examples/v1alpha2/taskruns/workingdir.yaml +++ b/examples/v1beta1/taskruns/workingdir.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: workingdir- diff --git a/examples/v1alpha2/taskruns/workspace-readonly.yaml b/examples/v1beta1/taskruns/workspace-readonly.yaml similarity index 97% rename from examples/v1alpha2/taskruns/workspace-readonly.yaml rename to examples/v1beta1/taskruns/workspace-readonly.yaml index 3dabb0fa9cc..bd06b1df0bc 100644 --- a/examples/v1alpha2/taskruns/workspace-readonly.yaml +++ b/examples/v1beta1/taskruns/workspace-readonly.yaml @@ -10,7 +10,7 @@ spec: accessModes: - ReadWriteOnce --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: workspaces-readonly- diff --git a/examples/v1alpha2/taskruns/workspace-volume.yaml b/examples/v1beta1/taskruns/workspace-volume.yaml similarity index 94% rename from examples/v1alpha2/taskruns/workspace-volume.yaml rename to examples/v1beta1/taskruns/workspace-volume.yaml index f756030daea..47f172a9651 100644 --- a/examples/v1alpha2/taskruns/workspace-volume.yaml +++ b/examples/v1beta1/taskruns/workspace-volume.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: workspace-volume- diff --git a/examples/v1alpha2/taskruns/workspace.yaml b/examples/v1beta1/taskruns/workspace.yaml similarity index 98% rename from examples/v1alpha2/taskruns/workspace.yaml rename to examples/v1beta1/taskruns/workspace.yaml index 3ca1d9bcaca..f13a2d9eea3 100644 --- a/examples/v1alpha2/taskruns/workspace.yaml +++ b/examples/v1beta1/taskruns/workspace.yaml @@ -27,7 +27,7 @@ stringData: data: message: aGVsbG8gc2VjcmV0 --- -apiVersion: tekton.dev/v1alpha2 +apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: generateName: custom-volume- diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 1069d6b06bb..b7de3ee0380 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -34,10 +34,10 @@ bash ${REPO_ROOT_DIR}/hack/generate-groups.sh "deepcopy,client,informer,lister" github.com/tektoncd/pipeline/pkg/client/resource github.com/tektoncd/pipeline/pkg/apis \ "resource:v1alpha1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt -# This generates deepcopy,client,informer and lister for the pipeline package (v1alpha1 and v1alpha2) +# This generates deepcopy,client,informer and lister for the pipeline package (v1alpha1 and v1beta1) bash ${REPO_ROOT_DIR}/hack/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \ - "pipeline:v1alpha1,v1alpha2" \ + "pipeline:v1alpha1,v1beta1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt # Depends on generate-groups.sh to install bin/deepcopy-gen @@ -63,10 +63,10 @@ bash ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ github.com/tektoncd/pipeline/pkg/client/resource github.com/tektoncd/pipeline/pkg/apis \ "resource:v1alpha1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt -# This generates the knative inject packages for the pipeline package (v1alpha1, v1alpha2). +# This generates the knative inject packages for the pipeline package (v1alpha1, v1beta1). bash ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \ - "pipeline:v1alpha1,v1alpha2" \ + "pipeline:v1alpha1,v1beta1" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt GOFLAGS="${OLDGOFLAGS}" diff --git a/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go b/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go index cc08819fd10..8d725ef2cbf 100644 --- a/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go @@ -21,7 +21,7 @@ import ( "context" "fmt" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/apis" ) @@ -30,7 +30,7 @@ var _ apis.Convertible = (*ClusterTask)(nil) // ConvertUp implements api.Convertible func (source *ClusterTask) ConvertUp(ctx context.Context, obj apis.Convertible) error { switch sink := obj.(type) { - case *v1alpha2.ClusterTask: + case *v1beta1.ClusterTask: sink.ObjectMeta = source.ObjectMeta return source.Spec.ConvertUp(ctx, &sink.Spec) default: @@ -41,7 +41,7 @@ func (source *ClusterTask) ConvertUp(ctx context.Context, obj apis.Convertible) // ConvertDown implements api.Convertible func (sink *ClusterTask) ConvertDown(ctx context.Context, obj apis.Convertible) error { switch source := obj.(type) { - case *v1alpha2.ClusterTask: + case *v1beta1.ClusterTask: sink.ObjectMeta = source.ObjectMeta return sink.Spec.ConvertDown(ctx, &source.Spec) default: diff --git a/pkg/apis/pipeline/v1alpha1/cluster_task_conversion_test.go b/pkg/apis/pipeline/v1alpha1/cluster_task_conversion_test.go index 287897a6f2a..bdb16e2606b 100644 --- a/pkg/apis/pipeline/v1alpha1/cluster_task_conversion_test.go +++ b/pkg/apis/pipeline/v1alpha1/cluster_task_conversion_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,7 +41,7 @@ func TestClusterTaskConversionBadType(t *testing.T) { } func TestClusterTaskConversion(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.ClusterTask{}} + versions := []apis.Convertible{&v1beta1.ClusterTask{}} tests := []struct { name string @@ -56,22 +56,22 @@ func TestClusterTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, Volumes: []corev1.Volume{{}}, - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -88,9 +88,9 @@ func TestClusterTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -114,17 +114,17 @@ func TestClusterTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Params: []v1alpha2.ParamSpec{{ + TaskSpec: v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, Inputs: &Inputs{ Params: []ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, @@ -140,9 +140,9 @@ func TestClusterTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -184,7 +184,7 @@ func TestClusterTaskConversion(t *testing.T) { } func TestClusterTaskConversionFromDeprecated(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.ClusterTask{}} + versions := []apis.Convertible{&v1beta1.ClusterTask{}} tests := []struct { name string in *ClusterTask @@ -202,7 +202,7 @@ func TestClusterTaskConversionFromDeprecated(t *testing.T) { Inputs: &Inputs{ Params: []ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, @@ -215,10 +215,10 @@ func TestClusterTaskConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Params: []v1alpha2.ParamSpec{{ + TaskSpec: v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, @@ -248,9 +248,9 @@ func TestClusterTaskConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -282,9 +282,9 @@ func TestClusterTaskConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, diff --git a/pkg/apis/pipeline/v1alpha1/condition_types.go b/pkg/apis/pipeline/v1alpha1/condition_types.go index 21c34f73198..8705c146a89 100644 --- a/pkg/apis/pipeline/v1alpha1/condition_types.go +++ b/pkg/apis/pipeline/v1alpha1/condition_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" ) @@ -40,12 +40,12 @@ type Condition struct { } // ConditionCheckStatus defines the observed state of ConditionCheck -type ConditionCheckStatus = v1alpha2.ConditionCheckStatus +type ConditionCheckStatus = v1beta1.ConditionCheckStatus // ConditionCheckStatusFields holds the fields of ConfigurationCheck's status. // This is defined separately and inlined so that other types can readily // consume these fields via duck typing. -type ConditionCheckStatusFields = v1alpha2.ConditionCheckStatusFields +type ConditionCheckStatusFields = v1beta1.ConditionCheckStatusFields // ConditionSpec defines the desired state of the Condition type ConditionSpec struct { diff --git a/pkg/apis/pipeline/v1alpha1/conversion_error.go b/pkg/apis/pipeline/v1alpha1/conversion_error.go index c2ab76388a8..990b34d9b95 100644 --- a/pkg/apis/pipeline/v1alpha1/conversion_error.go +++ b/pkg/apis/pipeline/v1alpha1/conversion_error.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/apis" ) @@ -25,13 +25,13 @@ const ( // ConditionTypeConvertible is a Warning condition that is set on // resources when they cannot be converted to warn of a forthcoming // breakage. - ConditionTypeConvertible apis.ConditionType = v1alpha2.ConditionTypeConvertible + ConditionTypeConvertible apis.ConditionType = v1beta1.ConditionTypeConvertible ) // CannotConvertError is returned when a field cannot be converted. -type CannotConvertError = v1alpha2.CannotConvertError +type CannotConvertError = v1beta1.CannotConvertError var _ error = (*CannotConvertError)(nil) // ConvertErrorf creates a CannotConvertError from the field name and format string. -var ConvertErrorf = v1alpha2.ConvertErrorf +var ConvertErrorf = v1beta1.ConvertErrorf diff --git a/pkg/apis/pipeline/v1alpha1/param_types.go b/pkg/apis/pipeline/v1alpha1/param_types.go index dde36221e4a..69b21947c6a 100644 --- a/pkg/apis/pipeline/v1alpha1/param_types.go +++ b/pkg/apis/pipeline/v1alpha1/param_types.go @@ -17,33 +17,33 @@ limitations under the License. package v1alpha1 import ( - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) // ParamSpec defines arbitrary parameters needed beyond typed inputs (such as // resources). Parameter values are provided by users as inputs on a TaskRun // or PipelineRun. -type ParamSpec = v1alpha2.ParamSpec +type ParamSpec = v1beta1.ParamSpec // Param declares an ArrayOrString to use for the parameter called name. -type Param = v1alpha2.Param +type Param = v1beta1.Param // ParamType indicates the type of an input parameter; // Used to distinguish between a single string and an array of strings. -type ParamType = v1alpha2.ParamType +type ParamType = v1beta1.ParamType // Valid ParamTypes: const ( - ParamTypeString ParamType = v1alpha2.ParamTypeString - ParamTypeArray ParamType = v1alpha2.ParamTypeArray + ParamTypeString ParamType = v1beta1.ParamTypeString + ParamTypeArray ParamType = v1beta1.ParamTypeArray ) // AllParamTypes can be used for ParamType validation. -var AllParamTypes = v1alpha2.AllParamTypes +var AllParamTypes = v1beta1.AllParamTypes // ArrayOrString is modeled after IntOrString in kubernetes/apimachinery: // ArrayOrString is a type that can hold a single string or string array. // Used in JSON unmarshalling so that a single JSON field can accept // either an individual string or an array of strings. -type ArrayOrString = v1alpha2.ArrayOrString +type ArrayOrString = v1beta1.ArrayOrString diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go b/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go index ea1f0491bf1..3bdab97fc12 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go @@ -21,7 +21,7 @@ import ( "context" "fmt" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/apis" ) @@ -30,7 +30,7 @@ var _ apis.Convertible = (*Pipeline)(nil) // ConvertUp implements api.Convertible func (source *Pipeline) ConvertUp(ctx context.Context, obj apis.Convertible) error { switch sink := obj.(type) { - case *v1alpha2.Pipeline: + case *v1beta1.Pipeline: sink.ObjectMeta = source.ObjectMeta return source.Spec.ConvertUp(ctx, &sink.Spec) default: @@ -38,12 +38,12 @@ func (source *Pipeline) ConvertUp(ctx context.Context, obj apis.Convertible) err } } -func (source *PipelineSpec) ConvertUp(ctx context.Context, sink *v1alpha2.PipelineSpec) error { +func (source *PipelineSpec) ConvertUp(ctx context.Context, sink *v1beta1.PipelineSpec) error { sink.Resources = source.Resources sink.Params = source.Params sink.Workspaces = source.Workspaces if len(source.Tasks) > 0 { - sink.Tasks = make([]v1alpha2.PipelineTask, len(source.Tasks)) + sink.Tasks = make([]v1beta1.PipelineTask, len(source.Tasks)) for i := range source.Tasks { if err := source.Tasks[i].ConvertUp(ctx, &sink.Tasks[i]); err != nil { return err @@ -53,11 +53,11 @@ func (source *PipelineSpec) ConvertUp(ctx context.Context, sink *v1alpha2.Pipeli return nil } -func (source *PipelineTask) ConvertUp(ctx context.Context, sink *v1alpha2.PipelineTask) error { +func (source *PipelineTask) ConvertUp(ctx context.Context, sink *v1beta1.PipelineTask) error { sink.Name = source.Name sink.TaskRef = source.TaskRef if source.TaskSpec != nil { - sink.TaskSpec = &v1alpha2.TaskSpec{} + sink.TaskSpec = &v1beta1.TaskSpec{} if err := source.TaskSpec.ConvertUp(ctx, sink.TaskSpec); err != nil { return err } @@ -74,7 +74,7 @@ func (source *PipelineTask) ConvertUp(ctx context.Context, sink *v1alpha2.Pipeli // ConvertDown implements api.Convertible func (sink *Pipeline) ConvertDown(ctx context.Context, obj apis.Convertible) error { switch source := obj.(type) { - case *v1alpha2.Pipeline: + case *v1beta1.Pipeline: sink.ObjectMeta = source.ObjectMeta return sink.Spec.ConvertDown(ctx, source.Spec) default: @@ -82,7 +82,7 @@ func (sink *Pipeline) ConvertDown(ctx context.Context, obj apis.Convertible) err } } -func (sink *PipelineSpec) ConvertDown(ctx context.Context, source v1alpha2.PipelineSpec) error { +func (sink *PipelineSpec) ConvertDown(ctx context.Context, source v1beta1.PipelineSpec) error { sink.Resources = source.Resources sink.Params = source.Params sink.Workspaces = source.Workspaces @@ -97,7 +97,7 @@ func (sink *PipelineSpec) ConvertDown(ctx context.Context, source v1alpha2.Pipel return nil } -func (sink *PipelineTask) ConvertDown(ctx context.Context, source v1alpha2.PipelineTask) error { +func (sink *PipelineTask) ConvertDown(ctx context.Context, source v1beta1.PipelineTask) error { sink.Name = source.Name sink.TaskRef = source.TaskRef if source.TaskSpec != nil { diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go b/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go index cb23f42a84c..7f3f78de020 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,7 +41,7 @@ func TestPipelineConversionBadType(t *testing.T) { } func TestPipelineConversion(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.Pipeline{}} + versions := []apis.Convertible{&v1beta1.Pipeline{}} tests := []struct { name string @@ -65,7 +65,7 @@ func TestPipelineConversion(t *testing.T) { }}, Params: []ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, Workspaces: []WorkspacePipelineDeclaration{{ @@ -82,18 +82,18 @@ func TestPipelineConversion(t *testing.T) { Retries: 10, RunAfter: []string{"task1"}, Resources: &PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ + Inputs: []v1beta1.PipelineTaskInputResource{{ Name: "input1", Resource: "resource1", }}, - Outputs: []v1alpha2.PipelineTaskOutputResource{{ + Outputs: []v1beta1.PipelineTaskOutputResource{{ Name: "output1", Resource: "resource2", }}, }, Params: []Param{{ Name: "param1", - Value: v1alpha2.ArrayOrString{StringVal: "str", Type: v1alpha2.ParamTypeString}, + Value: v1beta1.ArrayOrString{StringVal: "str", Type: v1beta1.ParamTypeString}, }}, Workspaces: []WorkspacePipelineTaskBinding{{ Name: "w1", @@ -101,8 +101,8 @@ func TestPipelineConversion(t *testing.T) { }}, }, { Name: "task2", - TaskSpec: &TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, }}, @@ -121,18 +121,18 @@ func TestPipelineConversion(t *testing.T) { Spec: PipelineSpec{ Params: []ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, Tasks: []PipelineTask{{ Name: "task2", TaskSpec: &TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_types.go b/pkg/apis/pipeline/v1alpha1/pipeline_types.go index 03b6888f4a3..dae4d65dba4 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/reconciler/pipeline/dag" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -40,13 +40,13 @@ type PipelineSpec struct { // Check that Pipeline may be validated and defaulted. // TaskKind defines the type of Task used by the pipeline. -type TaskKind = v1alpha2.TaskKind +type TaskKind = v1beta1.TaskKind const ( // NamespacedTaskKind indicates that the task type has a namepace scope. - NamespacedTaskKind TaskKind = v1alpha2.NamespacedTaskKind + NamespacedTaskKind TaskKind = v1beta1.NamespacedTaskKind // ClusterTaskKind indicates that task type has a cluster scope. - ClusterTaskKind TaskKind = v1alpha2.ClusterTaskKind + ClusterTaskKind TaskKind = v1beta1.ClusterTaskKind ) // +genclient @@ -172,34 +172,34 @@ func (l PipelineTaskList) Items() []dag.Task { } // PipelineTaskParam is used to provide arbitrary string parameters to a Task. -type PipelineTaskParam = v1alpha2.PipelineTaskParam +type PipelineTaskParam = v1beta1.PipelineTaskParam // PipelineTaskCondition allows a PipelineTask to declare a Condition to be evaluated before // the Task is run. -type PipelineTaskCondition = v1alpha2.PipelineTaskCondition +type PipelineTaskCondition = v1beta1.PipelineTaskCondition // PipelineDeclaredResource is used by a Pipeline to declare the types of the // PipelineResources that it will required to run and names which can be used to // refer to these PipelineResources in PipelineTaskResourceBindings. -type PipelineDeclaredResource = v1alpha2.PipelineDeclaredResource +type PipelineDeclaredResource = v1beta1.PipelineDeclaredResource // PipelineTaskResources allows a Pipeline to declare how its DeclaredPipelineResources // should be provided to a Task as its inputs and outputs. -type PipelineTaskResources = v1alpha2.PipelineTaskResources +type PipelineTaskResources = v1beta1.PipelineTaskResources // PipelineTaskInputResource maps the name of a declared PipelineResource input // dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources // that should be used. This input may come from a previous task. -type PipelineTaskInputResource = v1alpha2.PipelineTaskInputResource +type PipelineTaskInputResource = v1beta1.PipelineTaskInputResource // PipelineTaskOutputResource maps the name of a declared PipelineResource output // dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources // that should be used. -type PipelineTaskOutputResource = v1alpha2.PipelineTaskOutputResource +type PipelineTaskOutputResource = v1beta1.PipelineTaskOutputResource // TaskRef can be used to refer to a specific instance of a task. // Copied from CrossVersionObjectReference: https://github.com/kubernetes/kubernetes/blob/169df7434155cbbc22f1532cba8e0a9588e29ad8/pkg/apis/autoscaling/types.go#L64 -type TaskRef = v1alpha2.TaskRef +type TaskRef = v1beta1.TaskRef // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_validation_test.go b/pkg/apis/pipeline/v1alpha1/pipeline_validation_test.go index cbadb97a53d..86525794e4f 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_validation_test.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_validation_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" tb "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" ) @@ -85,7 +85,7 @@ func TestPipeline_Validate(t *testing.T) { name: "pipeline spec with taskref and taskspec", p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( tb.PipelineTask("foo", "foo-task", tb.PipelineTaskSpec(&v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "foo", Image: "bar", @@ -104,7 +104,7 @@ func TestPipeline_Validate(t *testing.T) { name: "pipeline spec valid taskspec", p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( tb.PipelineTask("", "", tb.PipelineTaskSpec(&v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "foo", Image: "bar", diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go index 83544af1db8..63e604474a9 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go @@ -21,7 +21,7 @@ import ( "context" "fmt" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/apis" ) @@ -30,7 +30,7 @@ var _ apis.Convertible = (*PipelineRun)(nil) // ConvertUp implements api.Convertible func (source *PipelineRun) ConvertUp(ctx context.Context, obj apis.Convertible) error { switch sink := obj.(type) { - case *v1alpha2.PipelineRun: + case *v1beta1.PipelineRun: sink.ObjectMeta = source.ObjectMeta if err := source.Spec.ConvertUp(ctx, &sink.Spec); err != nil { return err @@ -42,10 +42,10 @@ func (source *PipelineRun) ConvertUp(ctx context.Context, obj apis.Convertible) } } -func (source *PipelineRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.PipelineRunSpec) error { +func (source *PipelineRunSpec) ConvertUp(ctx context.Context, sink *v1beta1.PipelineRunSpec) error { sink.PipelineRef = source.PipelineRef if source.PipelineSpec != nil { - sink.PipelineSpec = &v1alpha2.PipelineSpec{} + sink.PipelineSpec = &v1beta1.PipelineSpec{} if err := source.PipelineSpec.ConvertUp(ctx, sink.PipelineSpec); err != nil { return err } @@ -64,7 +64,7 @@ func (source *PipelineRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.Pip // ConvertDown implements api.Convertible func (sink *PipelineRun) ConvertDown(ctx context.Context, obj apis.Convertible) error { switch source := obj.(type) { - case *v1alpha2.PipelineRun: + case *v1beta1.PipelineRun: sink.ObjectMeta = source.ObjectMeta if err := sink.Spec.ConvertDown(ctx, &source.Spec); err != nil { return err @@ -76,7 +76,7 @@ func (sink *PipelineRun) ConvertDown(ctx context.Context, obj apis.Convertible) } } -func (sink *PipelineRunSpec) ConvertDown(ctx context.Context, source *v1alpha2.PipelineRunSpec) error { +func (sink *PipelineRunSpec) ConvertDown(ctx context.Context, source *v1beta1.PipelineRunSpec) error { sink.PipelineRef = source.PipelineRef if source.PipelineSpec != nil { sink.PipelineSpec = &PipelineSpec{} diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion_test.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion_test.go index 90d089dd875..6c37e3c4828 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion_test.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion_test.go @@ -22,7 +22,7 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -41,7 +41,7 @@ func TestPipelineRunConversionBadType(t *testing.T) { } func TestPipelineRunConversion(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.PipelineRun{}} + versions := []apis.Convertible{&v1beta1.PipelineRun{}} tests := []struct { name string @@ -75,11 +75,11 @@ func TestPipelineRunConversion(t *testing.T) { }}, Params: []Param{{ Name: "p1", - Value: v1alpha2.ArrayOrString{StringVal: "baz"}, + Value: v1beta1.ArrayOrString{StringVal: "baz"}, }}, Resources: []PipelineResourceBinding{{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }}, }, Status: PipelineRunStatus{ @@ -111,8 +111,8 @@ func TestPipelineRunConversion(t *testing.T) { }, }, { Name: "task2", - TaskSpec: &TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, }}, @@ -135,11 +135,11 @@ func TestPipelineRunConversion(t *testing.T) { }}, Params: []Param{{ Name: "p1", - Value: v1alpha2.ArrayOrString{StringVal: "baz"}, + Value: v1beta1.ArrayOrString{StringVal: "baz"}, }}, Resources: []PipelineResourceBinding{{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }}, }, Status: PipelineRunStatus{ diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go index 60326548119..963f6ea5d13 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_types.go @@ -22,7 +22,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" @@ -90,37 +90,37 @@ type PipelineRunSpec struct { } // PipelineRunSpecStatus defines the pipelinerun spec status the user can provide -type PipelineRunSpecStatus = v1alpha2.PipelineRunSpecStatus +type PipelineRunSpecStatus = v1beta1.PipelineRunSpecStatus const ( // PipelineRunSpecStatusCancelled indicates that the user wants to cancel the task, // if not already cancelled or terminated - PipelineRunSpecStatusCancelled = v1alpha2.PipelineRunSpecStatusCancelled + PipelineRunSpecStatusCancelled = v1beta1.PipelineRunSpecStatusCancelled ) // PipelineResourceRef can be used to refer to a specific instance of a Resource -type PipelineResourceRef = v1alpha2.PipelineResourceRef +type PipelineResourceRef = v1beta1.PipelineResourceRef // PipelineRef can be used to refer to a specific instance of a Pipeline. // Copied from CrossVersionObjectReference: https://github.com/kubernetes/kubernetes/blob/169df7434155cbbc22f1532cba8e0a9588e29ad8/pkg/apis/autoscaling/types.go#L64 -type PipelineRef = v1alpha2.PipelineRef +type PipelineRef = v1beta1.PipelineRef // PipelineRunStatus defines the observed state of PipelineRun -type PipelineRunStatus = v1alpha2.PipelineRunStatus +type PipelineRunStatus = v1beta1.PipelineRunStatus // PipelineRunStatusFields holds the fields of PipelineRunStatus' status. // This is defined separately and inlined so that other types can readily // consume these fields via duck typing. -type PipelineRunStatusFields = v1alpha2.PipelineRunStatusFields +type PipelineRunStatusFields = v1beta1.PipelineRunStatusFields // PipelineRunTaskRunStatus contains the name of the PipelineTask for this TaskRun and the TaskRun's Status -type PipelineRunTaskRunStatus = v1alpha2.PipelineRunTaskRunStatus +type PipelineRunTaskRunStatus = v1beta1.PipelineRunTaskRunStatus -type PipelineRunConditionCheckStatus = v1alpha2.PipelineRunConditionCheckStatus +type PipelineRunConditionCheckStatus = v1beta1.PipelineRunConditionCheckStatus // PipelineRunSpecServiceAccountName can be used to configure specific // ServiceAccountName for a concrete Task -type PipelineRunSpecServiceAccountName = v1alpha2.PipelineRunSpecServiceAccountName +type PipelineRunSpecServiceAccountName = v1beta1.PipelineRunSpecServiceAccountName // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -135,7 +135,7 @@ type PipelineRunList struct { // PipelineTaskRun reports the results of running a step in the Task. Each // task has the potential to succeed or fail (based on the exit code) // and produces logs. -type PipelineTaskRun = v1alpha2.PipelineTaskRun +type PipelineTaskRun = v1beta1.PipelineTaskRun // GetTaskRunRef for pipelinerun func (pr *PipelineRun) GetTaskRunRef() corev1.ObjectReference { diff --git a/pkg/apis/pipeline/v1alpha1/resource_types.go b/pkg/apis/pipeline/v1alpha1/resource_types.go index a725022c103..d987494e173 100644 --- a/pkg/apis/pipeline/v1alpha1/resource_types.go +++ b/pkg/apis/pipeline/v1alpha1/resource_types.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) // PipelineResourceInterface interface to be implemented by different PipelineResource types @@ -41,10 +41,10 @@ type PipelineResourceInterface interface { } // TaskModifier is an interface to be implemented by different PipelineResources -type TaskModifier = v1alpha2.TaskModifier +type TaskModifier = v1beta1.TaskModifier // InternalTaskModifier implements TaskModifier for resources that are built-in to Tekton Pipelines. -type InternalTaskModifier = v1alpha2.InternalTaskModifier +type InternalTaskModifier = v1beta1.InternalTaskModifier func checkStepNotAlreadyAdded(s Step, steps []Step) error { for _, step := range steps { @@ -100,10 +100,10 @@ func ApplyTaskModifier(ts *TaskSpec, tm TaskModifier) error { // PipelineResourceBinding connects a reference to an instance of a PipelineResource // with a PipelineResource dependency that the Pipeline has declared -type PipelineResourceBinding = v1alpha2.PipelineResourceBinding +type PipelineResourceBinding = v1beta1.PipelineResourceBinding // PipelineResourceResult used to export the image name and digest as json -type PipelineResourceResult = v1alpha2.PipelineResourceResult +type PipelineResourceResult = v1beta1.PipelineResourceResult // ResultType used to find out whether a PipelineResourceResult is from a task result or not -type ResultType = v1alpha2.ResultType +type ResultType = v1beta1.ResultType diff --git a/pkg/apis/pipeline/v1alpha1/resource_types_test.go b/pkg/apis/pipeline/v1alpha1/resource_types_test.go index 1623e30ea65..c16b94a55d4 100644 --- a/pkg/apis/pipeline/v1alpha1/resource_types_test.go +++ b/pkg/apis/pipeline/v1alpha1/resource_types_test.go @@ -18,7 +18,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" ) @@ -70,7 +70,7 @@ func TestApplyTaskModifier(t *testing.T) { ts: v1alpha1.TaskSpec{}, }, { name: "identical volume already added", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ // Trying to add the same Volume that has already been added shouldn't be an error // and it should not be added twice Volumes: []corev1.Volume{volume}, @@ -82,7 +82,7 @@ func TestApplyTaskModifier(t *testing.T) { t.Fatalf("Did not expect error modifying TaskSpec but got %v", err) } - expectedTaskSpec := v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec := v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{ Container: prependStep, }, { @@ -106,27 +106,27 @@ func TestApplyTaskModifier_AlreadyAdded(t *testing.T) { ts v1alpha1.TaskSpec }{{ name: "prepend already added", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: prependStep}}, }}, }, { name: "append already added", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: appendStep}}, }}, }, { name: "both steps already added", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: prependStep}, {Container: appendStep}}, }}, }, { name: "both steps already added reverse order", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: appendStep}, {Container: prependStep}}, }}, }, { name: "volume with same name but diff content already added", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Volumes: []corev1.Volume{{ Name: "magic-volume", VolumeSource: corev1.VolumeSource{ diff --git a/pkg/apis/pipeline/v1alpha1/task_conversion.go b/pkg/apis/pipeline/v1alpha1/task_conversion.go index f614b75938b..7e4f925bf1c 100644 --- a/pkg/apis/pipeline/v1alpha1/task_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/task_conversion.go @@ -21,7 +21,7 @@ import ( "context" "fmt" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/apis" ) @@ -30,7 +30,7 @@ var _ apis.Convertible = (*Task)(nil) // ConvertUp implements api.Convertible func (source *Task) ConvertUp(ctx context.Context, obj apis.Convertible) error { switch sink := obj.(type) { - case *v1alpha2.Task: + case *v1beta1.Task: sink.ObjectMeta = source.ObjectMeta return source.Spec.ConvertUp(ctx, &sink.Spec) default: @@ -38,7 +38,7 @@ func (source *Task) ConvertUp(ctx context.Context, obj apis.Convertible) error { } } -func (source *TaskSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskSpec) error { +func (source *TaskSpec) ConvertUp(ctx context.Context, sink *v1beta1.TaskSpec) error { sink.Steps = source.Steps sink.Volumes = source.Volumes sink.StepTemplate = source.StepTemplate @@ -53,22 +53,22 @@ func (source *TaskSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskSpec) return apis.ErrMultipleOneOf("inputs.params", "params") } if len(source.Inputs.Params) > 0 { - sink.Params = make([]v1alpha2.ParamSpec, len(source.Inputs.Params)) + sink.Params = make([]v1beta1.ParamSpec, len(source.Inputs.Params)) for i, param := range source.Inputs.Params { sink.Params[i] = *param.DeepCopy() } } if len(source.Inputs.Resources) > 0 { if sink.Resources == nil { - sink.Resources = &v1alpha2.TaskResources{} + sink.Resources = &v1beta1.TaskResources{} } if len(source.Inputs.Resources) > 0 && source.Resources != nil && len(source.Resources.Inputs) > 0 { // This shouldn't happen as it shouldn't pass validation but just in case return apis.ErrMultipleOneOf("inputs.resources", "resources.inputs") } - sink.Resources.Inputs = make([]v1alpha2.TaskResource, len(source.Inputs.Resources)) + sink.Resources.Inputs = make([]v1beta1.TaskResource, len(source.Inputs.Resources)) for i, resource := range source.Inputs.Resources { - sink.Resources.Inputs[i] = v1alpha2.TaskResource{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + sink.Resources.Inputs[i] = v1beta1.TaskResource{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: resource.Name, Type: resource.Type, Description: resource.Description, @@ -80,15 +80,15 @@ func (source *TaskSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskSpec) } if source.Outputs != nil && len(source.Outputs.Resources) > 0 { if sink.Resources == nil { - sink.Resources = &v1alpha2.TaskResources{} + sink.Resources = &v1beta1.TaskResources{} } if len(source.Outputs.Resources) > 0 && source.Resources != nil && len(source.Resources.Outputs) > 0 { // This shouldn't happen as it shouldn't pass validation but just in case return apis.ErrMultipleOneOf("outputs.resources", "resources.outputs") } - sink.Resources.Outputs = make([]v1alpha2.TaskResource, len(source.Outputs.Resources)) + sink.Resources.Outputs = make([]v1beta1.TaskResource, len(source.Outputs.Resources)) for i, resource := range source.Outputs.Resources { - sink.Resources.Outputs[i] = v1alpha2.TaskResource{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + sink.Resources.Outputs[i] = v1beta1.TaskResource{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: resource.Name, Type: resource.Type, Description: resource.Description, @@ -103,7 +103,7 @@ func (source *TaskSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskSpec) // ConvertDown implements api.Convertible func (sink *Task) ConvertDown(ctx context.Context, obj apis.Convertible) error { switch source := obj.(type) { - case *v1alpha2.Task: + case *v1beta1.Task: sink.ObjectMeta = source.ObjectMeta return sink.Spec.ConvertDown(ctx, &source.Spec) default: @@ -111,7 +111,7 @@ func (sink *Task) ConvertDown(ctx context.Context, obj apis.Convertible) error { } } -func (sink *TaskSpec) ConvertDown(ctx context.Context, source *v1alpha2.TaskSpec) error { +func (sink *TaskSpec) ConvertDown(ctx context.Context, source *v1beta1.TaskSpec) error { sink.Steps = source.Steps sink.Volumes = source.Volumes sink.StepTemplate = source.StepTemplate diff --git a/pkg/apis/pipeline/v1alpha1/task_conversion_test.go b/pkg/apis/pipeline/v1alpha1/task_conversion_test.go index 17a1937bf69..2e6b6ff6200 100644 --- a/pkg/apis/pipeline/v1alpha1/task_conversion_test.go +++ b/pkg/apis/pipeline/v1alpha1/task_conversion_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,7 +41,7 @@ func TestTaskConversionBadType(t *testing.T) { } func TestTaskConversion(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.Task{}} + versions := []apis.Convertible{&v1beta1.Task{}} tests := []struct { name string @@ -56,22 +56,22 @@ func TestTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, Volumes: []corev1.Volume{{}}, - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -88,9 +88,9 @@ func TestTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -114,17 +114,17 @@ func TestTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Params: []v1alpha2.ParamSpec{{ + TaskSpec: v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, Inputs: &Inputs{ Params: []ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, @@ -140,9 +140,9 @@ func TestTaskConversion(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -184,7 +184,7 @@ func TestTaskConversion(t *testing.T) { } func TestTaskConversionFromDeprecated(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.Task{}} + versions := []apis.Convertible{&v1beta1.Task{}} tests := []struct { name string in *Task @@ -202,7 +202,7 @@ func TestTaskConversionFromDeprecated(t *testing.T) { Inputs: &Inputs{ Params: []ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, @@ -215,10 +215,10 @@ func TestTaskConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Params: []v1alpha2.ParamSpec{{ + TaskSpec: v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ Name: "param-1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "My first param", }}, }, @@ -248,9 +248,9 @@ func TestTaskConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -282,9 +282,9 @@ func TestTaskConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, diff --git a/pkg/apis/pipeline/v1alpha1/task_defaults.go b/pkg/apis/pipeline/v1alpha1/task_defaults.go index 2baa6bfd3e6..969ab34986e 100644 --- a/pkg/apis/pipeline/v1alpha1/task_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/task_defaults.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "context" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" "knative.dev/pkg/apis" ) @@ -33,7 +33,7 @@ func (t *Task) SetDefaults(ctx context.Context) { // SetDefaults set any defaults for the task spec func (ts *TaskSpec) SetDefaults(ctx context.Context) { if contexts.IsUpgradeViaDefaulting(ctx) { - v := v1alpha2.TaskSpec{} + v := v1beta1.TaskSpec{} if ts.ConvertUp(ctx, &v) == nil { alpha := TaskSpec{} if alpha.ConvertDown(ctx, &v) == nil { diff --git a/pkg/apis/pipeline/v1alpha1/task_types.go b/pkg/apis/pipeline/v1alpha1/task_types.go index 2fdb63e488c..71f891e8865 100644 --- a/pkg/apis/pipeline/v1alpha1/task_types.go +++ b/pkg/apis/pipeline/v1alpha1/task_types.go @@ -19,7 +19,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) const ( @@ -45,7 +45,7 @@ func (t *Task) Copy() TaskInterface { // TaskSpec defines the desired state of Task. type TaskSpec struct { - v1alpha2.TaskSpec `json:",inline"` + v1beta1.TaskSpec `json:",inline"` // Inputs is an optional set of parameters and resources which must be // supplied by the user when a Task is executed by a TaskRun. @@ -58,13 +58,13 @@ type TaskSpec struct { } // TaskResult used to describe the results of a task -type TaskResult = v1alpha2.TaskResult +type TaskResult = v1beta1.TaskResult // Step embeds the Container type, which allows it to include fields not // provided by Container. -type Step = v1alpha2.Step +type Step = v1beta1.Step -type Sidecar = v1alpha2.Sidecar +type Sidecar = v1beta1.Sidecar // +genclient // +genclient:noStatus @@ -105,7 +105,7 @@ type Inputs struct { // the Task definition, and when provided as an Input, the Name will be the // path to the volume mounted containing this Resource as an input (e.g. // an input Resource named `workspace` will be mounted at `/workspace`). -type TaskResource = v1alpha2.TaskResource +type TaskResource = v1beta1.TaskResource // Outputs allow a task to declare what data the Build/Task will be producing, // i.e. results such as logs and artifacts such as images. diff --git a/pkg/apis/pipeline/v1alpha1/task_validation.go b/pkg/apis/pipeline/v1alpha1/task_validation.go index ec5f00276db..c1602d71c62 100644 --- a/pkg/apis/pipeline/v1alpha1/task_validation.go +++ b/pkg/apis/pipeline/v1alpha1/task_validation.go @@ -22,7 +22,7 @@ import ( "path/filepath" "strings" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/substitution" corev1 "k8s.io/api/core/v1" @@ -85,7 +85,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { return err } // Validate that the parameters type are correct - if err := v1alpha2.ValidateParameterTypes(ts.Params); err != nil { + if err := v1beta1.ValidateParameterTypes(ts.Params); err != nil { return err } @@ -128,7 +128,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { } } - if err := v1alpha2.ValidateParameterVariables(ts.Steps, ts.Params); err != nil { + if err := v1beta1.ValidateParameterVariables(ts.Steps, ts.Params); err != nil { return err } // Deprecated @@ -136,7 +136,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { return err } - if err := v1alpha2.ValidateResourcesVariables(ts.Steps, ts.Resources); err != nil { + if err := v1beta1.ValidateResourcesVariables(ts.Steps, ts.Resources); err != nil { return err } // Deprecated @@ -271,7 +271,7 @@ func validateInputParameterTypes(inputs *Inputs) *apis.FieldError { return nil } -func validateInputParameterVariables(steps []Step, inputs *Inputs, params []v1alpha2.ParamSpec) *apis.FieldError { +func validateInputParameterVariables(steps []Step, inputs *Inputs, params []v1beta1.ParamSpec) *apis.FieldError { parameterNames := map[string]struct{}{} arrayParameterNames := map[string]struct{}{} @@ -297,7 +297,7 @@ func validateInputParameterVariables(steps []Step, inputs *Inputs, params []v1al return validateArrayUsage(steps, "params", arrayParameterNames) } -func validateResourceVariables(steps []Step, inputs *Inputs, outputs *Outputs, resources *v1alpha2.TaskResources) *apis.FieldError { +func validateResourceVariables(steps []Step, inputs *Inputs, outputs *Outputs, resources *v1beta1.TaskResources) *apis.FieldError { resourceNames := map[string]struct{}{} if resources != nil { for _, r := range resources.Inputs { diff --git a/pkg/apis/pipeline/v1alpha1/task_validation_test.go b/pkg/apis/pipeline/v1alpha1/task_validation_test.go index 7c3adb346e7..e847f95d8ed 100644 --- a/pkg/apis/pipeline/v1alpha1/task_validation_test.go +++ b/pkg/apis/pipeline/v1alpha1/task_validation_test.go @@ -23,7 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" @@ -322,7 +322,7 @@ func TestTaskSpecValidate(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ts := &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: tt.fields.Steps, StepTemplate: tt.fields.StepTemplate, Workspaces: tt.fields.Workspaces, @@ -347,9 +347,9 @@ func TestTaskSpecValidateError(t *testing.T) { Volumes []corev1.Volume StepTemplate *corev1.Container Workspaces []v1alpha1.WorkspaceDeclaration - // v1alpha2 - Params []v1alpha2.ParamSpec - Resources *v1alpha2.TaskResources + // v1beta1 + Params []v1beta1.ParamSpec + Resources *v1beta1.TaskResources } tests := []struct { name string @@ -924,17 +924,17 @@ func TestTaskSpecValidateError(t *testing.T) { Paths: []string{"workspaces.mountpath"}, }, }, { - name: "v1alpha2: params and deprecated inputs.params", + name: "v1beta1: params and deprecated inputs.params", fields: fields{ Steps: validSteps, - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "param1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, }}, Inputs: &v1alpha1.Inputs{ Params: []v1alpha1.ParamSpec{{ Name: "param1", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, }}, }, }, @@ -943,11 +943,11 @@ func TestTaskSpecValidateError(t *testing.T) { Paths: []string{"inputs.params", "params"}, }, }, { - name: "v1alpha2: resources.inputs and deprecated inputs.resource", + name: "v1beta1: resources.inputs and deprecated inputs.resource", fields: fields{ Steps: validSteps, - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "input-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -964,11 +964,11 @@ func TestTaskSpecValidateError(t *testing.T) { Paths: []string{"inputs.resources", "resources.inputs"}, }, }, { - name: "v1alpha2: resources.outputs and deprecated outputs.resource", + name: "v1beta1: resources.outputs and deprecated outputs.resource", fields: fields{ Steps: validSteps, - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha2.ResourceDeclaration{ + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "output-1", Type: resource.PipelineResourceTypeGit, }}}, @@ -988,7 +988,7 @@ func TestTaskSpecValidateError(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ts := &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: tt.fields.Steps, Volumes: tt.fields.Volumes, StepTemplate: tt.fields.StepTemplate, diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go b/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go index 3cbeddd214e..d295e9deee8 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go @@ -21,7 +21,7 @@ import ( "context" "fmt" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/apis" ) @@ -30,7 +30,7 @@ var _ apis.Convertible = (*TaskRun)(nil) // ConvertUp implements api.Convertible func (source *TaskRun) ConvertUp(ctx context.Context, obj apis.Convertible) error { switch sink := obj.(type) { - case *v1alpha2.TaskRun: + case *v1beta1.TaskRun: sink.ObjectMeta = source.ObjectMeta if err := source.Spec.ConvertUp(ctx, &sink.Spec); err != nil { return err @@ -42,11 +42,11 @@ func (source *TaskRun) ConvertUp(ctx context.Context, obj apis.Convertible) erro } } -func (source *TaskRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskRunSpec) error { +func (source *TaskRunSpec) ConvertUp(ctx context.Context, sink *v1beta1.TaskRunSpec) error { sink.ServiceAccountName = source.ServiceAccountName sink.TaskRef = source.TaskRef if source.TaskSpec != nil { - sink.TaskSpec = &v1alpha2.TaskSpec{} + sink.TaskSpec = &v1beta1.TaskSpec{} if err := source.TaskSpec.ConvertUp(ctx, sink.TaskSpec); err != nil { return err } @@ -63,23 +63,23 @@ func (source *TaskRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskRun return apis.ErrMultipleOneOf("inputs.params", "params") } if len(source.Inputs.Params) > 0 { - sink.Params = make([]v1alpha2.Param, len(source.Inputs.Params)) + sink.Params = make([]v1beta1.Param, len(source.Inputs.Params)) for i, param := range source.Inputs.Params { sink.Params[i] = *param.DeepCopy() } } if len(source.Inputs.Resources) > 0 { if sink.Resources == nil { - sink.Resources = &v1alpha2.TaskRunResources{} + sink.Resources = &v1beta1.TaskRunResources{} } if len(source.Inputs.Resources) > 0 && source.Resources != nil && len(source.Resources.Inputs) > 0 { // This shouldn't happen as it shouldn't pass validation but just in case return apis.ErrMultipleOneOf("inputs.resources", "resources.inputs") } - sink.Resources.Inputs = make([]v1alpha2.TaskResourceBinding, len(source.Inputs.Resources)) + sink.Resources.Inputs = make([]v1beta1.TaskResourceBinding, len(source.Inputs.Resources)) for i, resource := range source.Inputs.Resources { - sink.Resources.Inputs[i] = v1alpha2.TaskResourceBinding{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + sink.Resources.Inputs[i] = v1beta1.TaskResourceBinding{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: resource.Name, ResourceRef: resource.ResourceRef, ResourceSpec: resource.ResourceSpec, @@ -90,16 +90,16 @@ func (source *TaskRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskRun } if len(source.Outputs.Resources) > 0 { if sink.Resources == nil { - sink.Resources = &v1alpha2.TaskRunResources{} + sink.Resources = &v1beta1.TaskRunResources{} } if len(source.Outputs.Resources) > 0 && source.Resources != nil && len(source.Resources.Outputs) > 0 { // This shouldn't happen as it shouldn't pass validation but just in case return apis.ErrMultipleOneOf("outputs.resources", "resources.outputs") } - sink.Resources.Outputs = make([]v1alpha2.TaskResourceBinding, len(source.Outputs.Resources)) + sink.Resources.Outputs = make([]v1beta1.TaskResourceBinding, len(source.Outputs.Resources)) for i, resource := range source.Outputs.Resources { - sink.Resources.Outputs[i] = v1alpha2.TaskResourceBinding{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + sink.Resources.Outputs[i] = v1beta1.TaskResourceBinding{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: resource.Name, ResourceRef: resource.ResourceRef, ResourceSpec: resource.ResourceSpec, @@ -114,7 +114,7 @@ func (source *TaskRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskRun // ConvertDown implements api.Convertible func (sink *TaskRun) ConvertDown(ctx context.Context, obj apis.Convertible) error { switch source := obj.(type) { - case *v1alpha2.TaskRun: + case *v1beta1.TaskRun: sink.ObjectMeta = source.ObjectMeta if err := sink.Spec.ConvertDown(ctx, &source.Spec); err != nil { return err @@ -126,7 +126,7 @@ func (sink *TaskRun) ConvertDown(ctx context.Context, obj apis.Convertible) erro } } -func (sink *TaskRunSpec) ConvertDown(ctx context.Context, source *v1alpha2.TaskRunSpec) error { +func (sink *TaskRunSpec) ConvertDown(ctx context.Context, source *v1beta1.TaskRunSpec) error { sink.ServiceAccountName = source.ServiceAccountName sink.TaskRef = source.TaskRef if source.TaskSpec != nil { diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_conversion_test.go b/pkg/apis/pipeline/v1alpha1/taskrun_conversion_test.go index 371ac2d2052..6d093175b07 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_conversion_test.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_conversion_test.go @@ -22,7 +22,7 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -41,7 +41,7 @@ func TestTaskRunConversionBadType(t *testing.T) { } func TestTaskRunConversion(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.TaskRun{}} + versions := []apis.Convertible{&v1beta1.TaskRun{}} tests := []struct { name string @@ -71,20 +71,20 @@ func TestTaskRunConversion(t *testing.T) { }}, Params: []Param{{ Name: "p1", - Value: v1alpha2.ArrayOrString{StringVal: "baz"}, + Value: v1beta1.ArrayOrString{StringVal: "baz"}, }}, - Resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "o1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r2"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r2"}, }, }}, }, @@ -109,8 +109,8 @@ func TestTaskRunConversion(t *testing.T) { Generation: 1, }, Spec: TaskRunSpec{ - TaskSpec: &TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, }}, @@ -126,20 +126,20 @@ func TestTaskRunConversion(t *testing.T) { }}, Params: []Param{{ Name: "p1", - Value: v1alpha2.ArrayOrString{StringVal: "baz"}, + Value: v1beta1.ArrayOrString{StringVal: "baz"}, }}, - Resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "o1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r2"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r2"}, }, }}, }, @@ -154,8 +154,8 @@ func TestTaskRunConversion(t *testing.T) { Generation: 1, }, Spec: TaskRunSpec{ - TaskSpec: &TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, }}, @@ -171,12 +171,12 @@ func TestTaskRunConversion(t *testing.T) { }}, Params: []Param{{ Name: "p1", - Value: v1alpha2.ArrayOrString{StringVal: "baz"}, + Value: v1beta1.ArrayOrString{StringVal: "baz"}, }}, Inputs: TaskRunInputs{ Params: []Param{{ Name: "p2", - Value: v1alpha2.ArrayOrString{StringVal: "bar"}}, + Value: v1beta1.ArrayOrString{StringVal: "bar"}}, }, }, }, @@ -191,8 +191,8 @@ func TestTaskRunConversion(t *testing.T) { Generation: 1, }, Spec: TaskRunSpec{ - TaskSpec: &TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, }}, @@ -206,11 +206,11 @@ func TestTaskRunConversion(t *testing.T) { SubPath: "foo", EmptyDir: &corev1.EmptyDirVolumeSource{}, }}, - Resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -219,7 +219,7 @@ func TestTaskRunConversion(t *testing.T) { Resources: []TaskResourceBinding{{ PipelineResourceBinding: PipelineResourceBinding{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -236,8 +236,8 @@ func TestTaskRunConversion(t *testing.T) { Generation: 1, }, Spec: TaskRunSpec{ - TaskSpec: &TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "foo", }}}, }}, @@ -251,11 +251,11 @@ func TestTaskRunConversion(t *testing.T) { SubPath: "foo", EmptyDir: &corev1.EmptyDirVolumeSource{}, }}, - Resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "o1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -264,7 +264,7 @@ func TestTaskRunConversion(t *testing.T) { Resources: []TaskResourceBinding{{ PipelineResourceBinding: PipelineResourceBinding{ Name: "o1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -299,7 +299,7 @@ func TestTaskRunConversion(t *testing.T) { } func TestTaskRunConversionFromDeprecated(t *testing.T) { - versions := []apis.Convertible{&v1alpha2.TaskRun{}} + versions := []apis.Convertible{&v1beta1.TaskRun{}} tests := []struct { name string in *TaskRun @@ -317,7 +317,7 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { Inputs: TaskRunInputs{ Params: []Param{{ Name: "p2", - Value: v1alpha2.ArrayOrString{StringVal: "bar"}}, + Value: v1beta1.ArrayOrString{StringVal: "bar"}}, }, }, }, @@ -331,7 +331,7 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { Spec: TaskRunSpec{ Params: []Param{{ Name: "p2", - Value: v1alpha2.ArrayOrString{StringVal: "bar"}}, + Value: v1beta1.ArrayOrString{StringVal: "bar"}}, }, }, }, @@ -348,7 +348,7 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { Resources: []TaskResourceBinding{{ PipelineResourceBinding: PipelineResourceBinding{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -362,11 +362,11 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "i1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -386,7 +386,7 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { Resources: []TaskResourceBinding{{ PipelineResourceBinding: PipelineResourceBinding{ Name: "o1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, @@ -400,11 +400,11 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { Generation: 1, }, Spec: TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + Resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "o1", - ResourceRef: &v1alpha2.PipelineResourceRef{Name: "r1"}, + ResourceRef: &v1beta1.PipelineResourceRef{Name: "r1"}, }, Paths: []string{"foo", "bar"}, }}, diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go index d3415d6d603..db65548b5ba 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go @@ -21,7 +21,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/config" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -48,7 +48,7 @@ func (tr *TaskRun) SetDefaults(ctx context.Context) { func (trs *TaskRunSpec) SetDefaults(ctx context.Context) { if contexts.IsUpgradeViaDefaulting(ctx) { - v := v1alpha2.TaskRunSpec{} + v := v1beta1.TaskRunSpec{} if trs.ConvertUp(ctx, &v) == nil { alpha := TaskRunSpec{} if alpha.ConvertDown(ctx, &v) == nil { diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_types.go b/pkg/apis/pipeline/v1alpha1/taskrun_types.go index b34f099b61d..365d52606d2 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_types.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_types.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -49,11 +49,11 @@ type TaskRunSpec struct { // Workspaces is a list of WorkspaceBindings from volumes to workspaces. // +optional Workspaces []WorkspaceBinding `json:"workspaces,omitempty"` - // From v1alpha2 + // From v1beta1 // +optional Params []Param `json:"params,omitempty"` // +optional - Resources *v1alpha2.TaskRunResources `json:"resources,omitempty"` + Resources *v1beta1.TaskRunResources `json:"resources,omitempty"` // Deprecated // +optional Inputs TaskRunInputs `json:"inputs,omitempty"` @@ -62,12 +62,12 @@ type TaskRunSpec struct { } // TaskRunSpecStatus defines the taskrun spec status the user can provide -type TaskRunSpecStatus = v1alpha2.TaskRunSpecStatus +type TaskRunSpecStatus = v1beta1.TaskRunSpecStatus const ( // TaskRunSpecStatusCancelled indicates that the user wants to cancel the task, // if not already cancelled or terminated - TaskRunSpecStatusCancelled = v1alpha2.TaskRunSpecStatusCancelled + TaskRunSpecStatusCancelled = v1beta1.TaskRunSpecStatusCancelled ) // TaskRunInputs holds the input values that this task was invoked with. @@ -80,7 +80,7 @@ type TaskRunInputs struct { // TaskResourceBinding points to the PipelineResource that // will be used for the Task input or output called Name. -type TaskResourceBinding = v1alpha2.TaskResourceBinding +type TaskResourceBinding = v1beta1.TaskResourceBinding // TaskRunOutputs holds the output values that this task was invoked with. type TaskRunOutputs struct { @@ -89,42 +89,42 @@ type TaskRunOutputs struct { } // TaskRunStatus defines the observed state of TaskRun -type TaskRunStatus = v1alpha2.TaskRunStatus +type TaskRunStatus = v1beta1.TaskRunStatus // TaskRunStatusFields holds the fields of TaskRun's status. This is defined // separately and inlined so that other types can readily consume these fields // via duck typing. -type TaskRunStatusFields = v1alpha2.TaskRunStatusFields +type TaskRunStatusFields = v1beta1.TaskRunStatusFields // TaskRunResult used to describe the results of a task -type TaskRunResult = v1alpha2.TaskRunResult +type TaskRunResult = v1beta1.TaskRunResult // StepState reports the results of running a step in the Task. -type StepState = v1alpha2.StepState +type StepState = v1beta1.StepState // SidecarState reports the results of sidecar in the Task. -type SidecarState = v1alpha2.SidecarState +type SidecarState = v1beta1.SidecarState // CloudEventDelivery is the target of a cloud event along with the state of // delivery. -type CloudEventDelivery = v1alpha2.CloudEventDelivery +type CloudEventDelivery = v1beta1.CloudEventDelivery // CloudEventCondition is a string that represents the condition of the event. -type CloudEventCondition = v1alpha2.CloudEventCondition +type CloudEventCondition = v1beta1.CloudEventCondition const ( // CloudEventConditionUnknown means that the condition for the event to be // triggered was not met yet, or we don't know the state yet. - CloudEventConditionUnknown CloudEventCondition = v1alpha2.CloudEventConditionUnknown + CloudEventConditionUnknown CloudEventCondition = v1beta1.CloudEventConditionUnknown // CloudEventConditionSent means that the event was sent successfully - CloudEventConditionSent CloudEventCondition = v1alpha2.CloudEventConditionSent + CloudEventConditionSent CloudEventCondition = v1beta1.CloudEventConditionSent // CloudEventConditionFailed means that there was one or more attempts to // send the event, and none was successful so far. - CloudEventConditionFailed CloudEventCondition = v1alpha2.CloudEventConditionFailed + CloudEventConditionFailed CloudEventCondition = v1beta1.CloudEventConditionFailed ) // CloudEventDeliveryState reports the state of a cloud event to be sent. -type CloudEventDeliveryState = v1alpha2.CloudEventDeliveryState +type CloudEventDeliveryState = v1beta1.CloudEventDeliveryState // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_validation_test.go b/pkg/apis/pipeline/v1alpha1/taskrun_validation_test.go index 7ca24ce0739..3b8e50e9194 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_validation_test.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_validation_test.go @@ -23,7 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/test/builder" tb "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" @@ -123,7 +123,7 @@ func TestTaskRunSpec_Invalid(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "taskrefname", }, - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", @@ -143,7 +143,7 @@ func TestTaskRunSpec_Invalid(t *testing.T) { }, { name: "invalid taskspec", spec: v1alpha1.TaskRunSpec{ - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "invalid-name-with-$weird-char*/%", Image: "myimage", @@ -173,7 +173,7 @@ func TestTaskRunSpec_Validate(t *testing.T) { }{{ name: "taskspec without a taskRef", spec: v1alpha1.TaskRunSpec{ - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", @@ -184,7 +184,7 @@ func TestTaskRunSpec_Validate(t *testing.T) { name: "no timeout", spec: v1alpha1.TaskRunSpec{ Timeout: &metav1.Duration{Duration: 0}, - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", diff --git a/pkg/apis/pipeline/v1alpha1/workspace_types.go b/pkg/apis/pipeline/v1alpha1/workspace_types.go index 09b68d4ab05..1d9650c45b4 100644 --- a/pkg/apis/pipeline/v1alpha1/workspace_types.go +++ b/pkg/apis/pipeline/v1alpha1/workspace_types.go @@ -17,19 +17,19 @@ limitations under the License. package v1alpha1 import ( - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) // WorkspaceDeclaration is a declaration of a volume that a Task requires. -type WorkspaceDeclaration = v1alpha2.WorkspaceDeclaration +type WorkspaceDeclaration = v1beta1.WorkspaceDeclaration // WorkspaceBinding maps a Task's declared workspace to a Volume. -type WorkspaceBinding = v1alpha2.WorkspaceBinding +type WorkspaceBinding = v1beta1.WorkspaceBinding // WorkspacePipelineDeclaration creates a named slot in a Pipeline that a PipelineRun // is expected to populate with a workspace binding. -type WorkspacePipelineDeclaration = v1alpha2.WorkspacePipelineDeclaration +type WorkspacePipelineDeclaration = v1beta1.WorkspacePipelineDeclaration // WorkspacePipelineTaskBinding describes how a workspace passed into the pipeline should be // mapped to a task's declared workspace. -type WorkspacePipelineTaskBinding = v1alpha2.WorkspacePipelineTaskBinding +type WorkspacePipelineTaskBinding = v1beta1.WorkspacePipelineTaskBinding diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 7cd2bc85249..343abca21e8 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -22,7 +22,7 @@ package v1alpha1 import ( pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -174,7 +174,7 @@ func (in *ConditionSpec) DeepCopyInto(out *ConditionSpec) { in.Check.DeepCopyInto(&out.Check) if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.ParamSpec, len(*in)) + *out = make([]v1beta1.ParamSpec, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -202,12 +202,12 @@ func (in *Inputs) DeepCopyInto(out *Inputs) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]v1alpha2.TaskResource, len(*in)) + *out = make([]v1beta1.TaskResource, len(*in)) copy(*out, *in) } if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.ParamSpec, len(*in)) + *out = make([]v1beta1.ParamSpec, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -235,7 +235,7 @@ func (in *Outputs) DeepCopyInto(out *Outputs) { } if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]v1alpha2.TaskResource, len(*in)) + *out = make([]v1beta1.TaskResource, len(*in)) copy(*out, *in) } return @@ -382,7 +382,7 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { *out = *in if in.PipelineRef != nil { in, out := &in.PipelineRef, &out.PipelineRef - *out = new(v1alpha2.PipelineRef) + *out = new(v1beta1.PipelineRef) **out = **in } if in.PipelineSpec != nil { @@ -392,21 +392,21 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { } if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]v1alpha2.PipelineResourceBinding, len(*in)) + *out = make([]v1beta1.PipelineResourceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.Param, len(*in)) + *out = make([]v1beta1.Param, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.ServiceAccountNames != nil { in, out := &in.ServiceAccountNames, &out.ServiceAccountNames - *out = make([]v1alpha2.PipelineRunSpecServiceAccountName, len(*in)) + *out = make([]v1beta1.PipelineRunSpecServiceAccountName, len(*in)) copy(*out, *in) } if in.Timeout != nil { @@ -421,7 +421,7 @@ func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { } if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces - *out = make([]v1alpha2.WorkspaceBinding, len(*in)) + *out = make([]v1beta1.WorkspaceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -444,7 +444,7 @@ func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]v1alpha2.PipelineDeclaredResource, len(*in)) + *out = make([]v1beta1.PipelineDeclaredResource, len(*in)) copy(*out, *in) } if in.Tasks != nil { @@ -456,14 +456,14 @@ func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) { } if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.ParamSpec, len(*in)) + *out = make([]v1beta1.ParamSpec, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces - *out = make([]v1alpha2.WorkspacePipelineDeclaration, len(*in)) + *out = make([]v1beta1.WorkspacePipelineDeclaration, len(*in)) copy(*out, *in) } return @@ -500,7 +500,7 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { *out = *in if in.TaskRef != nil { in, out := &in.TaskRef, &out.TaskRef - *out = new(v1alpha2.TaskRef) + *out = new(v1beta1.TaskRef) **out = **in } if in.TaskSpec != nil { @@ -510,7 +510,7 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1alpha2.PipelineTaskCondition, len(*in)) + *out = make([]v1beta1.PipelineTaskCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -522,19 +522,19 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { } if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = new(v1alpha2.PipelineTaskResources) + *out = new(v1beta1.PipelineTaskResources) (*in).DeepCopyInto(*out) } if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.Param, len(*in)) + *out = make([]v1beta1.Param, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces - *out = make([]v1alpha2.WorkspacePipelineTaskBinding, len(*in)) + *out = make([]v1beta1.WorkspacePipelineTaskBinding, len(*in)) copy(*out, *in) } if in.Timeout != nil { @@ -670,14 +670,14 @@ func (in *TaskRunInputs) DeepCopyInto(out *TaskRunInputs) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]v1alpha2.TaskResourceBinding, len(*in)) + *out = make([]v1beta1.TaskResourceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.Param, len(*in)) + *out = make([]v1beta1.Param, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -733,7 +733,7 @@ func (in *TaskRunOutputs) DeepCopyInto(out *TaskRunOutputs) { *out = *in if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make([]v1alpha2.TaskResourceBinding, len(*in)) + *out = make([]v1beta1.TaskResourceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -756,7 +756,7 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { *out = *in if in.TaskRef != nil { in, out := &in.TaskRef, &out.TaskRef - *out = new(v1alpha2.TaskRef) + *out = new(v1beta1.TaskRef) **out = **in } if in.TaskSpec != nil { @@ -776,21 +776,21 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { } if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces - *out = make([]v1alpha2.WorkspaceBinding, len(*in)) + *out = make([]v1beta1.WorkspaceBinding, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Params != nil { in, out := &in.Params, &out.Params - *out = make([]v1alpha2.Param, len(*in)) + *out = make([]v1beta1.Param, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = new(v1alpha2.TaskRunResources) + *out = new(v1beta1.TaskRunResources) (*in).DeepCopyInto(*out) } in.Inputs.DeepCopyInto(&out.Inputs) diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go b/pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go deleted file mode 100644 index 6b201e42b9f..00000000000 --- a/pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go +++ /dev/null @@ -1,680 +0,0 @@ -/* -Copyright 2020 The Tekton Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha2_test - -import ( - "context" - "testing" - - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func TestPipeline_Validate(t *testing.T) { - tests := []struct { - name string - p *v1alpha2.Pipeline - failureExpected bool - }{{ - name: "valid metadata", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}}}, - }, - }, - failureExpected: false, - }, { - name: "valid resource declarations and usage", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }, { - Name: "wonderful-resource", Type: v1alpha2.PipelineResourceTypeImage, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "some-workspace", Resource: "great-resource", - }}, - Outputs: []v1alpha2.PipelineTaskOutputResource{{ - Name: "some-imagee", Resource: "wonderful-resource", - }}, - }, - Conditions: []v1alpha2.PipelineTaskCondition{{ - ConditionRef: "some-condition", - Resources: []v1alpha2.PipelineTaskInputResource{{ - Name: "some-workspace", Resource: "great-resource", - }}, - }}, - }, { - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "some-imagee", Resource: "wonderful-resource", From: []string{"bar"}, - }}, - }, - Conditions: []v1alpha2.PipelineTaskCondition{{ - ConditionRef: "some-condition-2", - Resources: []v1alpha2.PipelineTaskInputResource{{ - Name: "some-image", Resource: "wonderful-resource", From: []string{"bar"}, - }}, - }}, - }}, - }, - }, - failureExpected: false, - }, { - name: "period in name", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipe.line"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}}}, - }, - }, - failureExpected: true, - }, { - name: "pipeline name too long", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "asdf123456789012345678901234567890123456789012345678901234567890"}, - }, - failureExpected: true, - }, { - name: "pipeline spec missing taskref and taskspec", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{ - {Name: "foo"}, - }, - }, - }, - failureExpected: true, - }, { - name: "pipeline spec with taskref and taskspec", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{ - { - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{ - Container: corev1.Container{Name: "foo", Image: "bar"}, - }}, - }, - }, - }, - }, - }, - failureExpected: true, - }, { - name: "pipeline spec invalid taskspec", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{ - { - Name: "foo", - TaskSpec: &v1alpha2.TaskSpec{}, - }, - }, - }, - }, - failureExpected: true, - }, { - name: "pipeline spec valid taskspec", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{ - { - Name: "foo", - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{ - Container: corev1.Container{Name: "foo", Image: "bar"}, - }}, - }, - }, - }, - }, - }, - failureExpected: false, - }, { - name: "pipeline spec invalid (duplicate tasks)", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{ - {Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}}, - {Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}}, - }, - }, - }, - failureExpected: true, - }, { - name: "pipeline spec empty task name", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{Name: "", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}}}, - }, - }, - failureExpected: true, - }, { - name: "pipeline spec invalid task name", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{Name: "_foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}}}, - }, - }, - failureExpected: true, - }, { - name: "pipeline spec invalid taskref name", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "_foo-task"}}}, - }, - }, - failureExpected: true, - }, { - name: "valid condition only resource", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Conditions: []v1alpha2.PipelineTaskCondition{{ - ConditionRef: "some-condition", - Resources: []v1alpha2.PipelineTaskInputResource{{ - Name: "sowe-workspace", Resource: "great-resource", - }}, - }}, - }}, - }, - }, - failureExpected: false, - }, { - name: "valid parameter variables", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeString, - }, { - Name: "foo-is-baz", Type: v1alpha2.ParamTypeString, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{StringVal: "$(baz) and $(foo-is-baz)"}, - }}, - }}, - }, - }, - failureExpected: false, - }, { - name: "valid array parameter variables", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeArray, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"some", "default"}}, - }, { - Name: "foo-is-baz", Type: v1alpha2.ParamTypeArray, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{ArrayVal: []string{"$(baz)", "and", "$(foo-is-baz)"}}, - }}, - }}, - }, - }, - failureExpected: false, - }, { - name: "valid star array parameter variables", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeArray, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"some", "default"}}, - }, { - Name: "foo-is-baz", Type: v1alpha2.ParamTypeArray, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{ArrayVal: []string{"$(baz[*])", "and", "$(foo-is-baz[*])"}}, - }}, - }}, - }, - }, - failureExpected: false, - }, { - name: "pipeline parameter nested in task parameter", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeString, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{StringVal: "$(input.workspace.$(baz))"}, - }}, - }}, - }, - }, - failureExpected: false, - }, { - name: "from is on first task", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "the-resource", Resource: "great-resource", From: []string{"bar"}, - }}, - }, - }}, - }, - }, - failureExpected: true, - }, { - name: "from task doesnt exist", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "baz", TaskRef: &v1alpha2.TaskRef{Name: "baz-task"}, - }, { - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "the-resource", Resource: "great-resource", From: []string{"bar"}, - }}, - }, - }}, - }, - }, - failureExpected: true, - }, { - name: "output resources missing from declaration", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "the-resource", Resource: "great-resource", - }}, - Outputs: []v1alpha2.PipelineTaskOutputResource{{ - Name: "the-magic-resource", Resource: "missing-resource", - }}, - }, - }}, - }, - }, - failureExpected: true, - }, { - name: "input resources missing from declaration", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "the-resource", Resource: "missing-resource", - }}, - Outputs: []v1alpha2.PipelineTaskOutputResource{{ - Name: "the-magic-resource", Resource: "great-resource", - }}, - }, - }}, - }, - }, - failureExpected: true, - }, { - name: "invalid condition only resource", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Conditions: []v1alpha2.PipelineTaskCondition{{ - ConditionRef: "some-condition", - Resources: []v1alpha2.PipelineTaskInputResource{{ - Name: "sowe-workspace", Resource: "missing-resource", - }}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "invalid from in condition", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - }, { - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Conditions: []v1alpha2.PipelineTaskCondition{{ - ConditionRef: "some-condition", - Resources: []v1alpha2.PipelineTaskInputResource{{ - Name: "sowe-workspace", Resource: "missing-resource", From: []string{"foo"}, - }}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "from resource isn't output by task", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Resources: []v1alpha2.PipelineDeclaredResource{{ - Name: "great-resource", Type: v1alpha2.PipelineResourceTypeGit, - }, { - Name: "wonderful-resource", Type: v1alpha2.PipelineResourceTypeImage, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "some-resource", Resource: "great-resource", - }}, - }, - }, { - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Resources: &v1alpha2.PipelineTaskResources{ - Inputs: []v1alpha2.PipelineTaskInputResource{{ - Name: "wow-image", Resource: "wonderful-resource", From: []string{"bar"}, - }}, - }, - }}, - }, - }, - failureExpected: true, - }, { - name: "not defined parameter variable", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeString, StringVal: "$(params.does-not-exist)"}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "not defined parameter variable with defined", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "foo", Type: v1alpha2.ParamTypeString, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeString, StringVal: "$(params.foo) and $(params.does-not-exist)"}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "invalid parameter type", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "foo", Type: "invalidtype", - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - }}, - }, - }, - failureExpected: true, - }, { - name: "array parameter mismatching default type", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "foo", Type: v1alpha2.ParamTypeArray, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeString, StringVal: "astring"}, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - }}, - }, - }, - failureExpected: true, - }, { - name: "string parameter mismatching default type", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "foo", Type: v1alpha2.ParamTypeString, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", - TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, - }}, - }, - }, - failureExpected: true, - }, { - name: "array parameter used as string", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeString, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeString, StringVal: "$(params.baz)"}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "star array parameter used as string", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeString, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeString, StringVal: "$(params.baz[*])"}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "array parameter string template not isolated", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeString, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"value: $(params.baz)", "last"}}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "star array parameter string template not isolated", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Params: []v1alpha2.ParamSpec{{ - Name: "baz", Type: v1alpha2.ParamTypeString, Default: &v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, - }}, - Tasks: []v1alpha2.PipelineTask{{ - Name: "bar", - TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, - Params: []v1alpha2.Param{{ - Name: "a-param", Value: v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"value: $(params.baz[*])", "last"}}, - }}, - }}, - }, - }, - failureExpected: true, - }, { - name: "invalid dependency graph between the tasks", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo-task"}, RunAfter: []string{"bar"}, - }, { - Name: "bar", TaskRef: &v1alpha2.TaskRef{Name: "bar-task"}, RunAfter: []string{"foo"}, - }}, - }, - }, - failureExpected: true, - }, { - name: "unused pipeline spec workspaces do not cause an error", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo"}, - }}, - Workspaces: []v1alpha2.WorkspacePipelineDeclaration{{ - Name: "foo", - }, { - Name: "bar", - }}, - }, - }, - failureExpected: false, - }, { - name: "workspace bindings relying on a non-existent pipeline workspace cause an error", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, - Spec: v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ - Name: "foo", TaskRef: &v1alpha2.TaskRef{Name: "foo"}, - Workspaces: []v1alpha2.WorkspacePipelineTaskBinding{{ - Name: "taskWorkspaceName", - Workspace: "pipelineWorkspaceName", - }}, - }}, - Workspaces: []v1alpha2.WorkspacePipelineDeclaration{{ - Name: "foo", - }}, - }, - }, - failureExpected: true, - }, { - name: "multiple workspaces sharing the same name are not allowed", - p: &v1alpha2.Pipeline{ - ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, Spec: v1alpha2.PipelineSpec{ - Workspaces: []v1alpha2.WorkspacePipelineDeclaration{{ - Name: "foo", - }, { - Name: "foo", - }}, - }, - }, - failureExpected: true, - }} - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.p.Validate(context.Background()) - if (!tt.failureExpected) && (err != nil) { - t.Errorf("Pipeline.Validate() returned error: %v", err) - } - - if tt.failureExpected && (err == nil) { - t.Error("Pipeline.Validate() did not return error, wanted error") - } - }) - } -} diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_conversion.go b/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go similarity index 85% rename from pkg/apis/pipeline/v1alpha2/cluster_task_conversion.go rename to pkg/apis/pipeline/v1beta1/cluster_task_conversion.go index c7a96c3c725..beb3c379f92 100644 --- a/pkg/apis/pipeline/v1alpha2/cluster_task_conversion.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go @@ -15,7 +15,7 @@ limitations under the License. */ // nolint: golint -package v1alpha2 +package v1beta1 import ( "context" @@ -28,10 +28,10 @@ var _ apis.Convertible = (*ClusterTask)(nil) // ConvertUp implements api.Convertible func (source *ClusterTask) ConvertUp(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) + return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) } // ConvertDown implements api.Convertible func (sink *ClusterTask) ConvertDown(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest know version, got: %T", source) + return fmt.Errorf("v1beta1 is the highest know version, got: %T", source) } diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_conversion_test.go b/pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/cluster_task_conversion_test.go rename to pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go index 2c7c0acfc88..a075cb579ed 100644 --- a/pkg/apis/pipeline/v1alpha2/cluster_task_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go b/pkg/apis/pipeline/v1beta1/cluster_task_defaults.go similarity index 97% rename from pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go rename to pkg/apis/pipeline/v1beta1/cluster_task_defaults.go index 0b4f7856660..b8a47e304f3 100644 --- a/pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_defaults.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_types.go b/pkg/apis/pipeline/v1beta1/cluster_task_types.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/cluster_task_types.go rename to pkg/apis/pipeline/v1beta1/cluster_task_types.go index 6ca9d93eb78..0f89fc3fc4d 100644 --- a/pkg/apis/pipeline/v1alpha2/cluster_task_types.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_validation.go b/pkg/apis/pipeline/v1beta1/cluster_task_validation.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/cluster_task_validation.go rename to pkg/apis/pipeline/v1beta1/cluster_task_validation.go index db2ce3630d6..b803b0bce91 100644 --- a/pkg/apis/pipeline/v1alpha2/cluster_task_validation.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/condition_types.go b/pkg/apis/pipeline/v1beta1/condition_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/condition_types.go rename to pkg/apis/pipeline/v1beta1/condition_types.go index f7838974eec..9b2b5717827 100644 --- a/pkg/apis/pipeline/v1alpha2/condition_types.go +++ b/pkg/apis/pipeline/v1beta1/condition_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( corev1 "k8s.io/api/core/v1" diff --git a/pkg/apis/pipeline/v1alpha2/conversion_error.go b/pkg/apis/pipeline/v1beta1/conversion_error.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/conversion_error.go rename to pkg/apis/pipeline/v1beta1/conversion_error.go index be489604de6..91c49aec479 100644 --- a/pkg/apis/pipeline/v1alpha2/conversion_error.go +++ b/pkg/apis/pipeline/v1beta1/conversion_error.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "fmt" diff --git a/pkg/apis/pipeline/v1alpha2/doc.go b/pkg/apis/pipeline/v1beta1/doc.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/doc.go rename to pkg/apis/pipeline/v1beta1/doc.go index 6627a64a5ce..7af728e16a6 100644 --- a/pkg/apis/pipeline/v1alpha2/doc.go +++ b/pkg/apis/pipeline/v1beta1/doc.go @@ -20,4 +20,4 @@ limitations under the License. // +k8s:conversion-gen=github.com/tektoncd/pipeline/pkg/apis/pipeline // +k8s:defaulter-gen=TypeMeta // +groupName=tekton.dev -package v1alpha2 +package v1beta1 diff --git a/pkg/apis/pipeline/v1alpha2/merge.go b/pkg/apis/pipeline/v1beta1/merge.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/merge.go rename to pkg/apis/pipeline/v1beta1/merge.go index 59e10ebf132..d22e4969f8e 100644 --- a/pkg/apis/pipeline/v1alpha2/merge.go +++ b/pkg/apis/pipeline/v1beta1/merge.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "encoding/json" diff --git a/pkg/apis/pipeline/v1alpha2/merge_test.go b/pkg/apis/pipeline/v1beta1/merge_test.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/merge_test.go rename to pkg/apis/pipeline/v1beta1/merge_test.go index 1f8ea6fbd4f..a2fd97ff644 100644 --- a/pkg/apis/pipeline/v1alpha2/merge_test.go +++ b/pkg/apis/pipeline/v1beta1/merge_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "testing" diff --git a/pkg/apis/pipeline/v1alpha2/param_types.go b/pkg/apis/pipeline/v1beta1/param_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/param_types.go rename to pkg/apis/pipeline/v1beta1/param_types.go index 01249a2101a..0ec2c2774f9 100644 --- a/pkg/apis/pipeline/v1alpha2/param_types.go +++ b/pkg/apis/pipeline/v1beta1/param_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/param_types_test.go b/pkg/apis/pipeline/v1beta1/param_types_test.go similarity index 83% rename from pkg/apis/pipeline/v1alpha2/param_types_test.go rename to pkg/apis/pipeline/v1beta1/param_types_test.go index b64cc2739c8..021fc0a06ed 100644 --- a/pkg/apis/pipeline/v1alpha2/param_types_test.go +++ b/pkg/apis/pipeline/v1beta1/param_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "context" @@ -23,46 +23,46 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/test/builder" ) func TestParamSpec_SetDefaults(t *testing.T) { tests := []struct { name string - before *v1alpha2.ParamSpec - defaultsApplied *v1alpha2.ParamSpec + before *v1beta1.ParamSpec + defaultsApplied *v1beta1.ParamSpec }{{ name: "inferred string type", - before: &v1alpha2.ParamSpec{ + before: &v1beta1.ParamSpec{ Name: "parametername", }, - defaultsApplied: &v1alpha2.ParamSpec{ + defaultsApplied: &v1beta1.ParamSpec{ Name: "parametername", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, }, }, { name: "inferred type from default value", - before: &v1alpha2.ParamSpec{ + before: &v1beta1.ParamSpec{ Name: "parametername", Default: builder.ArrayOrString("an", "array"), }, - defaultsApplied: &v1alpha2.ParamSpec{ + defaultsApplied: &v1beta1.ParamSpec{ Name: "parametername", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, Default: builder.ArrayOrString("an", "array"), }, }, { name: "fully defined ParamSpec", - before: &v1alpha2.ParamSpec{ + before: &v1beta1.ParamSpec{ Name: "parametername", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, Description: "a description", Default: builder.ArrayOrString("an", "array"), }, - defaultsApplied: &v1alpha2.ParamSpec{ + defaultsApplied: &v1beta1.ParamSpec{ Name: "parametername", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, Description: "a description", Default: builder.ArrayOrString("an", "array"), }, @@ -80,14 +80,14 @@ func TestParamSpec_SetDefaults(t *testing.T) { func TestArrayOrString_ApplyReplacements(t *testing.T) { type args struct { - input *v1alpha2.ArrayOrString + input *v1beta1.ArrayOrString stringReplacements map[string]string arrayReplacements map[string][]string } tests := []struct { name string args args - expectedOutput *v1alpha2.ArrayOrString + expectedOutput *v1beta1.ArrayOrString }{{ name: "no replacements on array", args: args{ @@ -140,19 +140,19 @@ func TestArrayOrString_ApplyReplacements(t *testing.T) { } type ArrayOrStringHolder struct { - AOrS v1alpha2.ArrayOrString `json:"val"` + AOrS v1beta1.ArrayOrString `json:"val"` } func TestArrayOrString_UnmarshalJSON(t *testing.T) { cases := []struct { input string - result v1alpha2.ArrayOrString + result v1beta1.ArrayOrString }{ {"{\"val\": \"123\"}", *builder.ArrayOrString("123")}, {"{\"val\": \"\"}", *builder.ArrayOrString("")}, - {"{\"val\":[]}", v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{}}}, - {"{\"val\":[\"oneelement\"]}", v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"oneelement"}}}, - {"{\"val\":[\"multiple\", \"elements\"]}", v1alpha2.ArrayOrString{Type: v1alpha2.ParamTypeArray, ArrayVal: []string{"multiple", "elements"}}}, + {"{\"val\":[]}", v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{}}}, + {"{\"val\":[\"oneelement\"]}", v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"oneelement"}}}, + {"{\"val\":[\"multiple\", \"elements\"]}", v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"multiple", "elements"}}}, } for _, c := range cases { @@ -168,7 +168,7 @@ func TestArrayOrString_UnmarshalJSON(t *testing.T) { func TestArrayOrString_MarshalJSON(t *testing.T) { cases := []struct { - input v1alpha2.ArrayOrString + input v1beta1.ArrayOrString result string }{ {*builder.ArrayOrString("123"), "{\"val\":\"123\"}"}, diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_conversion.go b/pkg/apis/pipeline/v1beta1/pipeline_conversion.go similarity index 84% rename from pkg/apis/pipeline/v1alpha2/pipeline_conversion.go rename to pkg/apis/pipeline/v1beta1/pipeline_conversion.go index 658ecdb213c..66f647e85a3 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_conversion.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_conversion.go @@ -15,7 +15,7 @@ limitations under the License. */ // nolint: golint -package v1alpha2 +package v1beta1 import ( "context" @@ -27,10 +27,10 @@ import ( var _ apis.Convertible = (*Pipeline)(nil) func (source *Pipeline) ConvertUp(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) + return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) } // ConvertDown implements api.Convertible func (sink *Pipeline) ConvertDown(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest know version, got: %T", source) + return fmt.Errorf("v1beta1 is the highest know version, got: %T", source) } diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_conversion_test.go b/pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/pipeline_conversion_test.go rename to pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go index d24db7ba3a0..3ee3db9b6d9 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_defaults.go b/pkg/apis/pipeline/v1beta1/pipeline_defaults.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/pipeline_defaults.go rename to pkg/apis/pipeline/v1beta1/pipeline_defaults.go index 341863f54e9..64aaebd281d 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_defaults.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_defaults.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_interface.go b/pkg/apis/pipeline/v1beta1/pipeline_interface.go similarity index 97% rename from pkg/apis/pipeline/v1alpha2/pipeline_interface.go rename to pkg/apis/pipeline/v1beta1/pipeline_interface.go index d13c0c50ed1..f63e84d7744 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_interface.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_types.go b/pkg/apis/pipeline/v1beta1/pipeline_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/pipeline_types.go rename to pkg/apis/pipeline/v1beta1/pipeline_types.go index f8acff074fe..ba6bcc4d430 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_types.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "github.com/tektoncd/pipeline/pkg/reconciler/pipeline/dag" diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_validation.go b/pkg/apis/pipeline/v1beta1/pipeline_validation.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/pipeline_validation.go rename to pkg/apis/pipeline/v1beta1/pipeline_validation.go index e7c8e78bc83..c58de3580c0 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go new file mode 100644 index 00000000000..cebe662e7fb --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go @@ -0,0 +1,680 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1_test + +import ( + "context" + "testing" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestPipeline_Validate(t *testing.T) { + tests := []struct { + name string + p *v1beta1.Pipeline + failureExpected bool + }{{ + name: "valid metadata", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}}}, + }, + }, + failureExpected: false, + }, { + name: "valid resource declarations and usage", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }, { + Name: "wonderful-resource", Type: v1beta1.PipelineResourceTypeImage, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "some-workspace", Resource: "great-resource", + }}, + Outputs: []v1beta1.PipelineTaskOutputResource{{ + Name: "some-imagee", Resource: "wonderful-resource", + }}, + }, + Conditions: []v1beta1.PipelineTaskCondition{{ + ConditionRef: "some-condition", + Resources: []v1beta1.PipelineTaskInputResource{{ + Name: "some-workspace", Resource: "great-resource", + }}, + }}, + }, { + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "some-imagee", Resource: "wonderful-resource", From: []string{"bar"}, + }}, + }, + Conditions: []v1beta1.PipelineTaskCondition{{ + ConditionRef: "some-condition-2", + Resources: []v1beta1.PipelineTaskInputResource{{ + Name: "some-image", Resource: "wonderful-resource", From: []string{"bar"}, + }}, + }}, + }}, + }, + }, + failureExpected: false, + }, { + name: "period in name", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipe.line"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}}}, + }, + }, + failureExpected: true, + }, { + name: "pipeline name too long", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "asdf123456789012345678901234567890123456789012345678901234567890"}, + }, + failureExpected: true, + }, { + name: "pipeline spec missing taskref and taskspec", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{ + {Name: "foo"}, + }, + }, + }, + failureExpected: true, + }, { + name: "pipeline spec with taskref and taskspec", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{ + { + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{ + Container: corev1.Container{Name: "foo", Image: "bar"}, + }}, + }, + }, + }, + }, + }, + failureExpected: true, + }, { + name: "pipeline spec invalid taskspec", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{ + { + Name: "foo", + TaskSpec: &v1beta1.TaskSpec{}, + }, + }, + }, + }, + failureExpected: true, + }, { + name: "pipeline spec valid taskspec", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{ + { + Name: "foo", + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{ + Container: corev1.Container{Name: "foo", Image: "bar"}, + }}, + }, + }, + }, + }, + }, + failureExpected: false, + }, { + name: "pipeline spec invalid (duplicate tasks)", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{ + {Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}}, + {Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}}, + }, + }, + }, + failureExpected: true, + }, { + name: "pipeline spec empty task name", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{Name: "", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}}}, + }, + }, + failureExpected: true, + }, { + name: "pipeline spec invalid task name", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{Name: "_foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}}}, + }, + }, + failureExpected: true, + }, { + name: "pipeline spec invalid taskref name", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "_foo-task"}}}, + }, + }, + failureExpected: true, + }, { + name: "valid condition only resource", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Conditions: []v1beta1.PipelineTaskCondition{{ + ConditionRef: "some-condition", + Resources: []v1beta1.PipelineTaskInputResource{{ + Name: "sowe-workspace", Resource: "great-resource", + }}, + }}, + }}, + }, + }, + failureExpected: false, + }, { + name: "valid parameter variables", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeString, + }, { + Name: "foo-is-baz", Type: v1beta1.ParamTypeString, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{StringVal: "$(baz) and $(foo-is-baz)"}, + }}, + }}, + }, + }, + failureExpected: false, + }, { + name: "valid array parameter variables", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeArray, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"some", "default"}}, + }, { + Name: "foo-is-baz", Type: v1beta1.ParamTypeArray, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{ArrayVal: []string{"$(baz)", "and", "$(foo-is-baz)"}}, + }}, + }}, + }, + }, + failureExpected: false, + }, { + name: "valid star array parameter variables", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeArray, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"some", "default"}}, + }, { + Name: "foo-is-baz", Type: v1beta1.ParamTypeArray, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{ArrayVal: []string{"$(baz[*])", "and", "$(foo-is-baz[*])"}}, + }}, + }}, + }, + }, + failureExpected: false, + }, { + name: "pipeline parameter nested in task parameter", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeString, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{StringVal: "$(input.workspace.$(baz))"}, + }}, + }}, + }, + }, + failureExpected: false, + }, { + name: "from is on first task", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "the-resource", Resource: "great-resource", From: []string{"bar"}, + }}, + }, + }}, + }, + }, + failureExpected: true, + }, { + name: "from task doesnt exist", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "baz", TaskRef: &v1beta1.TaskRef{Name: "baz-task"}, + }, { + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "the-resource", Resource: "great-resource", From: []string{"bar"}, + }}, + }, + }}, + }, + }, + failureExpected: true, + }, { + name: "output resources missing from declaration", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "the-resource", Resource: "great-resource", + }}, + Outputs: []v1beta1.PipelineTaskOutputResource{{ + Name: "the-magic-resource", Resource: "missing-resource", + }}, + }, + }}, + }, + }, + failureExpected: true, + }, { + name: "input resources missing from declaration", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "the-resource", Resource: "missing-resource", + }}, + Outputs: []v1beta1.PipelineTaskOutputResource{{ + Name: "the-magic-resource", Resource: "great-resource", + }}, + }, + }}, + }, + }, + failureExpected: true, + }, { + name: "invalid condition only resource", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Conditions: []v1beta1.PipelineTaskCondition{{ + ConditionRef: "some-condition", + Resources: []v1beta1.PipelineTaskInputResource{{ + Name: "sowe-workspace", Resource: "missing-resource", + }}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "invalid from in condition", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + }, { + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Conditions: []v1beta1.PipelineTaskCondition{{ + ConditionRef: "some-condition", + Resources: []v1beta1.PipelineTaskInputResource{{ + Name: "sowe-workspace", Resource: "missing-resource", From: []string{"foo"}, + }}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "from resource isn't output by task", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Resources: []v1beta1.PipelineDeclaredResource{{ + Name: "great-resource", Type: v1beta1.PipelineResourceTypeGit, + }, { + Name: "wonderful-resource", Type: v1beta1.PipelineResourceTypeImage, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "some-resource", Resource: "great-resource", + }}, + }, + }, { + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Resources: &v1beta1.PipelineTaskResources{ + Inputs: []v1beta1.PipelineTaskInputResource{{ + Name: "wow-image", Resource: "wonderful-resource", From: []string{"bar"}, + }}, + }, + }}, + }, + }, + failureExpected: true, + }, { + name: "not defined parameter variable", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: "$(params.does-not-exist)"}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "not defined parameter variable with defined", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "foo", Type: v1beta1.ParamTypeString, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: "$(params.foo) and $(params.does-not-exist)"}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "invalid parameter type", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "foo", Type: "invalidtype", + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + }}, + }, + }, + failureExpected: true, + }, { + name: "array parameter mismatching default type", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "foo", Type: v1beta1.ParamTypeArray, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: "astring"}, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + }}, + }, + }, + failureExpected: true, + }, { + name: "string parameter mismatching default type", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "foo", Type: v1beta1.ParamTypeString, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + }}, + }, + }, + failureExpected: true, + }, { + name: "array parameter used as string", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeString, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: "$(params.baz)"}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "star array parameter used as string", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeString, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: "$(params.baz[*])"}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "array parameter string template not isolated", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeString, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"value: $(params.baz)", "last"}}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "star array parameter string template not isolated", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "baz", Type: v1beta1.ParamTypeString, Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"anarray", "elements"}}, + }}, + Tasks: []v1beta1.PipelineTask{{ + Name: "bar", + TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, + Params: []v1beta1.Param{{ + Name: "a-param", Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeArray, ArrayVal: []string{"value: $(params.baz[*])", "last"}}, + }}, + }}, + }, + }, + failureExpected: true, + }, { + name: "invalid dependency graph between the tasks", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, RunAfter: []string{"bar"}, + }, { + Name: "bar", TaskRef: &v1beta1.TaskRef{Name: "bar-task"}, RunAfter: []string{"foo"}, + }}, + }, + }, + failureExpected: true, + }, { + name: "unused pipeline spec workspaces do not cause an error", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo"}, + }}, + Workspaces: []v1beta1.WorkspacePipelineDeclaration{{ + Name: "foo", + }, { + Name: "bar", + }}, + }, + }, + failureExpected: false, + }, { + name: "workspace bindings relying on a non-existent pipeline workspace cause an error", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ + Name: "foo", TaskRef: &v1beta1.TaskRef{Name: "foo"}, + Workspaces: []v1beta1.WorkspacePipelineTaskBinding{{ + Name: "taskWorkspaceName", + Workspace: "pipelineWorkspaceName", + }}, + }}, + Workspaces: []v1beta1.WorkspacePipelineDeclaration{{ + Name: "foo", + }}, + }, + }, + failureExpected: true, + }, { + name: "multiple workspaces sharing the same name are not allowed", + p: &v1beta1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, Spec: v1beta1.PipelineSpec{ + Workspaces: []v1beta1.WorkspacePipelineDeclaration{{ + Name: "foo", + }, { + Name: "foo", + }}, + }, + }, + failureExpected: true, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.p.Validate(context.Background()) + if (!tt.failureExpected) && (err != nil) { + t.Errorf("Pipeline.Validate() returned error: %v", err) + } + + if tt.failureExpected && (err == nil) { + t.Error("Pipeline.Validate() did not return error, wanted error") + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_conversion.go b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go similarity index 85% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_conversion.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go index 0bcdbfd42a5..e7554f92eb9 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_conversion.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go @@ -15,7 +15,7 @@ limitations under the License. */ // nolint: golint -package v1alpha2 +package v1beta1 import ( "context" @@ -28,10 +28,10 @@ var _ apis.Convertible = (*PipelineRun)(nil) // ConvertUp implements api.Convertible func (source *PipelineRun) ConvertUp(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) + return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) } // ConvertDown implements api.Convertible func (sink *PipelineRun) ConvertDown(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest know version, got: %T", source) + return fmt.Errorf("v1beta1 is the highest know version, got: %T", source) } diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_conversion_test.go b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_conversion_test.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go index 81f82159a88..58e7a75f043 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go b/pkg/apis/pipeline/v1beta1/pipelinerun_defaults.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_defaults.go index 18389f3ef09..cdb60529055 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_defaults.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go b/pkg/apis/pipeline/v1beta1/pipelinerun_defaults_test.go similarity index 72% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_defaults_test.go index 7297da8abd6..52e46c8843b 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_defaults_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/config" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,44 +33,44 @@ import ( func TestPipelineRunSpec_SetDefaults(t *testing.T) { cases := []struct { desc string - prs *v1alpha2.PipelineRunSpec - want *v1alpha2.PipelineRunSpec + prs *v1beta1.PipelineRunSpec + want *v1beta1.PipelineRunSpec }{ { desc: "timeout is nil", - prs: &v1alpha2.PipelineRunSpec{}, - want: &v1alpha2.PipelineRunSpec{ + prs: &v1beta1.PipelineRunSpec{}, + want: &v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, { desc: "timeout is not nil", - prs: &v1alpha2.PipelineRunSpec{ + prs: &v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, }, - want: &v1alpha2.PipelineRunSpec{ + want: &v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, }, }, { desc: "pod template is nil", - prs: &v1alpha2.PipelineRunSpec{}, - want: &v1alpha2.PipelineRunSpec{ + prs: &v1beta1.PipelineRunSpec{}, + want: &v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, { desc: "pod template is not nil", - prs: &v1alpha2.PipelineRunSpec{ - PodTemplate: &v1alpha2.PodTemplate{ + prs: &v1beta1.PipelineRunSpec{ + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label": "value", }, }, }, - want: &v1alpha2.PipelineRunSpec{ + want: &v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, - PodTemplate: &v1alpha2.PodTemplate{ + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label": "value", }, @@ -94,41 +94,41 @@ func TestPipelineRunSpec_SetDefaults(t *testing.T) { func TestPipelineRunDefaulting(t *testing.T) { tests := []struct { name string - in *v1alpha2.PipelineRun - want *v1alpha2.PipelineRun + in *v1beta1.PipelineRun + want *v1beta1.PipelineRun wc func(context.Context) context.Context }{{ name: "empty no context", - in: &v1alpha2.PipelineRun{}, - want: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ + in: &v1beta1.PipelineRun{}, + want: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, }, { name: "PipelineRef upgrade context", - in: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + in: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, }, }, - want: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + want: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, wc: contexts.WithUpgradeViaDefaulting, }, { name: "PipelineRef default config context", - in: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + in: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, }, }, - want: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + want: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, Timeout: &metav1.Duration{Duration: 5 * time.Minute}, }, }, @@ -146,14 +146,14 @@ func TestPipelineRunDefaulting(t *testing.T) { }, }, { name: "PipelineRef default config context with sa", - in: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + in: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, }, }, - want: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + want: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, Timeout: &metav1.Duration{Duration: 5 * time.Minute}, ServiceAccountName: "tekton", }, @@ -173,17 +173,17 @@ func TestPipelineRunDefaulting(t *testing.T) { }, }, { name: "PipelineRef pod template is coming from default config pod template", - in: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + in: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, }, }, - want: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + want: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, Timeout: &metav1.Duration{Duration: 5 * time.Minute}, ServiceAccountName: "tekton", - PodTemplate: &v1alpha2.PodTemplate{ + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label": "value", }, @@ -206,22 +206,22 @@ func TestPipelineRunDefaulting(t *testing.T) { }, }, { name: "PipelineRef pod template takes precedence over default config pod template", - in: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, - PodTemplate: &v1alpha2.PodTemplate{ + in: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label2": "value2", }, }, }, }, - want: &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "foo"}, + want: &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "foo"}, Timeout: &metav1.Duration{Duration: 5 * time.Minute}, ServiceAccountName: "tekton", - PodTemplate: &v1alpha2.PodTemplate{ + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label2": "value2", }, diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go b/pkg/apis/pipeline/v1beta1/pipelinerun_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_types.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_types.go index 975a176c80e..f971b888caf 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "fmt" diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go b/pkg/apis/pipeline/v1beta1/pipelinerun_types_test.go similarity index 81% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_types_test.go index 78af313857a..9f9a3488770 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "fmt" @@ -22,7 +22,7 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" tb "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,7 +30,7 @@ import ( ) func TestPipelineRunStatusConditions(t *testing.T) { - p := &v1alpha2.PipelineRun{} + p := &v1beta1.PipelineRun{} foo := &apis.Condition{ Type: "Foo", Status: "True", @@ -63,7 +63,7 @@ func TestPipelineRunStatusConditions(t *testing.T) { } func TestPipelineRun_TaskRunref(t *testing.T) { - p := &v1alpha2.PipelineRun{ + p := &v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "test-name", Namespace: "test-ns", @@ -71,7 +71,7 @@ func TestPipelineRun_TaskRunref(t *testing.T) { } expectTaskRunRef := corev1.ObjectReference{ - APIVersion: "tekton.dev/v1alpha2", + APIVersion: "tekton.dev/v1beta1", Kind: "TaskRun", Namespace: p.Namespace, Name: p.Name, @@ -83,7 +83,7 @@ func TestPipelineRun_TaskRunref(t *testing.T) { } func TestInitializeConditions(t *testing.T) { - p := &v1alpha2.PipelineRun{ + p := &v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "test-name", Namespace: "test-ns", @@ -99,7 +99,7 @@ func TestInitializeConditions(t *testing.T) { t.Fatalf("PipelineRun StartTime not initialized correctly") } - p.Status.TaskRuns["fooTask"] = &v1alpha2.PipelineRunTaskRunStatus{} + p.Status.TaskRuns["fooTask"] = &v1beta1.PipelineRunTaskRunStatus{} p.Status.InitializeConditions() if len(p.Status.TaskRuns) != 1 { @@ -108,7 +108,7 @@ func TestInitializeConditions(t *testing.T) { } func TestPipelineRunIsDone(t *testing.T) { - pr := &v1alpha2.PipelineRun{} + pr := &v1beta1.PipelineRun{} foo := &apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, @@ -120,9 +120,9 @@ func TestPipelineRunIsDone(t *testing.T) { } func TestPipelineRunIsCancelled(t *testing.T) { - pr := &v1alpha2.PipelineRun{ - Spec: v1alpha2.PipelineRunSpec{ - Status: v1alpha2.PipelineRunSpecStatusCancelled, + pr := &v1beta1.PipelineRun{ + Spec: v1beta1.PipelineRunSpec{ + Status: v1beta1.PipelineRunSpecStatusCancelled, }, } if !pr.IsCancelled() { @@ -141,24 +141,24 @@ func TestPipelineRunKey(t *testing.T) { func TestPipelineRunHasStarted(t *testing.T) { params := []struct { name string - prStatus v1alpha2.PipelineRunStatus + prStatus v1beta1.PipelineRunStatus expectedValue bool }{{ name: "prWithNoStartTime", - prStatus: v1alpha2.PipelineRunStatus{}, + prStatus: v1beta1.PipelineRunStatus{}, expectedValue: false, }, { name: "prWithStartTime", - prStatus: v1alpha2.PipelineRunStatus{ - PipelineRunStatusFields: v1alpha2.PipelineRunStatusFields{ + prStatus: v1beta1.PipelineRunStatus{ + PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &metav1.Time{Time: time.Now()}, }, }, expectedValue: true, }, { name: "prWithZeroStartTime", - prStatus: v1alpha2.PipelineRunStatus{ - PipelineRunStatusFields: v1alpha2.PipelineRunStatusFields{ + prStatus: v1beta1.PipelineRunStatus{ + PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &metav1.Time{}, }, }, @@ -166,7 +166,7 @@ func TestPipelineRunHasStarted(t *testing.T) { }} for _, tc := range params { t.Run(tc.name, func(t *testing.T) { - pr := &v1alpha2.PipelineRun{ + pr := &v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "prunname", Namespace: "testns", @@ -206,12 +206,12 @@ func TestPipelineRunHasTimedOut(t *testing.T) { for _, tc := range tcs { t.Run(t.Name(), func(t *testing.T) { - pr := &v1alpha2.PipelineRun{ + pr := &v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{Name: "foo"}, - Spec: v1alpha2.PipelineRunSpec{ + Spec: v1beta1.PipelineRunSpec{ Timeout: &metav1.Duration{Duration: tc.timeout}, }, - Status: v1alpha2.PipelineRunStatus{PipelineRunStatusFields: v1alpha2.PipelineRunStatusFields{ + Status: v1beta1.PipelineRunStatus{PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &metav1.Time{Time: tc.starttime}, }}, } @@ -226,17 +226,17 @@ func TestPipelineRunHasTimedOut(t *testing.T) { func TestPipelineRunGetServiceAccountName(t *testing.T) { for _, tt := range []struct { name string - pr *v1alpha2.PipelineRun + pr *v1beta1.PipelineRun saNames map[string]string }{ { name: "default SA", - pr: &v1alpha2.PipelineRun{ + pr: &v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{Name: "pr"}, - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "prs"}, + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "prs"}, ServiceAccountName: "defaultSA", - ServiceAccountNames: []v1alpha2.PipelineRunSpecServiceAccountName{{ + ServiceAccountNames: []v1beta1.PipelineRunSpecServiceAccountName{{ TaskName: "taskName", ServiceAccountName: "taskSA", }}, }, @@ -248,12 +248,12 @@ func TestPipelineRunGetServiceAccountName(t *testing.T) { }, { name: "mixed default SA", - pr: &v1alpha2.PipelineRun{ + pr: &v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{Name: "pr"}, - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{Name: "prs"}, + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{Name: "prs"}, ServiceAccountName: "defaultSA", - ServiceAccountNames: []v1alpha2.PipelineRunSpecServiceAccountName{{ + ServiceAccountNames: []v1beta1.PipelineRunSpecServiceAccountName{{ TaskName: "task1", ServiceAccountName: "task1SA", }, { TaskName: "task2", ServiceAccountName: "task2SA", diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go b/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_validation.go index a3d0968dcc6..2d1a8ae53d5 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go b/pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go similarity index 78% rename from pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go rename to pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go index 55f3aa92603..aa697fcd1ac 100644 --- a/pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "context" @@ -22,7 +22,7 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -31,12 +31,12 @@ import ( func TestPipelineRun_Invalidate(t *testing.T) { tests := []struct { name string - pr v1alpha2.PipelineRun + pr v1beta1.PipelineRun want *apis.FieldError }{ { name: "invalid pipelinerun", - pr: v1alpha2.PipelineRun{ + pr: v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "prmetaname", }, @@ -45,7 +45,7 @@ func TestPipelineRun_Invalidate(t *testing.T) { }, { name: "invalid pipelinerun metadata", - pr: v1alpha2.PipelineRun{ + pr: v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "pipelinerun.name", }, @@ -56,23 +56,23 @@ func TestPipelineRun_Invalidate(t *testing.T) { }, }, { name: "no pipeline reference", - pr: v1alpha2.PipelineRun{ + pr: v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "pipelinelineName", }, - Spec: v1alpha2.PipelineRunSpec{ + Spec: v1beta1.PipelineRunSpec{ ServiceAccountName: "foo", }, }, want: apis.ErrMissingField("spec.pipelineref.name, spec.pipelinespec"), }, { name: "negative pipeline timeout", - pr: v1alpha2.PipelineRun{ + pr: v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "pipelinelineName", }, - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{ Name: "prname", }, Timeout: &metav1.Duration{Duration: -48 * time.Hour}, @@ -95,28 +95,28 @@ func TestPipelineRun_Invalidate(t *testing.T) { func TestPipelineRun_Validate(t *testing.T) { tests := []struct { name string - pr v1alpha2.PipelineRun + pr v1beta1.PipelineRun }{ { name: "normal case", - pr: v1alpha2.PipelineRun{ + pr: v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "pipelinelineName", }, - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{ Name: "prname", }, }, }, }, { name: "no timeout", - pr: v1alpha2.PipelineRun{ + pr: v1beta1.PipelineRun{ ObjectMeta: metav1.ObjectMeta{ Name: "pipelinelineName", }, - Spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{ + Spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{ Name: "prname", }, Timeout: &metav1.Duration{Duration: 0}, @@ -137,28 +137,28 @@ func TestPipelineRun_Validate(t *testing.T) { func TestPipelineRunSpec_Invalidate(t *testing.T) { tests := []struct { name string - spec v1alpha2.PipelineRunSpec + spec v1beta1.PipelineRunSpec wantErr *apis.FieldError }{{ name: "Empty pipelineSpec", - spec: v1alpha2.PipelineRunSpec{}, + spec: v1beta1.PipelineRunSpec{}, wantErr: apis.ErrMissingField("spec"), }, { name: "pipelineRef without Pipeline Name", - spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{}, + spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{}, }, wantErr: apis.ErrMissingField("spec.pipelineref.name", "spec.pipelinespec"), }, { name: "pipelineRef and pipelineSpec together", - spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{ + spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{ Name: "pipelinerefname", }, - PipelineSpec: &v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ + PipelineSpec: &v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ Name: "mytask", - TaskRef: &v1alpha2.TaskRef{ + TaskRef: &v1beta1.TaskRef{ Name: "mytask", }, }}}, @@ -166,11 +166,11 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) { wantErr: apis.ErrDisallowedFields("spec.pipelinespec", "spec.pipelineref"), }, { name: "workspaces may only appear once", - spec: v1alpha2.PipelineRunSpec{ - PipelineRef: &v1alpha2.PipelineRef{ + spec: v1beta1.PipelineRunSpec{ + PipelineRef: &v1beta1.PipelineRef{ Name: "pipelinerefname", }, - Workspaces: []v1alpha2.WorkspaceBinding{{ + Workspaces: []v1beta1.WorkspaceBinding{{ Name: "ws", EmptyDir: &corev1.EmptyDirVolumeSource{}, }, { @@ -196,14 +196,14 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) { func TestPipelineRunSpec_Validate(t *testing.T) { tests := []struct { name string - spec v1alpha2.PipelineRunSpec + spec v1beta1.PipelineRunSpec }{{ name: "PipelineRun without pipelineRef", - spec: v1alpha2.PipelineRunSpec{ - PipelineSpec: &v1alpha2.PipelineSpec{ - Tasks: []v1alpha2.PipelineTask{{ + spec: v1beta1.PipelineRunSpec{ + PipelineSpec: &v1beta1.PipelineSpec{ + Tasks: []v1beta1.PipelineTask{{ Name: "mytask", - TaskRef: &v1alpha2.TaskRef{ + TaskRef: &v1beta1.TaskRef{ Name: "mytask", }, }}, diff --git a/pkg/apis/pipeline/v1alpha2/pod.go b/pkg/apis/pipeline/v1beta1/pod.go similarity index 97% rename from pkg/apis/pipeline/v1alpha2/pod.go rename to pkg/apis/pipeline/v1beta1/pod.go index 5066d433560..d4e16486e91 100644 --- a/pkg/apis/pipeline/v1alpha2/pod.go +++ b/pkg/apis/pipeline/v1beta1/pod.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" diff --git a/pkg/apis/pipeline/v1alpha2/pod_test.go b/pkg/apis/pipeline/v1beta1/pod_test.go similarity index 96% rename from pkg/apis/pipeline/v1alpha2/pod_test.go rename to pkg/apis/pipeline/v1beta1/pod_test.go index ab6dd76d66d..36525af19b9 100644 --- a/pkg/apis/pipeline/v1alpha2/pod_test.go +++ b/pkg/apis/pipeline/v1beta1/pod_test.go @@ -14,4 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test diff --git a/pkg/apis/pipeline/v1alpha2/register.go b/pkg/apis/pipeline/v1beta1/register.go similarity index 97% rename from pkg/apis/pipeline/v1alpha2/register.go rename to pkg/apis/pipeline/v1beta1/register.go index 025ac06044e..4d7de9d2245 100644 --- a/pkg/apis/pipeline/v1alpha2/register.go +++ b/pkg/apis/pipeline/v1beta1/register.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "github.com/tektoncd/pipeline/pkg/apis/pipeline" @@ -24,7 +24,7 @@ import ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: pipeline.GroupName, Version: "v1alpha2"} +var SchemeGroupVersion = schema.GroupVersion{Group: pipeline.GroupName, Version: "v1beta1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { diff --git a/pkg/apis/pipeline/v1alpha2/resource_types.go b/pkg/apis/pipeline/v1beta1/resource_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/resource_types.go rename to pkg/apis/pipeline/v1beta1/resource_types.go index b579a245169..4d43b0105c1 100644 --- a/pkg/apis/pipeline/v1alpha2/resource_types.go +++ b/pkg/apis/pipeline/v1beta1/resource_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "fmt" diff --git a/pkg/apis/pipeline/v1alpha2/resource_types_test.go b/pkg/apis/pipeline/v1beta1/resource_types_test.go similarity index 73% rename from pkg/apis/pipeline/v1alpha2/resource_types_test.go rename to pkg/apis/pipeline/v1beta1/resource_types_test.go index 63a4c22f8e6..fe155a71b33 100644 --- a/pkg/apis/pipeline/v1alpha2/resource_types_test.go +++ b/pkg/apis/pipeline/v1beta1/resource_types_test.go @@ -11,13 +11,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" ) @@ -44,14 +44,14 @@ var ( type TestTaskModifier struct{} -func (tm *TestTaskModifier) GetStepsToPrepend() []v1alpha2.Step { - return []v1alpha2.Step{{ +func (tm *TestTaskModifier) GetStepsToPrepend() []v1beta1.Step { + return []v1beta1.Step{{ Container: prependStep, }} } -func (tm *TestTaskModifier) GetStepsToAppend() []v1alpha2.Step { - return []v1alpha2.Step{{ +func (tm *TestTaskModifier) GetStepsToAppend() []v1beta1.Step { + return []v1beta1.Step{{ Container: appendStep, }} } @@ -63,13 +63,13 @@ func (tm *TestTaskModifier) GetVolumes() []corev1.Volume { func TestApplyTaskModifier(t *testing.T) { testcases := []struct { name string - ts v1alpha2.TaskSpec + ts v1beta1.TaskSpec }{{ name: "success", - ts: v1alpha2.TaskSpec{}, + ts: v1beta1.TaskSpec{}, }, { name: "identical volume already added", - ts: v1alpha2.TaskSpec{ + ts: v1beta1.TaskSpec{ // Trying to add the same Volume that has already been added shouldn't be an error // and it should not be added twice Volumes: []corev1.Volume{volume}, @@ -77,12 +77,12 @@ func TestApplyTaskModifier(t *testing.T) { }} for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { - if err := v1alpha2.ApplyTaskModifier(&tc.ts, &TestTaskModifier{}); err != nil { + if err := v1beta1.ApplyTaskModifier(&tc.ts, &TestTaskModifier{}); err != nil { t.Fatalf("Did not expect error modifying TaskSpec but got %v", err) } - expectedTaskSpec := v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{ + expectedTaskSpec := v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{ Container: prependStep, }, { Container: appendStep, @@ -102,30 +102,30 @@ func TestApplyTaskModifier(t *testing.T) { func TestApplyTaskModifier_AlreadyAdded(t *testing.T) { testcases := []struct { name string - ts v1alpha2.TaskSpec + ts v1beta1.TaskSpec }{{ name: "prepend already added", - ts: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: prependStep}}, + ts: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: prependStep}}, }, }, { name: "append already added", - ts: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: appendStep}}, + ts: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: appendStep}}, }, }, { name: "both steps already added", - ts: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: prependStep}, {Container: appendStep}}, + ts: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: prependStep}, {Container: appendStep}}, }, }, { name: "both steps already added reverse order", - ts: v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: appendStep}, {Container: prependStep}}, + ts: v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: appendStep}, {Container: prependStep}}, }, }, { name: "volume with same name but diff content already added", - ts: v1alpha2.TaskSpec{ + ts: v1beta1.TaskSpec{ Volumes: []corev1.Volume{{ Name: "magic-volume", VolumeSource: corev1.VolumeSource{ @@ -136,7 +136,7 @@ func TestApplyTaskModifier_AlreadyAdded(t *testing.T) { }} for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { - if err := v1alpha2.ApplyTaskModifier(&tc.ts, &TestTaskModifier{}); err == nil { + if err := v1beta1.ApplyTaskModifier(&tc.ts, &TestTaskModifier{}); err == nil { t.Errorf("Expected error when applying values already added but got none") } }) diff --git a/pkg/apis/pipeline/v1alpha2/resource_types_validation.go b/pkg/apis/pipeline/v1beta1/resource_types_validation.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/resource_types_validation.go rename to pkg/apis/pipeline/v1beta1/resource_types_validation.go index e5d658ffc23..d49acfce4d4 100644 --- a/pkg/apis/pipeline/v1alpha2/resource_types_validation.go +++ b/pkg/apis/pipeline/v1beta1/resource_types_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/substitution.go b/pkg/apis/pipeline/v1beta1/substitution.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/substitution.go rename to pkg/apis/pipeline/v1beta1/substitution.go index 8d191b6ded2..e806b988a44 100644 --- a/pkg/apis/pipeline/v1alpha2/substitution.go +++ b/pkg/apis/pipeline/v1beta1/substitution.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "fmt" diff --git a/pkg/apis/pipeline/v1alpha2/task_conversion.go b/pkg/apis/pipeline/v1beta1/task_conversion.go similarity index 84% rename from pkg/apis/pipeline/v1alpha2/task_conversion.go rename to pkg/apis/pipeline/v1beta1/task_conversion.go index 775a2295165..54b5ee318bf 100644 --- a/pkg/apis/pipeline/v1alpha2/task_conversion.go +++ b/pkg/apis/pipeline/v1beta1/task_conversion.go @@ -15,7 +15,7 @@ limitations under the License. */ // nolint: golint -package v1alpha2 +package v1beta1 import ( "context" @@ -28,10 +28,10 @@ var _ apis.Convertible = (*Task)(nil) // ConvertUp implements api.Convertible func (source *Task) ConvertUp(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) + return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) } // ConvertDown implements api.Convertible func (sink *Task) ConvertDown(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest know version, got: %T", source) + return fmt.Errorf("v1beta1 is the highest know version, got: %T", source) } diff --git a/pkg/apis/pipeline/v1alpha2/task_conversion_test.go b/pkg/apis/pipeline/v1beta1/task_conversion_test.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/task_conversion_test.go rename to pkg/apis/pipeline/v1beta1/task_conversion_test.go index 947f795148e..84db635105b 100644 --- a/pkg/apis/pipeline/v1alpha2/task_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/task_conversion_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/task_defaults.go b/pkg/apis/pipeline/v1beta1/task_defaults.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/task_defaults.go rename to pkg/apis/pipeline/v1beta1/task_defaults.go index f1d1ee1e8b1..c0399f34418 100644 --- a/pkg/apis/pipeline/v1alpha2/task_defaults.go +++ b/pkg/apis/pipeline/v1beta1/task_defaults.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/task_interface.go b/pkg/apis/pipeline/v1beta1/task_interface.go similarity index 97% rename from pkg/apis/pipeline/v1alpha2/task_interface.go rename to pkg/apis/pipeline/v1beta1/task_interface.go index ecb8adeade4..c9507777c5a 100644 --- a/pkg/apis/pipeline/v1alpha2/task_interface.go +++ b/pkg/apis/pipeline/v1beta1/task_interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/pipeline/v1alpha2/task_types.go b/pkg/apis/pipeline/v1beta1/task_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/task_types.go rename to pkg/apis/pipeline/v1beta1/task_types.go index 0d1cd3cfe2c..81b290713c1 100644 --- a/pkg/apis/pipeline/v1alpha2/task_types.go +++ b/pkg/apis/pipeline/v1beta1/task_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( corev1 "k8s.io/api/core/v1" diff --git a/pkg/apis/pipeline/v1alpha2/task_validation.go b/pkg/apis/pipeline/v1beta1/task_validation.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/task_validation.go rename to pkg/apis/pipeline/v1beta1/task_validation.go index bbbf3005063..3bf84cbbd09 100644 --- a/pkg/apis/pipeline/v1alpha2/task_validation.go +++ b/pkg/apis/pipeline/v1beta1/task_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/task_validation_test.go b/pkg/apis/pipeline/v1beta1/task_validation_test.go similarity index 79% rename from pkg/apis/pipeline/v1alpha2/task_validation_test.go rename to pkg/apis/pipeline/v1beta1/task_validation_test.go index d0a62ab303e..df105ff84d1 100644 --- a/pkg/apis/pipeline/v1alpha2/task_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/task_validation_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "context" @@ -22,43 +22,43 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" "knative.dev/pkg/apis" ) -var validResource = v1alpha2.TaskResource{ - ResourceDeclaration: v1alpha2.ResourceDeclaration{ +var validResource = v1beta1.TaskResource{ + ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "source", Type: "git", }, } -var invalidResource = v1alpha2.TaskResource{ - ResourceDeclaration: v1alpha2.ResourceDeclaration{ +var invalidResource = v1beta1.TaskResource{ + ResourceDeclaration: v1beta1.ResourceDeclaration{ Name: "source", Type: "what", }, } -var validSteps = []v1alpha2.Step{{Container: corev1.Container{ +var validSteps = []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", }}} -var invalidSteps = []v1alpha2.Step{{Container: corev1.Container{ +var invalidSteps = []v1beta1.Step{{Container: corev1.Container{ Name: "replaceImage", Image: "myimage", }}} func TestTaskSpecValidate(t *testing.T) { type fields struct { - Params []v1alpha2.ParamSpec - Resources *v1alpha2.TaskResources - Steps []v1alpha2.Step + Params []v1beta1.ParamSpec + Resources *v1beta1.TaskResources + Steps []v1beta1.Step StepTemplate *corev1.Container - Workspaces []v1alpha2.WorkspaceDeclaration + Workspaces []v1beta1.WorkspaceDeclaration } tests := []struct { name string @@ -66,7 +66,7 @@ func TestTaskSpecValidate(t *testing.T) { }{{ name: "unnamed steps", fields: fields{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "myimage", }}, {Container: corev1.Container{ Image: "myotherimage", @@ -75,23 +75,23 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid input resources", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{validResource}, + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{validResource}, }, Steps: validSteps, }, }, { name: "valid output resources", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{validResource}, + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{validResource}, }, Steps: validSteps, }, }, { name: "valid params type implied", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "task", Description: "param", Default: builder.ArrayOrString("default"), @@ -101,9 +101,9 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid params type explicit", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "task", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "param", Default: builder.ArrayOrString("default"), }}, @@ -112,12 +112,12 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid template variable", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", }, { Name: "foo-is-baz", }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "url", Args: []string{"--flag=$(params.baz) && $(params.foo-is-baz)"}, @@ -127,14 +127,14 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid array template variable", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }, { Name: "foo-is-baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", Command: []string{"$(params.foo-is-baz)"}, @@ -145,14 +145,14 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid star array template variable", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }, { Name: "foo-is-baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", Command: []string{"$(params.foo-is-baz)"}, @@ -163,7 +163,7 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "step template included in validation", fields: fields{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "astep", Command: []string{"echo"}, Args: []string{"hello"}, @@ -175,7 +175,7 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid step with script", fields: fields{ - Steps: []v1alpha2.Step{{ + Steps: []v1beta1.Step{{ Container: corev1.Container{ Image: "my-image", }, @@ -187,7 +187,7 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid step with script and args", fields: fields{ - Steps: []v1alpha2.Step{{ + Steps: []v1beta1.Step{{ Container: corev1.Container{ Image: "my-image", Args: []string{"arg"}, @@ -200,7 +200,7 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid step with volumeMount under /tekton/home", fields: fields{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "myimage", VolumeMounts: []corev1.VolumeMount{{ Name: "foo", @@ -211,13 +211,13 @@ func TestTaskSpecValidate(t *testing.T) { }, { name: "valid workspace", fields: fields{ - Steps: []v1alpha2.Step{{ + Steps: []v1beta1.Step{{ Container: corev1.Container{ Image: "my-image", Args: []string{"arg"}, }, }}, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "foo-workspace", Description: "my great workspace", MountPath: "some/path", @@ -226,7 +226,7 @@ func TestTaskSpecValidate(t *testing.T) { }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ts := &v1alpha2.TaskSpec{ + ts := &v1beta1.TaskSpec{ Params: tt.fields.Params, Resources: tt.fields.Resources, Steps: tt.fields.Steps, @@ -244,12 +244,12 @@ func TestTaskSpecValidate(t *testing.T) { func TestTaskSpecValidateError(t *testing.T) { type fields struct { - Params []v1alpha2.ParamSpec - Resources *v1alpha2.TaskResources - Steps []v1alpha2.Step + Params []v1beta1.ParamSpec + Resources *v1beta1.TaskResources + Steps []v1beta1.Step Volumes []corev1.Volume StepTemplate *corev1.Container - Workspaces []v1alpha2.WorkspaceDeclaration + Workspaces []v1beta1.WorkspaceDeclaration } tests := []struct { name string @@ -264,9 +264,9 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "no step", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "validparam", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "parameter", Default: builder.ArrayOrString("default"), }}, @@ -278,8 +278,8 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "invalid input resource", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{invalidResource}, + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{invalidResource}, }, Steps: validSteps, }, @@ -290,8 +290,8 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "one invalid input resource", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{validResource, invalidResource}, + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{validResource, invalidResource}, }, Steps: validSteps, }, @@ -302,9 +302,9 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "duplicated inputs resources", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{validResource, validResource}, - Outputs: []v1alpha2.TaskResource{validResource}, + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{validResource, validResource}, + Outputs: []v1beta1.TaskResource{validResource}, }, Steps: validSteps, }, @@ -315,8 +315,8 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "invalid output resource", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{invalidResource}, + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{invalidResource}, }, Steps: validSteps, }, @@ -327,8 +327,8 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "one invalid output resource", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Outputs: []v1alpha2.TaskResource{validResource, invalidResource}, + Resources: &v1beta1.TaskResources{ + Outputs: []v1beta1.TaskResource{validResource, invalidResource}, }, Steps: validSteps, }, @@ -339,9 +339,9 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "duplicated outputs resources", fields: fields{ - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{validResource}, - Outputs: []v1alpha2.TaskResource{validResource, validResource}, + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{validResource}, + Outputs: []v1beta1.TaskResource{validResource, validResource}, }, Steps: validSteps, }, @@ -352,9 +352,9 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "invalid param type", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "validparam", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "parameter", Default: builder.ArrayOrString("default"), }, { @@ -372,9 +372,9 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "param mismatching default/type 1", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "task", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, Description: "param", Default: builder.ArrayOrString("default"), }}, @@ -387,9 +387,9 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "param mismatching default/type 2", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "task", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "param", Default: builder.ArrayOrString("default", "array"), }}, @@ -402,13 +402,13 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "invalid step", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "validparam", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, Description: "parameter", Default: builder.ArrayOrString("default"), }}, - Steps: []v1alpha2.Step{}, + Steps: []v1beta1.Step{}, }, expectedError: apis.FieldError{ Message: "missing field(s)", @@ -427,7 +427,7 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "inexistent param variable", fields: fields{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", Args: []string{"--flag=$(params.inexistent)"}, @@ -440,14 +440,14 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "array used in unaccepted field", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }, { Name: "foo-is-baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "$(params.baz)", Command: []string{"$(params.foo-is-baz)"}, @@ -462,14 +462,14 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "array not properly isolated", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }, { Name: "foo-is-baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "someimage", Command: []string{"$(params.foo-is-baz)"}, @@ -484,14 +484,14 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "array star not properly isolated", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }, { Name: "foo-is-baz", - Type: v1alpha2.ParamTypeArray, + Type: v1beta1.ParamTypeArray, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "someimage", Command: []string{"$(params.foo-is-baz)"}, @@ -506,20 +506,20 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "inferred array not properly isolated", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Default: &v1alpha2.ArrayOrString{ - Type: v1alpha2.ParamTypeArray, + Default: &v1beta1.ArrayOrString{ + Type: v1beta1.ParamTypeArray, ArrayVal: []string{"implied", "array", "type"}, }, }, { Name: "foo-is-baz", - Default: &v1alpha2.ArrayOrString{ - Type: v1alpha2.ParamTypeArray, + Default: &v1beta1.ArrayOrString{ + Type: v1beta1.ParamTypeArray, ArrayVal: []string{"implied", "array", "type"}, }, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "someimage", Command: []string{"$(params.foo-is-baz)"}, @@ -534,20 +534,20 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "inferred array star not properly isolated", fields: fields{ - Params: []v1alpha2.ParamSpec{{ + Params: []v1beta1.ParamSpec{{ Name: "baz", - Default: &v1alpha2.ArrayOrString{ - Type: v1alpha2.ParamTypeArray, + Default: &v1beta1.ArrayOrString{ + Type: v1beta1.ParamTypeArray, ArrayVal: []string{"implied", "array", "type"}, }, }, { Name: "foo-is-baz", - Default: &v1alpha2.ArrayOrString{ - Type: v1alpha2.ParamTypeArray, + Default: &v1beta1.ArrayOrString{ + Type: v1beta1.ParamTypeArray, ArrayVal: []string{"implied", "array", "type"}, }, }}, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "someimage", Command: []string{"$(params.foo-is-baz)"}, @@ -562,14 +562,14 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "Inexistent param variable with existing", fields: fields{ - Params: []v1alpha2.ParamSpec{ + Params: []v1beta1.ParamSpec{ { Name: "foo", Description: "param", Default: builder.ArrayOrString("default"), }, }, - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", Args: []string{"$(params.foo) && $(params.inexistent)"}, @@ -596,7 +596,7 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "step with script and command", fields: fields{ - Steps: []v1alpha2.Step{{ + Steps: []v1beta1.Step{{ Container: corev1.Container{ Image: "myimage", Command: []string{"command"}, @@ -611,7 +611,7 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "step volume mounts under /tekton/", fields: fields{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "myimage", VolumeMounts: []corev1.VolumeMount{{ Name: "foo", @@ -626,7 +626,7 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "step volume mount name starts with tekton-internal-", fields: fields{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Image: "myimage", VolumeMounts: []corev1.VolumeMount{{ Name: "tekton-internal-foo", @@ -642,7 +642,7 @@ func TestTaskSpecValidateError(t *testing.T) { name: "declared workspaces names are not unique", fields: fields{ Steps: validSteps, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "same-workspace", }, { Name: "same-workspace", @@ -656,7 +656,7 @@ func TestTaskSpecValidateError(t *testing.T) { name: "declared workspaces clash with each other", fields: fields{ Steps: validSteps, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "some-workspace", MountPath: "/foo", }, { @@ -671,7 +671,7 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "workspace mount path already in volumeMounts", fields: fields{ - Steps: []v1alpha2.Step{{ + Steps: []v1beta1.Step{{ Container: corev1.Container{ Image: "myimage", Command: []string{"command"}, @@ -681,7 +681,7 @@ func TestTaskSpecValidateError(t *testing.T) { }}, }, }}, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "some-workspace", MountPath: "/foo", }}, @@ -693,7 +693,7 @@ func TestTaskSpecValidateError(t *testing.T) { }, { name: "workspace default mount path already in volumeMounts", fields: fields{ - Steps: []v1alpha2.Step{{ + Steps: []v1beta1.Step{{ Container: corev1.Container{ Image: "myimage", Command: []string{"command"}, @@ -703,7 +703,7 @@ func TestTaskSpecValidateError(t *testing.T) { }}, }, }}, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "some-workspace", }}, }, @@ -721,7 +721,7 @@ func TestTaskSpecValidateError(t *testing.T) { }}, }, Steps: validSteps, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "some-workspace", MountPath: "/foo", }}, @@ -740,7 +740,7 @@ func TestTaskSpecValidateError(t *testing.T) { }}, }, Steps: validSteps, - Workspaces: []v1alpha2.WorkspaceDeclaration{{ + Workspaces: []v1beta1.WorkspaceDeclaration{{ Name: "some-workspace", }}, }, @@ -751,7 +751,7 @@ func TestTaskSpecValidateError(t *testing.T) { }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ts := &v1alpha2.TaskSpec{ + ts := &v1beta1.TaskSpec{ Params: tt.fields.Params, Resources: tt.fields.Resources, Steps: tt.fields.Steps, diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_conversion.go b/pkg/apis/pipeline/v1beta1/taskrun_conversion.go similarity index 84% rename from pkg/apis/pipeline/v1alpha2/taskrun_conversion.go rename to pkg/apis/pipeline/v1beta1/taskrun_conversion.go index c02993167de..62598644134 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_conversion.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_conversion.go @@ -15,7 +15,7 @@ limitations under the License. */ // nolint: golint -package v1alpha2 +package v1beta1 import ( "context" @@ -28,10 +28,10 @@ var _ apis.Convertible = (*TaskRun)(nil) // ConvertUp implements api.Convertible func (source *TaskRun) ConvertUp(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) + return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) } // ConvertDown implements api.Convertible func (sink *TaskRun) ConvertDown(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1alpha2 is the highest know version, got: %T", source) + return fmt.Errorf("v1beta1 is the highest know version, got: %T", source) } diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_conversion_test.go b/pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go similarity index 98% rename from pkg/apis/pipeline/v1alpha2/taskrun_conversion_test.go rename to pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go index 01fa6ea729f..504722c2390 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_defaults.go b/pkg/apis/pipeline/v1beta1/taskrun_defaults.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/taskrun_defaults.go rename to pkg/apis/pipeline/v1beta1/taskrun_defaults.go index 8a9932f1a93..be5a012aedd 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_defaults.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_defaults.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go b/pkg/apis/pipeline/v1beta1/taskrun_defaults_test.go similarity index 67% rename from pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go rename to pkg/apis/pipeline/v1beta1/taskrun_defaults_test.go index b8a687d26fe..8dbd19384eb 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_defaults_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "context" @@ -24,7 +24,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/tektoncd/pipeline/pkg/apis/config" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -38,55 +38,55 @@ var ( func TestTaskRunSpec_SetDefaults(t *testing.T) { cases := []struct { desc string - trs *v1alpha2.TaskRunSpec - want *v1alpha2.TaskRunSpec + trs *v1beta1.TaskRunSpec + want *v1beta1.TaskRunSpec }{{ desc: "taskref is nil", - trs: &v1alpha2.TaskRunSpec{ + trs: &v1beta1.TaskRunSpec{ TaskRef: nil, Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, }, - want: &v1alpha2.TaskRunSpec{ + want: &v1beta1.TaskRunSpec{ TaskRef: nil, Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, }, }, { desc: "taskref kind is empty", - trs: &v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{}, + trs: &v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{}, Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, }, - want: &v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Kind: v1alpha2.NamespacedTaskKind}, + want: &v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Kind: v1beta1.NamespacedTaskKind}, Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, }, }, { desc: "timeout is nil", - trs: &v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Kind: v1alpha2.ClusterTaskKind}, + trs: &v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Kind: v1beta1.ClusterTaskKind}, }, - want: &v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Kind: v1alpha2.ClusterTaskKind}, + want: &v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Kind: v1beta1.ClusterTaskKind}, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, { desc: "pod template is nil", - trs: &v1alpha2.TaskRunSpec{}, - want: &v1alpha2.TaskRunSpec{ + trs: &v1beta1.TaskRunSpec{}, + want: &v1beta1.TaskRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, { desc: "pod template is not nil", - trs: &v1alpha2.TaskRunSpec{ - PodTemplate: &v1alpha2.PodTemplate{ + trs: &v1beta1.TaskRunSpec{ + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label": "value", }, }, }, - want: &v1alpha2.TaskRunSpec{ + want: &v1beta1.TaskRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, - PodTemplate: &v1alpha2.PodTemplate{ + PodTemplate: &v1beta1.PodTemplate{ NodeSelector: map[string]string{ "label": "value", }, @@ -94,18 +94,18 @@ func TestTaskRunSpec_SetDefaults(t *testing.T) { }, }, { desc: "embedded taskSpec", - trs: &v1alpha2.TaskRunSpec{ - TaskSpec: &v1alpha2.TaskSpec{ - Params: []v1alpha2.ParamSpec{{ + trs: &v1beta1.TaskRunSpec{ + TaskSpec: &v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ Name: "param-name", }}, }, }, - want: &v1alpha2.TaskRunSpec{ - TaskSpec: &v1alpha2.TaskSpec{ - Params: []v1alpha2.ParamSpec{{ + want: &v1beta1.TaskRunSpec{ + TaskSpec: &v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ Name: "param-name", - Type: v1alpha2.ParamTypeString, + Type: v1beta1.ParamTypeString, }}, }, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, @@ -126,54 +126,54 @@ func TestTaskRunSpec_SetDefaults(t *testing.T) { func TestTaskRunDefaulting(t *testing.T) { tests := []struct { name string - in *v1alpha2.TaskRun - want *v1alpha2.TaskRun + in *v1beta1.TaskRun + want *v1beta1.TaskRun wc func(context.Context) context.Context }{{ name: "empty no context", - in: &v1alpha2.TaskRun{}, - want: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ + in: &v1beta1.TaskRun{}, + want: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, }, { name: "TaskRef default to namespace kind", - in: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo"}, + in: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo"}, }, }, - want: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo", Kind: v1alpha2.NamespacedTaskKind}, + want: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo", Kind: v1beta1.NamespacedTaskKind}, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, }, { name: "TaskRef upgrade context", - in: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo"}, + in: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo"}, }, }, - want: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo", Kind: v1alpha2.NamespacedTaskKind}, + want: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo", Kind: v1beta1.NamespacedTaskKind}, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, }, wc: contexts.WithUpgradeViaDefaulting, }, { name: "TaskRef default config context", - in: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo"}, + in: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo"}, }, }, - want: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo", Kind: v1alpha2.NamespacedTaskKind}, + want: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo", Kind: v1beta1.NamespacedTaskKind}, Timeout: &metav1.Duration{Duration: 5 * time.Minute}, }, }, @@ -191,14 +191,14 @@ func TestTaskRunDefaulting(t *testing.T) { }, }, { name: "TaskRef default config context with SA", - in: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo"}, + in: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo"}, }, }, - want: &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "foo", Kind: v1alpha2.NamespacedTaskKind}, + want: &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "foo", Kind: v1beta1.NamespacedTaskKind}, Timeout: &metav1.Duration{Duration: 5 * time.Minute}, ServiceAccountName: "tekton", }, diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_types.go b/pkg/apis/pipeline/v1beta1/taskrun_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/taskrun_types.go rename to pkg/apis/pipeline/v1beta1/taskrun_types.go index 41511db13ed..c6ee26fa05f 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_types.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "fmt" diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_types_test.go b/pkg/apis/pipeline/v1beta1/taskrun_types_test.go similarity index 86% rename from pkg/apis/pipeline/v1alpha2/taskrun_types_test.go rename to pkg/apis/pipeline/v1beta1/taskrun_types_test.go index 7fc9e2d1d69..d8de391bdf4 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_types_test.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "fmt" @@ -23,7 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -31,7 +31,7 @@ import ( ) func TestTaskRun_GetBuildPodRef(t *testing.T) { - tr := &v1alpha2.TaskRun{ + tr := &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ Namespace: "testns", Name: "taskrunname", @@ -50,11 +50,11 @@ func TestTaskRun_GetBuildPodRef(t *testing.T) { func TestTaskRun_GetPipelineRunPVCName(t *testing.T) { tests := []struct { name string - tr *v1alpha2.TaskRun + tr *v1beta1.TaskRun expectedPVCName string }{{ name: "invalid owner reference", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ OwnerReferences: []metav1.OwnerReference{{ Kind: "SomeOtherOwner", @@ -65,7 +65,7 @@ func TestTaskRun_GetPipelineRunPVCName(t *testing.T) { expectedPVCName: "", }, { name: "valid pipelinerun owner", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ OwnerReferences: []metav1.OwnerReference{{ Kind: "PipelineRun", @@ -90,11 +90,11 @@ func TestTaskRun_GetPipelineRunPVCName(t *testing.T) { func TestTaskRun_HasPipelineRun(t *testing.T) { tests := []struct { name string - tr *v1alpha2.TaskRun + tr *v1beta1.TaskRun want bool }{{ name: "invalid owner reference", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ OwnerReferences: []metav1.OwnerReference{{ Kind: "SomeOtherOwner", @@ -105,7 +105,7 @@ func TestTaskRun_HasPipelineRun(t *testing.T) { want: false, }, { name: "valid pipelinerun owner", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ OwnerReferences: []metav1.OwnerReference{{ Kind: "PipelineRun", @@ -125,8 +125,8 @@ func TestTaskRun_HasPipelineRun(t *testing.T) { } func TestTaskRunIsDone(t *testing.T) { - tr := &v1alpha2.TaskRun{ - Status: v1alpha2.TaskRunStatus{ + tr := &v1beta1.TaskRun{ + Status: v1beta1.TaskRunStatus{ Status: duckv1beta1.Status{ Conditions: []apis.Condition{{ Type: apis.ConditionSucceeded, @@ -141,9 +141,9 @@ func TestTaskRunIsDone(t *testing.T) { } func TestTaskRunIsCancelled(t *testing.T) { - tr := &v1alpha2.TaskRun{ - Spec: v1alpha2.TaskRunSpec{ - Status: v1alpha2.TaskRunSpecStatusCancelled, + tr := &v1beta1.TaskRun{ + Spec: v1beta1.TaskRunSpec{ + Status: v1beta1.TaskRunSpecStatusCancelled, }, } if !tr.IsCancelled() { @@ -152,7 +152,7 @@ func TestTaskRunIsCancelled(t *testing.T) { } func TestTaskRunKey(t *testing.T) { - tr := &v1alpha2.TaskRun{ + tr := &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ Name: "taskrunname", }, @@ -166,24 +166,24 @@ func TestTaskRunKey(t *testing.T) { func TestTaskRunHasStarted(t *testing.T) { params := []struct { name string - trStatus v1alpha2.TaskRunStatus + trStatus v1beta1.TaskRunStatus expectedValue bool }{{ name: "trWithNoStartTime", - trStatus: v1alpha2.TaskRunStatus{}, + trStatus: v1beta1.TaskRunStatus{}, expectedValue: false, }, { name: "trWithStartTime", - trStatus: v1alpha2.TaskRunStatus{ - TaskRunStatusFields: v1alpha2.TaskRunStatusFields{ + trStatus: v1beta1.TaskRunStatus{ + TaskRunStatusFields: v1beta1.TaskRunStatusFields{ StartTime: &metav1.Time{Time: time.Now()}, }, }, expectedValue: true, }, { name: "trWithZeroStartTime", - trStatus: v1alpha2.TaskRunStatus{ - TaskRunStatusFields: v1alpha2.TaskRunStatusFields{ + trStatus: v1beta1.TaskRunStatus{ + TaskRunStatusFields: v1beta1.TaskRunStatusFields{ StartTime: &metav1.Time{}, }, }, @@ -191,7 +191,7 @@ func TestTaskRunHasStarted(t *testing.T) { }} for _, tc := range params { t.Run(tc.name, func(t *testing.T) { - tr := &v1alpha2.TaskRun{} + tr := &v1beta1.TaskRun{} tr.Status = tc.trStatus if tr.HasStarted() != tc.expectedValue { t.Fatalf("Expected taskrun HasStarted() to return %t but got %t", tc.expectedValue, tr.HasStarted()) @@ -203,13 +203,13 @@ func TestTaskRunHasStarted(t *testing.T) { func TestTaskRunIsOfPipelinerun(t *testing.T) { tests := []struct { name string - tr *v1alpha2.TaskRun + tr *v1beta1.TaskRun expectedValue bool expetectedPipeline string expetectedPipelineRun string }{{ name: "yes", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ pipeline.GroupName + pipeline.PipelineLabelKey: "pipeline", @@ -222,7 +222,7 @@ func TestTaskRunIsOfPipelinerun(t *testing.T) { expetectedPipelineRun: "pipelinerun", }, { name: "no", - tr: &v1alpha2.TaskRun{}, + tr: &v1beta1.TaskRun{}, expectedValue: false, }} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_validation.go b/pkg/apis/pipeline/v1beta1/taskrun_validation.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/taskrun_validation.go rename to pkg/apis/pipeline/v1beta1/taskrun_validation.go index 772584251ad..d76cdbb72ef 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_validation.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go b/pkg/apis/pipeline/v1beta1/taskrun_validation_test.go similarity index 65% rename from pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go rename to pkg/apis/pipeline/v1beta1/taskrun_validation_test.go index 9dddc41741a..0712fda9a1d 100644 --- a/pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_validation_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" @@ -34,15 +34,15 @@ import ( func TestTaskRun_Invalidate(t *testing.T) { tests := []struct { name string - task *v1alpha2.TaskRun + task *v1beta1.TaskRun want *apis.FieldError }{{ name: "invalid taskspec", - task: &v1alpha2.TaskRun{}, + task: &v1beta1.TaskRun{}, want: apis.ErrMissingField("spec"), }, { name: "invalid taskrun metadata", - task: &v1alpha2.TaskRun{ + task: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ Name: "task.name", }, @@ -63,12 +63,12 @@ func TestTaskRun_Invalidate(t *testing.T) { } func TestTaskRun_Validate(t *testing.T) { - tr := &v1alpha2.TaskRun{ + tr := &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ Name: "taskrname", }, - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "taskrefname"}, + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "taskrefname"}, }, } if err := tr.Validate(context.Background()); err != nil { @@ -79,15 +79,15 @@ func TestTaskRun_Validate(t *testing.T) { func TestTaskRun_Workspaces_Invalid(t *testing.T) { tests := []struct { name string - tr *v1alpha2.TaskRun + tr *v1beta1.TaskRun wantErr *apis.FieldError }{{ name: "make sure WorkspaceBinding validation invoked", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{Name: "taskname"}, - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "task"}, - Workspaces: []v1alpha2.WorkspaceBinding{{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "task"}, + Workspaces: []v1beta1.WorkspaceBinding{{ Name: "workspace", PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{}, }}, @@ -96,11 +96,11 @@ func TestTaskRun_Workspaces_Invalid(t *testing.T) { wantErr: apis.ErrMissingField("workspace.persistentvolumeclaim.claimname"), }, { name: "bind same workspace twice", - tr: &v1alpha2.TaskRun{ + tr: &v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{Name: "taskname"}, - Spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{Name: "task"}, - Workspaces: []v1alpha2.WorkspaceBinding{{ + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "task"}, + Workspaces: []v1beta1.WorkspaceBinding{{ Name: "workspace", EmptyDir: &corev1.EmptyDirVolumeSource{}, }, { @@ -127,26 +127,26 @@ func TestTaskRun_Workspaces_Invalid(t *testing.T) { func TestTaskRunSpec_Invalidate(t *testing.T) { tests := []struct { name string - spec v1alpha2.TaskRunSpec + spec v1beta1.TaskRunSpec wantErr *apis.FieldError }{{ name: "invalid taskspec", - spec: v1alpha2.TaskRunSpec{}, + spec: v1beta1.TaskRunSpec{}, wantErr: apis.ErrMissingField("spec"), }, { name: "invalid taskref name", - spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{}, + spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{}, }, wantErr: apis.ErrMissingField("spec.taskref.name, spec.taskspec"), }, { name: "invalid taskref and taskspec together", - spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{ + spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{ Name: "taskrefname", }, - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", }}}, @@ -155,8 +155,8 @@ func TestTaskRunSpec_Invalidate(t *testing.T) { wantErr: apis.ErrDisallowedFields("spec.taskspec", "spec.taskref"), }, { name: "negative pipeline timeout", - spec: v1alpha2.TaskRunSpec{ - TaskRef: &v1alpha2.TaskRef{ + spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{ Name: "taskrefname", }, Timeout: &metav1.Duration{Duration: -48 * time.Hour}, @@ -164,9 +164,9 @@ func TestTaskRunSpec_Invalidate(t *testing.T) { wantErr: apis.ErrInvalidValue("-48h0m0s should be >= 0", "spec.timeout"), }, { name: "invalid taskspec", - spec: v1alpha2.TaskRunSpec{ - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + spec: v1beta1.TaskRunSpec{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "invalid-name-with-$weird-char/%", Image: "myimage", }}}, @@ -179,7 +179,7 @@ func TestTaskRunSpec_Invalidate(t *testing.T) { }, }, { name: "invalid params", - spec: v1alpha2.TaskRunSpec{ + spec: v1beta1.TaskRunSpec{ Params: []v1alpha1.Param{{ Name: "name", Value: *builder.ArrayOrString("value"), @@ -187,7 +187,7 @@ func TestTaskRunSpec_Invalidate(t *testing.T) { Name: "name", Value: *builder.ArrayOrString("value"), }}, - TaskRef: &v1alpha2.TaskRef{Name: "mytask"}, + TaskRef: &v1beta1.TaskRef{Name: "mytask"}, }, wantErr: apis.ErrMultipleOneOf("spec.inputs.params"), }} @@ -204,12 +204,12 @@ func TestTaskRunSpec_Invalidate(t *testing.T) { func TestTaskRunSpec_Validate(t *testing.T) { tests := []struct { name string - spec v1alpha2.TaskRunSpec + spec v1beta1.TaskRunSpec }{{ name: "taskspec without a taskRef", - spec: v1alpha2.TaskRunSpec{ - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + spec: v1beta1.TaskRunSpec{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", }}}, @@ -217,10 +217,10 @@ func TestTaskRunSpec_Validate(t *testing.T) { }, }, { name: "no timeout", - spec: v1alpha2.TaskRunSpec{ + spec: v1beta1.TaskRunSpec{ Timeout: &metav1.Duration{Duration: 0}, - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", }}}, @@ -228,14 +228,14 @@ func TestTaskRunSpec_Validate(t *testing.T) { }, }, { name: "parameters", - spec: v1alpha2.TaskRunSpec{ + spec: v1beta1.TaskRunSpec{ Timeout: &metav1.Duration{Duration: 0}, - Params: []v1alpha2.Param{{ + Params: []v1beta1.Param{{ Name: "name", Value: *builder.ArrayOrString("value"), }}, - TaskSpec: &v1alpha2.TaskSpec{ - Steps: []v1alpha2.Step{{Container: corev1.Container{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", }}}, @@ -254,15 +254,15 @@ func TestTaskRunSpec_Validate(t *testing.T) { func TestResources_Validate(t *testing.T) { tests := []struct { name string - resources *v1alpha2.TaskRunResources + resources *v1beta1.TaskRunResources }{{ name: "no resources is valid", }, { name: "inputs only", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource", }, Name: "workspace", @@ -271,17 +271,17 @@ func TestResources_Validate(t *testing.T) { }, }, { name: "multiple inputs only", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource1", }, Name: "workspace1", }, }, { - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource2", }, Name: "workspace2", @@ -290,10 +290,10 @@ func TestResources_Validate(t *testing.T) { }, }, { name: "outputs only", - resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource", }, Name: "workspace", @@ -302,17 +302,17 @@ func TestResources_Validate(t *testing.T) { }, }, { name: "multiple outputs only", - resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource1", }, Name: "workspace1", }, }, { - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource2", }, Name: "workspace2", @@ -321,18 +321,18 @@ func TestResources_Validate(t *testing.T) { }, }, { name: "inputs and outputs", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource", }, Name: "workspace", }, }}, - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource", }, Name: "workspace", @@ -353,21 +353,21 @@ func TestResources_Validate(t *testing.T) { func TestResources_Invalidate(t *testing.T) { tests := []struct { name string - resources *v1alpha2.TaskRunResources + resources *v1beta1.TaskRunResources wantErr *apis.FieldError }{{ name: "duplicate task inputs", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource1", }, Name: "workspace", }, }, { - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource2", }, Name: "workspace", @@ -377,14 +377,14 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrMultipleOneOf("spec.resources.inputs.name"), }, { name: "duplicate resource ref and resource spec", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource", }, ResourceSpec: &resource.PipelineResourceSpec{ - Type: v1alpha2.PipelineResourceTypeGit, + Type: v1beta1.PipelineResourceTypeGit, }, Name: "resource-dup", }, @@ -393,9 +393,9 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrDisallowedFields("spec.resources.inputs.name.resourceRef", "spec.resources.inputs.name.resourceSpec"), }, { name: "invalid resource spec", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ ResourceSpec: &resource.PipelineResourceSpec{ Type: "non-existent", }, @@ -406,9 +406,9 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrInvalidValue("spec.type", "non-existent"), }, { name: "no resource ref", // and resource spec - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "resource", }, }}, @@ -416,17 +416,17 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrMissingField("spec.resources.inputs.name.resourceRef", "spec.resources.inputs.name.resourceSpec"), }, { name: "duplicate task outputs", - resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource1", }, Name: "workspace", }, }, { - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource2", }, Name: "workspace", @@ -436,14 +436,14 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrMultipleOneOf("spec.resources.outputs.name"), }, { name: "duplicate resource ref and resource spec", - resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ - ResourceRef: &v1alpha2.PipelineResourceRef{ + resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ + ResourceRef: &v1beta1.PipelineResourceRef{ Name: "testresource", }, ResourceSpec: &resource.PipelineResourceSpec{ - Type: v1alpha2.PipelineResourceTypeGit, + Type: v1beta1.PipelineResourceTypeGit, }, Name: "resource-dup", }, @@ -452,9 +452,9 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrDisallowedFields("spec.resources.outputs.name.resourceRef", "spec.resources.outputs.name.resourceSpec"), }, { name: "invalid resource spec", - resources: &v1alpha2.TaskRunResources{ - Inputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + resources: &v1beta1.TaskRunResources{ + Inputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ ResourceSpec: &resource.PipelineResourceSpec{ Type: "non-existent", }, @@ -465,9 +465,9 @@ func TestResources_Invalidate(t *testing.T) { wantErr: apis.ErrInvalidValue("spec.type", "non-existent"), }, { name: "no resource ref ", // and resource spec - resources: &v1alpha2.TaskRunResources{ - Outputs: []v1alpha2.TaskResourceBinding{{ - PipelineResourceBinding: v1alpha2.PipelineResourceBinding{ + resources: &v1beta1.TaskRunResources{ + Outputs: []v1beta1.TaskResourceBinding{{ + PipelineResourceBinding: v1beta1.PipelineResourceBinding{ Name: "resource", }, }}, diff --git a/pkg/apis/pipeline/v1alpha2/types_test.go b/pkg/apis/pipeline/v1beta1/types_test.go similarity index 63% rename from pkg/apis/pipeline/v1alpha2/types_test.go rename to pkg/apis/pipeline/v1beta1/types_test.go index 705c238e779..546b8fce5db 100644 --- a/pkg/apis/pipeline/v1alpha2/types_test.go +++ b/pkg/apis/pipeline/v1beta1/types_test.go @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2_test +package v1beta1_test import ( "testing" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "knative.dev/pkg/webhook/resourcesemantics" ) func TestTypes(t *testing.T) { // Assert that types satisfy webhook interface. - // var _ resourcesemantics.GenericCRD = (*v1alpha2.ClusterTask)(nil) - var _ resourcesemantics.GenericCRD = (*v1alpha2.TaskRun)(nil) - var _ resourcesemantics.GenericCRD = (*v1alpha2.Task)(nil) - var _ resourcesemantics.GenericCRD = (*v1alpha2.Pipeline)(nil) - // var _ resourcesemantics.GenericCRD = (*v1alpha2.Condition)(nil) + // var _ resourcesemantics.GenericCRD = (*v1beta1.ClusterTask)(nil) + var _ resourcesemantics.GenericCRD = (*v1beta1.TaskRun)(nil) + var _ resourcesemantics.GenericCRD = (*v1beta1.Task)(nil) + var _ resourcesemantics.GenericCRD = (*v1beta1.Pipeline)(nil) + // var _ resourcesemantics.GenericCRD = (*v1beta1.Condition)(nil) } diff --git a/pkg/apis/pipeline/v1alpha2/workspace_types.go b/pkg/apis/pipeline/v1beta1/workspace_types.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/workspace_types.go rename to pkg/apis/pipeline/v1beta1/workspace_types.go index f9d85a7d55f..e2c768a563a 100644 --- a/pkg/apis/pipeline/v1alpha2/workspace_types.go +++ b/pkg/apis/pipeline/v1beta1/workspace_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "path/filepath" diff --git a/pkg/apis/pipeline/v1alpha2/workspace_validation.go b/pkg/apis/pipeline/v1beta1/workspace_validation.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/workspace_validation.go rename to pkg/apis/pipeline/v1beta1/workspace_validation.go index 61778dc0dc0..99e0a1b9ef5 100644 --- a/pkg/apis/pipeline/v1alpha2/workspace_validation.go +++ b/pkg/apis/pipeline/v1beta1/workspace_validation.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/workspace_validation_test.go b/pkg/apis/pipeline/v1beta1/workspace_validation_test.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/workspace_validation_test.go rename to pkg/apis/pipeline/v1beta1/workspace_validation_test.go index f8ee5c1162b..9316e0f1e63 100644 --- a/pkg/apis/pipeline/v1alpha2/workspace_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/workspace_validation_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1beta1 import ( "context" diff --git a/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go similarity index 99% rename from pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go rename to pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go index 0d5d6c52e08..9fec10b10e2 100644 --- a/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go @@ -18,7 +18,7 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( pod "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 404c9a03d3f..fdee31c6897 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -22,7 +22,7 @@ import ( "fmt" tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1" - tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2" + tektonv1beta1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -31,7 +31,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface - TektonV1alpha2() tektonv1alpha2.TektonV1alpha2Interface + TektonV1beta1() tektonv1beta1.TektonV1beta1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -39,7 +39,7 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient tektonV1alpha1 *tektonv1alpha1.TektonV1alpha1Client - tektonV1alpha2 *tektonv1alpha2.TektonV1alpha2Client + tektonV1beta1 *tektonv1beta1.TektonV1beta1Client } // TektonV1alpha1 retrieves the TektonV1alpha1Client @@ -47,9 +47,9 @@ func (c *Clientset) TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface { return c.tektonV1alpha1 } -// TektonV1alpha2 retrieves the TektonV1alpha2Client -func (c *Clientset) TektonV1alpha2() tektonv1alpha2.TektonV1alpha2Interface { - return c.tektonV1alpha2 +// TektonV1beta1 retrieves the TektonV1beta1Client +func (c *Clientset) TektonV1beta1() tektonv1beta1.TektonV1beta1Interface { + return c.tektonV1beta1 } // Discovery retrieves the DiscoveryClient @@ -77,7 +77,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.tektonV1alpha2, err = tektonv1alpha2.NewForConfig(&configShallowCopy) + cs.tektonV1beta1, err = tektonv1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -94,7 +94,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.tektonV1alpha1 = tektonv1alpha1.NewForConfigOrDie(c) - cs.tektonV1alpha2 = tektonv1alpha2.NewForConfigOrDie(c) + cs.tektonV1beta1 = tektonv1beta1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -104,7 +104,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.tektonV1alpha1 = tektonv1alpha1.New(c) - cs.tektonV1alpha2 = tektonv1alpha2.New(c) + cs.tektonV1beta1 = tektonv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index e87ff86fc78..06ece62d7a4 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -22,8 +22,8 @@ import ( clientset "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1" faketektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake" - tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2" - faketektonv1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake" + tektonv1beta1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1" + faketektonv1beta1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -83,7 +83,7 @@ func (c *Clientset) TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface { return &faketektonv1alpha1.FakeTektonV1alpha1{Fake: &c.Fake} } -// TektonV1alpha2 retrieves the TektonV1alpha2Client -func (c *Clientset) TektonV1alpha2() tektonv1alpha2.TektonV1alpha2Interface { - return &faketektonv1alpha2.FakeTektonV1alpha2{Fake: &c.Fake} +// TektonV1beta1 retrieves the TektonV1beta1Client +func (c *Clientset) TektonV1beta1() tektonv1beta1.TektonV1beta1Interface { + return &faketektonv1beta1.FakeTektonV1beta1{Fake: &c.Fake} } diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index e3ab1e2e306..9cb0cd85161 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -20,7 +20,7 @@ package fake import ( tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -33,7 +33,7 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ tektonv1alpha1.AddToScheme, - tektonv1alpha2.AddToScheme, + tektonv1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 591f92bb2fa..aca95492fcb 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -20,7 +20,7 @@ package scheme import ( tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -33,7 +33,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ tektonv1alpha1.AddToScheme, - tektonv1alpha2.AddToScheme, + tektonv1beta1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/clustertask.go similarity index 80% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/clustertask.go index 2dfffff4c89..25545a39169 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/clustertask.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( "time" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,14 +37,14 @@ type ClusterTasksGetter interface { // ClusterTaskInterface has methods to work with ClusterTask resources. type ClusterTaskInterface interface { - Create(*v1alpha2.ClusterTask) (*v1alpha2.ClusterTask, error) - Update(*v1alpha2.ClusterTask) (*v1alpha2.ClusterTask, error) + Create(*v1beta1.ClusterTask) (*v1beta1.ClusterTask, error) + Update(*v1beta1.ClusterTask) (*v1beta1.ClusterTask, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.ClusterTask, error) - List(opts v1.ListOptions) (*v1alpha2.ClusterTaskList, error) + Get(name string, options v1.GetOptions) (*v1beta1.ClusterTask, error) + List(opts v1.ListOptions) (*v1beta1.ClusterTaskList, error) Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.ClusterTask, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterTask, err error) ClusterTaskExpansion } @@ -54,15 +54,15 @@ type clusterTasks struct { } // newClusterTasks returns a ClusterTasks -func newClusterTasks(c *TektonV1alpha2Client) *clusterTasks { +func newClusterTasks(c *TektonV1beta1Client) *clusterTasks { return &clusterTasks{ client: c.RESTClient(), } } // Get takes name of the clusterTask, and returns the corresponding clusterTask object, and an error if there is any. -func (c *clusterTasks) Get(name string, options v1.GetOptions) (result *v1alpha2.ClusterTask, err error) { - result = &v1alpha2.ClusterTask{} +func (c *clusterTasks) Get(name string, options v1.GetOptions) (result *v1beta1.ClusterTask, err error) { + result = &v1beta1.ClusterTask{} err = c.client.Get(). Resource("clustertasks"). Name(name). @@ -73,12 +73,12 @@ func (c *clusterTasks) Get(name string, options v1.GetOptions) (result *v1alpha2 } // List takes label and field selectors, and returns the list of ClusterTasks that match those selectors. -func (c *clusterTasks) List(opts v1.ListOptions) (result *v1alpha2.ClusterTaskList, err error) { +func (c *clusterTasks) List(opts v1.ListOptions) (result *v1beta1.ClusterTaskList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha2.ClusterTaskList{} + result = &v1beta1.ClusterTaskList{} err = c.client.Get(). Resource("clustertasks"). VersionedParams(&opts, scheme.ParameterCodec). @@ -103,8 +103,8 @@ func (c *clusterTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a clusterTask and creates it. Returns the server's representation of the clusterTask, and an error, if there is any. -func (c *clusterTasks) Create(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { - result = &v1alpha2.ClusterTask{} +func (c *clusterTasks) Create(clusterTask *v1beta1.ClusterTask) (result *v1beta1.ClusterTask, err error) { + result = &v1beta1.ClusterTask{} err = c.client.Post(). Resource("clustertasks"). Body(clusterTask). @@ -114,8 +114,8 @@ func (c *clusterTasks) Create(clusterTask *v1alpha2.ClusterTask) (result *v1alph } // Update takes the representation of a clusterTask and updates it. Returns the server's representation of the clusterTask, and an error, if there is any. -func (c *clusterTasks) Update(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { - result = &v1alpha2.ClusterTask{} +func (c *clusterTasks) Update(clusterTask *v1beta1.ClusterTask) (result *v1beta1.ClusterTask, err error) { + result = &v1beta1.ClusterTask{} err = c.client.Put(). Resource("clustertasks"). Name(clusterTask.Name). @@ -151,8 +151,8 @@ func (c *clusterTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v } // Patch applies the patch and returns the patched clusterTask. -func (c *clusterTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.ClusterTask, err error) { - result = &v1alpha2.ClusterTask{} +func (c *clusterTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterTask, err error) { + result = &v1beta1.ClusterTask{} err = c.client.Patch(pt). Resource("clustertasks"). SubResource(subresources...). diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/doc.go similarity index 97% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/doc.go index 1df2d63e633..ff6e6bc2555 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1alpha2 +package v1beta1 diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/doc.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/doc.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/doc.go diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_clustertask.go similarity index 74% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_clustertask.go index 0500b54e877..5cfd93cc11e 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_clustertask.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,27 +30,27 @@ import ( // FakeClusterTasks implements ClusterTaskInterface type FakeClusterTasks struct { - Fake *FakeTektonV1alpha2 + Fake *FakeTektonV1beta1 } -var clustertasksResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "clustertasks"} +var clustertasksResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1beta1", Resource: "clustertasks"} -var clustertasksKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "ClusterTask"} +var clustertasksKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1beta1", Kind: "ClusterTask"} // Get takes name of the clusterTask, and returns the corresponding clusterTask object, and an error if there is any. -func (c *FakeClusterTasks) Get(name string, options v1.GetOptions) (result *v1alpha2.ClusterTask, err error) { +func (c *FakeClusterTasks) Get(name string, options v1.GetOptions) (result *v1beta1.ClusterTask, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertasksResource, name), &v1alpha2.ClusterTask{}) + Invokes(testing.NewRootGetAction(clustertasksResource, name), &v1beta1.ClusterTask{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.ClusterTask), err + return obj.(*v1beta1.ClusterTask), err } // List takes label and field selectors, and returns the list of ClusterTasks that match those selectors. -func (c *FakeClusterTasks) List(opts v1.ListOptions) (result *v1alpha2.ClusterTaskList, err error) { +func (c *FakeClusterTasks) List(opts v1.ListOptions) (result *v1beta1.ClusterTaskList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertasksResource, clustertasksKind, opts), &v1alpha2.ClusterTaskList{}) + Invokes(testing.NewRootListAction(clustertasksResource, clustertasksKind, opts), &v1beta1.ClusterTaskList{}) if obj == nil { return nil, err } @@ -59,8 +59,8 @@ func (c *FakeClusterTasks) List(opts v1.ListOptions) (result *v1alpha2.ClusterTa if label == nil { label = labels.Everything() } - list := &v1alpha2.ClusterTaskList{ListMeta: obj.(*v1alpha2.ClusterTaskList).ListMeta} - for _, item := range obj.(*v1alpha2.ClusterTaskList).Items { + list := &v1beta1.ClusterTaskList{ListMeta: obj.(*v1beta1.ClusterTaskList).ListMeta} + for _, item := range obj.(*v1beta1.ClusterTaskList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -75,29 +75,29 @@ func (c *FakeClusterTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a clusterTask and creates it. Returns the server's representation of the clusterTask, and an error, if there is any. -func (c *FakeClusterTasks) Create(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { +func (c *FakeClusterTasks) Create(clusterTask *v1beta1.ClusterTask) (result *v1beta1.ClusterTask, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertasksResource, clusterTask), &v1alpha2.ClusterTask{}) + Invokes(testing.NewRootCreateAction(clustertasksResource, clusterTask), &v1beta1.ClusterTask{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.ClusterTask), err + return obj.(*v1beta1.ClusterTask), err } // Update takes the representation of a clusterTask and updates it. Returns the server's representation of the clusterTask, and an error, if there is any. -func (c *FakeClusterTasks) Update(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { +func (c *FakeClusterTasks) Update(clusterTask *v1beta1.ClusterTask) (result *v1beta1.ClusterTask, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertasksResource, clusterTask), &v1alpha2.ClusterTask{}) + Invokes(testing.NewRootUpdateAction(clustertasksResource, clusterTask), &v1beta1.ClusterTask{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.ClusterTask), err + return obj.(*v1beta1.ClusterTask), err } // Delete takes name of the clusterTask and deletes it. Returns an error if one occurs. func (c *FakeClusterTasks) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(clustertasksResource, name), &v1alpha2.ClusterTask{}) + Invokes(testing.NewRootDeleteAction(clustertasksResource, name), &v1beta1.ClusterTask{}) return err } @@ -105,16 +105,16 @@ func (c *FakeClusterTasks) Delete(name string, options *v1.DeleteOptions) error func (c *FakeClusterTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(clustertasksResource, listOptions) - _, err := c.Fake.Invokes(action, &v1alpha2.ClusterTaskList{}) + _, err := c.Fake.Invokes(action, &v1beta1.ClusterTaskList{}) return err } // Patch applies the patch and returns the patched clusterTask. -func (c *FakeClusterTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.ClusterTask, err error) { +func (c *FakeClusterTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterTask, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertasksResource, name, pt, data, subresources...), &v1alpha2.ClusterTask{}) + Invokes(testing.NewRootPatchSubresourceAction(clustertasksResource, name, pt, data, subresources...), &v1beta1.ClusterTask{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.ClusterTask), err + return obj.(*v1beta1.ClusterTask), err } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipeline.go similarity index 74% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipeline.go index 9987d89c0af..f146c35b258 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipeline.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,29 +30,29 @@ import ( // FakePipelines implements PipelineInterface type FakePipelines struct { - Fake *FakeTektonV1alpha2 + Fake *FakeTektonV1beta1 ns string } -var pipelinesResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "pipelines"} +var pipelinesResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1beta1", Resource: "pipelines"} -var pipelinesKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "Pipeline"} +var pipelinesKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1beta1", Kind: "Pipeline"} // Get takes name of the pipeline, and returns the corresponding pipeline object, and an error if there is any. -func (c *FakePipelines) Get(name string, options v1.GetOptions) (result *v1alpha2.Pipeline, err error) { +func (c *FakePipelines) Get(name string, options v1.GetOptions) (result *v1beta1.Pipeline, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(pipelinesResource, c.ns, name), &v1alpha2.Pipeline{}) + Invokes(testing.NewGetAction(pipelinesResource, c.ns, name), &v1beta1.Pipeline{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Pipeline), err + return obj.(*v1beta1.Pipeline), err } // List takes label and field selectors, and returns the list of Pipelines that match those selectors. -func (c *FakePipelines) List(opts v1.ListOptions) (result *v1alpha2.PipelineList, err error) { +func (c *FakePipelines) List(opts v1.ListOptions) (result *v1beta1.PipelineList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(pipelinesResource, pipelinesKind, c.ns, opts), &v1alpha2.PipelineList{}) + Invokes(testing.NewListAction(pipelinesResource, pipelinesKind, c.ns, opts), &v1beta1.PipelineList{}) if obj == nil { return nil, err @@ -62,8 +62,8 @@ func (c *FakePipelines) List(opts v1.ListOptions) (result *v1alpha2.PipelineList if label == nil { label = labels.Everything() } - list := &v1alpha2.PipelineList{ListMeta: obj.(*v1alpha2.PipelineList).ListMeta} - for _, item := range obj.(*v1alpha2.PipelineList).Items { + list := &v1beta1.PipelineList{ListMeta: obj.(*v1beta1.PipelineList).ListMeta} + for _, item := range obj.(*v1beta1.PipelineList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,31 +79,31 @@ func (c *FakePipelines) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a pipeline and creates it. Returns the server's representation of the pipeline, and an error, if there is any. -func (c *FakePipelines) Create(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { +func (c *FakePipelines) Create(pipeline *v1beta1.Pipeline) (result *v1beta1.Pipeline, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(pipelinesResource, c.ns, pipeline), &v1alpha2.Pipeline{}) + Invokes(testing.NewCreateAction(pipelinesResource, c.ns, pipeline), &v1beta1.Pipeline{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Pipeline), err + return obj.(*v1beta1.Pipeline), err } // Update takes the representation of a pipeline and updates it. Returns the server's representation of the pipeline, and an error, if there is any. -func (c *FakePipelines) Update(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { +func (c *FakePipelines) Update(pipeline *v1beta1.Pipeline) (result *v1beta1.Pipeline, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(pipelinesResource, c.ns, pipeline), &v1alpha2.Pipeline{}) + Invokes(testing.NewUpdateAction(pipelinesResource, c.ns, pipeline), &v1beta1.Pipeline{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Pipeline), err + return obj.(*v1beta1.Pipeline), err } // Delete takes name of the pipeline and deletes it. Returns an error if one occurs. func (c *FakePipelines) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(pipelinesResource, c.ns, name), &v1alpha2.Pipeline{}) + Invokes(testing.NewDeleteAction(pipelinesResource, c.ns, name), &v1beta1.Pipeline{}) return err } @@ -112,17 +112,17 @@ func (c *FakePipelines) Delete(name string, options *v1.DeleteOptions) error { func (c *FakePipelines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(pipelinesResource, c.ns, listOptions) - _, err := c.Fake.Invokes(action, &v1alpha2.PipelineList{}) + _, err := c.Fake.Invokes(action, &v1beta1.PipelineList{}) return err } // Patch applies the patch and returns the patched pipeline. -func (c *FakePipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Pipeline, err error) { +func (c *FakePipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Pipeline, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(pipelinesResource, c.ns, name, pt, data, subresources...), &v1alpha2.Pipeline{}) + Invokes(testing.NewPatchSubresourceAction(pipelinesResource, c.ns, name, pt, data, subresources...), &v1beta1.Pipeline{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Pipeline), err + return obj.(*v1beta1.Pipeline), err } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipeline_client.go similarity index 64% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipeline_client.go index 14cbd2b7dae..e3863eb0939 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipeline_client.go @@ -19,38 +19,38 @@ limitations under the License. package fake import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeTektonV1alpha2 struct { +type FakeTektonV1beta1 struct { *testing.Fake } -func (c *FakeTektonV1alpha2) ClusterTasks() v1alpha2.ClusterTaskInterface { +func (c *FakeTektonV1beta1) ClusterTasks() v1beta1.ClusterTaskInterface { return &FakeClusterTasks{c} } -func (c *FakeTektonV1alpha2) Pipelines(namespace string) v1alpha2.PipelineInterface { +func (c *FakeTektonV1beta1) Pipelines(namespace string) v1beta1.PipelineInterface { return &FakePipelines{c, namespace} } -func (c *FakeTektonV1alpha2) PipelineRuns(namespace string) v1alpha2.PipelineRunInterface { +func (c *FakeTektonV1beta1) PipelineRuns(namespace string) v1beta1.PipelineRunInterface { return &FakePipelineRuns{c, namespace} } -func (c *FakeTektonV1alpha2) Tasks(namespace string) v1alpha2.TaskInterface { +func (c *FakeTektonV1beta1) Tasks(namespace string) v1beta1.TaskInterface { return &FakeTasks{c, namespace} } -func (c *FakeTektonV1alpha2) TaskRuns(namespace string) v1alpha2.TaskRunInterface { +func (c *FakeTektonV1beta1) TaskRuns(namespace string) v1beta1.TaskRunInterface { return &FakeTaskRuns{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeTektonV1alpha2) RESTClient() rest.Interface { +func (c *FakeTektonV1beta1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipelinerun.go similarity index 72% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipelinerun.go index fca23a73381..c9c0f0c16f2 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_pipelinerun.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,29 +30,29 @@ import ( // FakePipelineRuns implements PipelineRunInterface type FakePipelineRuns struct { - Fake *FakeTektonV1alpha2 + Fake *FakeTektonV1beta1 ns string } -var pipelinerunsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "pipelineruns"} +var pipelinerunsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1beta1", Resource: "pipelineruns"} -var pipelinerunsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "PipelineRun"} +var pipelinerunsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1beta1", Kind: "PipelineRun"} // Get takes name of the pipelineRun, and returns the corresponding pipelineRun object, and an error if there is any. -func (c *FakePipelineRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.PipelineRun, err error) { +func (c *FakePipelineRuns) Get(name string, options v1.GetOptions) (result *v1beta1.PipelineRun, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(pipelinerunsResource, c.ns, name), &v1alpha2.PipelineRun{}) + Invokes(testing.NewGetAction(pipelinerunsResource, c.ns, name), &v1beta1.PipelineRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.PipelineRun), err + return obj.(*v1beta1.PipelineRun), err } // List takes label and field selectors, and returns the list of PipelineRuns that match those selectors. -func (c *FakePipelineRuns) List(opts v1.ListOptions) (result *v1alpha2.PipelineRunList, err error) { +func (c *FakePipelineRuns) List(opts v1.ListOptions) (result *v1beta1.PipelineRunList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(pipelinerunsResource, pipelinerunsKind, c.ns, opts), &v1alpha2.PipelineRunList{}) + Invokes(testing.NewListAction(pipelinerunsResource, pipelinerunsKind, c.ns, opts), &v1beta1.PipelineRunList{}) if obj == nil { return nil, err @@ -62,8 +62,8 @@ func (c *FakePipelineRuns) List(opts v1.ListOptions) (result *v1alpha2.PipelineR if label == nil { label = labels.Everything() } - list := &v1alpha2.PipelineRunList{ListMeta: obj.(*v1alpha2.PipelineRunList).ListMeta} - for _, item := range obj.(*v1alpha2.PipelineRunList).Items { + list := &v1beta1.PipelineRunList{ListMeta: obj.(*v1beta1.PipelineRunList).ListMeta} + for _, item := range obj.(*v1beta1.PipelineRunList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,43 +79,43 @@ func (c *FakePipelineRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a pipelineRun and creates it. Returns the server's representation of the pipelineRun, and an error, if there is any. -func (c *FakePipelineRuns) Create(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { +func (c *FakePipelineRuns) Create(pipelineRun *v1beta1.PipelineRun) (result *v1beta1.PipelineRun, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(pipelinerunsResource, c.ns, pipelineRun), &v1alpha2.PipelineRun{}) + Invokes(testing.NewCreateAction(pipelinerunsResource, c.ns, pipelineRun), &v1beta1.PipelineRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.PipelineRun), err + return obj.(*v1beta1.PipelineRun), err } // Update takes the representation of a pipelineRun and updates it. Returns the server's representation of the pipelineRun, and an error, if there is any. -func (c *FakePipelineRuns) Update(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { +func (c *FakePipelineRuns) Update(pipelineRun *v1beta1.PipelineRun) (result *v1beta1.PipelineRun, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(pipelinerunsResource, c.ns, pipelineRun), &v1alpha2.PipelineRun{}) + Invokes(testing.NewUpdateAction(pipelinerunsResource, c.ns, pipelineRun), &v1beta1.PipelineRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.PipelineRun), err + return obj.(*v1beta1.PipelineRun), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePipelineRuns) UpdateStatus(pipelineRun *v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) { +func (c *FakePipelineRuns) UpdateStatus(pipelineRun *v1beta1.PipelineRun) (*v1beta1.PipelineRun, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(pipelinerunsResource, "status", c.ns, pipelineRun), &v1alpha2.PipelineRun{}) + Invokes(testing.NewUpdateSubresourceAction(pipelinerunsResource, "status", c.ns, pipelineRun), &v1beta1.PipelineRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.PipelineRun), err + return obj.(*v1beta1.PipelineRun), err } // Delete takes name of the pipelineRun and deletes it. Returns an error if one occurs. func (c *FakePipelineRuns) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(pipelinerunsResource, c.ns, name), &v1alpha2.PipelineRun{}) + Invokes(testing.NewDeleteAction(pipelinerunsResource, c.ns, name), &v1beta1.PipelineRun{}) return err } @@ -124,17 +124,17 @@ func (c *FakePipelineRuns) Delete(name string, options *v1.DeleteOptions) error func (c *FakePipelineRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(pipelinerunsResource, c.ns, listOptions) - _, err := c.Fake.Invokes(action, &v1alpha2.PipelineRunList{}) + _, err := c.Fake.Invokes(action, &v1beta1.PipelineRunList{}) return err } // Patch applies the patch and returns the patched pipelineRun. -func (c *FakePipelineRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineRun, err error) { +func (c *FakePipelineRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PipelineRun, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(pipelinerunsResource, c.ns, name, pt, data, subresources...), &v1alpha2.PipelineRun{}) + Invokes(testing.NewPatchSubresourceAction(pipelinerunsResource, c.ns, name, pt, data, subresources...), &v1beta1.PipelineRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.PipelineRun), err + return obj.(*v1beta1.PipelineRun), err } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_task.go similarity index 75% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_task.go index b8dc46324b3..fb0f456b69a 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_task.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,29 +30,29 @@ import ( // FakeTasks implements TaskInterface type FakeTasks struct { - Fake *FakeTektonV1alpha2 + Fake *FakeTektonV1beta1 ns string } -var tasksResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "tasks"} +var tasksResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1beta1", Resource: "tasks"} -var tasksKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "Task"} +var tasksKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1beta1", Kind: "Task"} // Get takes name of the task, and returns the corresponding task object, and an error if there is any. -func (c *FakeTasks) Get(name string, options v1.GetOptions) (result *v1alpha2.Task, err error) { +func (c *FakeTasks) Get(name string, options v1.GetOptions) (result *v1beta1.Task, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(tasksResource, c.ns, name), &v1alpha2.Task{}) + Invokes(testing.NewGetAction(tasksResource, c.ns, name), &v1beta1.Task{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Task), err + return obj.(*v1beta1.Task), err } // List takes label and field selectors, and returns the list of Tasks that match those selectors. -func (c *FakeTasks) List(opts v1.ListOptions) (result *v1alpha2.TaskList, err error) { +func (c *FakeTasks) List(opts v1.ListOptions) (result *v1beta1.TaskList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(tasksResource, tasksKind, c.ns, opts), &v1alpha2.TaskList{}) + Invokes(testing.NewListAction(tasksResource, tasksKind, c.ns, opts), &v1beta1.TaskList{}) if obj == nil { return nil, err @@ -62,8 +62,8 @@ func (c *FakeTasks) List(opts v1.ListOptions) (result *v1alpha2.TaskList, err er if label == nil { label = labels.Everything() } - list := &v1alpha2.TaskList{ListMeta: obj.(*v1alpha2.TaskList).ListMeta} - for _, item := range obj.(*v1alpha2.TaskList).Items { + list := &v1beta1.TaskList{ListMeta: obj.(*v1beta1.TaskList).ListMeta} + for _, item := range obj.(*v1beta1.TaskList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,31 +79,31 @@ func (c *FakeTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a task and creates it. Returns the server's representation of the task, and an error, if there is any. -func (c *FakeTasks) Create(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { +func (c *FakeTasks) Create(task *v1beta1.Task) (result *v1beta1.Task, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(tasksResource, c.ns, task), &v1alpha2.Task{}) + Invokes(testing.NewCreateAction(tasksResource, c.ns, task), &v1beta1.Task{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Task), err + return obj.(*v1beta1.Task), err } // Update takes the representation of a task and updates it. Returns the server's representation of the task, and an error, if there is any. -func (c *FakeTasks) Update(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { +func (c *FakeTasks) Update(task *v1beta1.Task) (result *v1beta1.Task, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tasksResource, c.ns, task), &v1alpha2.Task{}) + Invokes(testing.NewUpdateAction(tasksResource, c.ns, task), &v1beta1.Task{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Task), err + return obj.(*v1beta1.Task), err } // Delete takes name of the task and deletes it. Returns an error if one occurs. func (c *FakeTasks) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(tasksResource, c.ns, name), &v1alpha2.Task{}) + Invokes(testing.NewDeleteAction(tasksResource, c.ns, name), &v1beta1.Task{}) return err } @@ -112,17 +112,17 @@ func (c *FakeTasks) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(tasksResource, c.ns, listOptions) - _, err := c.Fake.Invokes(action, &v1alpha2.TaskList{}) + _, err := c.Fake.Invokes(action, &v1beta1.TaskList{}) return err } // Patch applies the patch and returns the patched task. -func (c *FakeTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Task, err error) { +func (c *FakeTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Task, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tasksResource, c.ns, name, pt, data, subresources...), &v1alpha2.Task{}) + Invokes(testing.NewPatchSubresourceAction(tasksResource, c.ns, name, pt, data, subresources...), &v1beta1.Task{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.Task), err + return obj.(*v1beta1.Task), err } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_taskrun.go similarity index 74% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_taskrun.go index 6d1592efc40..5b833596739 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/fake/fake_taskrun.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,29 +30,29 @@ import ( // FakeTaskRuns implements TaskRunInterface type FakeTaskRuns struct { - Fake *FakeTektonV1alpha2 + Fake *FakeTektonV1beta1 ns string } -var taskrunsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "taskruns"} +var taskrunsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1beta1", Resource: "taskruns"} -var taskrunsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "TaskRun"} +var taskrunsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1beta1", Kind: "TaskRun"} // Get takes name of the taskRun, and returns the corresponding taskRun object, and an error if there is any. -func (c *FakeTaskRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.TaskRun, err error) { +func (c *FakeTaskRuns) Get(name string, options v1.GetOptions) (result *v1beta1.TaskRun, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(taskrunsResource, c.ns, name), &v1alpha2.TaskRun{}) + Invokes(testing.NewGetAction(taskrunsResource, c.ns, name), &v1beta1.TaskRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.TaskRun), err + return obj.(*v1beta1.TaskRun), err } // List takes label and field selectors, and returns the list of TaskRuns that match those selectors. -func (c *FakeTaskRuns) List(opts v1.ListOptions) (result *v1alpha2.TaskRunList, err error) { +func (c *FakeTaskRuns) List(opts v1.ListOptions) (result *v1beta1.TaskRunList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(taskrunsResource, taskrunsKind, c.ns, opts), &v1alpha2.TaskRunList{}) + Invokes(testing.NewListAction(taskrunsResource, taskrunsKind, c.ns, opts), &v1beta1.TaskRunList{}) if obj == nil { return nil, err @@ -62,8 +62,8 @@ func (c *FakeTaskRuns) List(opts v1.ListOptions) (result *v1alpha2.TaskRunList, if label == nil { label = labels.Everything() } - list := &v1alpha2.TaskRunList{ListMeta: obj.(*v1alpha2.TaskRunList).ListMeta} - for _, item := range obj.(*v1alpha2.TaskRunList).Items { + list := &v1beta1.TaskRunList{ListMeta: obj.(*v1beta1.TaskRunList).ListMeta} + for _, item := range obj.(*v1beta1.TaskRunList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,43 +79,43 @@ func (c *FakeTaskRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a taskRun and creates it. Returns the server's representation of the taskRun, and an error, if there is any. -func (c *FakeTaskRuns) Create(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { +func (c *FakeTaskRuns) Create(taskRun *v1beta1.TaskRun) (result *v1beta1.TaskRun, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(taskrunsResource, c.ns, taskRun), &v1alpha2.TaskRun{}) + Invokes(testing.NewCreateAction(taskrunsResource, c.ns, taskRun), &v1beta1.TaskRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.TaskRun), err + return obj.(*v1beta1.TaskRun), err } // Update takes the representation of a taskRun and updates it. Returns the server's representation of the taskRun, and an error, if there is any. -func (c *FakeTaskRuns) Update(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { +func (c *FakeTaskRuns) Update(taskRun *v1beta1.TaskRun) (result *v1beta1.TaskRun, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(taskrunsResource, c.ns, taskRun), &v1alpha2.TaskRun{}) + Invokes(testing.NewUpdateAction(taskrunsResource, c.ns, taskRun), &v1beta1.TaskRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.TaskRun), err + return obj.(*v1beta1.TaskRun), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeTaskRuns) UpdateStatus(taskRun *v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) { +func (c *FakeTaskRuns) UpdateStatus(taskRun *v1beta1.TaskRun) (*v1beta1.TaskRun, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(taskrunsResource, "status", c.ns, taskRun), &v1alpha2.TaskRun{}) + Invokes(testing.NewUpdateSubresourceAction(taskrunsResource, "status", c.ns, taskRun), &v1beta1.TaskRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.TaskRun), err + return obj.(*v1beta1.TaskRun), err } // Delete takes name of the taskRun and deletes it. Returns an error if one occurs. func (c *FakeTaskRuns) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(taskrunsResource, c.ns, name), &v1alpha2.TaskRun{}) + Invokes(testing.NewDeleteAction(taskrunsResource, c.ns, name), &v1beta1.TaskRun{}) return err } @@ -124,17 +124,17 @@ func (c *FakeTaskRuns) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeTaskRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(taskrunsResource, c.ns, listOptions) - _, err := c.Fake.Invokes(action, &v1alpha2.TaskRunList{}) + _, err := c.Fake.Invokes(action, &v1beta1.TaskRunList{}) return err } // Patch applies the patch and returns the patched taskRun. -func (c *FakeTaskRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.TaskRun, err error) { +func (c *FakeTaskRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.TaskRun, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(taskrunsResource, c.ns, name, pt, data, subresources...), &v1alpha2.TaskRun{}) + Invokes(testing.NewPatchSubresourceAction(taskrunsResource, c.ns, name, pt, data, subresources...), &v1beta1.TaskRun{}) if obj == nil { return nil, err } - return obj.(*v1alpha2.TaskRun), err + return obj.(*v1beta1.TaskRun), err } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/generated_expansion.go similarity index 97% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/generated_expansion.go index e88ed853bba..0fe47f306c0 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/generated_expansion.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 type ClusterTaskExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipeline.go similarity index 81% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipeline.go index a5c10399123..c89e4a46317 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipeline.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( "time" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,14 +37,14 @@ type PipelinesGetter interface { // PipelineInterface has methods to work with Pipeline resources. type PipelineInterface interface { - Create(*v1alpha2.Pipeline) (*v1alpha2.Pipeline, error) - Update(*v1alpha2.Pipeline) (*v1alpha2.Pipeline, error) + Create(*v1beta1.Pipeline) (*v1beta1.Pipeline, error) + Update(*v1beta1.Pipeline) (*v1beta1.Pipeline, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.Pipeline, error) - List(opts v1.ListOptions) (*v1alpha2.PipelineList, error) + Get(name string, options v1.GetOptions) (*v1beta1.Pipeline, error) + List(opts v1.ListOptions) (*v1beta1.PipelineList, error) Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Pipeline, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Pipeline, err error) PipelineExpansion } @@ -55,7 +55,7 @@ type pipelines struct { } // newPipelines returns a Pipelines -func newPipelines(c *TektonV1alpha2Client, namespace string) *pipelines { +func newPipelines(c *TektonV1beta1Client, namespace string) *pipelines { return &pipelines{ client: c.RESTClient(), ns: namespace, @@ -63,8 +63,8 @@ func newPipelines(c *TektonV1alpha2Client, namespace string) *pipelines { } // Get takes name of the pipeline, and returns the corresponding pipeline object, and an error if there is any. -func (c *pipelines) Get(name string, options v1.GetOptions) (result *v1alpha2.Pipeline, err error) { - result = &v1alpha2.Pipeline{} +func (c *pipelines) Get(name string, options v1.GetOptions) (result *v1beta1.Pipeline, err error) { + result = &v1beta1.Pipeline{} err = c.client.Get(). Namespace(c.ns). Resource("pipelines"). @@ -76,12 +76,12 @@ func (c *pipelines) Get(name string, options v1.GetOptions) (result *v1alpha2.Pi } // List takes label and field selectors, and returns the list of Pipelines that match those selectors. -func (c *pipelines) List(opts v1.ListOptions) (result *v1alpha2.PipelineList, err error) { +func (c *pipelines) List(opts v1.ListOptions) (result *v1beta1.PipelineList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha2.PipelineList{} + result = &v1beta1.PipelineList{} err = c.client.Get(). Namespace(c.ns). Resource("pipelines"). @@ -108,8 +108,8 @@ func (c *pipelines) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a pipeline and creates it. Returns the server's representation of the pipeline, and an error, if there is any. -func (c *pipelines) Create(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { - result = &v1alpha2.Pipeline{} +func (c *pipelines) Create(pipeline *v1beta1.Pipeline) (result *v1beta1.Pipeline, err error) { + result = &v1beta1.Pipeline{} err = c.client.Post(). Namespace(c.ns). Resource("pipelines"). @@ -120,8 +120,8 @@ func (c *pipelines) Create(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeli } // Update takes the representation of a pipeline and updates it. Returns the server's representation of the pipeline, and an error, if there is any. -func (c *pipelines) Update(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { - result = &v1alpha2.Pipeline{} +func (c *pipelines) Update(pipeline *v1beta1.Pipeline) (result *v1beta1.Pipeline, err error) { + result = &v1beta1.Pipeline{} err = c.client.Put(). Namespace(c.ns). Resource("pipelines"). @@ -160,8 +160,8 @@ func (c *pipelines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.L } // Patch applies the patch and returns the patched pipeline. -func (c *pipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Pipeline, err error) { - result = &v1alpha2.Pipeline{} +func (c *pipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Pipeline, err error) { + result = &v1beta1.Pipeline{} err = c.client.Patch(pt). Namespace(c.ns). Resource("pipelines"). diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipeline_client.go similarity index 59% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipeline_client.go index b6acbfd826f..373236e24d9 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipeline_client.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type TektonV1alpha2Interface interface { +type TektonV1beta1Interface interface { RESTClient() rest.Interface ClusterTasksGetter PipelinesGetter @@ -33,33 +33,33 @@ type TektonV1alpha2Interface interface { TaskRunsGetter } -// TektonV1alpha2Client is used to interact with features provided by the tekton.dev group. -type TektonV1alpha2Client struct { +// TektonV1beta1Client is used to interact with features provided by the tekton.dev group. +type TektonV1beta1Client struct { restClient rest.Interface } -func (c *TektonV1alpha2Client) ClusterTasks() ClusterTaskInterface { +func (c *TektonV1beta1Client) ClusterTasks() ClusterTaskInterface { return newClusterTasks(c) } -func (c *TektonV1alpha2Client) Pipelines(namespace string) PipelineInterface { +func (c *TektonV1beta1Client) Pipelines(namespace string) PipelineInterface { return newPipelines(c, namespace) } -func (c *TektonV1alpha2Client) PipelineRuns(namespace string) PipelineRunInterface { +func (c *TektonV1beta1Client) PipelineRuns(namespace string) PipelineRunInterface { return newPipelineRuns(c, namespace) } -func (c *TektonV1alpha2Client) Tasks(namespace string) TaskInterface { +func (c *TektonV1beta1Client) Tasks(namespace string) TaskInterface { return newTasks(c, namespace) } -func (c *TektonV1alpha2Client) TaskRuns(namespace string) TaskRunInterface { +func (c *TektonV1beta1Client) TaskRuns(namespace string) TaskRunInterface { return newTaskRuns(c, namespace) } -// NewForConfig creates a new TektonV1alpha2Client for the given config. -func NewForConfig(c *rest.Config) (*TektonV1alpha2Client, error) { +// NewForConfig creates a new TektonV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*TektonV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -68,12 +68,12 @@ func NewForConfig(c *rest.Config) (*TektonV1alpha2Client, error) { if err != nil { return nil, err } - return &TektonV1alpha2Client{client}, nil + return &TektonV1beta1Client{client}, nil } -// NewForConfigOrDie creates a new TektonV1alpha2Client for the given config and +// NewForConfigOrDie creates a new TektonV1beta1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *TektonV1alpha2Client { +func NewForConfigOrDie(c *rest.Config) *TektonV1beta1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -81,13 +81,13 @@ func NewForConfigOrDie(c *rest.Config) *TektonV1alpha2Client { return client } -// New creates a new TektonV1alpha2Client for the given RESTClient. -func New(c rest.Interface) *TektonV1alpha2Client { - return &TektonV1alpha2Client{c} +// New creates a new TektonV1beta1Client for the given RESTClient. +func New(c rest.Interface) *TektonV1beta1Client { + return &TektonV1beta1Client{c} } func setConfigDefaults(config *rest.Config) error { - gv := v1alpha2.SchemeGroupVersion + gv := v1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() @@ -101,7 +101,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *TektonV1alpha2Client) RESTClient() rest.Interface { +func (c *TektonV1beta1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipelinerun.go similarity index 78% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipelinerun.go index e168cc0ac3d..0509c0f0f76 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/pipelinerun.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( "time" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,15 +37,15 @@ type PipelineRunsGetter interface { // PipelineRunInterface has methods to work with PipelineRun resources. type PipelineRunInterface interface { - Create(*v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) - Update(*v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) - UpdateStatus(*v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) + Create(*v1beta1.PipelineRun) (*v1beta1.PipelineRun, error) + Update(*v1beta1.PipelineRun) (*v1beta1.PipelineRun, error) + UpdateStatus(*v1beta1.PipelineRun) (*v1beta1.PipelineRun, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.PipelineRun, error) - List(opts v1.ListOptions) (*v1alpha2.PipelineRunList, error) + Get(name string, options v1.GetOptions) (*v1beta1.PipelineRun, error) + List(opts v1.ListOptions) (*v1beta1.PipelineRunList, error) Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineRun, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PipelineRun, err error) PipelineRunExpansion } @@ -56,7 +56,7 @@ type pipelineRuns struct { } // newPipelineRuns returns a PipelineRuns -func newPipelineRuns(c *TektonV1alpha2Client, namespace string) *pipelineRuns { +func newPipelineRuns(c *TektonV1beta1Client, namespace string) *pipelineRuns { return &pipelineRuns{ client: c.RESTClient(), ns: namespace, @@ -64,8 +64,8 @@ func newPipelineRuns(c *TektonV1alpha2Client, namespace string) *pipelineRuns { } // Get takes name of the pipelineRun, and returns the corresponding pipelineRun object, and an error if there is any. -func (c *pipelineRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.PipelineRun, err error) { - result = &v1alpha2.PipelineRun{} +func (c *pipelineRuns) Get(name string, options v1.GetOptions) (result *v1beta1.PipelineRun, err error) { + result = &v1beta1.PipelineRun{} err = c.client.Get(). Namespace(c.ns). Resource("pipelineruns"). @@ -77,12 +77,12 @@ func (c *pipelineRuns) Get(name string, options v1.GetOptions) (result *v1alpha2 } // List takes label and field selectors, and returns the list of PipelineRuns that match those selectors. -func (c *pipelineRuns) List(opts v1.ListOptions) (result *v1alpha2.PipelineRunList, err error) { +func (c *pipelineRuns) List(opts v1.ListOptions) (result *v1beta1.PipelineRunList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha2.PipelineRunList{} + result = &v1beta1.PipelineRunList{} err = c.client.Get(). Namespace(c.ns). Resource("pipelineruns"). @@ -109,8 +109,8 @@ func (c *pipelineRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a pipelineRun and creates it. Returns the server's representation of the pipelineRun, and an error, if there is any. -func (c *pipelineRuns) Create(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { - result = &v1alpha2.PipelineRun{} +func (c *pipelineRuns) Create(pipelineRun *v1beta1.PipelineRun) (result *v1beta1.PipelineRun, err error) { + result = &v1beta1.PipelineRun{} err = c.client.Post(). Namespace(c.ns). Resource("pipelineruns"). @@ -121,8 +121,8 @@ func (c *pipelineRuns) Create(pipelineRun *v1alpha2.PipelineRun) (result *v1alph } // Update takes the representation of a pipelineRun and updates it. Returns the server's representation of the pipelineRun, and an error, if there is any. -func (c *pipelineRuns) Update(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { - result = &v1alpha2.PipelineRun{} +func (c *pipelineRuns) Update(pipelineRun *v1beta1.PipelineRun) (result *v1beta1.PipelineRun, err error) { + result = &v1beta1.PipelineRun{} err = c.client.Put(). Namespace(c.ns). Resource("pipelineruns"). @@ -136,8 +136,8 @@ func (c *pipelineRuns) Update(pipelineRun *v1alpha2.PipelineRun) (result *v1alph // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *pipelineRuns) UpdateStatus(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { - result = &v1alpha2.PipelineRun{} +func (c *pipelineRuns) UpdateStatus(pipelineRun *v1beta1.PipelineRun) (result *v1beta1.PipelineRun, err error) { + result = &v1beta1.PipelineRun{} err = c.client.Put(). Namespace(c.ns). Resource("pipelineruns"). @@ -177,8 +177,8 @@ func (c *pipelineRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v } // Patch applies the patch and returns the patched pipelineRun. -func (c *pipelineRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineRun, err error) { - result = &v1alpha2.PipelineRun{} +func (c *pipelineRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.PipelineRun, err error) { + result = &v1beta1.PipelineRun{} err = c.client.Patch(pt). Namespace(c.ns). Resource("pipelineruns"). diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/task.go similarity index 82% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/task.go index bdc655bb45c..7b02a7a6ca7 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/task.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( "time" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,14 +37,14 @@ type TasksGetter interface { // TaskInterface has methods to work with Task resources. type TaskInterface interface { - Create(*v1alpha2.Task) (*v1alpha2.Task, error) - Update(*v1alpha2.Task) (*v1alpha2.Task, error) + Create(*v1beta1.Task) (*v1beta1.Task, error) + Update(*v1beta1.Task) (*v1beta1.Task, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.Task, error) - List(opts v1.ListOptions) (*v1alpha2.TaskList, error) + Get(name string, options v1.GetOptions) (*v1beta1.Task, error) + List(opts v1.ListOptions) (*v1beta1.TaskList, error) Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Task, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Task, err error) TaskExpansion } @@ -55,7 +55,7 @@ type tasks struct { } // newTasks returns a Tasks -func newTasks(c *TektonV1alpha2Client, namespace string) *tasks { +func newTasks(c *TektonV1beta1Client, namespace string) *tasks { return &tasks{ client: c.RESTClient(), ns: namespace, @@ -63,8 +63,8 @@ func newTasks(c *TektonV1alpha2Client, namespace string) *tasks { } // Get takes name of the task, and returns the corresponding task object, and an error if there is any. -func (c *tasks) Get(name string, options v1.GetOptions) (result *v1alpha2.Task, err error) { - result = &v1alpha2.Task{} +func (c *tasks) Get(name string, options v1.GetOptions) (result *v1beta1.Task, err error) { + result = &v1beta1.Task{} err = c.client.Get(). Namespace(c.ns). Resource("tasks"). @@ -76,12 +76,12 @@ func (c *tasks) Get(name string, options v1.GetOptions) (result *v1alpha2.Task, } // List takes label and field selectors, and returns the list of Tasks that match those selectors. -func (c *tasks) List(opts v1.ListOptions) (result *v1alpha2.TaskList, err error) { +func (c *tasks) List(opts v1.ListOptions) (result *v1beta1.TaskList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha2.TaskList{} + result = &v1beta1.TaskList{} err = c.client.Get(). Namespace(c.ns). Resource("tasks"). @@ -108,8 +108,8 @@ func (c *tasks) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a task and creates it. Returns the server's representation of the task, and an error, if there is any. -func (c *tasks) Create(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { - result = &v1alpha2.Task{} +func (c *tasks) Create(task *v1beta1.Task) (result *v1beta1.Task, err error) { + result = &v1beta1.Task{} err = c.client.Post(). Namespace(c.ns). Resource("tasks"). @@ -120,8 +120,8 @@ func (c *tasks) Create(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { } // Update takes the representation of a task and updates it. Returns the server's representation of the task, and an error, if there is any. -func (c *tasks) Update(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { - result = &v1alpha2.Task{} +func (c *tasks) Update(task *v1beta1.Task) (result *v1beta1.Task, err error) { + result = &v1beta1.Task{} err = c.client.Put(). Namespace(c.ns). Resource("tasks"). @@ -160,8 +160,8 @@ func (c *tasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListO } // Patch applies the patch and returns the patched task. -func (c *tasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Task, err error) { - result = &v1alpha2.Task{} +func (c *tasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Task, err error) { + result = &v1beta1.Task{} err = c.client.Patch(pt). Namespace(c.ns). Resource("tasks"). diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/taskrun.go similarity index 80% rename from pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go rename to pkg/client/clientset/versioned/typed/pipeline/v1beta1/taskrun.go index f56e6e50d4b..b3f3018538f 100644 --- a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go +++ b/pkg/client/clientset/versioned/typed/pipeline/v1beta1/taskrun.go @@ -16,12 +16,12 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( "time" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,15 +37,15 @@ type TaskRunsGetter interface { // TaskRunInterface has methods to work with TaskRun resources. type TaskRunInterface interface { - Create(*v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) - Update(*v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) - UpdateStatus(*v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) + Create(*v1beta1.TaskRun) (*v1beta1.TaskRun, error) + Update(*v1beta1.TaskRun) (*v1beta1.TaskRun, error) + UpdateStatus(*v1beta1.TaskRun) (*v1beta1.TaskRun, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.TaskRun, error) - List(opts v1.ListOptions) (*v1alpha2.TaskRunList, error) + Get(name string, options v1.GetOptions) (*v1beta1.TaskRun, error) + List(opts v1.ListOptions) (*v1beta1.TaskRunList, error) Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.TaskRun, err error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.TaskRun, err error) TaskRunExpansion } @@ -56,7 +56,7 @@ type taskRuns struct { } // newTaskRuns returns a TaskRuns -func newTaskRuns(c *TektonV1alpha2Client, namespace string) *taskRuns { +func newTaskRuns(c *TektonV1beta1Client, namespace string) *taskRuns { return &taskRuns{ client: c.RESTClient(), ns: namespace, @@ -64,8 +64,8 @@ func newTaskRuns(c *TektonV1alpha2Client, namespace string) *taskRuns { } // Get takes name of the taskRun, and returns the corresponding taskRun object, and an error if there is any. -func (c *taskRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.TaskRun, err error) { - result = &v1alpha2.TaskRun{} +func (c *taskRuns) Get(name string, options v1.GetOptions) (result *v1beta1.TaskRun, err error) { + result = &v1beta1.TaskRun{} err = c.client.Get(). Namespace(c.ns). Resource("taskruns"). @@ -77,12 +77,12 @@ func (c *taskRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.Tas } // List takes label and field selectors, and returns the list of TaskRuns that match those selectors. -func (c *taskRuns) List(opts v1.ListOptions) (result *v1alpha2.TaskRunList, err error) { +func (c *taskRuns) List(opts v1.ListOptions) (result *v1beta1.TaskRunList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1alpha2.TaskRunList{} + result = &v1beta1.TaskRunList{} err = c.client.Get(). Namespace(c.ns). Resource("taskruns"). @@ -109,8 +109,8 @@ func (c *taskRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { } // Create takes the representation of a taskRun and creates it. Returns the server's representation of the taskRun, and an error, if there is any. -func (c *taskRuns) Create(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { - result = &v1alpha2.TaskRun{} +func (c *taskRuns) Create(taskRun *v1beta1.TaskRun) (result *v1beta1.TaskRun, err error) { + result = &v1beta1.TaskRun{} err = c.client.Post(). Namespace(c.ns). Resource("taskruns"). @@ -121,8 +121,8 @@ func (c *taskRuns) Create(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, } // Update takes the representation of a taskRun and updates it. Returns the server's representation of the taskRun, and an error, if there is any. -func (c *taskRuns) Update(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { - result = &v1alpha2.TaskRun{} +func (c *taskRuns) Update(taskRun *v1beta1.TaskRun) (result *v1beta1.TaskRun, err error) { + result = &v1beta1.TaskRun{} err = c.client.Put(). Namespace(c.ns). Resource("taskruns"). @@ -136,8 +136,8 @@ func (c *taskRuns) Update(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *taskRuns) UpdateStatus(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { - result = &v1alpha2.TaskRun{} +func (c *taskRuns) UpdateStatus(taskRun *v1beta1.TaskRun) (result *v1beta1.TaskRun, err error) { + result = &v1beta1.TaskRun{} err = c.client.Put(). Namespace(c.ns). Resource("taskruns"). @@ -177,8 +177,8 @@ func (c *taskRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.Li } // Patch applies the patch and returns the patched taskRun. -func (c *taskRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.TaskRun, err error) { - result = &v1alpha2.TaskRun{} +func (c *taskRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.TaskRun, err error) { + result = &v1beta1.TaskRun{} err = c.client.Patch(pt). Namespace(c.ns). Resource("taskruns"). diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index a57c99d44de..707a9843c8a 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,7 +22,7 @@ import ( "fmt" v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -67,17 +67,17 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("taskruns"): return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha1().TaskRuns().Informer()}, nil - // Group=tekton.dev, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("clustertasks"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().ClusterTasks().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("pipelines"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().Pipelines().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("pipelineruns"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().PipelineRuns().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("tasks"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().Tasks().Informer()}, nil - case v1alpha2.SchemeGroupVersion.WithResource("taskruns"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().TaskRuns().Informer()}, nil + // Group=tekton.dev, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("clustertasks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1beta1().ClusterTasks().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("pipelines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1beta1().Pipelines().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("pipelineruns"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1beta1().PipelineRuns().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("tasks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1beta1().Tasks().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("taskruns"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1beta1().TaskRuns().Informer()}, nil } diff --git a/pkg/client/informers/externalversions/pipeline/interface.go b/pkg/client/informers/externalversions/pipeline/interface.go index 1cd7b1c27b2..ffd05dbcfb1 100644 --- a/pkg/client/informers/externalversions/pipeline/interface.go +++ b/pkg/client/informers/externalversions/pipeline/interface.go @@ -21,15 +21,15 @@ package pipeline import ( internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" v1alpha1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { // V1alpha1 provides access to shared informers for resources in V1alpha1. V1alpha1() v1alpha1.Interface - // V1alpha2 provides access to shared informers for resources in V1alpha2. - V1alpha2() v1alpha2.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface } type group struct { @@ -48,7 +48,7 @@ func (g *group) V1alpha1() v1alpha1.Interface { return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) } -// V1alpha2 returns a new v1alpha2.Interface. -func (g *group) V1alpha2() v1alpha2.Interface { - return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go b/pkg/client/informers/externalversions/pipeline/v1beta1/clustertask.go similarity index 83% rename from pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go rename to pkg/client/informers/externalversions/pipeline/v1beta1/clustertask.go index 5fed5cc58fc..58faade858a 100644 --- a/pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go +++ b/pkg/client/informers/externalversions/pipeline/v1beta1/clustertask.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( time "time" - pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -35,7 +35,7 @@ import ( // ClusterTasks. type ClusterTaskInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.ClusterTaskLister + Lister() v1beta1.ClusterTaskLister } type clusterTaskInformer struct { @@ -60,16 +60,16 @@ func NewFilteredClusterTaskInformer(client versioned.Interface, resyncPeriod tim if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().ClusterTasks().List(options) + return client.TektonV1beta1().ClusterTasks().List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().ClusterTasks().Watch(options) + return client.TektonV1beta1().ClusterTasks().Watch(options) }, }, - &pipelinev1alpha2.ClusterTask{}, + &pipelinev1beta1.ClusterTask{}, resyncPeriod, indexers, ) @@ -80,9 +80,9 @@ func (f *clusterTaskInformer) defaultInformer(client versioned.Interface, resync } func (f *clusterTaskInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&pipelinev1alpha2.ClusterTask{}, f.defaultInformer) + return f.factory.InformerFor(&pipelinev1beta1.ClusterTask{}, f.defaultInformer) } -func (f *clusterTaskInformer) Lister() v1alpha2.ClusterTaskLister { - return v1alpha2.NewClusterTaskLister(f.Informer().GetIndexer()) +func (f *clusterTaskInformer) Lister() v1beta1.ClusterTaskLister { + return v1beta1.NewClusterTaskLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go b/pkg/client/informers/externalversions/pipeline/v1beta1/interface.go similarity index 99% rename from pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go rename to pkg/client/informers/externalversions/pipeline/v1beta1/interface.go index c494dbd88f3..b93bb635e08 100644 --- a/pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go +++ b/pkg/client/informers/externalversions/pipeline/v1beta1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go b/pkg/client/informers/externalversions/pipeline/v1beta1/pipeline.go similarity index 84% rename from pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go rename to pkg/client/informers/externalversions/pipeline/v1beta1/pipeline.go index 6801a3e82d0..d856526eda9 100644 --- a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go +++ b/pkg/client/informers/externalversions/pipeline/v1beta1/pipeline.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( time "time" - pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -35,7 +35,7 @@ import ( // Pipelines. type PipelineInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.PipelineLister + Lister() v1beta1.PipelineLister } type pipelineInformer struct { @@ -61,16 +61,16 @@ func NewFilteredPipelineInformer(client versioned.Interface, namespace string, r if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().Pipelines(namespace).List(options) + return client.TektonV1beta1().Pipelines(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().Pipelines(namespace).Watch(options) + return client.TektonV1beta1().Pipelines(namespace).Watch(options) }, }, - &pipelinev1alpha2.Pipeline{}, + &pipelinev1beta1.Pipeline{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *pipelineInformer) defaultInformer(client versioned.Interface, resyncPer } func (f *pipelineInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&pipelinev1alpha2.Pipeline{}, f.defaultInformer) + return f.factory.InformerFor(&pipelinev1beta1.Pipeline{}, f.defaultInformer) } -func (f *pipelineInformer) Lister() v1alpha2.PipelineLister { - return v1alpha2.NewPipelineLister(f.Informer().GetIndexer()) +func (f *pipelineInformer) Lister() v1beta1.PipelineLister { + return v1beta1.NewPipelineLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go b/pkg/client/informers/externalversions/pipeline/v1beta1/pipelinerun.go similarity index 83% rename from pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go rename to pkg/client/informers/externalversions/pipeline/v1beta1/pipelinerun.go index 44047dd06f1..6672320d6dd 100644 --- a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go +++ b/pkg/client/informers/externalversions/pipeline/v1beta1/pipelinerun.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( time "time" - pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -35,7 +35,7 @@ import ( // PipelineRuns. type PipelineRunInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.PipelineRunLister + Lister() v1beta1.PipelineRunLister } type pipelineRunInformer struct { @@ -61,16 +61,16 @@ func NewFilteredPipelineRunInformer(client versioned.Interface, namespace string if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().PipelineRuns(namespace).List(options) + return client.TektonV1beta1().PipelineRuns(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().PipelineRuns(namespace).Watch(options) + return client.TektonV1beta1().PipelineRuns(namespace).Watch(options) }, }, - &pipelinev1alpha2.PipelineRun{}, + &pipelinev1beta1.PipelineRun{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *pipelineRunInformer) defaultInformer(client versioned.Interface, resync } func (f *pipelineRunInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&pipelinev1alpha2.PipelineRun{}, f.defaultInformer) + return f.factory.InformerFor(&pipelinev1beta1.PipelineRun{}, f.defaultInformer) } -func (f *pipelineRunInformer) Lister() v1alpha2.PipelineRunLister { - return v1alpha2.NewPipelineRunLister(f.Informer().GetIndexer()) +func (f *pipelineRunInformer) Lister() v1beta1.PipelineRunLister { + return v1beta1.NewPipelineRunLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/task.go b/pkg/client/informers/externalversions/pipeline/v1beta1/task.go similarity index 84% rename from pkg/client/informers/externalversions/pipeline/v1alpha2/task.go rename to pkg/client/informers/externalversions/pipeline/v1beta1/task.go index d8bddca6a97..eae8a5daca7 100644 --- a/pkg/client/informers/externalversions/pipeline/v1alpha2/task.go +++ b/pkg/client/informers/externalversions/pipeline/v1beta1/task.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( time "time" - pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -35,7 +35,7 @@ import ( // Tasks. type TaskInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.TaskLister + Lister() v1beta1.TaskLister } type taskInformer struct { @@ -61,16 +61,16 @@ func NewFilteredTaskInformer(client versioned.Interface, namespace string, resyn if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().Tasks(namespace).List(options) + return client.TektonV1beta1().Tasks(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().Tasks(namespace).Watch(options) + return client.TektonV1beta1().Tasks(namespace).Watch(options) }, }, - &pipelinev1alpha2.Task{}, + &pipelinev1beta1.Task{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *taskInformer) defaultInformer(client versioned.Interface, resyncPeriod } func (f *taskInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&pipelinev1alpha2.Task{}, f.defaultInformer) + return f.factory.InformerFor(&pipelinev1beta1.Task{}, f.defaultInformer) } -func (f *taskInformer) Lister() v1alpha2.TaskLister { - return v1alpha2.NewTaskLister(f.Informer().GetIndexer()) +func (f *taskInformer) Lister() v1beta1.TaskLister { + return v1beta1.NewTaskLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go b/pkg/client/informers/externalversions/pipeline/v1beta1/taskrun.go similarity index 84% rename from pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go rename to pkg/client/informers/externalversions/pipeline/v1beta1/taskrun.go index 614ff931881..4bed6732367 100644 --- a/pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go +++ b/pkg/client/informers/externalversions/pipeline/v1beta1/taskrun.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( time "time" - pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -35,7 +35,7 @@ import ( // TaskRuns. type TaskRunInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.TaskRunLister + Lister() v1beta1.TaskRunLister } type taskRunInformer struct { @@ -61,16 +61,16 @@ func NewFilteredTaskRunInformer(client versioned.Interface, namespace string, re if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().TaskRuns(namespace).List(options) + return client.TektonV1beta1().TaskRuns(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TektonV1alpha2().TaskRuns(namespace).Watch(options) + return client.TektonV1beta1().TaskRuns(namespace).Watch(options) }, }, - &pipelinev1alpha2.TaskRun{}, + &pipelinev1beta1.TaskRun{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *taskRunInformer) defaultInformer(client versioned.Interface, resyncPeri } func (f *taskRunInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&pipelinev1alpha2.TaskRun{}, f.defaultInformer) + return f.factory.InformerFor(&pipelinev1beta1.TaskRun{}, f.defaultInformer) } -func (f *taskRunInformer) Lister() v1alpha2.TaskRunLister { - return v1alpha2.NewTaskRunLister(f.Informer().GetIndexer()) +func (f *taskRunInformer) Lister() v1beta1.TaskRunLister { + return v1beta1.NewTaskRunLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go b/pkg/client/injection/informers/pipeline/v1beta1/clustertask/clustertask.go similarity index 80% rename from pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go rename to pkg/client/injection/informers/pipeline/v1beta1/clustertask/clustertask.go index f99f39a8fde..6b3e61e835e 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/clustertask/clustertask.go @@ -21,7 +21,7 @@ package clustertask import ( "context" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,16 +37,16 @@ type Key struct{} func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := factory.Get(ctx) - inf := f.Tekton().V1alpha2().ClusterTasks() + inf := f.Tekton().V1beta1().ClusterTasks() return context.WithValue(ctx, Key{}, inf), inf.Informer() } // Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha2.ClusterTaskInformer { +func Get(ctx context.Context) v1beta1.ClusterTaskInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.ClusterTaskInformer from context.") + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1.ClusterTaskInformer from context.") } - return untyped.(v1alpha2.ClusterTaskInformer) + return untyped.(v1beta1.ClusterTaskInformer) } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go b/pkg/client/injection/informers/pipeline/v1beta1/clustertask/fake/fake.go similarity index 93% rename from pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go rename to pkg/client/injection/informers/pipeline/v1beta1/clustertask/fake/fake.go index 241415d5657..7e9896dd41d 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/clustertask/fake/fake.go @@ -22,7 +22,7 @@ import ( "context" fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" - clustertask "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/clustertask" + clustertask "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/clustertask" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) @@ -35,6 +35,6 @@ func init() { func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := fake.Get(ctx) - inf := f.Tekton().V1alpha2().ClusterTasks() + inf := f.Tekton().V1beta1().ClusterTasks() return context.WithValue(ctx, clustertask.Key{}, inf), inf.Informer() } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go b/pkg/client/injection/informers/pipeline/v1beta1/pipeline/fake/fake.go similarity index 93% rename from pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go rename to pkg/client/injection/informers/pipeline/v1beta1/pipeline/fake/fake.go index 946e54037a7..3b0460cff1a 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/pipeline/fake/fake.go @@ -22,7 +22,7 @@ import ( "context" fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" - pipeline "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/pipeline" + pipeline "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/pipeline" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) @@ -35,6 +35,6 @@ func init() { func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := fake.Get(ctx) - inf := f.Tekton().V1alpha2().Pipelines() + inf := f.Tekton().V1beta1().Pipelines() return context.WithValue(ctx, pipeline.Key{}, inf), inf.Informer() } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go b/pkg/client/injection/informers/pipeline/v1beta1/pipeline/pipeline.go similarity index 81% rename from pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go rename to pkg/client/injection/informers/pipeline/v1beta1/pipeline/pipeline.go index ff19269f11d..48afd99ddb7 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/pipeline/pipeline.go @@ -21,7 +21,7 @@ package pipeline import ( "context" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,16 +37,16 @@ type Key struct{} func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := factory.Get(ctx) - inf := f.Tekton().V1alpha2().Pipelines() + inf := f.Tekton().V1beta1().Pipelines() return context.WithValue(ctx, Key{}, inf), inf.Informer() } // Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha2.PipelineInformer { +func Get(ctx context.Context) v1beta1.PipelineInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.PipelineInformer from context.") + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1.PipelineInformer from context.") } - return untyped.(v1alpha2.PipelineInformer) + return untyped.(v1beta1.PipelineInformer) } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go b/pkg/client/injection/informers/pipeline/v1beta1/pipelinerun/fake/fake.go similarity index 93% rename from pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go rename to pkg/client/injection/informers/pipeline/v1beta1/pipelinerun/fake/fake.go index 995fffc705a..6170db795b8 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/pipelinerun/fake/fake.go @@ -22,7 +22,7 @@ import ( "context" fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" - pipelinerun "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun" + pipelinerun "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/pipelinerun" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) @@ -35,6 +35,6 @@ func init() { func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := fake.Get(ctx) - inf := f.Tekton().V1alpha2().PipelineRuns() + inf := f.Tekton().V1beta1().PipelineRuns() return context.WithValue(ctx, pipelinerun.Key{}, inf), inf.Informer() } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go b/pkg/client/injection/informers/pipeline/v1beta1/pipelinerun/pipelinerun.go similarity index 80% rename from pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go rename to pkg/client/injection/informers/pipeline/v1beta1/pipelinerun/pipelinerun.go index 8c18696bfab..0b3fc8e1c97 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/pipelinerun/pipelinerun.go @@ -21,7 +21,7 @@ package pipelinerun import ( "context" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,16 +37,16 @@ type Key struct{} func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := factory.Get(ctx) - inf := f.Tekton().V1alpha2().PipelineRuns() + inf := f.Tekton().V1beta1().PipelineRuns() return context.WithValue(ctx, Key{}, inf), inf.Informer() } // Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha2.PipelineRunInformer { +func Get(ctx context.Context) v1beta1.PipelineRunInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.PipelineRunInformer from context.") + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1.PipelineRunInformer from context.") } - return untyped.(v1alpha2.PipelineRunInformer) + return untyped.(v1beta1.PipelineRunInformer) } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go b/pkg/client/injection/informers/pipeline/v1beta1/task/fake/fake.go similarity index 94% rename from pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go rename to pkg/client/injection/informers/pipeline/v1beta1/task/fake/fake.go index 675368cd38c..9efa956eb22 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/task/fake/fake.go @@ -22,7 +22,7 @@ import ( "context" fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" - task "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/task" + task "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/task" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) @@ -35,6 +35,6 @@ func init() { func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := fake.Get(ctx) - inf := f.Tekton().V1alpha2().Tasks() + inf := f.Tekton().V1beta1().Tasks() return context.WithValue(ctx, task.Key{}, inf), inf.Informer() } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/task/task.go b/pkg/client/injection/informers/pipeline/v1beta1/task/task.go similarity index 82% rename from pkg/client/injection/informers/pipeline/v1alpha2/task/task.go rename to pkg/client/injection/informers/pipeline/v1beta1/task/task.go index ee1f1c3ec0e..c38102ddb32 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/task/task.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/task/task.go @@ -21,7 +21,7 @@ package task import ( "context" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,16 +37,16 @@ type Key struct{} func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := factory.Get(ctx) - inf := f.Tekton().V1alpha2().Tasks() + inf := f.Tekton().V1beta1().Tasks() return context.WithValue(ctx, Key{}, inf), inf.Informer() } // Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha2.TaskInformer { +func Get(ctx context.Context) v1beta1.TaskInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.TaskInformer from context.") + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1.TaskInformer from context.") } - return untyped.(v1alpha2.TaskInformer) + return untyped.(v1beta1.TaskInformer) } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go b/pkg/client/injection/informers/pipeline/v1beta1/taskrun/fake/fake.go similarity index 93% rename from pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go rename to pkg/client/injection/informers/pipeline/v1beta1/taskrun/fake/fake.go index 33ea930befa..ab9ffbda40d 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/taskrun/fake/fake.go @@ -22,7 +22,7 @@ import ( "context" fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" - taskrun "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/taskrun" + taskrun "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1beta1/taskrun" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) @@ -35,6 +35,6 @@ func init() { func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := fake.Get(ctx) - inf := f.Tekton().V1alpha2().TaskRuns() + inf := f.Tekton().V1beta1().TaskRuns() return context.WithValue(ctx, taskrun.Key{}, inf), inf.Informer() } diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go b/pkg/client/injection/informers/pipeline/v1beta1/taskrun/taskrun.go similarity index 81% rename from pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go rename to pkg/client/injection/informers/pipeline/v1beta1/taskrun/taskrun.go index 52addcae9c7..943f7eb108c 100644 --- a/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go +++ b/pkg/client/injection/informers/pipeline/v1beta1/taskrun/taskrun.go @@ -21,7 +21,7 @@ package taskrun import ( "context" - v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1" factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" @@ -37,16 +37,16 @@ type Key struct{} func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := factory.Get(ctx) - inf := f.Tekton().V1alpha2().TaskRuns() + inf := f.Tekton().V1beta1().TaskRuns() return context.WithValue(ctx, Key{}, inf), inf.Informer() } // Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha2.TaskRunInformer { +func Get(ctx context.Context) v1beta1.TaskRunInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.TaskRunInformer from context.") + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1beta1.TaskRunInformer from context.") } - return untyped.(v1alpha2.TaskRunInformer) + return untyped.(v1beta1.TaskRunInformer) } diff --git a/pkg/client/listers/pipeline/v1alpha2/clustertask.go b/pkg/client/listers/pipeline/v1beta1/clustertask.go similarity index 77% rename from pkg/client/listers/pipeline/v1alpha2/clustertask.go rename to pkg/client/listers/pipeline/v1beta1/clustertask.go index e71fbe7492a..73388bd7e6a 100644 --- a/pkg/client/listers/pipeline/v1alpha2/clustertask.go +++ b/pkg/client/listers/pipeline/v1beta1/clustertask.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -28,9 +28,9 @@ import ( // ClusterTaskLister helps list ClusterTasks. type ClusterTaskLister interface { // List lists all ClusterTasks in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.ClusterTask, err error) + List(selector labels.Selector) (ret []*v1beta1.ClusterTask, err error) // Get retrieves the ClusterTask from the index for a given name. - Get(name string) (*v1alpha2.ClusterTask, error) + Get(name string) (*v1beta1.ClusterTask, error) ClusterTaskListerExpansion } @@ -45,21 +45,21 @@ func NewClusterTaskLister(indexer cache.Indexer) ClusterTaskLister { } // List lists all ClusterTasks in the indexer. -func (s *clusterTaskLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterTask, err error) { +func (s *clusterTaskLister) List(selector labels.Selector) (ret []*v1beta1.ClusterTask, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ClusterTask)) + ret = append(ret, m.(*v1beta1.ClusterTask)) }) return ret, err } // Get retrieves the ClusterTask from the index for a given name. -func (s *clusterTaskLister) Get(name string) (*v1alpha2.ClusterTask, error) { +func (s *clusterTaskLister) Get(name string) (*v1beta1.ClusterTask, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("clustertask"), name) + return nil, errors.NewNotFound(v1beta1.Resource("clustertask"), name) } - return obj.(*v1alpha2.ClusterTask), nil + return obj.(*v1beta1.ClusterTask), nil } diff --git a/pkg/client/listers/pipeline/v1alpha2/expansion_generated.go b/pkg/client/listers/pipeline/v1beta1/expansion_generated.go similarity index 99% rename from pkg/client/listers/pipeline/v1alpha2/expansion_generated.go rename to pkg/client/listers/pipeline/v1beta1/expansion_generated.go index 19d3ffa1bc9..ca23ad825cf 100644 --- a/pkg/client/listers/pipeline/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/pipeline/v1beta1/expansion_generated.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 // ClusterTaskListerExpansion allows custom methods to be added to // ClusterTaskLister. diff --git a/pkg/client/listers/pipeline/v1alpha2/pipeline.go b/pkg/client/listers/pipeline/v1beta1/pipeline.go similarity index 80% rename from pkg/client/listers/pipeline/v1alpha2/pipeline.go rename to pkg/client/listers/pipeline/v1beta1/pipeline.go index 5fa74362ac4..f35adf32a1d 100644 --- a/pkg/client/listers/pipeline/v1alpha2/pipeline.go +++ b/pkg/client/listers/pipeline/v1beta1/pipeline.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -28,7 +28,7 @@ import ( // PipelineLister helps list Pipelines. type PipelineLister interface { // List lists all Pipelines in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) + List(selector labels.Selector) (ret []*v1beta1.Pipeline, err error) // Pipelines returns an object that can list and get Pipelines. Pipelines(namespace string) PipelineNamespaceLister PipelineListerExpansion @@ -45,9 +45,9 @@ func NewPipelineLister(indexer cache.Indexer) PipelineLister { } // List lists all Pipelines in the indexer. -func (s *pipelineLister) List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) { +func (s *pipelineLister) List(selector labels.Selector) (ret []*v1beta1.Pipeline, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.Pipeline)) + ret = append(ret, m.(*v1beta1.Pipeline)) }) return ret, err } @@ -60,9 +60,9 @@ func (s *pipelineLister) Pipelines(namespace string) PipelineNamespaceLister { // PipelineNamespaceLister helps list and get Pipelines. type PipelineNamespaceLister interface { // List lists all Pipelines in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) + List(selector labels.Selector) (ret []*v1beta1.Pipeline, err error) // Get retrieves the Pipeline from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.Pipeline, error) + Get(name string) (*v1beta1.Pipeline, error) PipelineNamespaceListerExpansion } @@ -74,21 +74,21 @@ type pipelineNamespaceLister struct { } // List lists all Pipelines in the indexer for a given namespace. -func (s pipelineNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) { +func (s pipelineNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Pipeline, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.Pipeline)) + ret = append(ret, m.(*v1beta1.Pipeline)) }) return ret, err } // Get retrieves the Pipeline from the indexer for a given namespace and name. -func (s pipelineNamespaceLister) Get(name string) (*v1alpha2.Pipeline, error) { +func (s pipelineNamespaceLister) Get(name string) (*v1beta1.Pipeline, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("pipeline"), name) + return nil, errors.NewNotFound(v1beta1.Resource("pipeline"), name) } - return obj.(*v1alpha2.Pipeline), nil + return obj.(*v1beta1.Pipeline), nil } diff --git a/pkg/client/listers/pipeline/v1alpha2/pipelinerun.go b/pkg/client/listers/pipeline/v1beta1/pipelinerun.go similarity index 80% rename from pkg/client/listers/pipeline/v1alpha2/pipelinerun.go rename to pkg/client/listers/pipeline/v1beta1/pipelinerun.go index c83afb1a6d1..29eb1f86df4 100644 --- a/pkg/client/listers/pipeline/v1alpha2/pipelinerun.go +++ b/pkg/client/listers/pipeline/v1beta1/pipelinerun.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -28,7 +28,7 @@ import ( // PipelineRunLister helps list PipelineRuns. type PipelineRunLister interface { // List lists all PipelineRuns in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) + List(selector labels.Selector) (ret []*v1beta1.PipelineRun, err error) // PipelineRuns returns an object that can list and get PipelineRuns. PipelineRuns(namespace string) PipelineRunNamespaceLister PipelineRunListerExpansion @@ -45,9 +45,9 @@ func NewPipelineRunLister(indexer cache.Indexer) PipelineRunLister { } // List lists all PipelineRuns in the indexer. -func (s *pipelineRunLister) List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) { +func (s *pipelineRunLister) List(selector labels.Selector) (ret []*v1beta1.PipelineRun, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PipelineRun)) + ret = append(ret, m.(*v1beta1.PipelineRun)) }) return ret, err } @@ -60,9 +60,9 @@ func (s *pipelineRunLister) PipelineRuns(namespace string) PipelineRunNamespaceL // PipelineRunNamespaceLister helps list and get PipelineRuns. type PipelineRunNamespaceLister interface { // List lists all PipelineRuns in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) + List(selector labels.Selector) (ret []*v1beta1.PipelineRun, err error) // Get retrieves the PipelineRun from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.PipelineRun, error) + Get(name string) (*v1beta1.PipelineRun, error) PipelineRunNamespaceListerExpansion } @@ -74,21 +74,21 @@ type pipelineRunNamespaceLister struct { } // List lists all PipelineRuns in the indexer for a given namespace. -func (s pipelineRunNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) { +func (s pipelineRunNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.PipelineRun, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.PipelineRun)) + ret = append(ret, m.(*v1beta1.PipelineRun)) }) return ret, err } // Get retrieves the PipelineRun from the indexer for a given namespace and name. -func (s pipelineRunNamespaceLister) Get(name string) (*v1alpha2.PipelineRun, error) { +func (s pipelineRunNamespaceLister) Get(name string) (*v1beta1.PipelineRun, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("pipelinerun"), name) + return nil, errors.NewNotFound(v1beta1.Resource("pipelinerun"), name) } - return obj.(*v1alpha2.PipelineRun), nil + return obj.(*v1beta1.PipelineRun), nil } diff --git a/pkg/client/listers/pipeline/v1alpha2/task.go b/pkg/client/listers/pipeline/v1beta1/task.go similarity index 78% rename from pkg/client/listers/pipeline/v1alpha2/task.go rename to pkg/client/listers/pipeline/v1beta1/task.go index 9b8b2ee73eb..fa6284eeb04 100644 --- a/pkg/client/listers/pipeline/v1alpha2/task.go +++ b/pkg/client/listers/pipeline/v1beta1/task.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -28,7 +28,7 @@ import ( // TaskLister helps list Tasks. type TaskLister interface { // List lists all Tasks in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.Task, err error) + List(selector labels.Selector) (ret []*v1beta1.Task, err error) // Tasks returns an object that can list and get Tasks. Tasks(namespace string) TaskNamespaceLister TaskListerExpansion @@ -45,9 +45,9 @@ func NewTaskLister(indexer cache.Indexer) TaskLister { } // List lists all Tasks in the indexer. -func (s *taskLister) List(selector labels.Selector) (ret []*v1alpha2.Task, err error) { +func (s *taskLister) List(selector labels.Selector) (ret []*v1beta1.Task, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.Task)) + ret = append(ret, m.(*v1beta1.Task)) }) return ret, err } @@ -60,9 +60,9 @@ func (s *taskLister) Tasks(namespace string) TaskNamespaceLister { // TaskNamespaceLister helps list and get Tasks. type TaskNamespaceLister interface { // List lists all Tasks in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.Task, err error) + List(selector labels.Selector) (ret []*v1beta1.Task, err error) // Get retrieves the Task from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.Task, error) + Get(name string) (*v1beta1.Task, error) TaskNamespaceListerExpansion } @@ -74,21 +74,21 @@ type taskNamespaceLister struct { } // List lists all Tasks in the indexer for a given namespace. -func (s taskNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Task, err error) { +func (s taskNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Task, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.Task)) + ret = append(ret, m.(*v1beta1.Task)) }) return ret, err } // Get retrieves the Task from the indexer for a given namespace and name. -func (s taskNamespaceLister) Get(name string) (*v1alpha2.Task, error) { +func (s taskNamespaceLister) Get(name string) (*v1beta1.Task, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("task"), name) + return nil, errors.NewNotFound(v1beta1.Resource("task"), name) } - return obj.(*v1alpha2.Task), nil + return obj.(*v1beta1.Task), nil } diff --git a/pkg/client/listers/pipeline/v1alpha2/taskrun.go b/pkg/client/listers/pipeline/v1beta1/taskrun.go similarity index 80% rename from pkg/client/listers/pipeline/v1alpha2/taskrun.go rename to pkg/client/listers/pipeline/v1beta1/taskrun.go index 53302307ef6..eff83408030 100644 --- a/pkg/client/listers/pipeline/v1alpha2/taskrun.go +++ b/pkg/client/listers/pipeline/v1beta1/taskrun.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( - v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -28,7 +28,7 @@ import ( // TaskRunLister helps list TaskRuns. type TaskRunLister interface { // List lists all TaskRuns in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) + List(selector labels.Selector) (ret []*v1beta1.TaskRun, err error) // TaskRuns returns an object that can list and get TaskRuns. TaskRuns(namespace string) TaskRunNamespaceLister TaskRunListerExpansion @@ -45,9 +45,9 @@ func NewTaskRunLister(indexer cache.Indexer) TaskRunLister { } // List lists all TaskRuns in the indexer. -func (s *taskRunLister) List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) { +func (s *taskRunLister) List(selector labels.Selector) (ret []*v1beta1.TaskRun, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TaskRun)) + ret = append(ret, m.(*v1beta1.TaskRun)) }) return ret, err } @@ -60,9 +60,9 @@ func (s *taskRunLister) TaskRuns(namespace string) TaskRunNamespaceLister { // TaskRunNamespaceLister helps list and get TaskRuns. type TaskRunNamespaceLister interface { // List lists all TaskRuns in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) + List(selector labels.Selector) (ret []*v1beta1.TaskRun, err error) // Get retrieves the TaskRun from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.TaskRun, error) + Get(name string) (*v1beta1.TaskRun, error) TaskRunNamespaceListerExpansion } @@ -74,21 +74,21 @@ type taskRunNamespaceLister struct { } // List lists all TaskRuns in the indexer for a given namespace. -func (s taskRunNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) { +func (s taskRunNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.TaskRun, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TaskRun)) + ret = append(ret, m.(*v1beta1.TaskRun)) }) return ret, err } // Get retrieves the TaskRun from the indexer for a given namespace and name. -func (s taskRunNamespaceLister) Get(name string) (*v1alpha2.TaskRun, error) { +func (s taskRunNamespaceLister) Get(name string) (*v1beta1.TaskRun, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("taskrun"), name) + return nil, errors.NewNotFound(v1beta1.Resource("taskrun"), name) } - return obj.(*v1alpha2.TaskRun), nil + return obj.(*v1beta1.TaskRun), nil } diff --git a/pkg/pod/pod_test.go b/pkg/pod/pod_test.go index 5ee55acb30c..254c55e7912 100644 --- a/pkg/pod/pod_test.go +++ b/pkg/pod/pod_test.go @@ -25,7 +25,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/system" "github.com/tektoncd/pipeline/test/names" corev1 "k8s.io/api/core/v1" @@ -79,7 +79,7 @@ func TestMakePod(t *testing.T) { wantAnnotations map[string]string }{{ desc: "simple", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "name", Image: "image", @@ -115,7 +115,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "with service account", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "name", Image: "image", @@ -169,7 +169,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "with-pod-template", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "name", Image: "image", @@ -237,7 +237,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "very long step name", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "a-very-very-long-character-step-name-to-trigger-max-len----and-invalid-characters", Image: "image", @@ -273,7 +273,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "step name ends with non alphanumeric", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "ends-with-invalid-%%__$$", Image: "image", @@ -309,7 +309,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "workingDir in workspace", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "name", Image: "image", @@ -355,7 +355,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "sidecar container", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "primary-name", Image: "primary-image", @@ -404,7 +404,7 @@ func TestMakePod(t *testing.T) { }, }, { desc: "sidecar container with script", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "primary-name", Image: "primary-image", @@ -471,7 +471,7 @@ sidecar-script-heredoc-randomly-generated-mz4c7 }, }, { desc: "resource request", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Image: "image", Command: []string{"cmd"}, // avoid entrypoint lookup. @@ -553,7 +553,7 @@ sidecar-script-heredoc-randomly-generated-mz4c7 }, }, { desc: "step with script and stepTemplate", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ Env: []corev1.EnvVar{{Name: "FOO", Value: "bar"}}, Args: []string{"template", "args"}, @@ -681,7 +681,7 @@ script-heredoc-randomly-generated-78c5n }, { desc: "using another scheduler", ts: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{ { Container: corev1.Container{ diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 98749f8eb37..cbd410d0e09 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -27,7 +27,7 @@ import ( apisconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/artifacts" listers "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" resourcelisters "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" @@ -236,8 +236,8 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1alpha1.PipelineRun) er // and may not have had all of the assumed default specified. pr.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) - if err := pr.ConvertUp(ctx, &v1alpha2.PipelineRun{}); err != nil { - if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + if err := pr.ConvertUp(ctx, &v1beta1.PipelineRun{}); err != nil { + if ce, ok := err.(*v1beta1.CannotConvertError); ok { pr.Status.MarkResourceNotConvertible(ce) return nil } @@ -247,7 +247,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1alpha1.PipelineRun) er getPipelineFunc := c.getPipelineFunc(pr) pipelineMeta, pipelineSpec, err := resources.GetPipelineData(ctx, pr, getPipelineFunc) if err != nil { - if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + if ce, ok := err.(*v1beta1.CannotConvertError); ok { pr.Status.MarkResourceNotConvertible(ce) return nil } @@ -733,7 +733,7 @@ func (c *Reconciler) makeConditionCheckContainer(rprt *resources.ResolvedPipelin TaskSpec: taskSpec, ServiceAccountName: pr.GetServiceAccountName(rprt.PipelineTask.Name), Params: rcc.PipelineTaskCondition.Params, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: rcc.ToTaskResourceBindings(), }, Timeout: getTaskRunTimeout(pr, rprt), diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index d3710d74b7f..01da170c50b 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -27,7 +27,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun/resources" taskrunresources "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" @@ -295,7 +295,7 @@ func TestReconcile_PipelineSpecTaskSpec(t *testing.T) { ps := []*v1alpha1.Pipeline{ tb.Pipeline("test-pipeline", "foo", tb.PipelineSpec( - tb.PipelineTask("unit-test-task-spec", "", tb.PipelineTaskSpec(&v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + tb.PipelineTask("unit-test-task-spec", "", tb.PipelineTaskSpec(&v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage"}}}, diff --git a/pkg/reconciler/pipelinerun/resources/conditionresolution.go b/pkg/reconciler/pipelinerun/resources/conditionresolution.go index 3294da25277..52ba82a8917 100644 --- a/pkg/reconciler/pipelinerun/resources/conditionresolution.go +++ b/pkg/reconciler/pipelinerun/resources/conditionresolution.go @@ -22,7 +22,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/resource" resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" corev1 "k8s.io/api/core/v1" @@ -99,7 +99,7 @@ func (rcc *ResolvedConditionCheck) ConditionToTaskSpec() (*v1alpha1.TaskSpec, er } t := &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{rcc.Condition.Spec.Check}, }, } diff --git a/pkg/reconciler/pipelinerun/resources/conditionresolution_test.go b/pkg/reconciler/pipelinerun/resources/conditionresolution_test.go index 80aec7f805d..c898478c8a7 100644 --- a/pkg/reconciler/pipelinerun/resources/conditionresolution_test.go +++ b/pkg/reconciler/pipelinerun/resources/conditionresolution_test.go @@ -22,7 +22,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" tb "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -196,7 +196,7 @@ func TestResolvedConditionCheck_ConditionToTaskSpec(t *testing.T) { tb.ConditionSpecCheck("foo", "ubuntu"), )), want: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "foo", Image: "ubuntu", @@ -210,7 +210,7 @@ func TestResolvedConditionCheck_ConditionToTaskSpec(t *testing.T) { tb.ConditionSpecCheck("", "ubuntu"), )), want: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "condition-check-bar", Image: "ubuntu", @@ -227,7 +227,7 @@ func TestResolvedConditionCheck_ConditionToTaskSpec(t *testing.T) { tb.ConditionParamSpec("img", v1alpha1.ParamTypeString), )), want: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "$(inputs.params.name)", Image: "$(inputs.params.img)", @@ -258,7 +258,7 @@ func TestResolvedConditionCheck_ConditionToTaskSpec(t *testing.T) { )), }, want: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "name", Image: "ubuntu", diff --git a/pkg/reconciler/pipelinerun/resources/input_output_steps.go b/pkg/reconciler/pipelinerun/resources/input_output_steps.go index eec7460b67c..0079f7b1b5d 100644 --- a/pkg/reconciler/pipelinerun/resources/input_output_steps.go +++ b/pkg/reconciler/pipelinerun/resources/input_output_steps.go @@ -20,7 +20,7 @@ import ( "path/filepath" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) // GetOutputSteps will add the correct `path` to the output resources for pt @@ -103,7 +103,7 @@ func WrapSteps(tr *v1alpha1.TaskRunSpec, pt *v1alpha1.PipelineTask, inputs, outp return } if tr.Resources == nil { - tr.Resources = &v1alpha2.TaskRunResources{} + tr.Resources = &v1beta1.TaskRunResources{} } if pt.Resources != nil { // Add presteps to setup updated input diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go index bc7fdc2a05b..f3025f20541 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go @@ -27,7 +27,7 @@ import ( "knative.dev/pkg/apis" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" "github.com/tektoncd/pipeline/pkg/list" "github.com/tektoncd/pipeline/pkg/names" @@ -321,7 +321,7 @@ func ResolvePipelineRun( spec = *pt.TaskSpec } spec.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) - if err := spec.ConvertUp(ctx, &v1alpha2.TaskSpec{}); err != nil { + if err := spec.ConvertUp(ctx, &v1beta1.TaskSpec{}); err != nil { return nil, err } rtr, err := ResolvePipelineTaskResources(pt, &spec, taskName, kind, providedResources) diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go index bdcb40fe8bc..fbb638a4f3a 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution_test.go @@ -25,7 +25,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/reconciler/pipeline/dag" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" tb "github.com/tektoncd/pipeline/test/builder" @@ -93,7 +93,7 @@ var task = &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{ Name: "task", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, @@ -104,7 +104,7 @@ var clustertask = &v1alpha1.ClusterTask{ ObjectMeta: metav1.ObjectMeta{ Name: "clustertask", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, @@ -459,7 +459,7 @@ var taskWithOptionalResourcesDeprecated = &v1alpha1.Task{ Name: "task", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, @@ -492,12 +492,12 @@ var taskWithOptionalResources = &v1alpha1.Task{ Name: "task", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, - Resources: &v1alpha2.TaskResources{ - Inputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Resources: &v1beta1.TaskResources{ + Inputs: []v1beta1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "optional-input", Type: "git", Optional: true, @@ -506,7 +506,7 @@ var taskWithOptionalResources = &v1alpha1.Task{ Type: "git", Optional: false, }}}, - Outputs: []v1alpha2.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Outputs: []v1beta1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "optional-output", Type: "git", Optional: true, @@ -1187,7 +1187,7 @@ func TestResolvePipelineRun(t *testing.T) { tb.PipelineTaskOutputResource("output1", "git-resource"), ), tb.PipelineTask("mytask4", "", - tb.PipelineTaskSpec(&v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + tb.PipelineTaskSpec(&v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, diff --git a/pkg/reconciler/pipelinerun/resources/pipelinespec.go b/pkg/reconciler/pipelinerun/resources/pipelinespec.go index c3bc2845e1b..46b1f1e917d 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinespec.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinespec.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -44,7 +44,7 @@ func GetPipelineData(ctx context.Context, pipelineRun *v1alpha1.PipelineRun, get pipelineMeta = t.PipelineMetadata() pipelineSpec = t.PipelineSpec() - if err := pipelineSpec.ConvertUp(ctx, &v1alpha2.PipelineSpec{}); err != nil { + if err := pipelineSpec.ConvertUp(ctx, &v1beta1.PipelineSpec{}); err != nil { return nil, nil, err } case pipelineRun.Spec.PipelineSpec != nil: diff --git a/pkg/reconciler/taskrun/resources/apply_test.go b/pkg/reconciler/taskrun/resources/apply_test.go index 65cbf7da3bf..24c7224601f 100644 --- a/pkg/reconciler/taskrun/resources/apply_test.go +++ b/pkg/reconciler/taskrun/resources/apply_test.go @@ -22,7 +22,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/resource" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" "github.com/tektoncd/pipeline/test/builder" @@ -46,7 +46,7 @@ var ( } simpleTaskSpec = &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Sidecars: []v1alpha1.Sidecar{{ Container: corev1.Container{ Name: "foo", @@ -160,7 +160,7 @@ var ( }, }, }}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "workspace", @@ -182,13 +182,13 @@ var ( } gcsTaskSpec = &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "foobar", Image: "someImage", Args: []string{"$(outputs.resources.bucket.path)"}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "bucket", @@ -198,7 +198,7 @@ var ( }, } - arrayParamTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + arrayParamTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "simple-image", Image: "some-image", @@ -210,7 +210,7 @@ var ( }}}, }} - arrayAndStringParamTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + arrayAndStringParamTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "simple-image", Image: "some-image", @@ -222,7 +222,7 @@ var ( }}}, }} - multipleArrayParamsTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + multipleArrayParamsTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "simple-image", Image: "some-image", @@ -234,7 +234,7 @@ var ( }}}, }} - multipleArrayAndStringsParamsTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + multipleArrayAndStringsParamsTaskSpec = &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "simple-image", Image: "image-$(inputs.params.string-param2)", @@ -604,7 +604,7 @@ func TestApplyResources(t *testing.T) { func TestApplyWorkspaces(t *testing.T) { names.TestingSeed() - ts := &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts := &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ Env: []corev1.EnvVar{{ Name: "template-var", @@ -715,7 +715,7 @@ func TestApplyWorkspaces(t *testing.T) { func TestTaskResults(t *testing.T) { names.TestingSeed() - ts := &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts := &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Results: []v1alpha1.TaskResult{{ Name: "current-date-unix-timestamp", Description: "The current date in unix timestamp format", diff --git a/pkg/reconciler/taskrun/resources/image_exporter_test.go b/pkg/reconciler/taskrun/resources/image_exporter_test.go index a9ba08e2526..7551b411754 100644 --- a/pkg/reconciler/taskrun/resources/image_exporter_test.go +++ b/pkg/reconciler/taskrun/resources/image_exporter_test.go @@ -21,7 +21,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/test/names" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,11 +41,11 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-image", @@ -68,7 +68,7 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-image", @@ -105,13 +105,13 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}, {Container: corev1.Container{ Name: "step2", }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-image", @@ -134,7 +134,7 @@ func TestAddOutputImageDigestExporter(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-image", diff --git a/pkg/reconciler/taskrun/resources/input_resource_test.go b/pkg/reconciler/taskrun/resources/input_resource_test.go index d4a27ecb7fd..89f5a6bb493 100644 --- a/pkg/reconciler/taskrun/resources/input_resource_test.go +++ b/pkg/reconciler/taskrun/resources/input_resource_test.go @@ -22,7 +22,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/resource" "github.com/tektoncd/pipeline/pkg/artifacts" "github.com/tektoncd/pipeline/pkg/logging" @@ -281,8 +281,8 @@ func TestAddResourceToTask(t *testing.T) { Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }}, @@ -292,8 +292,8 @@ func TestAddResourceToTask(t *testing.T) { Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: multipleGitInputs, }, }}, @@ -303,8 +303,8 @@ func TestAddResourceToTask(t *testing.T) { Name: "task-with-targetpath", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: gcsInputs, }, }}, @@ -314,8 +314,8 @@ func TestAddResourceToTask(t *testing.T) { Name: "build-from-repo-with-optional-source", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: optionalGitInputs, }, }}, @@ -330,7 +330,7 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -355,7 +355,7 @@ func TestAddResourceToTask(t *testing.T) { taskRun: taskRun, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-9l9zj", Image: "override-with-git:latest", @@ -364,7 +364,7 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }, @@ -381,7 +381,7 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -395,7 +395,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-9l9zj", Image: "override-with-git:latest", @@ -404,7 +404,7 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }, @@ -421,7 +421,7 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -442,7 +442,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-mz4c7", Image: "override-with-git:latest", @@ -458,7 +458,7 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: multipleGitInputs, }, }, @@ -475,7 +475,7 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -489,7 +489,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-9l9zj", Image: "override-with-git:latest", @@ -498,7 +498,7 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }, @@ -515,7 +515,7 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -529,7 +529,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-9l9zj", Image: "override-with-git:latest", @@ -538,7 +538,7 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }, @@ -556,7 +556,7 @@ func TestAddResourceToTask(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -571,7 +571,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-gitspace-mz4c7", Image: "busybox", @@ -588,7 +588,7 @@ func TestAddResourceToTask(t *testing.T) { PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ClaimName: "pipelinerun-pvc"}, }, }}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }, @@ -605,7 +605,7 @@ func TestAddResourceToTask(t *testing.T) { TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -619,7 +619,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-sslVerify-false-9l9zj", Image: "override-with-git:latest", @@ -628,7 +628,7 @@ func TestAddResourceToTask(t *testing.T) { WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-sslVerify-false"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }, @@ -642,7 +642,7 @@ func TestAddResourceToTask(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -656,7 +656,7 @@ func TestAddResourceToTask(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-storage1-9l9zj", Image: "busybox", @@ -674,7 +674,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Image: "google/cloud-sdk", }, }}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gcsInputs, }, }, @@ -692,7 +692,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -707,7 +707,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-workspace-mz4c7", Image: "busybox", @@ -724,7 +724,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ClaimName: "pipelinerun-pvc"}, }, }}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gcsInputs, }, }, @@ -738,7 +738,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -760,7 +760,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -780,8 +780,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "workspace-invalid", @@ -799,8 +799,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: clusterInputs, }, }}, @@ -814,7 +814,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir TaskRef: &v1alpha1.TaskRef{ Name: "build-from-repo", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "target-cluster", @@ -828,7 +828,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "kubeconfig-9l9zj", Image: "override-with-kubeconfig-writer:latest", @@ -837,7 +837,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir "-clusterConfig", `{"name":"cluster3","type":"cluster","url":"http://10.10.10.10","revision":"","username":"","password":"","namespace":"namespace1","token":"","Insecure":false,"cadata":"bXktY2EtY2VydAo=","secrets":null}`, }, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: clusterInputs, }, }, @@ -849,8 +849,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: clusterInputs, }, }}, @@ -864,7 +864,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir TaskRef: &v1alpha1.TaskRef{ Name: "build-from-repo", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "target-cluster", @@ -878,7 +878,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "kubeconfig-9l9zj", Image: "override-with-kubeconfig-writer:latest", @@ -898,7 +898,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir Name: "CADATA", }}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: clusterInputs, }, }, @@ -915,7 +915,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir TaskRef: &v1alpha1.TaskRef{ Name: "simpleTask", }, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -929,7 +929,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "git-source-the-git-with-branch-9l9zj", Image: "override-with-git:latest", @@ -938,7 +938,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir WorkingDir: "/workspace", Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "the-git-with-branch"}}, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: optionalGitInputs, }, }, @@ -985,8 +985,8 @@ func TestStorageInputResource(t *testing.T) { }{{ desc: "inputs with no resource spec and resource ref", task: &v1alpha1.Task{ - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "gcs-input-resource", @@ -1001,7 +1001,7 @@ func TestStorageInputResource(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "gcs-input-resource", @@ -1014,8 +1014,8 @@ func TestStorageInputResource(t *testing.T) { }, { desc: "inputs with resource spec and no resource ref", task: &v1alpha1.Task{ - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: gcsStorageInputs, }, }}, @@ -1026,7 +1026,7 @@ func TestStorageInputResource(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "gcs-input-resource", @@ -1047,7 +1047,7 @@ func TestStorageInputResource(t *testing.T) { }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-gcs-input-resource-9l9zj", Image: "busybox", @@ -1065,7 +1065,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource Image: "google/cloud-sdk", }, }}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gcsStorageInputs, }, }, @@ -1093,8 +1093,8 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource Name: "get-storage", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: gcsStorageInputs, }, }}, @@ -1105,7 +1105,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "gcs-input-resource", @@ -1119,7 +1119,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "create-dir-storage-gcs-keys-9l9zj", Image: "busybox", @@ -1143,7 +1143,7 @@ gsutil rsync -d -r gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, }, }}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gcsStorageInputs, }, Volumes: []corev1.Volume{{ @@ -1158,8 +1158,8 @@ gsutil rsync -d -r gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, { desc: "optional inputs with no resource spec and no resource ref", task: &v1alpha1.Task{ - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: optionalStorageInputs, }, }}, @@ -1171,16 +1171,16 @@ gsutil rsync -d -r gs://fake-bucket/rules.zip /workspace/gcs-input-resource }, Spec: v1alpha1.TaskRunSpec{ Params: nil, - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: nil, }, }, }, wantErr: false, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: nil, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: optionalStorageInputs, }, }, @@ -1207,8 +1207,8 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Name: "build-from-repo", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, }}, @@ -1218,8 +1218,8 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Name: "task-with-targetpath", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: gcsInputs, }, }}, @@ -1229,8 +1229,8 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Name: "task-with-multiple-gcs-inputs", Namespace: "marshmallow", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: multipleGcsInputs, }, }}, @@ -1272,7 +1272,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1286,7 +1286,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }, }, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "artifact-dest-mkdir-gitspace-9l9zj", Image: "busybox", @@ -1299,7 +1299,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Env: gcsEnv, VolumeMounts: gcsVolumeMounts, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gitInputs, }, Volumes: gcsVolumes, @@ -1318,7 +1318,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1332,7 +1332,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }, }, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "artifact-dest-mkdir-workspace-mssqb", Image: "busybox", @@ -1345,7 +1345,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Env: gcsEnv, VolumeMounts: gcsVolumeMounts, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: gcsInputs, }, Volumes: gcsVolumes, @@ -1364,7 +1364,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ ResourceRef: &v1alpha1.PipelineResourceRef{ @@ -1386,7 +1386,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { }, }, want: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "artifact-dest-mkdir-workspace-vr6ds", Image: "busybox", @@ -1410,7 +1410,7 @@ func TestAddStepsToTaskWithBucketFromConfigMap(t *testing.T) { Env: gcsEnv, VolumeMounts: gcsVolumeMounts, }}}, - Resources: &v1alpha2.TaskResources{ + Resources: &v1beta1.TaskResources{ Inputs: multipleGcsInputs, }, Volumes: gcsVolumes, diff --git a/pkg/reconciler/taskrun/resources/output_resource_test.go b/pkg/reconciler/taskrun/resources/output_resource_test.go index 210ab80eac4..8e7624ac2a9 100644 --- a/pkg/reconciler/taskrun/resources/output_resource_test.go +++ b/pkg/reconciler/taskrun/resources/output_resource_test.go @@ -21,7 +21,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/resource" "github.com/tektoncd/pipeline/pkg/artifacts" "github.com/tektoncd/pipeline/pkg/logging" @@ -122,7 +122,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -149,8 +149,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -210,7 +210,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -229,8 +229,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -285,7 +285,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -304,8 +304,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -330,7 +330,7 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -348,8 +348,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -377,7 +377,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -404,8 +404,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -483,7 +483,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -502,8 +502,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -568,7 +568,7 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -587,8 +587,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -632,7 +632,7 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -650,8 +650,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -699,7 +699,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -717,8 +717,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -746,7 +746,7 @@ func TestValidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -764,8 +764,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -789,7 +789,7 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -807,8 +807,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -831,7 +831,7 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -856,8 +856,8 @@ func TestValidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -922,7 +922,7 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Inputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -949,8 +949,8 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Inputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -988,7 +988,7 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -1007,8 +1007,8 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -1037,7 +1037,7 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -1055,8 +1055,8 @@ func TestValidOutputResourcesWithBucketStorage(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -1133,8 +1133,8 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -1154,7 +1154,7 @@ func TestInvalidOutputResources(t *testing.T) { }}, }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -1176,8 +1176,8 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -1206,7 +1206,7 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskRunSpec{ - Resources: &v1alpha2.TaskRunResources{ + Resources: &v1beta1.TaskRunResources{ Outputs: []v1alpha1.TaskResourceBinding{{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: "source-workspace", @@ -1224,8 +1224,8 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", @@ -1244,8 +1244,8 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", Type: "git", @@ -1274,8 +1274,8 @@ func TestInvalidOutputResources(t *testing.T) { Namespace: "marshmallow", }, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ - Resources: &v1alpha2.TaskResources{ + TaskSpec: v1beta1.TaskSpec{ + Resources: &v1beta1.TaskResources{ Outputs: []v1alpha1.TaskResource{{ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: "source-workspace", Type: "git", diff --git a/pkg/reconciler/taskrun/resources/taskresourceresolution.go b/pkg/reconciler/taskrun/resources/taskresourceresolution.go index 31546992cd7..b501b0b5ac8 100644 --- a/pkg/reconciler/taskrun/resources/taskresourceresolution.go +++ b/pkg/reconciler/taskrun/resources/taskresourceresolution.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -45,7 +45,7 @@ type GetResource func(string) (*v1alpha1.PipelineResource, error) // ResolveTaskResources looks up PipelineResources referenced by inputs and outputs and returns // a structure that unites the resolved references and the Task Spec. If referenced PipelineResources // can't be found, an error is returned. -func ResolveTaskResources(ts *v1alpha1.TaskSpec, taskName string, kind v1alpha1.TaskKind, inputs []v1alpha2.TaskResourceBinding, outputs []v1alpha2.TaskResourceBinding, gr GetResource) (*ResolvedTaskResources, error) { +func ResolveTaskResources(ts *v1alpha1.TaskSpec, taskName string, kind v1alpha1.TaskKind, inputs []v1beta1.TaskResourceBinding, outputs []v1beta1.TaskResourceBinding, gr GetResource) (*ResolvedTaskResources, error) { rtr := ResolvedTaskResources{ TaskName: taskName, TaskSpec: ts, diff --git a/pkg/reconciler/taskrun/resources/taskresourceresolution_test.go b/pkg/reconciler/taskrun/resources/taskresourceresolution_test.go index 342214c9bc2..77c494471bf 100644 --- a/pkg/reconciler/taskrun/resources/taskresourceresolution_test.go +++ b/pkg/reconciler/taskrun/resources/taskresourceresolution_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -76,7 +76,7 @@ func TestResolveTaskRun(t *testing.T) { taskName := "orchestrate" kind := v1alpha1.NamespacedTaskKind - taskSpec := v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + taskSpec := v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, @@ -198,7 +198,7 @@ func TestResolveTaskRun_missingInput(t *testing.T) { } func TestResolveTaskRun_noResources(t *testing.T) { - taskSpec := v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + taskSpec := v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, diff --git a/pkg/reconciler/taskrun/resources/taskspec.go b/pkg/reconciler/taskrun/resources/taskspec.go index b2d19f09660..9f59de771e6 100644 --- a/pkg/reconciler/taskrun/resources/taskspec.go +++ b/pkg/reconciler/taskrun/resources/taskspec.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/contexts" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -50,7 +50,7 @@ func GetTaskData(ctx context.Context, taskRun *v1alpha1.TaskRun, getTask GetTask taskSpec = t.TaskSpec() taskSpec.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) - if err := taskSpec.ConvertUp(ctx, &v1alpha2.TaskSpec{}); err != nil { + if err := taskSpec.ConvertUp(ctx, &v1beta1.TaskSpec{}); err != nil { return nil, nil, err } case taskRun.Spec.TaskSpec != nil: diff --git a/pkg/reconciler/taskrun/resources/taskspec_test.go b/pkg/reconciler/taskrun/resources/taskspec_test.go index a5f74996211..5b71476fce3 100644 --- a/pkg/reconciler/taskrun/resources/taskspec_test.go +++ b/pkg/reconciler/taskrun/resources/taskspec_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -32,7 +32,7 @@ func TestGetTaskSpec_Ref(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "orchestrate", }, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, @@ -70,7 +70,7 @@ func TestGetTaskSpec_Embedded(t *testing.T) { Name: "mytaskrun", }, Spec: v1alpha1.TaskRunSpec{ - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step1", }}}, diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index e0ef3b694e0..f4538f18d58 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -27,7 +27,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/resource" listers "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" resourcelisters "github.com/tektoncd/pipeline/pkg/client/resource/listers/resource/v1alpha1" @@ -232,8 +232,8 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error // and may not have had all of the assumed default specified. tr.SetDefaults(contexts.WithUpgradeViaDefaulting(ctx)) - if err := tr.ConvertUp(ctx, &v1alpha2.TaskRun{}); err != nil { - if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + if err := tr.ConvertUp(ctx, &v1beta1.TaskRun{}); err != nil { + if ce, ok := err.(*v1beta1.CannotConvertError); ok { tr.Status.MarkResourceNotConvertible(ce) return nil } @@ -252,7 +252,7 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error getTaskFunc, kind := c.getTaskFunc(tr) taskMeta, taskSpec, err := resources.GetTaskData(ctx, tr, getTaskFunc) if err != nil { - if ce, ok := err.(*v1alpha2.CannotConvertError); ok { + if ce, ok := err.(*v1beta1.CannotConvertError); ok { tr.Status.MarkResourceNotConvertible(ce) return nil } @@ -297,8 +297,8 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error return nil } - inputs := []v1alpha2.TaskResourceBinding{} - outputs := []v1alpha2.TaskResourceBinding{} + inputs := []v1beta1.TaskResourceBinding{} + outputs := []v1beta1.TaskResourceBinding{} if tr.Spec.Resources != nil { inputs = tr.Spec.Resources.Inputs outputs = tr.Spec.Resources.Outputs diff --git a/pkg/reconciler/taskrun/validate_resources.go b/pkg/reconciler/taskrun/validate_resources.go index 567dbfa3097..0a0c6776219 100644 --- a/pkg/reconciler/taskrun/validate_resources.go +++ b/pkg/reconciler/taskrun/validate_resources.go @@ -20,12 +20,12 @@ import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/list" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" ) -func validateResources(requiredResources []v1alpha2.TaskResource, providedResources map[string]*v1alpha1.PipelineResource) error { +func validateResources(requiredResources []v1beta1.TaskResource, providedResources map[string]*v1alpha1.PipelineResource) error { required := make([]string, 0, len(requiredResources)) optional := make([]string, 0, len(requiredResources)) for _, resource := range requiredResources { @@ -64,7 +64,7 @@ func validateResources(requiredResources []v1alpha2.TaskResource, providedResour return nil } -func validateParams(paramSpecs []v1alpha2.ParamSpec, params []v1alpha1.Param) error { +func validateParams(paramSpecs []v1beta1.ParamSpec, params []v1alpha1.Param) error { var neededParams []string paramTypes := make(map[string]v1alpha1.ParamType) neededParams = make([]string, 0, len(paramSpecs)) @@ -113,8 +113,8 @@ func ValidateResolvedTaskResources(params []v1alpha1.Param, rtr *resources.Resol if err := validateParams(rtr.TaskSpec.Params, params); err != nil { return fmt.Errorf("invalid input params: %w", err) } - inputs := []v1alpha2.TaskResource{} - outputs := []v1alpha2.TaskResource{} + inputs := []v1beta1.TaskResource{} + outputs := []v1beta1.TaskResource{} if rtr.TaskSpec.Resources != nil { inputs = rtr.TaskSpec.Resources.Inputs outputs = rtr.TaskSpec.Resources.Outputs diff --git a/pkg/workspace/apply_test.go b/pkg/workspace/apply_test.go index 3471cb9041c..88204440925 100644 --- a/pkg/workspace/apply_test.go +++ b/pkg/workspace/apply_test.go @@ -5,7 +5,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/workspace" "github.com/tektoncd/pipeline/test/names" corev1 "k8s.io/api/core/v1" @@ -202,7 +202,7 @@ func TestApply(t *testing.T) { expectedTaskSpec v1alpha1.TaskSpec }{{ name: "binding a single workspace with a PVC", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Workspaces: []v1alpha1.WorkspaceDeclaration{{ Name: "custom", }}, @@ -214,7 +214,7 @@ func TestApply(t *testing.T) { }, SubPath: "/foo/bar/baz", }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "ws-9l9zj", @@ -236,7 +236,7 @@ func TestApply(t *testing.T) { }}, }, { name: "binding a single workspace with emptyDir", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Workspaces: []v1alpha1.WorkspaceDeclaration{{ Name: "custom", }}, @@ -248,7 +248,7 @@ func TestApply(t *testing.T) { }, SubPath: "/foo/bar/baz", }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "ws-mz4c7", @@ -270,7 +270,7 @@ func TestApply(t *testing.T) { }}, }, { name: "task spec already has volumes and stepTemplate", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "awesome-volume", @@ -294,7 +294,7 @@ func TestApply(t *testing.T) { }, SubPath: "/foo/bar/baz", }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "awesome-volume", @@ -324,14 +324,14 @@ func TestApply(t *testing.T) { }}, }, { name: "0 workspace bindings", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{ Container: corev1.Container{ Name: "foo", }}}, }}, workspaces: []v1alpha1.WorkspaceBinding{}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{ Container: corev1.Container{ Name: "foo", @@ -339,7 +339,7 @@ func TestApply(t *testing.T) { }}, }, { name: "binding multiple workspaces", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Workspaces: []v1alpha1.WorkspaceDeclaration{{ Name: "custom", }, { @@ -358,7 +358,7 @@ func TestApply(t *testing.T) { ClaimName: "myotherpvc", }, }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "ws-78c5n", @@ -392,7 +392,7 @@ func TestApply(t *testing.T) { }}, }, { name: "multiple workspaces binding to the same volume with diff subpaths doesnt duplicate", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Workspaces: []v1alpha1.WorkspaceDeclaration{{ Name: "custom", }, { @@ -412,7 +412,7 @@ func TestApply(t *testing.T) { }, SubPath: "/very/professional/work/space", }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "ws-j2tds", @@ -440,7 +440,7 @@ func TestApply(t *testing.T) { }}, }, { name: "non default mount path", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Workspaces: []v1alpha1.WorkspaceDeclaration{{ Name: "custom", MountPath: "/my/fancy/mount/path", @@ -452,7 +452,7 @@ func TestApply(t *testing.T) { ClaimName: "mypvc", }, }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "ws-l22wn", @@ -474,7 +474,7 @@ func TestApply(t *testing.T) { }}, }, { name: "readOnly true marks volume mount readOnly", - ts: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + ts: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Workspaces: []v1alpha1.WorkspaceDeclaration{{ Name: "custom", MountPath: "/my/fancy/mount/path", @@ -487,7 +487,7 @@ func TestApply(t *testing.T) { ClaimName: "mypvc", }, }}, - expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + expectedTaskSpec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ StepTemplate: &corev1.Container{ VolumeMounts: []corev1.VolumeMount{{ Name: "ws-twkr2", diff --git a/test/builder/pipeline_test.go b/test/builder/pipeline_test.go index 0c27d2e9339..ca0132dea38 100644 --- a/test/builder/pipeline_test.go +++ b/test/builder/pipeline_test.go @@ -27,7 +27,7 @@ import ( duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" tb "github.com/tektoncd/pipeline/test/builder" ) @@ -56,7 +56,7 @@ func TestPipeline(t *testing.T) { tb.RunAfter("foo"), tb.PipelineTaskTimeout(5*time.Second), ), - tb.PipelineTask("foo", "", tb.PipelineTaskSpec(&v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + tb.PipelineTask("foo", "", tb.PipelineTaskSpec(&v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step", Image: "myimage", @@ -136,7 +136,7 @@ func TestPipeline(t *testing.T) { Timeout: &metav1.Duration{Duration: 5 * time.Second}, }, { Name: "foo", - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "step", Image: "myimage", diff --git a/test/builder/task.go b/test/builder/task.go index 78e9d6debe8..87d2f23aac5 100644 --- a/test/builder/task.go +++ b/test/builder/task.go @@ -21,7 +21,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -38,7 +38,7 @@ type ClusterTaskOp func(*v1alpha1.ClusterTask) type TaskSpecOp func(*v1alpha1.TaskSpec) // TaskResourcesOp is an operation which modify a TaskResources struct. -type TaskResourcesOp func(*v1alpha2.TaskResources) +type TaskResourcesOp func(*v1beta1.TaskResources) // InputsOp is an operation which modify an Inputs struct. type InputsOp func(*v1alpha1.Inputs) @@ -53,7 +53,7 @@ type TaskRunOp func(*v1alpha1.TaskRun) type TaskRunSpecOp func(*v1alpha1.TaskRunSpec) // TaskRunResourcesOp is an operation which modify a TaskRunResources struct. -type TaskRunResourcesOp func(*v1alpha2.TaskRunResources) +type TaskRunResourcesOp func(*v1beta1.TaskRunResources) // TaskResourceOp is an operation which modify a TaskResource struct. type TaskResourceOp func(*v1alpha1.TaskResource) @@ -232,7 +232,7 @@ func TaskParam(name string, pt v1alpha1.ParamType, ops ...ParamSpecOp) TaskSpecO // TaskResources sets the Resources to the TaskSpec func TaskResources(ops ...TaskResourcesOp) TaskSpecOp { return func(spec *v1alpha1.TaskSpec) { - r := &v1alpha2.TaskResources{} + r := &v1beta1.TaskResources{} for _, op := range ops { op(r) } @@ -242,8 +242,8 @@ func TaskResources(ops ...TaskResourcesOp) TaskSpecOp { // TaskResourcesInput adds a TaskResource as Inputs to the TaskResources func TaskResourcesInput(name string, resourceType v1alpha1.PipelineResourceType, ops ...TaskResourceOp) TaskResourcesOp { - return func(r *v1alpha2.TaskResources) { - i := &v1alpha2.TaskResource{ + return func(r *v1beta1.TaskResources) { + i := &v1beta1.TaskResource{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: name, Type: resourceType, @@ -258,8 +258,8 @@ func TaskResourcesInput(name string, resourceType v1alpha1.PipelineResourceType, // TaskResourcesOutput adds a TaskResource as Outputs to the TaskResources func TaskResourcesOutput(name string, resourceType v1alpha1.PipelineResourceType, ops ...TaskResourceOp) TaskResourcesOp { - return func(r *v1alpha2.TaskResources) { - o := &v1alpha2.TaskResource{ + return func(r *v1beta1.TaskResources) { + o := &v1beta1.TaskResource{ ResourceDeclaration: v1alpha1.ResourceDeclaration{ Name: name, Type: resourceType, @@ -607,7 +607,7 @@ func TaskRunSelfLink(selflink string) TaskRunOp { func TaskRunSpec(ops ...TaskRunSpecOp) TaskRunOp { return func(tr *v1alpha1.TaskRun) { spec := &tr.Spec - spec.Resources = &v1alpha2.TaskRunResources{} + spec.Resources = &v1beta1.TaskRunResources{} // Set a default timeout spec.Timeout = &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute} for _, op := range ops { @@ -689,7 +689,7 @@ func TaskRunParam(name, value string, additionalValues ...string) TaskRunSpecOp // TaskRunResources sets the TaskRunResources to the TaskRunSpec func TaskRunResources(ops ...TaskRunResourcesOp) TaskRunSpecOp { return func(spec *v1alpha1.TaskRunSpec) { - r := &v1alpha2.TaskRunResources{} + r := &v1beta1.TaskRunResources{} for _, op := range ops { op(r) } @@ -699,7 +699,7 @@ func TaskRunResources(ops ...TaskRunResourcesOp) TaskRunSpecOp { // TaskRunResourcesInput adds a TaskRunResource as Inputs to the TaskRunResources func TaskRunResourcesInput(name string, ops ...TaskResourceBindingOp) TaskRunResourcesOp { - return func(r *v1alpha2.TaskRunResources) { + return func(r *v1beta1.TaskRunResources) { binding := &v1alpha1.TaskResourceBinding{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: name, @@ -714,7 +714,7 @@ func TaskRunResourcesInput(name string, ops ...TaskResourceBindingOp) TaskRunRes // TaskRunResourcesOutput adds a TaskRunResource as Outputs to the TaskRunResources func TaskRunResourcesOutput(name string, ops ...TaskResourceBindingOp) TaskRunResourcesOp { - return func(r *v1alpha2.TaskRunResources) { + return func(r *v1beta1.TaskRunResources) { binding := &v1alpha1.TaskResourceBinding{ PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ Name: name, diff --git a/test/builder/task_test.go b/test/builder/task_test.go index 8dde503d36b..82b47c083ab 100644 --- a/test/builder/task_test.go +++ b/test/builder/task_test.go @@ -23,7 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" tb "github.com/tektoncd/pipeline/test/builder" corev1 "k8s.io/api/core/v1" @@ -68,7 +68,7 @@ func TestTask(t *testing.T) { expectedTask := &v1alpha1.Task{ ObjectMeta: metav1.ObjectMeta{Name: "test-task", Namespace: "foo"}, Spec: v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Name: "mycontainer", Image: "myimage", @@ -148,7 +148,7 @@ func TestClusterTask(t *testing.T) { )) expectedTask := &v1alpha1.ClusterTask{ ObjectMeta: metav1.ObjectMeta{Name: "test-clustertask"}, - Spec: v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + Spec: v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Image: "myimage", Command: []string{"/mycmd"}, @@ -265,7 +265,7 @@ func TestTaskRunWithTaskRef(t *testing.T) { Paths: []string{"output-folder"}, }}, }, - Resources: &v1alpha2.TaskRunResources{}, + Resources: &v1beta1.TaskRunResources{}, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, TaskRef: &v1alpha1.TaskRef{ Name: "task-output", @@ -290,7 +290,7 @@ func TestTaskRunWithTaskRef(t *testing.T) { }, TaskRunStatusFields: v1alpha1.TaskRunStatusFields{ PodName: "my-pod-name", - Sidecars: []v1alpha2.SidecarState{{ + Sidecars: []v1beta1.SidecarState{{ Name: "sidecar", ImageID: "ImageID", ContainerName: "ContainerName", @@ -328,7 +328,7 @@ func TestTaskRunWithTaskSpec(t *testing.T) { }, Spec: v1alpha1.TaskRunSpec{ TaskSpec: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Image: "image", Command: []string{"/mycmd"}, @@ -344,7 +344,7 @@ func TestTaskRunWithTaskSpec(t *testing.T) { Params: nil, }, }, - Resources: &v1alpha2.TaskRunResources{}, + Resources: &v1beta1.TaskRunResources{}, ServiceAccountName: "sa", Status: v1alpha1.TaskRunSpecStatusCancelled, Timeout: &metav1.Duration{Duration: 2 * time.Minute}, @@ -375,7 +375,7 @@ func TestTaskRunWithPodTemplate(t *testing.T) { }, Spec: v1alpha1.TaskRunSpec{ TaskSpec: &v1alpha1.TaskSpec{ - TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Image: "image", Command: []string{"/mycmd"}, @@ -396,7 +396,7 @@ func TestTaskRunWithPodTemplate(t *testing.T) { "label": "value", }, }, - Resources: &v1alpha2.TaskRunResources{}, + Resources: &v1beta1.TaskRunResources{}, ServiceAccountName: "sa", Status: v1alpha1.TaskRunSpecStatusCancelled, Timeout: &metav1.Duration{Duration: 2 * time.Minute}, @@ -416,7 +416,7 @@ func TestResolvedTaskResources(t *testing.T) { tb.ResolvedTaskResourcesOutputs("qux", tb.PipelineResource("quux", "quuz")), ) expectedResolvedTaskResources := &resources.ResolvedTaskResources{ - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{Container: corev1.Container{ Image: "image", Command: []string{"/mycmd"}, diff --git a/test/e2e-tests-yaml.sh b/test/e2e-tests-yaml.sh index 9969442f6c6..6d2061dca9f 100755 --- a/test/e2e-tests-yaml.sh +++ b/test/e2e-tests-yaml.sh @@ -33,7 +33,7 @@ install_pipeline_crd # Run the tests failed=0 -for version in v1alpha1 v1alpha2; do +for version in v1alpha1 v1beta1; do for test in taskrun pipelinerun; do header "Running YAML e2e tests for ${version} ${test}s" if ! run_yaml_tests ${version} ${test}; then diff --git a/test/retry_test.go b/test/retry_test.go index 7816395be4d..ab7add10491 100644 --- a/test/retry_test.go +++ b/test/retry_test.go @@ -23,7 +23,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/apis" @@ -48,7 +48,7 @@ func TestTaskRunRetry(t *testing.T) { PipelineSpec: &v1alpha1.PipelineSpec{ Tasks: []v1alpha1.PipelineTask{{ Name: "retry-me", - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{ Container: corev1.Container{Image: "busybox"}, Script: "exit 1", diff --git a/test/start_time_test.go b/test/start_time_test.go index bcbda9d199a..8dd8e742a70 100644 --- a/test/start_time_test.go +++ b/test/start_time_test.go @@ -19,7 +19,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" knativetest "knative.dev/pkg/test" @@ -43,7 +43,7 @@ func TestStartTime(t *testing.T) { Namespace: namespace, }, Spec: v1alpha1.TaskRunSpec{ - TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1alpha2.TaskSpec{ + TaskSpec: &v1alpha1.TaskSpec{TaskSpec: v1beta1.TaskSpec{ Steps: []v1alpha1.Step{{ Container: corev1.Container{Image: "ubuntu"}, Script: "sleep 10",