-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
refactor plugin install #28963
refactor plugin install #28963
Conversation
Compilation failing for windows
|
@vieux psst |
9adeceb
to
f31b378
Compare
@LK4D4 thanks |
f31b378
to
521287e
Compare
aef8096
to
c7b0481
Compare
@@ -65,7 +74,12 @@ func (cli *Client) PluginInstall(ctx context.Context, name string, options types | |||
return cli.PluginEnable(ctx, name, types.PluginEnableOptions{Timeout: 0}) | |||
} | |||
|
|||
func (cli *Client) tryPluginPull(ctx context.Context, query url.Values, registryAuth string) (serverResponse, error) { | |||
func (cli *Client) tryPluginGetPrivileges(ctx context.Context, query url.Values, registryAuth string) (serverResponse, error) { |
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: can be tryPluginPrivileges
to be consistent with other client function names.
@@ -177,7 +177,6 @@ func WritePullData(pd PullData, dest string, extract bool) error { | |||
if err := json.Unmarshal(config, &p); err != nil { | |||
return err | |||
} | |||
logrus.Debugf("%#v", p) |
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.
Lets keep this. Its useful to look at the payload during debugging.
/plugins/privileges: | ||
get: | ||
summary: "Get plugin privileges" | ||
operationId: "GetPluginsPrivileges" |
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.
Its a single plugin. So GetPluginPrivileges
$ref: "#/definitions/ErrorResponse" | ||
parameters: | ||
- name: "name" | ||
in: "query" |
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.
I'm trying to produce a human readable engine-api docs out of this. According to instructions on https://github.com/docker/docker/blob/master/api/README.md, I need to Copy api/swagger.yaml in this repository to engine/api/[VERSION_NUMBER]/swagger.yaml in the documentation repository
.
Interestingly, there's no such file in https://github.com/docker/docker.github.io. How did you verify this doc, @vieux ?
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.
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.
@mstanleyjones @bfirsh : Vendoring the swagger.yaml frequently
to the docs repo is supposed to generate a human readable API reference, yes? Few questions:
- How frequent is this vendoring?
- When and where can I get the 1.25 api reference doc? We have to send the link to a few partners working on plugins and there's no such doc in any repo at the moment. @khudgins
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.
- The latest version for a particular version is vendored automatically on every deploy. There has been some back and forth between whether this should be pinned to a commit or automatically the latest, so that might change.
- As @cpuguy83 says, Add make command for previewing API docs #29078 should help you there. :)
|
||
if p, _ := pm.pluginStore.GetByName(name); p != nil { |
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.
We should keep this check in Pull to avoid a race where another client has already pulled the plugin by now.
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.
Pull
is calling pull
that is doing this check.
} | ||
|
||
priv, err := pm.pull(ref, metaHeader, authConfig, pluginID) | ||
if err != nil { | ||
removePluginDir := func() { |
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.
Its more elegant if we change this to a defer that acts on a named return error. Then we can remove L182 and L189.
defer func() {
if err != nil {
os.RemoveAll(pluginDir)...
}
}()
c7b0481
to
0db0ec2
Compare
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
0db0ec2
to
30db51c
Compare
@anusha-ragunathan PTAL |
LGTM (if tests pass) |
LGTM |
refactor plugin install
before
calling
/pull
was pulling, installing a plugin, then a lists a privileges was returned.upon a user accepting the privileges, it would enable the plugin.
problems:
<ctrl-c>
the "do you accept privileges" question would leave the plugin installed on the daemonnow
calling
/privileges
will return the list of privileges required by the plugin (noting is installed)update a user accepting the privileges,
/pull
is called with the list of privileges acceptedthe daemon now compares the required privileges and the privileges sent by the user before installing
it forces a round-trip so even through the API there is an acceptance mechanism
ping @tiborvass @anusha-ragunathan