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.
Copy file name to clipboardExpand all lines: README.md
+29-27Lines changed: 29 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ type PackageInfo struct {
114
114
115
115
#### Single Version Diffs
116
116
117
-
The single version differs (apt, pip) have the following json output structure:
117
+
Single version differs (apt) have the following json output structure:
118
118
119
119
```
120
120
type PackageDiff struct {
@@ -130,7 +130,7 @@ Image1 and Image2 are the image names. Packages1 and Packages2 map package name
130
130
131
131
#### Multi Version Diffs
132
132
133
-
The multi version differs (node) support processing images which may have multiple versions of the same package. Below is the json output structure:
133
+
The multi version differs (pip, node) support processing images which may have multiple versions of the same package. Below is the json output structure:
134
134
135
135
```
136
136
type MultiVersionPackageDiff struct {
@@ -154,42 +154,36 @@ type MultiVersionInfo struct {
154
154
155
155
## Known issues
156
156
157
-
To run container-diff on image IDs or URLs, docker must be installed.
157
+
To run container-diff on image IDs, docker must be installed.
158
158
159
159
## Example Run
160
160
161
161
```
162
-
$ container-diff gcr.io/google-appengine/python:latest gcr.io/google-appengine/python:2017-07-25-110644 -p -a -n
162
+
$ container-diff gcr.io/google-appengine/python:2017-07-21-123058 gcr.io/google-appengine/python:2017-06-29-190410 -a -n -p
163
163
164
-
-----Apt Diff-----
164
+
-----AptDiffer-----
165
165
166
-
Packages found only in gcr.io/google-appengine/python:latest: None
166
+
Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None
167
167
168
-
Packages found only in gcr.io/google-appengine/python:2017-07-25-110644: None
168
+
Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
Packages found only in gcr.io/google-appengine/python:latest: None
174
+
-----NodeDiffer-----
183
175
184
-
Packages found only in gcr.io/google-appengine/python:2017-07-25-110644: None
176
+
Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None
177
+
178
+
Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
185
179
186
180
Version differences: None
187
181
188
-
-----Pip Diff-----
182
+
-----PipDiffer-----
189
183
190
-
Packages found only in gcr.io/google-appengine/python:latest: None
184
+
Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None
191
185
192
-
Packages found only in gcr.io/google-appengine/python:2017-07-25-110644: None
186
+
Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
193
187
194
188
Version differences: None
195
189
@@ -205,14 +199,14 @@ Feel free to develop your own differ leveraging the utils currently available.
205
199
In order to quickly make your own differ, follow these steps:
206
200
207
201
1. Add your diff identifier to the flags in [root.go](https://github.com/GoogleCloudPlatform/container-diff/blob/ReadMe/cmd/root.go)
208
-
2. Determine if you can use existing differ tools. If you can make use of existing tools, you then need to construct the structs to feed to the diff tools by getting all of the packages for each image or the analogous quality to be diffed. To determine if you can leverage existing tools, think through these questions:
202
+
2. Determine if you can use existing differ tools. If you can make use of existing tools, you then need to construct the structs to feed into the diff tools by getting all of the packages for each image or the analogous quality to be diffed. To determine if you can leverage existing tools, think through these questions:
209
203
- Are you trying to diff packages?
210
204
- Yes: Does the relevant package manager support different versions of the same package on one image?
211
-
- Yes: Use `GetMultiVerisonMapDiff` to diff `map[string]map[string]utils.PackageInfo` objects. See [nodeDiff.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/nodeDiff.go#L33)for an example.
212
-
- No: Use `GetMapDiff` to diff `map[string]utils.PackageInfo` objects. See [aptDiff.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/aptDiff.go#L29) or [pipDiff.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/pipDiff.go#L23) for examples.
205
+
- Yes: Use `GetMultiVerisonMapDiff` to diff `map[string]map[string]utils.PackageInfo` objects. See [nodeDiff.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/nodeDiff.go#L33) or [pipDiff.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/pipDiff.go#L23) for examples.
206
+
- No: Use `GetMapDiff` to diff `map[string]utils.PackageInfo` objects. See [aptDiff.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/aptDiff.go#L29).
213
207
- No: Look to [History](https://github.com/GoogleCloudPlatform/container-diff/blob/ReadMe/differs/historyDiff.go) and [File System](https://github.com/GoogleCloudPlatform/container-diff/blob/ReadMe/differs/fileDiff.go) differs as models for diffing.
214
208
215
-
3. Write your Diff driver such that you have a struct for your differ type and a method for that differ called Diff:
209
+
3. Write your Diff driver in the `differs` directory, such that you have a struct for your differ type and a method for that differ called Diff:
216
210
217
211
```
218
212
type YourDiffer struct {}
@@ -225,7 +219,15 @@ If using existing package differ tools, you should create the appropriate struct
225
219
226
220
Otherwise, create your own differ which should yield information to fill a DiffResult in the next step.
227
221
228
-
4. Create a DiffResult for your differ if you're not using existing utils or want to wrap the output. This is where you define how your differ should output for a human readable format and as a struct which can then be written to a `.json` file. See [output_utils.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/utils/output_utils.go).
222
+
4. Create a DiffResult for your differ.
223
+
```
224
+
type DiffResult interface {
225
+
GetStruct() DiffResult
226
+
OutputText(diffType string) error
227
+
}
228
+
```
229
+
230
+
This is where you define how your differ should output for a human readable format (`OutputText`) and as a struct which can then be written to a `.json` file. See [output_utils.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/utils/output_utils.go).
229
231
230
232
5. Add your differ to the diffs map in [differs.go](https://github.com/GoogleCloudPlatform/container-diff/blob/master/differs/differs.go#L22) with the corresponding Differ struct as the value.
0 commit comments