Skip to content

Commit

Permalink
Remove all occurrence of PipelineResource and move pipeline to 0.46.0…
Browse files Browse the repository at this point in the history
… in CI

As Pipelineresources have been removed in 0.46 pipeline
so this patch removes all occurrence of pipelineresource
and also moves pipeline 0.44.0 to latest in the CI

Signed-off-by: Shiv Verma <[email protected]>
  • Loading branch information
pratap0007 authored and tekton-robot committed Apr 17, 2023
1 parent fcf113d commit 4cb8c16
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 452 deletions.
2 changes: 0 additions & 2 deletions pkg/cli/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/jonboulle/clockwork"
"github.com/tektoncd/pipeline/pkg/client/clientset/versioned"
versionedResource "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned"
versionedTriggers "github.com/tektoncd/triggers/pkg/client/clientset/versioned"
"k8s.io/client-go/dynamic"
k8s "k8s.io/client-go/kubernetes"
Expand All @@ -37,7 +36,6 @@ type Clients struct {
Tekton versioned.Interface
Kube k8s.Interface
Triggers versionedTriggers.Interface
Resource versionedResource.Interface
HTTPClient http.Client
Dynamic dynamic.Interface
}
Expand Down
16 changes: 0 additions & 16 deletions pkg/cli/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/jonboulle/clockwork"
"github.com/pkg/errors"
"github.com/tektoncd/pipeline/pkg/client/clientset/versioned"
versionedResource "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned"
versionedTriggers "github.com/tektoncd/triggers/pkg/client/clientset/versioned"
"k8s.io/client-go/dynamic"
k8s "k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -63,15 +62,6 @@ func (p *TektonParams) triggersClient(config *rest.Config) (versionedTriggers.In
return cs, nil
}

func (p *TektonParams) resourceClient(config *rest.Config) (versionedResource.Interface, error) {
cs, err := versionedResource.NewForConfig(config)
if err != nil {
return nil, err
}

return cs, nil
}

