snazy commented on code in PR #2156:
URL: https://github.com/apache/polaris/pull/2156#discussion_r2227759351


##########
releasey/06-build-and-stage-docker-images.sh:
##########
@@ -0,0 +1,137 @@
+#!/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.
+#
+
+#
+# Build and Stage Docker Images Script
+#
+# Builds and publishes multi-platform Docker images to DockerHub for release 
candidates.
+# This script automates the "Build and staging Docker images" step from the 
release guide.
+#
+
+set -euo pipefail
+
+releases_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+libs_dir="${releases_dir}/libs"
+
+source "${libs_dir}/_log.sh"
+source "${libs_dir}/_constants.sh"
+source "${libs_dir}/_exec.sh"
+source "${libs_dir}/_files.sh"
+
+function usage() {
+  cat << EOF
+$(basename "$0") [--help | -h]
+
+  Builds and publishes multi-platform Docker images to DockerHub for release 
candidates.
+  The version is automatically determined from the current git tag. I.e. this 
script must
+  be run from a release tag.
+
+  Prerequisites:
+    - Docker with buildx support must be installed and configured
+    - DockerHub credentials must be configured (docker login)
+    - Must be run from a release tag (apache-polaris-x.y.z-incubating-rcN)
+
+  Options:
+    -h --help
+        Print usage information.
+
+  Examples:
+    $(basename "$0")
+
+EOF
+}
+
+ensure_cwd_is_project_root
+
+while [[ $# -gt 0 ]]; do
+  case $1 in
+    --help|-h)
+      usage
+      exit 0
+      ;;
+    *)
+      print_error "Unknown option/argument $1"
+      usage >&2
+      exit 1
+      ;;
+  esac
+done
+
+# Determine version from current git tag
+print_info "Determining version from current git tag..."
+
+if ! git_tag=$(git describe --tags --exact-match HEAD 2>/dev/null); then
+  print_error "Current HEAD is not on a release tag. Please checkout a release 
tag first."
+  print_error "Use: git checkout apache-polaris-x.y.z-incubating-rcN"
+  exit 1
+fi
+print_info "Found git tag: ${git_tag}"
+
+# Extract version components from git tag in one regex match
+git_tag_regex="^apache-polaris-([0-9]+)\.([0-9]+)\.([0-9]+)-incubating-rc([0-9]+)$"
+if [[ ! ${git_tag} =~ ${git_tag_regex} ]]; then
+  print_error "Invalid git tag format: ${git_tag}"
+  print_error "Expected format: apache-polaris-x.y.z-incubating-rcN"
+  exit 1
+fi
+
+# Extract version components from regex match
+major="${BASH_REMATCH[1]}"
+minor="${BASH_REMATCH[2]}"
+patch="${BASH_REMATCH[3]}"
+rc_number="${BASH_REMATCH[4]}"
+version="${major}.${minor}.${patch}-incubating"
+docker_tag="${version}-rc${rc_number}"
+
+print_info "Starting Docker image build and staging process..."
+print_info "Version: ${version}"
+print_info "RC number: ${rc_number}"
+print_info "Docker tag: ${docker_tag}"
+echo
+
+# Build and push polaris-server Docker image
+print_info "Building and pushing polaris-server Docker image..."
+exec_process ./gradlew :polaris-server:assemble 
:polaris-server:quarkusAppPartsBuild --rerun \
+  -Dquarkus.container-image.build=true \
+  -Dquarkus.container-image.push=true \
+  -Dquarkus.docker.buildx.platform="linux/amd64,linux/arm64" \
+  -Dquarkus.container-image.tag="${docker_tag}"
+
+# Build and push polaris-admin Docker image
+print_info "Building and pushing polaris-admin Docker image..."
+exec_process ./gradlew :polaris-admin:assemble 
:polaris-admin:quarkusAppPartsBuild --rerun \
+  -Dquarkus.container-image.build=true \
+  -Dquarkus.container-image.push=true \
+  -Dquarkus.docker.buildx.platform="linux/amd64,linux/arm64" \
+  -Dquarkus.container-image.tag="${docker_tag}"
+
+echo
+print_success "🎉 Docker images built and staged successfully!"
+echo
+print_info "Published Docker images:"
+print_info "- polaris-server: ${DOCKER_REGISTRY}/apache/polaris:${docker_tag}"
+print_info "- polaris-admin: 
${DOCKER_REGISTRY}/apache/polaris-admin-tool:${docker_tag}"
+echo
+print_info "Docker Hub links:"
+print_info "- ${DOCKER_HUB_URL}/r/apache/polaris/tags"
+print_info "- ${DOCKER_HUB_URL}/r/apache/polaris-admin-tool/tags"
+echo
+print_info "Next steps:"
+print_info "1. Start the vote thread"

Review Comment:
   Actually, I'm thinking of removing the `releaseEmailTemplate` (and related) 
tasks and do that in the release scripts. Mean, the scripts already have all 
the information, so the indirection via Gradle, which has to figure out the 
details again, isn't necessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to