|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set +x |
| 4 | +# Grab the container definitions from the integration test |
| 5 | +diffBase=$(cat ../tests/integration_test.go | grep diffBase | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 6 | +diffModified=$(cat ../tests/integration_test.go | grep diffModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 7 | +diffLayerBase=$(cat ../tests/integration_test.go | grep diffLayerBase | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 8 | +diffLayerModified=$(cat ../tests/integration_test.go | grep diffLayerModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 9 | +rpmBase=$(cat ../tests/integration_test.go | grep rpmBase | grep valentinrothberg | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 10 | +rpmModified=$(cat ../tests/integration_test.go | grep rpmModified | grep valentinrothberg | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 11 | +aptBase=$(cat ../tests/integration_test.go | grep aptBase | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 12 | +aptModified=$(cat ../tests/integration_test.go | grep aptModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 13 | +nodeBase=$(cat ../tests/integration_test.go | grep nodeBase | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 14 | +nodeModified=$(cat ../tests/integration_test.go | grep nodeModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 15 | +multiBase=$(cat ../tests/integration_test.go | grep -w multiBase | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 16 | +multiModified=$(cat ../tests/integration_test.go | grep -w multiModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 17 | +metadataBase=$(cat ../tests/integration_test.go | grep metadataBase | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 18 | +metadataModified=$(cat ../tests/integration_test.go | grep metadataModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 19 | +pipModified=$(cat ../tests/integration_test.go | grep pipModified | grep gcr.io | sed -e 's/.* = //g' | sed -e 's/"//g') |
| 20 | + |
| 21 | +# Echo the container definitions. |
| 22 | +echo diffBase=$diffBase |
| 23 | +echo diffModified=$diffModified |
| 24 | +echo diffLayerBase=$diffLayerBase |
| 25 | +echo diffLayerModified=$diffLayerModified |
| 26 | +echo rpmBase=$rpmBase |
| 27 | +echo rpmModified=$rpmModified |
| 28 | +echo aptBase=$aptBase |
| 29 | +echo aptModified=$aptModified |
| 30 | +echo nodeBase=$nodeBase |
| 31 | +echo nodeModified=$nodeModified |
| 32 | +echo multiBase=$multiBase |
| 33 | +echo multiModified=$multiModified |
| 34 | +echo metadataBase=$metadataBase |
| 35 | +echo metadataModified=$metadataModified |
| 36 | +echo pipModified=$pipModified |
| 37 | + |
| 38 | +# Now generate the containers |
| 39 | +# XXX TO-DO for now we're only generated diffBase diffModified diffLayerBase and |
| 40 | +# diffLayerModified, eventually we should generate all of them |
| 41 | +# |
| 42 | + |
| 43 | +echo 'docker build . -f Dockerfile.diffBase -t $diffBase:latest' |
| 44 | +docker build . -f Dockerfile.diffBase -t $diffBase:latest |
| 45 | +docker push $diffBase:latest |
| 46 | +echo 'docker build . -f Dockerfile.diffLayerBase -t $diffLayerBase:latest' |
| 47 | +docker build . -f Dockerfile.diffLayerBase -t $diffLayerBase:latest |
| 48 | +docker push $diffLayerBase:latest |
| 49 | +echo 'docker build . -f Dockerfile.diffLayerModified -t $diffLayerModified:latest' |
| 50 | +docker build . -f Dockerfile.diffLayerModified -t $diffLayerModified:latest |
| 51 | +docker push $diffLayerModified:latest |
| 52 | +echo 'docker build . -f Dockerfile.diffModified -t $diffModified:latest' |
| 53 | +docker build . -f Dockerfile.diffModified -t $diffModified:latest |
| 54 | +docker push $diffModified:latest |
| 55 | + |
| 56 | +#Now generate expected outputs. Do NOT commit these without reviewing them for reasonableness |
| 57 | +container-diff diff --no-cache -j --type=file $diffBase $diffModified > ../tests/file_diff_expected.json |
| 58 | +container-diff diff --no-cache -j --type=layer $diffLayerBase $diffLayerModified > ../tests/file_layer_diff_expected.json |
| 59 | +container-diff diff --no-cache -j --type=size $diffLayerBase $diffLayerModified > ../tests/size_diff_expected.json |
| 60 | +container-diff diff --no-cache -j --type=sizelayer $diffLayerBase $diffLayerModified > ../tests/size_layer_diff_expected.json |
| 61 | +container-diff diff --no-cache -j --type=apt $aptBase $aptModified > ../tests/apt_diff_expected.json |
| 62 | +container-diff diff --no-cache -j --type=node $nodeBase $nodeModified > ../tests/node_diff_order_expected.json |
| 63 | +container-diff diff --no-cache -j --type=node --type=pip --type=apt $multiBase $multiModified > ../tests/multi_diff_expected.json |
| 64 | +container-diff diff --no-cache -j --type=history $diffBase $diffModified > ../tests/hist_diff_expected.json |
| 65 | +container-diff diff --no-cache -j --type=metadata $metadataBase $metadataModified > ../tests/metadata_diff_expected.json |
| 66 | +container-diff diff --no-cache -j --type=apt -o $aptBase $aptModified > ../tests/apt_sorted_diff_expected.json |
| 67 | +container-diff analyze --no-cache -j --type=apt $aptModified > ../tests/apt_analysis_expected.json |
| 68 | +container-diff analyze --no-cache -j --type=file -o $diffModified > ../tests/file_sorted_analysis_expected.json |
| 69 | +container-diff analyze --no-cache -j --type=layer $diffLayerBase > ../tests/file_layer_analysis_expected.json |
| 70 | +container-diff analyze --no-cache -j --type=size $diffBase > ../tests/size_analysis_expected.json |
| 71 | +container-diff analyze --no-cache -j --type=sizelayer $diffLayerBase > ../tests/size_layer_analysis_expected.json |
| 72 | +container-diff analyze --no-cache -j --type=pip $pipModified > ../tests/pip_analysis_expected.json |
| 73 | +container-diff analyze --no-cache -j --type=node $nodeModified > ../tests/node_analysis_expected.json |
| 74 | + |
0 commit comments