// Set kube client based on config
func (p *TektonParams) kubeClient(config *rest.Config) (k8s.Interface, error) {
k8scs, err := k8s.NewForConfig(config)
Expand Down Expand Up @@ -127,11 +117,6 @@ func (p *TektonParams) Clients(cfg ...*rest.Config) (*Clients, error) {
return nil, err
}

resource, err := p.resourceClient(config)
if err != nil {
return nil, err
}

triggers, err := p.triggersClient(config)
if err != nil {
return nil, err
Expand All @@ -150,7 +135,6 @@ func (p *TektonParams) Clients(cfg ...*rest.Config) (*Clients, error) {
p.clients = &Clients{
Tekton: tekton,
Kube: kube,
Resource: resource,
Triggers: triggers,
Dynamic: dynamic,
}
Expand Down
47 changes: 23 additions & 24 deletions pkg/cmd/pipeline/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c1 := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Clock: clock, Resource: cs.Resource}
c1 := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Clock: clock}

pipeline := []*v1beta1.Pipeline{
{
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c2 := &test.Params{Tekton: cs2.Pipeline, Kube: cs2.Kube, Dynamic: dc2, Clock: clock, Resource: cs2.Resource}
c2 := &test.Params{Tekton: cs2.Pipeline, Kube: cs2.Kube, Dynamic: dc2, Clock: clock}

// With list error mocking
cs3, _ := test.SeedV1beta1TestData(t, pipelinetest.Data{Pipelines: pipeline, Namespaces: namespaces})
Expand All @@ -221,7 +221,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c3 := &test.Params{Tekton: cs3.Pipeline, Kube: cs3.Kube, Dynamic: dc3, Clock: clock, Resource: cs3.Resource}
c3 := &test.Params{Tekton: cs3.Pipeline, Kube: cs3.Kube, Dynamic: dc3, Clock: clock}

// With create error mocking
cs4, _ := test.SeedV1beta1TestData(t, pipelinetest.Data{Pipelines: pipeline2, Namespaces: namespaces})
Expand All @@ -243,7 +243,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c4 := &test.Params{Tekton: cs4.Pipeline, Kube: cs4.Kube, Dynamic: dc4, Clock: clock, Resource: cs4.Resource}
c4 := &test.Params{Tekton: cs4.Pipeline, Kube: cs4.Kube, Dynamic: dc4, Clock: clock}

// Without related pipelinerun
objs := []runtime.Object{
Expand All @@ -265,7 +265,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c5 := &test.Params{Tekton: cs5.Pipeline, Kube: cs5.Kube, Dynamic: dc5, Clock: clock, Resource: cs5.Resource}
c5 := &test.Params{Tekton: cs5.Pipeline, Kube: cs5.Kube, Dynamic: dc5, Clock: clock}

// pipelineresources data for tests with --filename
objs2 := []runtime.Object{}
Expand All @@ -283,7 +283,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c6 := &test.Params{Tekton: cs6.Pipeline, Kube: cs6.Kube, Dynamic: dc6, Clock: clock, Resource: cs6.Resource}
c6 := &test.Params{Tekton: cs6.Pipeline, Kube: cs6.Kube, Dynamic: dc6, Clock: clock}

cs7, _ := test.SeedV1beta1TestData(t, pipelinetest.Data{Pipelines: pipeline, Namespaces: namespaces})
cs7.Pipeline.Resources = cb.APIResourceList(versionv1beta1, []string{"pipeline", "pipelinerun"})
Expand All @@ -294,7 +294,7 @@ func TestPipelineStart_ExecuteCommand_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
c7 := &test.Params{Tekton: cs7.Pipeline, Kube: cs7.Kube, Dynamic: dc7, Clock: clock, Resource: cs7.Resource}
c7 := &test.Params{Tekton: cs7.Pipeline, Kube: cs7.Kube, Dynamic: dc7, Clock: clock}

testParams := []struct {
name string
Expand Down Expand Up @@ -1212,9 +1212,8 @@ func TestPipelineStart_Interactive_v1beta1(t *testing.T) {
for _, tp := range testParams {
t.Run(tp.name, func(t *testing.T) {
p := test.Params{
Kube: tp.input.Kube,
Tekton: tp.input.Pipeline,
Resource: tp.input.Resource,
Kube: tp.input.Kube,
Tekton: tp.input.Pipeline,
}
p.SetNamespace(tp.namespace)

Expand Down Expand Up @@ -1293,7 +1292,7 @@ func Test_start_pipeline_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}
c := Command(p)

got, _ := test.ExecuteCommand(c, "start", pipelineName,
Expand Down Expand Up @@ -1455,7 +1454,7 @@ func Test_start_pipeline_last_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -1610,7 +1609,7 @@ func Test_start_pipeline_last_override_timeout_deprecated_v1beta1(t *testing.T)
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
// Specify new timeout value to override previous value
Expand Down Expand Up @@ -1742,7 +1741,7 @@ func Test_start_pipeline_last_without_res_param_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -1886,7 +1885,7 @@ func Test_start_pipeline_last_merge_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -2049,7 +2048,7 @@ func Test_start_pipeline_use_pipelinerun_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
// There is no point to checkout otuput since we would be checking if our testdata works!
Expand Down Expand Up @@ -2171,7 +2170,7 @@ func Test_start_pipeline_use_pipelinerun_cancelled_status_v1beta1(t *testing.T)
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
_, _ = test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -2253,7 +2252,7 @@ func Test_start_pipeline_allkindparam_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Resource: cs.Resource, Dynamic: dc}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}
pipeline := Command(p)

got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -2405,7 +2404,7 @@ func Test_start_pipeline_last_generate_name_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -2536,7 +2535,7 @@ func Test_start_pipeline_last_with_prefix_name_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -2669,7 +2668,7 @@ func Test_start_pipeline_with_prefix_name_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down Expand Up @@ -2809,7 +2808,7 @@ func Test_lastPipelineRun_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Clock: clock, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Clock: clock}
p.SetNamespace("namespace")
return p
}(),
Expand All @@ -2829,7 +2828,7 @@ func Test_lastPipelineRun_v1beta1(t *testing.T) {
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}
p.SetNamespace("namespace")
return p
}(),
Expand Down Expand Up @@ -2928,7 +2927,7 @@ func Test_start_pipeline_with_skip_optional_workspace_flag_v1beta1(t *testing.T)
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc, Resource: cs.Resource}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

pipeline := Command(p)
got, _ := test.ExecuteCommand(pipeline, "start", pipelineName,
Expand Down
10 changes: 5 additions & 5 deletions pkg/cmd/task/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ func Test_start_task_with_prefix_name_v1beta1(t *testing.T) {
dc, _ := tdc.Client(
cb.UnstructuredV1beta1T(tasks[0], versionv1beta1),
cb.UnstructuredV1beta1TR(taskruns[0], versionv1beta1))
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Resource: cs.Resource, Dynamic: dc}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

task := Command(p)
got, _ := test.ExecuteCommand(task, "start", "task",
Expand Down Expand Up @@ -1435,7 +1435,7 @@ func Test_start_task_client_error_v1beta1(t *testing.T) {
cb.UnstructuredV1beta1T(tasks[0], versionv1beta1),
)

p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Resource: cs.Resource, Dynamic: dc}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

task := Command(p)
got, _ := test.ExecuteCommand(task,
Expand Down Expand Up @@ -1490,7 +1490,7 @@ func Test_start_task_invalid_workspace_v1beta1(t *testing.T) {
dc, _ := tdc.Client(
cb.UnstructuredV1beta1T(tasks[0], versionv1beta1),
)
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Resource: cs.Resource, Dynamic: dc}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

task := Command(p)
got, _ := test.ExecuteCommand(task, "start", "task-1",
Expand Down Expand Up @@ -1547,7 +1547,7 @@ func Test_start_task_invalid_param_v1beta1(t *testing.T) {
dc, _ := tdc.Client(
cb.UnstructuredV1beta1T(tasks[0], versionv1beta1),
)
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Resource: cs.Resource, Dynamic: dc}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

task := Command(p)
got, _ := test.ExecuteCommand(task, "start", "task-1",
Expand Down Expand Up @@ -1604,7 +1604,7 @@ func Test_start_task_invalid_label_v1beta1(t *testing.T) {
dc, _ := tdc.Client(
cb.UnstructuredV1beta1T(tasks[0], versionv1beta1),
)
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Resource: cs.Resource, Dynamic: dc}
p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dc}

task := Command(p)
got, _ := test.ExecuteCommand(task, "start", "task-1",
Expand Down
Loading

0 comments on commit 4cb8c16

Please sign in to comment.