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

✨ cli: write diagnostics in kubectl-workspace to stderr #3133

Merged
merged 3 commits into from
May 17, 2024

Conversation

embik
Copy link
Member

@embik embik commented May 16, 2024

Summary

While working on https://github.com/embik/kubectl-switch-ws I noticed that kubectl-workspace use will always print diagnostic information (deprecation notices and warnings about unfinished API bindings), even when using --short for inclusion in scripts / terminal prompts. There is no good way to avoid these warnings for scripts that only expect the workspace name returned as output.

I would like to propose that we start writing this supplementary information to stderr, which is specifically for diagnostic information and errors. This way, scripts can avoid the warnings by using something like kubectl workspace use --short <workspace> 2>/dev/null to make sure you only get back the workspace name (or an exit code that isn't zero, which signals that something bad happened).

There's also an old OWNERS file left here which I'd propose to remove.

Related issue(s)

Fixes #

Release Notes

Write diagnostics (deprecation notices and warnings) in `kubectl-workspace` to stderr instead of stdout

embik added 3 commits May 16, 2024 16:03
Signed-off-by: Marvin Beckers <marvin@kubermatic.com>
Signed-off-by: Marvin Beckers <marvin@kubermatic.com>
…tderr

Signed-off-by: Marvin Beckers <marvin@kubermatic.com>
@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2024
@embik
Copy link
Member Author

embik commented May 16, 2024

/cc @mjudeikis @sttts

@embik embik changed the title ✨ Write diagnostics in kubectl-workspace to stderr ✨ cli: write diagnostics in kubectl-workspace to stderr May 16, 2024
@mjudeikis
Copy link
Contributor

Where I dont quite like abusing stderr but I dont see better way without having bunch of
if short; dont print and this sound more of the evil compared to what you propose.
/lgtm
/approve
/hold

@kcp-ci-bot kcp-ci-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 17, 2024
@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label May 17, 2024
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 8cc6a3bd49750ad6bf093e2440f06617f9a45927

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 17, 2024
@sttts
Copy link
Member

sttts commented May 17, 2024

/lgtm
/approve

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjudeikis, sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@embik
Copy link
Member Author

embik commented May 17, 2024

/hold cancel

@kcp-ci-bot kcp-ci-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 17, 2024
@kcp-ci-bot kcp-ci-bot merged commit d8daae8 into kcp-dev:main May 17, 2024
17 checks passed
@embik embik deleted the kubectl-workspace-stderr branch May 17, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants