Skip to content

Commit

Permalink
Mark PipelineResource cmds deprecated
Browse files Browse the repository at this point in the history
This will mark pipelineresources related commands deprecated
as it has been deprecated in pipeline long back and can get
removed soon. we will also remove as it will get removed there

Part of tektoncd#1657
  • Loading branch information
piyush-garg authored and tekton-robot committed Oct 10, 2022
1 parent ff45bf2 commit 727b77b
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 10 deletions.
1 change: 0 additions & 1 deletion docs/cmd/tkn.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ CLI for tekton pipelines
* [tkn hub](tkn_hub.md) - Interact with tekton hub
* [tkn pipeline](tkn_pipeline.md) - Manage pipelines
* [tkn pipelinerun](tkn_pipelinerun.md) - Manage PipelineRuns
* [tkn resource](tkn_resource.md) - Manage pipeline resources
* [tkn task](tkn_task.md) - Manage Tasks
* [tkn taskrun](tkn_taskrun.md) - Manage TaskRuns
* [tkn triggerbinding](tkn_triggerbinding.md) - Manage TriggerBindings
Expand Down
2 changes: 1 addition & 1 deletion docs/man/man1/tkn.1
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ CLI for tekton pipelines

.SH SEE ALSO
.PP
\fBtkn\-bundle(1)\fP, \fBtkn\-chain(1)\fP, \fBtkn\-clustertask(1)\fP, \fBtkn\-clustertriggerbinding(1)\fP, \fBtkn\-completion(1)\fP, \fBtkn\-eventlistener(1)\fP, \fBtkn\-hub(1)\fP, \fBtkn\-pipeline(1)\fP, \fBtkn\-pipelinerun(1)\fP, \fBtkn\-resource(1)\fP, \fBtkn\-task(1)\fP, \fBtkn\-taskrun(1)\fP, \fBtkn\-triggerbinding(1)\fP, \fBtkn\-triggertemplate(1)\fP, \fBtkn\-version(1)\fP
\fBtkn\-bundle(1)\fP, \fBtkn\-chain(1)\fP, \fBtkn\-clustertask(1)\fP, \fBtkn\-clustertriggerbinding(1)\fP, \fBtkn\-completion(1)\fP, \fBtkn\-eventlistener(1)\fP, \fBtkn\-hub(1)\fP, \fBtkn\-pipeline(1)\fP, \fBtkn\-pipelinerun(1)\fP, \fBtkn\-task(1)\fP, \fBtkn\-taskrun(1)\fP, \fBtkn\-triggerbinding(1)\fP, \fBtkn\-triggertemplate(1)\fP, \fBtkn\-version(1)\fP
1 change: 1 addition & 0 deletions pkg/cmd/pipelineresource/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func createCommand(p cli.Params) *cobra.Command {
},
}
f.AddFlags(c)
c.Deprecated = "PipelineResource commands are deprecated, they will be removed soon as it get removed from API."
return c
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/pipelineresource/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ or
f.AddFlags(c)
c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all PipelineResources in a namespace (default: false)")
c.Deprecated = "PipelineResource commands are deprecated, they will be removed soon as it get removed from API."

