You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/06/21 23:32:14 UTC
[impala] 02/02: IMPALA-7947: script to push images to docker repo
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 7e897893b9ad6d8e5d4950a3d37b6217f2319131
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Thu Jun 20 17:39:57 2019 -0700
IMPALA-7947: script to push images to docker repo
docker/push-images.sh will push locally built images to
a remote docker repo, prefixed with some string. See the script for
details on usage.
Testing:
Manually tested pushing to dockerhub and to a private
docker repository.
Change-Id: I0996b090f513351b58c801ed7149f80c4188f903
Reviewed-on: http://gerrit.cloudera.org:8080/13698
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
docker/push-images.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/docker/push-images.sh b/docker/push-images.sh
new file mode 100755
index 0000000..b8d40ab
--- /dev/null
+++ b/docker/push-images.sh
@@ -0,0 +1,80 @@
+#!/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 "push_to_registry.sh [options]"
+ echo
+ echo "Pushes the latest docker images created by a local Impala build to a docker "
+ echo "registry, by default Docker Hub. Images must be prefixed with a string, which "
+ echo "could be the docker hub username, a branch name, or some other identifier."
+ echo
+ echo "Supported options are:"
+ echo " -p <image prefix>"
+ echo " Append this image prefix to all images pushed to the registry. Required."
+ echo " -r <registry>"
+ echo " Push to this registry. Optional, if not specified pushes to docker hub."
+ echo
+ echo "Examples:"
+ echo "To push to some user's repository on Docker Hub, with names like "
+ echo "experimental-statestored:"
+ echo " push_to_registry.sh -p someuser/experimental"
+}
+
+PREFIX=
+REGISTRY=
+while getopts "p:r:" OPTION
+do
+ case "$OPTION" in
+ p)
+ PREFIX="$OPTARG"
+ ;;
+ r)
+ REGISTRY="$OPTARG"
+ ;;
+ ?)
+ echo "Unknown option."
+ usage
+ exit 1;
+ ;;
+ esac
+done
+
+if [[ -z "$PREFIX" ]]; then
+ echo "-p must be specified"
+ usage
+ exit 1
+fi
+
+# The image tags that are updated by the impala build process.
+# TODO(IMPALA-8622): get this list from a generated file.
+IMAGES=(statestored catalogd impalad_coordinator impalad_executor impalad_coord_exec)
+
+for IMAGE in "${IMAGES[@]}"; do
+ if [[ -z "$REGISTRY" ]]; then
+ # Docker Hub does not require a prefix.
+ DEST=
+ else
+ DEST=$REGISTRY/
+ fi
+ DEST+="$PREFIX-$IMAGE"
+ docker image tag "$IMAGE" "$DEST"
+ docker push "$DEST"
+done