From 132b6570e47c2a2421b8d4ce9fb9191ac687dc5d Mon Sep 17 00:00:00 2001 From: deepakpanda93 Date: Thu, 16 Oct 2025 11:13:08 +0530 Subject: [PATCH 1/4] feat: Add script to build and push Docker images --- docker/build_docker_images.sh | 2 +- docker/push_docker_images.sh | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 docker/push_docker_images.sh diff --git a/docker/build_docker_images.sh b/docker/build_docker_images.sh index d377c5afe02b6..7a4a75f4483a1 100644 --- a/docker/build_docker_images.sh +++ b/docker/build_docker_images.sh @@ -40,7 +40,7 @@ HADOOP_VERSION="3.3.4" SPARK_VERSION="3.5.3" HIVE_VERSION="3.1.3" # Docker image tags -VERSION_TAG="1.1.0" +VERSION_TAG="4e6ebba26cb097cb26cddcbb3958d99dda476320" #Commit ID LATEST_TAG="latest" DOCKER_CONTEXT_DIR="hoodie/hadoop" # List of images to build: "subdir|image_base_name" diff --git a/docker/push_docker_images.sh b/docker/push_docker_images.sh new file mode 100644 index 0000000000000..981645f855bc3 --- /dev/null +++ b/docker/push_docker_images.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +TAGS=("latest" "4e6ebba26cb097cb26cddcbb3958d99dda476320") + +IMAGE_NAMES=( + "apachehudi/hudi-hadoop_3.3.4-base" + "apachehudi/hudi-hadoop_3.3.4-namenode" + "apachehudi/hudi-hadoop_3.3.4-datanode" + "apachehudi/hudi-hadoop_3.3.4-history" + "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3" + "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkbase_3.5.3" + "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkmaster_3.5.3" + "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkworker_3.5.3" + "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkadhoc_3.5.3" +) + +echo "Starting Docker push process for ${#IMAGE_NAMES[@]} images and ${#TAGS[@]} tags each" +echo "------------------------------------------------------------------------" + +# Check if docker is installed +if ! command -v docker &> /dev/null +then + echo "ERROR: Docker command not found. Please ensure Docker is installed and in your PATH." + exit 1 +fi + +SUCCESS_COUNT=0 +FAILURE_COUNT=0 + +for IMAGE in "${IMAGE_NAMES[@]}"; do + for TAG in "${TAGS[@]}"; do + FULL_IMAGE="${IMAGE}:${TAG}" + + echo "Attempting to push: ${FULL_IMAGE}" + + if ! docker image inspect "${FULL_IMAGE}" &> /dev/null; then + echo "--> [SKIPPED] Image ${FULL_IMAGE} does not exist locally. Skipping push." + FAILURE_COUNT=$((FAILURE_COUNT + 1)) + continue + fi + + if docker push "${FULL_IMAGE}"; then + echo "--> [SUCCESS] Successfully pushed ${FULL_IMAGE}" + SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) + else + echo "--> [FAILED] Failed to push ${FULL_IMAGE}. Check Docker login status and network." + FAILURE_COUNT=$((FAILURE_COUNT + 1)) + fi + echo "------------------------------------------------------------------------" + done +done + +echo "Docker Push Summary:" +echo "Total Pushes Attempted: $(( ${#IMAGE_NAMES[@]} * ${#TAGS[@]} ))" +echo "Successful: ${SUCCESS_COUNT}" +echo "Failed: ${FAILURE_COUNT}" + +if [ "${FAILURE_COUNT}" -eq 0 ]; then + echo "All images were successfully pushed." +else + echo "Please review the logs above for failed images." +fi From 10d0d787ba4bc340257f2e7d38ec11d28a76aca5 Mon Sep 17 00:00:00 2001 From: deepakpanda93 Date: Thu, 16 Oct 2025 22:09:50 +0530 Subject: [PATCH 2/4] feat: Add script to build and push Docker images --- docker/push_docker_images.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/push_docker_images.sh b/docker/push_docker_images.sh index 981645f855bc3..c46b0e59b0d41 100644 --- a/docker/push_docker_images.sh +++ b/docker/push_docker_images.sh @@ -46,7 +46,8 @@ for IMAGE in "${IMAGE_NAMES[@]}"; do echo "--> [FAILED] Failed to push ${FULL_IMAGE}. Check Docker login status and network." FAILURE_COUNT=$((FAILURE_COUNT + 1)) fi - echo "------------------------------------------------------------------------" + + echo "------------------------------------------------------------------------" done done From c28dab0d5759db4c2c123cfe0867f911c2f46d03 Mon Sep 17 00:00:00 2001 From: deepakpanda93 Date: Thu, 16 Oct 2025 22:12:41 +0530 Subject: [PATCH 3/4] feat: Add script to build and push Docker images --- docker/push_docker_images.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docker/push_docker_images.sh b/docker/push_docker_images.sh index c46b0e59b0d41..6e8591353421d 100644 --- a/docker/push_docker_images.sh +++ b/docker/push_docker_images.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + TAGS=("latest" "4e6ebba26cb097cb26cddcbb3958d99dda476320") IMAGE_NAMES=( From 11e074b5cdd3792dd1de7c3beca8c30e3c1c75cb Mon Sep 17 00:00:00 2001 From: deepakpanda93 Date: Tue, 28 Oct 2025 15:37:22 +0530 Subject: [PATCH 4/4] feat: Add script to build and push Docker images --- docker/build_and_push_docker_images.sh | 185 +++++++++++++++++++++++++ docker/build_docker_images.sh | 73 ---------- docker/push_docker_images.sh | 79 ----------- 3 files changed, 185 insertions(+), 152 deletions(-) create mode 100644 docker/build_and_push_docker_images.sh delete mode 100644 docker/build_docker_images.sh delete mode 100644 docker/push_docker_images.sh diff --git a/docker/build_and_push_docker_images.sh b/docker/build_and_push_docker_images.sh new file mode 100644 index 0000000000000..b7e173089aabb --- /dev/null +++ b/docker/build_and_push_docker_images.sh @@ -0,0 +1,185 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +# ----------------------------------------------------------------------------- +# build_and_push_docker_images.sh +# +# Usage: +# ./build_and_push_docker_images.sh [push_flag] +# +# Example: +# ./build_and_push_docker_images.sh # build only +# ./build_and_push_docker_images.sh true # build and push +# ----------------------------------------------------------------------------- + +validate_docker_install() { + # Check Docker availability + if ! command -v docker &> /dev/null; then + echo "ERROR: Docker command not found. Please ensure Docker is installed and available in PATH." + exit 1 + fi +} + +validate_docker_install + +# ======================== +# CONFIGURATION VARIABLES +# ======================== + +export PUSH_IMAGES_FLAG=${1:-false} + +ARCHITECTURE=$(uname -m) +case "$ARCHITECTURE" in + x86_64|amd64) + DOCKER_PLATFORM='linux/amd64' + ;; + aarch64|arm64) + DOCKER_PLATFORM='linux/arm64' + ;; + *) + echo "Unsupported architecture: $ARCHITECTURE" + exit 1 + ;; +esac +export DOCKER_DEFAULT_PLATFORM="$DOCKER_PLATFORM" + +# Get script directory +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) + +# Versions +HADOOP_VERSION="3.3.4" +SPARK_VERSION="3.5.3" +HIVE_VERSION="3.1.3" +VERSION_TAG="4e6ebba26cb097cb26cddcbb3958d99dda476320" +LATEST_TAG="latest" + +DOCKER_CONTEXT_DIR="hoodie/hadoop" +HUDI_HADOOP_IMAGE_CONTEXT="apachehudi/hudi-hadoop_${HADOOP_VERSION}" + +# ======================== +# IMAGE DEFINITIONS +# ======================== + +# Each entry: | +DOCKER_IMAGES=( + "base|${HUDI_HADOOP_IMAGE_CONTEXT}-base" + "datanode|${HUDI_HADOOP_IMAGE_CONTEXT}-datanode" + "historyserver|${HUDI_HADOOP_IMAGE_CONTEXT}-history" + "hive_base|${HUDI_HADOOP_IMAGE_CONTEXT}-hive_${HIVE_VERSION}" + "namenode|${HUDI_HADOOP_IMAGE_CONTEXT}-namenode" + "spark_base|${HUDI_HADOOP_IMAGE_CONTEXT}-hive_${HIVE_VERSION}-sparkbase_${SPARK_VERSION}" + "sparkadhoc|${HUDI_HADOOP_IMAGE_CONTEXT}-hive_${HIVE_VERSION}-sparkadhoc_${SPARK_VERSION}" + "sparkmaster|${HUDI_HADOOP_IMAGE_CONTEXT}-hive_${HIVE_VERSION}-sparkmaster_${SPARK_VERSION}" + "sparkworker|${HUDI_HADOOP_IMAGE_CONTEXT}-hive_${HIVE_VERSION}-sparkworker_${SPARK_VERSION}" +) + +TAGS=("$LATEST_TAG" "$VERSION_TAG") + +build_images() { + echo "==============================" + echo "Starting Docker Image Build..." + echo "==============================" + + for IMAGE_CONFIG in "${DOCKER_IMAGES[@]}"; do + IFS='|' read -r SUBDIR IMAGE_BASE <<< "$IMAGE_CONFIG" + IMAGE_CONTEXT="$DOCKER_CONTEXT_DIR/$SUBDIR" + TAG_LATEST="$IMAGE_BASE:$LATEST_TAG" + TAG_VERSIONED="$IMAGE_BASE:$VERSION_TAG" + + echo "Building $IMAGE_CONTEXT as:" + echo " - $TAG_LATEST" + echo " - $TAG_VERSIONED" + + if ! docker build "$IMAGE_CONTEXT" -t "$TAG_LATEST" -t "$TAG_VERSIONED"; then + echo "Error: Failed to build docker image for $IMAGE_CONTEXT" + exit 1 + fi + echo "Successfully built $IMAGE_CONTEXT" + echo "----------------------------------" + done + + echo "All Docker images built successfully." +} + +push_images() { + echo + echo "==============================" + echo "Starting Docker Image Push..." + echo "==============================" + + SUCCESS_COUNT=0 + FAILURE_COUNT=0 + + echo "Preparing image list for push..." + IMAGE_NAMES=() + for IMAGE_CONFIG in "${DOCKER_IMAGES[@]}"; do + IFS='|' read -r _ IMAGE_BASE <<< "$IMAGE_CONFIG" + IMAGE_NAMES+=("$IMAGE_BASE") + done + + echo "Pushing ${#IMAGE_NAMES[@]} images with ${#TAGS[@]} tags each" + echo "----------------------------------" + + for IMAGE in "${IMAGE_NAMES[@]}"; do + for TAG in "${TAGS[@]}"; do + FULL_IMAGE="${IMAGE}:${TAG}" + echo "Attempting to push: ${FULL_IMAGE}" + + if ! docker image inspect "${FULL_IMAGE}" &> /dev/null; then + echo "[SKIPPED] Image ${FULL_IMAGE} not found locally. Skipping." + FAILURE_COUNT=$((FAILURE_COUNT + 1)) + continue + fi + + if docker push "${FULL_IMAGE}"; then + echo "[SUCCESS] Pushed ${FULL_IMAGE}" + SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) + else + echo "[FAILED] Push failed for ${FULL_IMAGE}. Check Docker login and network." + FAILURE_COUNT=$((FAILURE_COUNT + 1)) + fi + + echo "----------------------------------" + done + done + + echo + echo "==============================" + echo "Docker Push Summary" + echo "==============================" + echo "Total Attempts: $(( ${#IMAGE_NAMES[@]} * ${#TAGS[@]} ))" + echo "Successful: ${SUCCESS_COUNT}" + echo "Failed: ${FAILURE_COUNT}" + + if [ "${FAILURE_COUNT}" -eq 0 ]; then + echo "All images pushed successfully!" + else + echo "Some pushes failed. Review logs above." + fi +} + +# ======================== +# MAIN EXECUTION +# ======================== +build_images + +if [ "$PUSH_IMAGES_FLAG" == "true" ]; then + push_images +fi diff --git a/docker/build_docker_images.sh b/docker/build_docker_images.sh deleted file mode 100644 index 7a4a75f4483a1..0000000000000 --- a/docker/build_docker_images.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# This script builds all required Hudi Docker images for Hadoop, Spark, and Hive components. -# It detects the system architecture, sets up Docker build platform, and loops through image configs. -# Usage: ./build_docker_images.sh -# Detect system architecture and set Docker platform accordingly -ARCHITECTURE=$(uname -m) -case "$ARCHITECTURE" in - x86_64|amd64) - DOCKER_PLATFORM='linux/amd64' - ;; - aarch64|arm64) - DOCKER_PLATFORM='linux/arm64' - ;; - *) - echo "Unsupported architecture: $ARCHITECTURE" - exit 1 - ;; -esac -export DOCKER_DEFAULT_PLATFORM="$DOCKER_PLATFORM" -export BUILDX_EXPERIMENTAL=1 -# Get the directory of this script for relative paths -SCRIPT_DIR=$(cd $(dirname "$0") && pwd) -# Versions for Hadoop, Spark, and Hive -HADOOP_VERSION="3.3.4" -SPARK_VERSION="3.5.3" -HIVE_VERSION="3.1.3" -# Docker image tags -VERSION_TAG="4e6ebba26cb097cb26cddcbb3958d99dda476320" #Commit ID -LATEST_TAG="latest" -DOCKER_CONTEXT_DIR="hoodie/hadoop" -# List of images to build: "subdir|image_base_name" -# Each entry: | -DOCKER_IMAGES=( - "base|apachehudi/hudi-hadoop_${HADOOP_VERSION}-base" - "datanode|apachehudi/hudi-hadoop_${HADOOP_VERSION}-datanode" - "historyserver|apachehudi/hudi-hadoop_${HADOOP_VERSION}-history" - "hive_base|apachehudi/hudi-hadoop_${HADOOP_VERSION}-hive_${HIVE_VERSION}" - "namenode|apachehudi/hudi-hadoop_${HADOOP_VERSION}-namenode" - "spark_base|apachehudi/hudi-hadoop_${HADOOP_VERSION}-hive_${HIVE_VERSION}-sparkbase_${SPARK_VERSION}" - "sparkadhoc|apachehudi/hudi-hadoop_${HADOOP_VERSION}-hive_${HIVE_VERSION}-sparkadhoc_${SPARK_VERSION}" - "sparkmaster|apachehudi/hudi-hadoop_${HADOOP_VERSION}-hive_${HIVE_VERSION}-sparkmaster_${SPARK_VERSION}" - "sparkworker|apachehudi/hudi-hadoop_${HADOOP_VERSION}-hive_${HIVE_VERSION}-sparkworker_${SPARK_VERSION}" -) -# Build each Docker image in the list -for IMAGE_CONFIG in "${DOCKER_IMAGES[@]}"; do - # Split config into subdir and image base name - IFS='|' read -r SUBDIR IMAGE_BASE <<< "$IMAGE_CONFIG" - IMAGE_CONTEXT="$DOCKER_CONTEXT_DIR/$SUBDIR" - TAG_LATEST="$IMAGE_BASE:$LATEST_TAG" - TAG_VERSIONED="$IMAGE_BASE:$VERSION_TAG" - echo "Building $IMAGE_CONTEXT as $TAG_LATEST and $TAG_VERSIONED" - # Build the Docker image with both latest and versioned tags - if ! docker build "$IMAGE_CONTEXT" -t "$TAG_LATEST" -t "$TAG_VERSIONED"; then - echo "Error: Failed to build docker image for $IMAGE_CONTEXT" - exit 1 - fi -done - diff --git a/docker/push_docker_images.sh b/docker/push_docker_images.sh deleted file mode 100644 index 6e8591353421d..0000000000000 --- a/docker/push_docker_images.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -TAGS=("latest" "4e6ebba26cb097cb26cddcbb3958d99dda476320") - -IMAGE_NAMES=( - "apachehudi/hudi-hadoop_3.3.4-base" - "apachehudi/hudi-hadoop_3.3.4-namenode" - "apachehudi/hudi-hadoop_3.3.4-datanode" - "apachehudi/hudi-hadoop_3.3.4-history" - "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3" - "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkbase_3.5.3" - "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkmaster_3.5.3" - "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkworker_3.5.3" - "apachehudi/hudi-hadoop_3.3.4-hive_3.1.3-sparkadhoc_3.5.3" -) - -echo "Starting Docker push process for ${#IMAGE_NAMES[@]} images and ${#TAGS[@]} tags each" -echo "------------------------------------------------------------------------" - -# Check if docker is installed -if ! command -v docker &> /dev/null -then - echo "ERROR: Docker command not found. Please ensure Docker is installed and in your PATH." - exit 1 -fi - -SUCCESS_COUNT=0 -FAILURE_COUNT=0 - -for IMAGE in "${IMAGE_NAMES[@]}"; do - for TAG in "${TAGS[@]}"; do - FULL_IMAGE="${IMAGE}:${TAG}" - - echo "Attempting to push: ${FULL_IMAGE}" - - if ! docker image inspect "${FULL_IMAGE}" &> /dev/null; then - echo "--> [SKIPPED] Image ${FULL_IMAGE} does not exist locally. Skipping push." - FAILURE_COUNT=$((FAILURE_COUNT + 1)) - continue - fi - - if docker push "${FULL_IMAGE}"; then - echo "--> [SUCCESS] Successfully pushed ${FULL_IMAGE}" - SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) - else - echo "--> [FAILED] Failed to push ${FULL_IMAGE}. Check Docker login status and network." - FAILURE_COUNT=$((FAILURE_COUNT + 1)) - fi - - echo "------------------------------------------------------------------------" - done -done - -echo "Docker Push Summary:" -echo "Total Pushes Attempted: $(( ${#IMAGE_NAMES[@]} * ${#TAGS[@]} ))" -echo "Successful: ${SUCCESS_COUNT}" -echo "Failed: ${FAILURE_COUNT}" - -if [ "${FAILURE_COUNT}" -eq 0 ]; then - echo "All images were successfully pushed." -else - echo "Please review the logs above for failed images." -fi