return c
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/cmd/pipelineresource/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ func TestPipelineResourceDelete(t *testing.T) {
input: seeds[0],
inputStream: nil,
wantError: false,
want: "PipelineResources deleted: \"pre-1\"\n",
want: "Command \"delete\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\nPipelineResources deleted: \"pre-1\"\n",
},
{
name: "With force delete flag",
command: []string{"rm", "pre-1", "-n", "ns", "--force"},
input: seeds[1],
inputStream: nil,
wantError: false,
want: "PipelineResources deleted: \"pre-1\"\n",
want: "Command \"delete\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\nPipelineResources deleted: \"pre-1\"\n",
},
{
name: "Without force delete flag, reply no",
Expand All @@ -104,7 +104,7 @@ func TestPipelineResourceDelete(t *testing.T) {
input: seeds[2],
inputStream: strings.NewReader("y"),
wantError: false,
want: "Are you sure you want to delete pipelineresource(s) \"pre-1\" (y/n): PipelineResources deleted: \"pre-1\"\n",
want: "Command \"delete\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\nAre you sure you want to delete pipelineresource(s) \"pre-1\" (y/n): PipelineResources deleted: \"pre-1\"\n",
},
{
name: "Remove non existent resource",
Expand All @@ -128,15 +128,15 @@ func TestPipelineResourceDelete(t *testing.T) {
input: seeds[3],
inputStream: strings.NewReader("y"),
wantError: false,
want: "Are you sure you want to delete all pipelineresources in namespace \"ns\" (y/n): All PipelineResources deleted in namespace \"ns\"\n",
want: "Command \"delete\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\nAre you sure you want to delete all pipelineresources in namespace \"ns\" (y/n): All PipelineResources deleted in namespace \"ns\"\n",
},
{
name: "Delete all with -f",
command: []string{"delete", "--all", "-f", "-n", "ns"},
input: seeds[4],
inputStream: nil,
wantError: false,
want: "All PipelineResources deleted in namespace \"ns\"\n",
want: "Command \"delete\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\nAll PipelineResources deleted in namespace \"ns\"\n",
},
{
name: "Error from using pipelineresource name with --all",
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/pipelineresource/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ or
}

f.AddFlags(c)
c.Deprecated = "PipelineResource commands are deprecated, they will be removed soon as it get removed from API."

return c
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/pipelineresource/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestPipelineResourceDescribe_Invalid_Namespace(t *testing.T) {
t.Errorf("Error expected here")
}

expected := "Error: failed to find pipelineresource \"bar\"\n"
expected := "Command \"describe\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\nError: failed to find pipelineresource \"bar\"\n"
test.AssertOutput(t, expected, out)
}

Expand Down Expand Up @@ -155,7 +155,7 @@ func TestPipelineResourceDescribe_WithSecretParams(t *testing.T) {

func TestPipelineResourcesDescribe_custom_output(t *testing.T) {
name := "pipeline-resource"
expected := "pipelineresource.tekton.dev/" + name
expected := "Command \"describe\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\npipelineresource.tekton.dev/" + name

clock := clockwork.NewFakeClock()

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/pipelineresource/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func listCommand(p cli.Params) *cobra.Command {
cmd.Flags().StringVarP(&opts.Type, "type", "t", "", "Pipeline resource type")
cmd.Flags().BoolVarP(&opts.NoHeaders, "no-headers", "", opts.NoHeaders, "do not print column headers with output (default print column headers with output)")
cmd.Flags().BoolVarP(&opts.AllNamespaces, "all-namespaces", "A", opts.AllNamespaces, "list pipeline resources from all namespaces")
cmd.Deprecated = "PipelineResource commands are deprecated, they will be removed soon as it get removed from API."

return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/pipelineresource/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func TestPipelineResourceList_empty(t *testing.T) {
pipelineresource := Command(p)

out, _ := test.ExecuteCommand(pipelineresource, "list", "-n", "test-ns-3")
test.AssertOutput(t, msgNoPREsFound+"\n", out)
test.AssertOutput(t, "Command \"list\" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.\n"+msgNoPREsFound+"\n", out)
}

func TestPipelineResourceList_invalidType(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/pipelineresource/pipelineresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func Command(p cli.Params) *cobra.Command {
describeCommand(p),
listCommand(p),
)
cmd.Deprecated = "PipelineResource commands are deprecated, they will be removed soon as it get removed from API."

return cmd
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "describe" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
Name: test-1
Namespace: test-ns-1
PipelineResource Type: image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "describe" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
Name: test-1
Namespace: test-ns-1
PipelineResource Type: image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
NAMESPACE NAME TYPE DETAILS
test-ns-1 test-5 cloudEvent targetURI: http://sink
test-ns-1 test git url: [email protected]:tektoncd/cli-new.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
test-5
test
test-2
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
No pipelineresources found.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
No pipelineresources found.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
NAME TYPE DETAILS
test-1 image URL: quey.io/tekton/controller
test-3 image ---
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
NAME TYPE DETAILS
test-5 cloudEvent targetURI: http://sink
test git url: [email protected]:tektoncd/cli-new.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
test-5 cloudEvent targetURI: http://sink
test git url: [email protected]:tektoncd/cli-new.git
test-2 git url: [email protected]:tektoncd/cli.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
NAME TYPE DETAILS
test-4 image URL: quey.io/tekton/webhook
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Command "list" is deprecated, PipelineResource commands are deprecated, they will be removed soon as it get removed from API.
NAME TYPE DETAILS
test-4 image URL: quey.io/tekton/webhook

0 comments on commit 727b77b

Please sign in to comment.