Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow IT Dockerfile to exit after all setup attempts fail #17592

Merged
merged 21 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions integration-tests/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions integration-tests/docker/base-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading