(cmd *cobra.Command)
| 48 | } |
| 49 | |
| 50 | func pruneOptions(cmd *cobra.Command) (types.SystemPruneOptions, error) { |
| 51 | globalOptions, err := helpers.ProcessRootCmdFlags(cmd) |
| 52 | if err != nil { |
| 53 | return types.SystemPruneOptions{}, err |
| 54 | } |
| 55 | |
| 56 | all, err := cmd.Flags().GetBool("all") |
| 57 | if err != nil { |
| 58 | return types.SystemPruneOptions{}, err |
| 59 | } |
| 60 | |
| 61 | vFlag, err := cmd.Flags().GetBool("volumes") |
| 62 | if err != nil { |
| 63 | return types.SystemPruneOptions{}, err |
| 64 | } |
| 65 | |
| 66 | buildkitHost, err := builder.GetBuildkitHost(cmd, globalOptions.Namespace) |
| 67 | if err != nil { |
| 68 | log.L.WithError(err).Warn("BuildKit is not running. Build caches will not be pruned.") |
| 69 | buildkitHost = "" |
| 70 | } |
| 71 | |
| 72 | return types.SystemPruneOptions{ |
| 73 | Stdout: cmd.OutOrStdout(), |
| 74 | Stderr: cmd.ErrOrStderr(), |
| 75 | GOptions: globalOptions, |
| 76 | All: all, |
| 77 | Volumes: vFlag, |
| 78 | BuildKitHost: buildkitHost, |
| 79 | NetworkDriversToKeep: network.NetworkDriversToKeep, |
| 80 | }, nil |
| 81 | } |
| 82 | |
| 83 | func grantSystemPrunePermission(cmd *cobra.Command, options types.SystemPruneOptions) (bool, error) { |
| 84 | force, err := cmd.Flags().GetBool("force") |
no test coverage detected
searching dependent graphs…