Files
impala/docker/publish_images_to_apache.sh
Tim Armstrong 79bee3befb IMPALA-10469: push quickstart to apache repo
This adds a script, docker/publish_images_to_apache.sh,
that allows uploading images to the apache/impala docker hub
repo, prefixed with a version string. E.g. with the following
commands:

  ninja docker_images quickstart_docker_images
  ./docker/publish_images_to_apache.sh -v 81d5377c2

The uploaded images can then be used for the quickstart cluster,
as documented in docker/README.

Updated docs for quickstart to use a prefix from apache/impala

Remove IMPALA_QUICKSTART_VERSION, which doesn't interact well with
the tagging since the image name and version are now encoded in the
tag.

Fix an incorrect image name added to docker-images.txt:
impala_profile_tool_image.

Testing:
Ran Impala quickstart with data loading using instructions in README.

  export IMPALA_QUICKSTART_IMAGE_PREFIX="apache/impala:81d5377c2-"
  docker network create -d bridge quickstart-network
  export QUICKSTART_IP=$(docker network inspect quickstart-network -f '{{(index .IPAM.Config 0).Gateway}}')
  export QUICKSTART_LISTEN_ADDR=$QUICKSTART_IP

  docker-compose -f docker/quickstart.yml \
      -f docker/quickstart-kudu-minimal.yml \
      -f docker/quickstart-load-data.yml up -d

  docker run --network=quickstart-network -it \
       ${IMPALA_QUICKSTART_IMAGE_PREFIX}impala_quickstart_client
       impala-shell

Change-Id: I535d77e565b73d732ae511d7525193467086c76a
Reviewed-on: http://gerrit.cloudera.org:8080/17030
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2021-02-10 06:56:45 +00:00

81 lines
2.4 KiB
Bash
Executable File

#!/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 -euo pipefail
usage() {
echo "publish_container_to_apache.sh -v <version string> [-d] [-r <repo>"
echo " -d: if specified, upload debug images instead of release images"
echo " -r: docker repository to upload to (defaults to apache/impala)"
echo " -v: version string to tag upload with, e.g. git hash or release version"
}
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
# Arguments to use for grep when filtering docker-images.txt
IMAGE_GREP_FILTER_ARGS="-v _debug"
VERSION=""
TARGET_REPO="apache/impala"
while getopts "r:v:" flag
do
case "${flag}" in
r) TARGET_REPO="$OPTARG"
;;
v) VERSION="$OPTARG"
;;
*)
usage
exit 1
esac
done
if [[ "$VERSION" = "" ]]; then
echo "-v must be provided"
usage
exit 1
fi
# Include the published images, filtering out debug/release as needed.
IMAGES=$(cat "$SCRIPT_DIR/docker-images.txt" | tr ' ' '\n' |\
grep $IMAGE_GREP_FILTER_ARGS | sort | uniq | tr '\n' ' ')
IMAGES+=" impala_quickstart_client impala_quickstart_hms"
echo "Docker images to publish: $IMAGES"
echo "Version string: '$VERSION'"
read -p "Continue with upload to $TARGET_REPO [y/N]? "
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 0
fi
for IMAGE in $IMAGES
do
# Prefix the image with the version so that the set of images can be identified
# with a prefix, e.g. IMPALA_QUICKSTART_IMAGE_PREFIX in the quickstart docker compose.
DST="${TARGET_REPO}:${VERSION}-${IMAGE}"
DIGEST=$(docker images --no-trunc --quiet "${IMAGE}")
echo "Publishing ${IMAGE} (${DIGEST}) to ${DST}"
docker tag $IMAGE "$DST"
docker push "$DST"
done