-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Vault 36295 Improve plugin mgmt ux in api and cli #30811
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
base: main
Are you sure you want to change the base?
Vault 36295 Improve plugin mgmt ux in api and cli #30811
Conversation
…ning before returning in RegisterPluginWithContext
CI Results: |
ddb46b0
to
76b9dec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR includes the doc updates for the sha256, command, and version parameters, as well as the current state of the manual registration flow with an extracted artifact.
It does not currently include any doc updates for the download functionality. IMO it would be better to get this into main
first so the current state is up-to-date, and then do a subsequent PR for download docs once our vault-enterprise
feature branch is shipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is looking great! I added some suggestions/nits for your consideration.
Version: "v1.0.0", | ||
}) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if len(resp.Warnings) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: any chance we could check the Warnings here using reflect.DeepEqual()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a bit of trouble with this, namely needing to differentiate when resp.Warnings
is []string(nil)
or []string{}
, which the length check handles. Are we ok ignoring this nit in favor of prioritizing the download work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where we don't expect a warning, we should not assert the value. Maybe I am misunderstanding. Is the suggestion to test the non-happy path?
t.Fatal(err) | ||
} | ||
if len(registerResp.Warnings) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: similar comment as above about testing the equality rather than the length of Warnings. Testing both is fine however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above #30811 (comment)
vault/logical_system.go
Outdated
return logical.ErrorResponse("must provide at least one of command or oci_image"), nil | ||
var resp logical.Response | ||
|
||
if sha256 == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally these parameter constraints would be handled by the Vault server API. The vault client could just pass in everything that it got from the command line to Vault and the Vault server would do the parameter checks, returning any errors to the vault client. This is not a blocker, but something to consider for the future, especially since the Vault client may be connecting to some version of Vault that does support plugin artifacts, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack for the future, thanks for the input.
There might be a misunderstanding on my side: I thought handlePluginCatalogUpdate
in logical_system.go
is the API handler? Where would you suggest making the change in the future?
…gisterPluginWithContext
… binary plugins, which rely on plugin.Command input; extracted artifact plugins don't rely on plugin.Command input
Co-authored-by: Sarah Chavis <[email protected]>
Co-authored-by: Sarah Chavis <[email protected]>
Co-authored-by: Sarah Chavis <[email protected]>
Co-authored-by: Sarah Chavis <[email protected]>
Co-authored-by: Sarah Chavis <[email protected]>
Co-authored-by: Sarah Chavis <[email protected]>
Co-authored-by: Sarah Chavis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
* suggestions * move common reqs to a partial * fix typo * tweak reqs * Update website/content/partials/plugins/prepare-plugin.mdx Co-authored-by: helenfufu <[email protected]> * Update website/content/partials/plugins/prepare-plugin.mdx Co-authored-by: helenfufu <[email protected]> * Update website/content/partials/plugins/prepare-plugin.mdx Co-authored-by: helenfufu <[email protected]> * tweak feedback * remove deprecation * Update website/content/partials/plugins/common-requirements.mdx Co-authored-by: helenfufu <[email protected]> * save * Update website/content/docs/plugins/rollback.mdx Co-authored-by: helenfufu <[email protected]> * Update website/content/docs/plugins/upgrade.mdx Co-authored-by: helenfufu <[email protected]> * fix formatting --------- Co-authored-by: helenfufu <[email protected]>
Description
This PR improves the API and CLI UX for
sha256
andcommand
following the below guidelines:sha256
is provided,command
is required (following the existing behavior). Whensha256
is not provided,command
is ignored and give a warningfmt.Sprintf("When sha256 is unspecified, a plugin artifact is expected for registration and the command parameter %q will be ignored.", command)
.sha256
is provided and bothcommand
andoci_image
are not provided, defaultcommand
to plugin name. Whensha256
is not provided, make the API call and propagate up the API warning.We additionally update the plugin registration docs (overview, API, and CLI) around
sha256
,command
, andversion
to capture the two supported plugin registration mechanisms at this time: binary with-sha256
and (extracted) artifact with-version
only.Local testing: link
ENT PR: https://github.com/hashicorp/vault-enterprise/pull/8365
TODO only if you're a HashiCorp employee
backport/
label that matches the desired release branch. Note that in the CE repo, the latest release branch will look likebackport/x.x.x
, but older release branches will bebackport/ent/x.x.x+ent
.of a public function, even if that change is in a CE file, double check that
applying the patch for this PR to the ENT repo and running tests doesn't
break any tests. Sometimes ENT only tests rely on public functions in CE
files.
in the PR description, commit message, or branch name.
description. Also, make sure the changelog is in this PR, not in your ENT PR.