GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — feat: add JSON output to coder provisioner keys create by nickvigilante · Pull Request #30152 · coder/coder Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think its fine most secrets print only text like |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@matifali Thanks for the review. Do you have any suggested changes for the PR, or are we good to merge? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I noticed a bunch of duplication in these PRs, particularly the json/table formatting
DRYing this up would probably go a long way for making these PRs smaller, and would set a pattern for future json/table output. I suggest asking the agent to create a new, first PR that sets up and tests some formatting helpers, then each of these callsites can be stacked on top of it |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jeremyruppel Agree on DRYing it up. I wanted to originally do a global |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d40e3ff to
c7b78f3
Compare
c7b78f3 to
b3efc89
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Default text output is byte-identical to before, and TestProvisionerKeys passes locally. A few notes inline.
One broader question: did you consider fixing this in the API instead? postProvisionerKey already has the ID, created-at, and tags in params but only returns {key}. Adding those to CreateProvisionerKeyResponse would remove the extra list call, the race between create and list, and the zero-valued fallback below. It touches the SDK, API docs, and generated types, so a follow-up is a reasonable answer, but the CLI workaround exists only because of that gap.
Note
This review was generated by Coder Agents on behalf of @jeremyruppel.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@jeremyruppel I hadn't considered updating the API here, but I'll happily do that if it cuts out a race condition. Stay tuned, another PR incoming! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…pers (#30508) Adds two small helpers to `cli/cliui/output.go` so commands that add `-o/--output` don't repeat the same boilerplate, as suggested in #30152 (comment) by @jeremyruppel. - `TextFormatFunc[T]` wraps `ChangeFormatterData(TextFormat(), ...)` with the type assertion and "expected X, got Y" error, so a command only supplies its render function. - `(*OutputFormatter).WriteLine` formats data and writes it to an `io.Writer` with a trailing newline, replacing the `Format` + `Fprintln` block. No existing callers change in this PR. These PRs are stacked on it and use the helpers: - #30135 `coder tokens create` - #30139 `coder ai-gateway keys create` - #30145 `coder organizations members edit-roles` - #30152 `coder provisioner keys create` Migrating the existing callers on `main` (for example `cli/organization.go`, `enterprise/cli/workspaceproxy.go`) is left for a follow-up, since some of them print with `Fprint` rather than `Fprintln` and need care to keep output identical. Refs CLI-56 <details> <summary>Decision log</summary> - A global `-o` flag on the root command was ruled out because `coder config-ssh` already uses `-o` for `--ssh-option`. - The "one-time secret plus metadata" response structs in #30135 and #30152 stay local to each command, since they embed different SDK types and a shared helper would save little. - `WriteLine` uses `Fprintln` to match the four stacked PRs and most existing callers. It was renamed from `Write` during review so the trailing newline is visible at call sites and the method is not confused with `io.Writer`. </details> > [!NOTE] > This PR was generated by Coder Agents on behalf of @nickvigilante.
4ebc13b to
e17dd34
Compare
There was an error while loading. Please reload this page.
|
@untra Can I poke you for another review? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
poke me again once the light is green plz |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
`coder provisioner keys create` printed the new key's secret as prose, so scripts provisioning external provisioners had to scrape it and look up the key's ID and tags separately. Linear: CLI-36
Co-authored-by: Jeremy Ruppel <[email protected]>
When the metadata lookup after create fails or finds no matching key, fall back to the tags this command sent and warn on stderr in both cases, instead of only when the list call errors.
Use GetProvisionerKey with the returned secret instead of listing all keys and matching by name.
The CLI docs template now emits a Property/Value header for flag tables, so the new --output flag table needs regenerating to match make gen and pass lint/docs-html.
8a8bc83 to
985283f
Compare
|
@untra Poking you again now that the light is green. The only red check is the advisory AI doc-check, which isn't required. This comment was generated by Coder Agents on behalf of @nickvigilante. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
985283f4
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.