diff --git a/integration-tests/docker/Dockerfile b/integration-tests/docker/Dockerfile index 1436aa5bf856..2e8a73c35f0c 100644 --- a/integration-tests/docker/Dockerfile +++ b/integration-tests/docker/Dockerfile @@ -25,17 +25,8 @@ ARG KAFKA_VERSION # This is passed in by maven at build time to align with the client version we depend on in the pom file ARG ZK_VERSION ARG APACHE_ARCHIVE_MIRROR_HOST=https://downloads.apache.org -ARG SETUP_RETRIES=3 -# Retry mechanism for running the setup script up to limit of 3 times. -RUN set -e; \ - for i in $(seq 1 $SETUP_RETRIES); do \ - echo "Attempt $i to run the setup script..."; \ - APACHE_ARCHIVE_MIRROR_HOST=${APACHE_ARCHIVE_MIRROR_HOST} /root/base-setup.sh && break || { \ - echo "Set up script attempt $i/$SETUP_RETRIES failed."; \ - sleep 2; \ - }; \ - done; \ - rm -f /root/base-setup.sh +RUN APACHE_ARCHIVE_MIRROR_HOST=${APACHE_ARCHIVE_MIRROR_HOST} /root/base-setup.sh && rm -f /root/base-setup.sh + FROM druidbase ARG MYSQL_VERSION diff --git a/integration-tests/docker/base-setup.sh b/integration-tests/docker/base-setup.sh index ea10e1a336b5..31720fcbca9f 100755 --- a/integration-tests/docker/base-setup.sh +++ b/integration-tests/docker/base-setup.sh @@ -31,10 +31,17 @@ apt-get install -y default-mysql-server # Supervisor apt-get install -y supervisor -# Zookeeper +# Download function +download_file() { + local dest=$1 + local host=$2 + + wget --retry-connrefused --continue --output-document="$dest" "$host" +} +# Zookeeper install_zk() { - wget -q -O /tmp/$ZK_TAR.tar.gz "$APACHE_ARCHIVE_MIRROR_HOST/zookeeper/zookeeper-$ZK_VERSION/$ZK_TAR.tar.gz" + download_file "/tmp/$ZK_TAR.tar.gz" "$APACHE_ARCHIVE_MIRROR_HOST/zookeeper/zookeeper-$ZK_VERSION/$ZK_TAR.tar.gz" tar -xzf /tmp/$ZK_TAR.tar.gz -C /usr/local cp /usr/local/$ZK_TAR/conf/zoo_sample.cfg /usr/local/$ZK_TAR/conf/zoo.cfg rm /tmp/$ZK_TAR.tar.gz @@ -46,7 +53,7 @@ ln -s /usr/local/$ZK_TAR /usr/local/zookeeper # Kafka # KAFKA_VERSION is defined by docker build arguments -wget -q -O /tmp/kafka_2.13-$KAFKA_VERSION.tgz "$APACHE_ARCHIVE_MIRROR_HOST/kafka/$KAFKA_VERSION/kafka_2.13-$KAFKA_VERSION.tgz" +download_file "/tmp/kafka_2.13-$KAFKA_VERSION.tgz" "$APACHE_ARCHIVE_MIRROR_HOST/kafka/$KAFKA_VERSION/kafka_2.13-$KAFKA_VERSION.tgz" tar -xzf /tmp/kafka_2.13-$KAFKA_VERSION.tgz -C /usr/local ln -s /usr/local/kafka_2.13-$KAFKA_VERSION /usr/local/kafka rm /tmp/kafka_2.13-$KAFKA_VERSION.tgz