Skip to content

Commit

Permalink
Compare package versions with prod
Browse files Browse the repository at this point in the history
  • Loading branch information
rosbo committed Dec 6, 2018
1 parent bf0bac6 commit c1b8c5b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ pipeline {
SLACK_CHANNEL = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"master\" ]]; then echo \"#kernelops\"; else echo \"#builds\"; fi").trim()
}

// TODO: Move at the end
stages {
stage('Package Versions Diff') {
parallel {
stage('CPU') {
steps {
sh '''#!/bin/bash
set -exo pipefail
./diff
'''
}
}
// TODO: Add GPU stage
}
}

}

stages {
stage('Docker CPU Build') {
steps {
Expand Down
54 changes: 54 additions & 0 deletions diff
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

0 comments on commit c1b8c5b

Please sign in to comment.