MCPcopy Index your code
hub / github.com/docker/cli / runRollback

Function runRollback

cli/command/service/rollback.go:35–63  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, options *serviceOptions, serviceID string)

Source from the content-addressed store, hash-verified

33}
34
35func runRollback(ctx context.Context, dockerCLI command.Cli, options *serviceOptions, serviceID string) error {
36 apiClient := dockerCLI.Client()
37
38 res, err := apiClient.ServiceInspect(ctx, serviceID, client.ServiceInspectOptions{})
39 if err != nil {
40 return err
41 }
42
43 response, err := apiClient.ServiceUpdate(ctx, res.Service.ID, client.ServiceUpdateOptions{
44 Version: res.Service.Version,
45 Spec: res.Service.Spec,
46 Rollback: "previous", // TODO(thaJeztah): this should have a const defined
47 })
48 if err != nil {
49 return err
50 }
51
52 for _, warning := range response.Warnings {
53 _, _ = fmt.Fprintln(dockerCLI.Err(), warning)
54 }
55
56 _, _ = fmt.Fprintln(dockerCLI.Out(), serviceID)
57
58 if options.detach {
59 return nil
60 }
61
62 return WaitOnService(ctx, dockerCLI, serviceID, options.quiet)
63}

Callers 1

newRollbackCommandFunction · 0.85

Calls 6

WaitOnServiceFunction · 0.85
ClientMethod · 0.65
ErrMethod · 0.65
OutMethod · 0.65
ServiceInspectMethod · 0.45
ServiceUpdateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…