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
+31-27Lines changed: 31 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,38 @@ 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
+
// TODO FIX EXAMPLE RUN
162
+
161
163
```
162
-
$ container-diff gcr.io/google-appengine/python:latest gcr.io/google-appengine/python:2017-07-25-110644 -p -a -n
164
+
$ container-diff gcr.io/google-appengine/python:2017-07-21-123058 gcr.io/google-appengine/python:2017-06-29-190410 -a -n -p
163
165
164
-
-----Apt Diff-----
166
+
-----AptDiffer-----
165
167
166
-
Packages found only in gcr.io/google-appengine/python:latest: None
168
+
Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None
167
169
168
-
Packages found only in gcr.io/google-appengine/python:2017-07-25-110644: None
170
+
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
178
+
Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None
183
179
184
-
Packages found only in gcr.io/google-appengine/python:2017-07-25-110644: None
180
+
Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
185
181
186
182
Version differences: None
187
183
188
-
-----Pip Diff-----
184
+
-----PipDiffer-----
189
185
190
-
Packages found only in gcr.io/google-appengine/python:latest: None
186
+
Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None
191
187
192
-
Packages found only in gcr.io/google-appengine/python:2017-07-25-110644: None
188
+
Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
193
189
194
190
Version differences: None
195
191
@@ -205,14 +201,14 @@ Feel free to develop your own differ leveraging the utils currently available.
205
201
In order to quickly make your own differ, follow these steps:
206
202
207
203
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:
204
+
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
205
- Are you trying to diff packages?
210
206
- 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.
207
+
- 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.
208
+
- 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
209
- 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
210
215
-
3. Write your Diff driver such that you have a struct for your differ type and a method for that differ called Diff:
211
+
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
212
217
213
```
218
214
type YourDiffer struct {}
@@ -225,7 +221,15 @@ If using existing package differ tools, you should create the appropriate struct
225
221
226
222
Otherwise, create your own differ which should yield information to fill a DiffResult in the next step.
227
223
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).
224
+
4. Create a DiffResult for your differ.
225
+
```
226
+
type DiffResult interface {
227
+
GetStruct() DiffResult
228
+
OutputText(diffType string) error
229
+
}
230
+
```
231
+
232
+
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
233
230
234
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