-
Notifications
You must be signed in to change notification settings - Fork 928
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
usage() { | ||
cat << EOF | ||
Usage: $0 [OPTIONS] | ||
Compare the package versions of the newly built Docker with the one in prod. | ||
Options: | ||
-g, --gpu Compare GPU images. | ||
EOF | ||
} | ||
|
||
|
||
BASE_IMAGE_TAG="gcr.io/kaggle-images/python:latest" | ||
TARGET_IMAGE_TAG="kaggle/python-build" | ||
|
||
while :; do | ||
case "$1" in | ||
-h|--help) | ||
usage | ||
exit | ||
;; | ||
-g|--gpu) | ||
BASE_IMAGE_TAG="gcr.io/kaggle-private-byod/python:latest" | ||
TARGET_IMAGE_TAG="kaggle/python-gpu-build" | ||
;; | ||
-?*) | ||
usage | ||
printf 'ERROR: Unknown option: %s\n' "$1" >&2 | ||
exit | ||
;; | ||
*) | ||
break | ||
esac | ||
|
||
shift | ||
done | ||
|
||
readonly BASE_IMAGE_TAG | ||
readonly TARGET_IMAGE_TAG | ||
|
||
echo "Base: $BASE_IMAGE_TAG" | ||
echo "Target: $TARGET_IMAGE_TAG" | ||
|
||
docker pull "$BASE_IMAGE_TAG" | ||
|
||
CMDS=('dpkg-query --show -f "${Package}==${Version}\n"' 'pip freeze') | ||
for cmd in "${CMDS[@]}"; do | ||
echo "== Comparing $cmd ==" | ||
diff --report-identical-files --suppress-common-lines --side-by-side \ | ||
<(docker run --rm "$BASE_IMAGE_TAG" $cmd) \ | ||
<(docker run --rm "$TARGET_IMAGE_TAG" $cmd) | ||
done |