You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 27, 2024. It is now read-only.
container-diff analyze <img> --types=apt,node [Apt and Node]
52
+
# --types=<analyzer1>,<analyzer2>,<analyzer3>,...
51
53
```
52
54
53
55
To use container-diff to perform a diff analysis on two images, you need two Docker images (in the form of an ID, tarball, or URL from a repo). Once you have those images, you can run any of the following differs:
54
56
```
55
57
container-diff diff <img1> <img2> [Run all differs]
@@ -372,7 +374,3 @@ This is where you define how your analyzer should output for a human readable fo
372
374
373
375
5. Add your analyzer to the `analyses` map in [differs.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/differs.go#L22) with the corresponding Analyzer struct as the value.
errMessage:=fmt.Sprintf("Argument %s is not an image ID, URL, or tar\n", args[0])
127
-
buffer.WriteString(errMessage)
101
+
glog.Errorf(errMessage)
102
+
returnerrors.New(errMessage)
128
103
}
129
104
}
130
-
if!valid {
131
-
returnfalse, errors.New(buffer.String())
105
+
returnnil
106
+
}
107
+
108
+
funccheckIfValidAnalyzer(flagtypesstring) error {
109
+
analyzers:=strings.Split(flagtypes, ",")
110
+
for_, name:=rangeanalyzers {
111
+
if_, exists:=differs.Analyzers[name]; !exists {
112
+
errMessage:=fmt.Sprintf("Argument %s is not an image ID, URL, or tar\n", name)
113
+
glog.Errorf(errMessage)
114
+
returnerrors.New(errMessage)
115
+
}
132
116
}
133
-
returntrue, nil
117
+
returnnil
134
118
}
135
119
136
120
funcremove(pathstring, dirbool) string {
@@ -157,11 +141,7 @@ func init() {
157
141
158
142
funcaddSharedFlags(cmd*cobra.Command) {
159
143
cmd.Flags().BoolVarP(&json, "json", "j", false, "JSON Output defines if the diff should be returned in a human readable format (false) or a JSON (true).")
160
-
cmd.Flags().BoolVarP(&pip, "pip", "p", false, "Set this flag to use the pip differ.")
161
-
cmd.Flags().BoolVarP(&node, "node", "n", false, "Set this flag to use the node differ.")
162
-
cmd.Flags().BoolVarP(&apt, "apt", "a", false, "Set this flag to use the apt differ.")
163
-
cmd.Flags().BoolVarP(&file, "file", "f", false, "Set this flag to use the file differ.")
164
-
cmd.Flags().BoolVarP(&history, "history", "d", false, "Set this flag to use the dockerfile history differ.")
144
+
cmd.Flags().StringVarP(&types, "types", "t", "", "This flag sets the list of analyzer types to use. It expects a comma separated list of supported analyzers.")
165
145
cmd.Flags().BoolVarP(&save, "save", "s", false, "Set this flag to save rather than remove the final image filesystems on exit.")
166
146
cmd.Flags().BoolVarP(&utils.SortSize, "order", "o", false, "Set this flag to sort any file/package results by descending size. Otherwise, they will be sorted by name.")
0 commit comments