Skip to content

Commit 28d87fe

Browse files
authored
Merge pull request #785 from Kaggle/fix-push
Ensure the image to push is present on the worker
2 parents 717bf24 + 3280eb8 commit 28d87fe

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

Jenkinsfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ pipeline {
4848
set -exo pipefail
4949
5050
date
51-
./push ${STAGING_TAG}
51+
docker pull gcr.io/kaggle-images/python:${PRETEST_TAG}
52+
./push --source-image gcr.io/kaggle-images/python:${PRETEST_TAG} ${STAGING_TAG}
5253
'''
5354
}
5455
}
@@ -96,7 +97,8 @@ pipeline {
9697
set -exo pipefail
9798
9899
date
99-
./push --gpu ${STAGING_TAG}
100+
docker pull gcr.io/kaggle-private-byod/python:${PRETEST_TAG}
101+
./push --source-image gcr.io/kaggle-private-byod/python:${PRETEST_TAG} --gpu ${STAGING_TAG}
100102
'''
101103
}
102104
}

push

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ Usage: $0 [OPTIONS] [LABEL]
77
Push a newly-built image with the given LABEL to gcr.io and DockerHub.
88
99
Options:
10-
-g, --gpu Push the image with GPU support.
10+
-g, --gpu Push the image with GPU support.
11+
-s, --source-image IMAGE Tag for the source image.
1112
EOF
1213
}
1314

14-
SOURCE_IMAGE='kaggle/python-build'
15+
SOURCE_IMAGE_TAG='kaggle/python-build:latest'
16+
SOURCE_IMAGE_TAG_OVERRIDE=''
1517
TARGET_IMAGE='gcr.io/kaggle-images/python'
1618

1719
while :; do
@@ -21,9 +23,18 @@ while :; do
2123
exit
2224
;;
2325
-g|--gpu)
24-
SOURCE_IMAGE='kaggle/python-gpu-build'
26+
SOURCE_IMAGE_TAG='kaggle/python-gpu-build:latest'
2527
TARGET_IMAGE='gcr.io/kaggle-private-byod/python'
2628
;;
29+
-s|--source-image)
30+
if [[ -z $2 ]]; then
31+
usage
32+
printf 'ERROR: No IMAGE specified after the %s flag.\n' "$1" >&2
33+
exit
34+
fi
35+
SOURCE_IMAGE_TAG_OVERRIDE=$2
36+
shift # skip the flag value
37+
;;
2738
-?*)
2839
usage
2940
printf 'ERROR: Unknown option: %s\n' "$1" >&2
@@ -38,16 +49,14 @@ done
3849

3950
LABEL=${1:-testing}
4051

41-
readonly SOURCE_IMAGE
52+
if [[ -n "$SOURCE_IMAGE_TAG_OVERRIDE" ]]; then
53+
SOURCE_IMAGE_TAG="$SOURCE_IMAGE_TAG_OVERRIDE"
54+
fi
55+
56+
readonly SOURCE_IMAGE_TAG
4257
readonly TARGET_IMAGE
4358
readonly LABEL
4459

4560
set -x
46-
docker tag "${SOURCE_IMAGE}:latest" "${TARGET_IMAGE}:${LABEL}"
61+
docker tag "${SOURCE_IMAGE_TAG}" "${TARGET_IMAGE}:${LABEL}"
4762
gcloud docker -- push "${TARGET_IMAGE}:${LABEL}"
48-
49-
# Only CPU images are made public at this time.
50-
if [[ "$LABEL" == "latest" && SOURCE_IMAGE = "kaggle/python-build" ]]; then
51-
docker tag "${SOURCE_IMAGE}:latest" "kaggle/python:${LABEL}"
52-
docker push "kaggle/python:${LABEL}"
53-
fi

0 commit comments

Comments
 (0)