Skip to content

Commit 9965677

Browse files
authored
Wait for docker images to be ready for e2e dataflow test (#909)
* Wait for docker images to be ready for e2e dataflow test * Fix typo in pull command * Allow non-zero exit command
1 parent 6308f1d commit 9965677

4 files changed

Lines changed: 43 additions & 45 deletions

File tree

‎infra/scripts/setup-common-functions.sh‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,31 @@ $1
130130
============================================================
131131
"
132132
}
133+
134+
wait_for_docker_image(){
135+
# This script will block until a docker image is ready
136+
137+
[[ -z "$1" ]] && { echo "Please pass the docker image URI as the first parameter" ; exit 1; }
138+
oldopt=$-
139+
set +e
140+
141+
DOCKER_IMAGE=$1
142+
poll_count=0
143+
maximum_poll_count=150
144+
145+
# Wait for Feast Core to be available on GCR
146+
until docker pull "$DOCKER_IMAGE"
147+
do
148+
# Exit when we have tried enough times
149+
if [[ "$poll_count" -gt "$maximum_poll_count" ]]; then
150+
set -$oldopt
151+
exit 1
152+
fi
153+
# Sleep and increment counter on failure
154+
echo "${DOCKER_IMAGE} could not be found";
155+
sleep 5;
156+
((poll_count++))
157+
done
158+
159+
set -$oldopt
160+
}

‎infra/scripts/test-end-to-end-batch-dataflow.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ export HELM_COMMON_NAME=$HELM_COMMON_NAME
213213
export IMAGE_TAG=$PULL_PULL_SHA
214214
export SPECS_TOPIC=$SPECS_TOPIC
215215

216+
export PROJECT_ROOT_DIR=$(git rev-parse --show-toplevel)
217+
export SCRIPTS_DIR=${PROJECT_ROOT_DIR}/infra/scripts
218+
source ${SCRIPTS_DIR}/setup-common-functions.sh
219+
220+
wait_for_docker_image gcr.io/kf-feast/feast-core:"${IMAGE_TAG}"
221+
wait_for_docker_image gcr.io/kf-feast/feast-serving:"${IMAGE_TAG}"
222+
216223
envsubst $'$TEMP_BUCKET $DATASET_NAME $GCLOUD_PROJECT $GCLOUD_NETWORK $SPECS_TOPIC \
217224
$GCLOUD_SUBNET $GCLOUD_REGION $IMAGE_TAG $HELM_COMMON_NAME $feast_kafka_1_ip
218225
$feast_kafka_2_ip $feast_kafka_3_ip $feast_redis_ip $feast_statsd_ip' < $ORIGINAL_DIR/infra/scripts/test-templates/values-end-to-end-batch-dataflow.yaml > $ORIGINAL_DIR/infra/charts/feast/values-end-to-end-batch-dataflow-updated.yaml

‎infra/scripts/test-load.sh‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ clean_up() {
2424
exit $ARG
2525
}
2626

27+
# Get Feast project repository root and scripts directory
28+
export PROJECT_ROOT_DIR=$(git rev-parse --show-toplevel)
29+
export SCRIPTS_DIR=${PROJECT_ROOT_DIR}/infra/scripts
30+
export COMPOSE_INTERACTIVE_NO_CLI=1
31+
source ${SCRIPTS_DIR}/setup-common-functions.sh
32+
2733
if [ -z "$1" ] ; then
2834
echo "No SHA provided as argument, using local HEAD";
2935
CURRENT_SHA=$(git rev-parse HEAD);
@@ -34,11 +40,8 @@ else
3440
export CURRENT_SHA
3541
fi
3642

37-
export PROJECT_ROOT_DIR=$(git rev-parse --show-toplevel)
38-
export COMPOSE_INTERACTIVE_NO_CLI=1
39-
40-
# Wait for docker images to be available
41-
"${PROJECT_ROOT_DIR}"/infra/scripts/wait-for-docker-images.sh "${CURRENT_SHA}"
43+
wait_for_docker_image gcr.io/kf-feast/feast-core:"${CURRENT_SHA}"
44+
wait_for_docker_image gcr.io/kf-feast/feast-serving:"${CURRENT_SHA}"
4245

4346
# Clean up Docker Compose if failure
4447
trap clean_up EXIT

‎infra/scripts/wait-for-docker-images.sh‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)