Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update rpkg commands to print to correct stream on execution #30

Merged
merged 10 commits into from
Mar 8, 2024
2 changes: 1 addition & 1 deletion pkg/cli/commands/rpkg/approve/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (r *runner) runE(_ *cobra.Command, args []string) error {
messages = append(messages, err.Error())
fmt.Fprintf(r.Command.ErrOrStderr(), "%s failed (%s)\n", name, err)
} else {
fmt.Fprintf(r.Command.OutOrStderr(), "%s approved\n", name)
fmt.Fprintf(r.Command.OutOrStdout(), "%s approved\n", name)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/commands/rpkg/del/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (r *runner) runE(_ *cobra.Command, args []string) error {
messages = append(messages, err.Error())
fmt.Fprintf(r.Command.ErrOrStderr(), "%s failed (%s)\n", pkg, err)
} else {
fmt.Fprintf(r.Command.OutOrStderr(), "%s deleted\n", pkg)
fmt.Fprintf(r.Command.OutOrStdout(), "%s deleted\n", pkg)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/commands/rpkg/propose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (r *runner) runE(_ *cobra.Command, args []string) error {
messages = append(messages, err.Error())
fmt.Fprintf(r.Command.ErrOrStderr(), "%s failed (%s)\n", name, err)
} else {
fmt.Fprintf(r.Command.OutOrStderr(), "%s proposed\n", name)
fmt.Fprintf(r.Command.OutOrStdout(), "%s proposed\n", name)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/commands/rpkg/proposedelete/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (r *runner) runE(_ *cobra.Command, args []string) error {
messages = append(messages, err.Error())
fmt.Fprintf(r.Command.ErrOrStderr(), "%s failed (%s)\n", name, err)
} else {
fmt.Fprintf(r.Command.OutOrStderr(), "%s proposed for deletion\n", name)
fmt.Fprintf(r.Command.OutOrStdout(), "%s proposed for deletion\n", name)
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cli/commands/rpkg/push/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (r *runner) runE(cmd *cobra.Command, args []string) error {
r.printFnResult(result, printOpt)
}
}
fmt.Fprintf(cmd.OutOrStdout(), "%s pushed\n", packageName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put a similar message on 'pull'?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put a similar message on 'pull'?

Never mind, pull already prints the manifests.

return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/commands/rpkg/reject/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ func (r *runner) runE(_ *cobra.Command, args []string) error {
messages = append(messages, err.Error())
fmt.Fprintf(r.Command.ErrOrStderr(), "%s failed (%s)\n", name, err)
} else {
fmt.Fprintf(r.Command.OutOrStderr(), "%s rejected\n", name)
fmt.Fprintf(r.Command.OutOrStdout(), "%s rejected\n", name)
}
case v1alpha1.PackageRevisionLifecycleDeletionProposed:
pr.Spec.Lifecycle = v1alpha1.PackageRevisionLifecyclePublished
if err := r.porchClient.Update(r.ctx, pr); err != nil {
messages = append(messages, err.Error())
fmt.Fprintf(r.Command.ErrOrStderr(), "%s failed (%s)\n", name, err)
} else {
fmt.Fprintf(r.Command.OutOrStderr(), "%s no longer proposed for deletion\n", name)
fmt.Fprintf(r.Command.OutOrStdout(), "%s no longer proposed for deletion\n", name)
}
default:
msg := fmt.Sprintf("cannot reject %s with lifecycle '%s'", name, pr.Spec.Lifecycle)
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cli/testdata/rpkg-copy/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ commands:
- propose
- --namespace=rpkg-copy
- git-eb5afe755bedd142f142c6a9363649c667ef77a5
stderr: "git-eb5afe755bedd142f142c6a9363649c667ef77a5 proposed\n"
stdout: "git-eb5afe755bedd142f142c6a9363649c667ef77a5 proposed\n"
- args:
- porchctl
- rpkg
- approve
- --namespace=rpkg-copy
- git-eb5afe755bedd142f142c6a9363649c667ef77a5
stderr: "git-eb5afe755bedd142f142c6a9363649c667ef77a5 approved\n"
stdout: "git-eb5afe755bedd142f142c6a9363649c667ef77a5 approved\n"
- args:
- porchctl
- rpkg
Expand Down
16 changes: 8 additions & 8 deletions test/e2e/cli/testdata/rpkg-lifecycle/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ commands:
- propose
- --namespace=rpkg-lifecycle
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 proposed
- args:
- porchctl
Expand Down Expand Up @@ -50,7 +50,7 @@ commands:
- reject
- --namespace=rpkg-lifecycle
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 rejected
- args:
- porchctl
Expand Down Expand Up @@ -78,7 +78,7 @@ commands:
- propose
- --namespace=rpkg-lifecycle
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 proposed
- args:
- porchctl
Expand All @@ -95,7 +95,7 @@ commands:
- approve
- --namespace=rpkg-lifecycle
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 approved
- args:
- porchctl
Expand Down Expand Up @@ -123,7 +123,7 @@ commands:
- propose-delete
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
- --namespace=rpkg-lifecycle
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 proposed for deletion
- args:
- porchctl
Expand All @@ -148,7 +148,7 @@ commands:
- reject
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
- --namespace=rpkg-lifecycle
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 no longer proposed for deletion
- args:
- porchctl
Expand Down Expand Up @@ -176,7 +176,7 @@ commands:
- propose-delete
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
- --namespace=rpkg-lifecycle
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 proposed for deletion
- args:
- porchctl
Expand All @@ -193,7 +193,7 @@ commands:
- delete
- git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034
- --namespace=rpkg-lifecycle
stderr: |
stdout: |
git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 deleted
- args:
- porchctl
Expand Down
1 change: 1 addition & 0 deletions test/e2e/cli/testdata/rpkg-push/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ commands:
- --namespace=rpkg-push
- git-efe3d01c68dfdcdd69114c9a7c65cce0d662a46f
- /tmp/porch-e2e/rpkg-push-git-efe3d01c68dfdcdd69114c9a7c65cce0d662a46f
stdout: "git-efe3d01c68dfdcdd69114c9a7c65cce0d662a46f pushed\n"
- args:
- porchctl
- rpkg
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/cli/testdata/rpkg-update/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ commands:
- propose
- --namespace=rpkg-update
- git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60
stderr: "git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 proposed\n"
stdout: "git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 proposed\n"
- args:
- porchctl
- rpkg
- approve
- --namespace=rpkg-update
- git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60
stderr: "git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 approved\n"
stdout: "git-7fcdd499f0790ac3bd8f805e3e5e00825641eb60 approved\n"
- args:
- porchctl
- rpkg
Expand Down Expand Up @@ -139,6 +139,7 @@ commands:
- --namespace=rpkg-update
- git-7ab0219ace10c1081a8b40a6b97d5da58bdb62e0
- /tmp/porch-e2e/pkg-update-git-7ab0219ace10c1081a8b40a6b97d5da58bdb62e0
stdout: "git-7ab0219ace10c1081a8b40a6b97d5da58bdb62e0 pushed\n"
- args:
- porchctl
- rpkg
Expand Down
Loading