-
Notifications
You must be signed in to change notification settings - Fork 549
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
Inappropriate printing to STDOUT #2510
Labels
Comments
znewman01
added a commit
to znewman01/cosign
that referenced
this issue
Dec 7, 2022
Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]>
znewman01
added a commit
to znewman01/cosign
that referenced
this issue
Dec 7, 2022
Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]>
znewman01
added a commit
to znewman01/cosign
that referenced
this issue
Dec 7, 2022
Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]>
znewman01
added a commit
to znewman01/cosign
that referenced
this issue
Dec 19, 2022
Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]>
znewman01
added a commit
to znewman01/cosign
that referenced
this issue
Jan 2, 2023
Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]>
znewman01
added a commit
to znewman01/cosign
that referenced
this issue
Jan 14, 2023
Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]>
znewman01
added a commit
that referenced
this issue
Jan 17, 2023
* Add versioning policy. Addresses (does not fix) #2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows #2365. After getting approval on this PR, I will update #2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also #2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]> * Reword private-by-default for Sigstore API Signed-off-by: Zachary Newman <[email protected]> * Minor rewordings Signed-off-by: Zachary Newman <[email protected]> * Another minor rewording Signed-off-by: Zachary Newman <[email protected]> Signed-off-by: Zachary Newman <[email protected]>
dmitris
pushed a commit
to dmitris/cosign
that referenced
this issue
Mar 24, 2023
* Add versioning policy. Addresses (does not fix) sigstore#2518. This follows [Proposal: Cosign Versioning][versioning-proposal], which in turn follows sigstore#2365. After getting approval on this PR, I will update sigstore#2518 to include a checklist containing the following (possibly linking to separate bugs): - [ ] (docs) Communicate the new version policy to Cosign users. - [ ] (process/CI) Separate CLI and API releases (with different tagging schemes). - [ ] (process/CI) Use gorelease or similar to catch breaking API changes. - [ ] (code) Add library support for deprecations (see also sigstore#2510) - [ ] (testing) E2E testing for old Cosign versions (Also client libraries, once they're stable). [versioning-proposal]: https://docs.google.com/document/d/1urWUPhtzXKWqL9CoaEw4Z35v5IDl9yrTRQ40XlYekOo/edit# Signed-off-by: Zachary Newman <[email protected]> * Reword private-by-default for Sigstore API Signed-off-by: Zachary Newman <[email protected]> * Minor rewordings Signed-off-by: Zachary Newman <[email protected]> * Another minor rewording Signed-off-by: Zachary Newman <[email protected]> Signed-off-by: Zachary Newman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generally, in Cosign we try to make STDOUT have the output of the command: the (often machine-readable) result of execution. We put status messages, errors, etc. on STDERR.
This is a common convention for CLI tools and a nice thing to do for scriptability.
However, we're pretty sloppy sometimes.
I'm looking mostly at:
cosign/pkg/cosign/tlog.go
Line 170 in fa8a799
cosign/cmd/cosign/cli/pivcli/commands.go
Line 152 in 381ba64
cosign/cmd/cosign/cli/initialize/init.go
Line 52 in 381ba64
cosign/cmd/cosign/cli/sign/sign.go
Line 250 in d720f04
But even some of the ones that are actually correct just work by spitting out to STDOUT in the middle of command execution:
cosign/cmd/cosign/cli/pivcli/commands.go
Line 265 in 381ba64
cosign/cmd/cosign/cli/tree.go
Line 152 in d720f04
My proposal is the following:
SaveCmd
would be implemented as a function with a return value, and then we'd hook into Cobra to print the output (if we need to stream output, we could use channels or something).fmt.Print{f,ln}
in the Cosign codebase.fmt.Fprintln(os.Stderr, "warning: foo")
directly, Cosign code would callWarn()
. Same for any other common output patterns. (That is, calling code can assign semantics to its output which helps make sure it goes to the right place).fmt.*
calls (we can keepfmt.Sprint*
).This has a number of benefits:
--format=jsonl
or--format=csv
) without requiring support from every commandcmd/
directory is under-tested.The text was updated successfully, but these errors were encountered: