This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 3416055  [docker] KUDU-2857: Rewrite docker build script in python
3416055 is described below

commit 341605597f7ed1ab7a36bfefb2e181102c173302
Author: Grant Henke <[email protected]>
AuthorDate: Thu Jul 9 16:28:50 2020 -0500

    [docker] KUDU-2857: Rewrite docker build script in python
    
    This patch rewrites the Docker script in Python while maintaining the
    same functionality. Not only will this make future development easier,
    but it makes usage more intuitive as well.
    
    Now instead of using environment variables, flags are used to
    configure the build. Additionally the flags are validated against
    valid values and `--help` output is available to show all the options.
    
    I also added basic resource validation checks to ensure users have
    configured enough CPU and memory resources to have a successful
    build and fail fast if they don’t.
    
    Change-Id: Ie678967a6b64f53682c636b8d1cdcb2f5467e608
    Reviewed-on: http://gerrit.cloudera.org:8080/16161
    Reviewed-by: Attila Bukor <[email protected]>
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
---
 docker/README.adoc          |   5 +-
 docker/docker-build.py      | 326 ++++++++++++++++++++++++++++++++++++++++++++
 docker/docker-build.sh      | 251 ----------------------------------
 kubernetes/README.adoc      |   2 +-
 kubernetes/helm/README.adoc |   2 +-
 5 files changed, 332 insertions(+), 254 deletions(-)

diff --git a/docker/README.adoc b/docker/README.adoc
index 4b8997e..413cc10 100644
--- a/docker/README.adoc
+++ b/docker/README.adoc
@@ -30,9 +30,12 @@ NOTE: These sample commands assume running from the project 
root directory.
 Build all the images for the default OS:
 [source,bash]
 ----
-$ ./docker/docker-build.sh
+$ ./docker/docker-build.py
 ----
 
+NOTE: You can pass `--help` to the build script to see usage details and
+all the available parameters.
+
 == Running an image
 
 Run an image with a bash prompt and remove it on exit:
diff --git a/docker/docker-build.py b/docker/docker-build.py
new file mode 100755
index 0000000..bcc853d
--- /dev/null
+++ b/docker/docker-build.py
@@ -0,0 +1,326 @@
+#!/usr/bin/env python
+##########################################################
+#
+# 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 handles the coordination of building all of
+# the Apache Kudu docker images.
+#
+# The format for tagging images is:
+#   kudu:[image-type]-[version]-[operating-system]
+#
+# The image type is the name of any target image. However,
+# the default image `kudu` will not include the image type
+# in the tag because it is redundant with the repository
+# name and intended to be the image used by most users.
+# This allows us to support the common syntax of
+# `kudu:latest` for normal users.
+#
+# The version tag for release images will be the full semantic
+# version. An additional tag with just the minor version will
+# also be created to allow for roll-forward semantics of
+# maintenance releases. Tags with just the major version are not
+# created because automatically rolling forward to a major version
+# is not recommended. Images created for a snapshot version
+# will use the short git hash in place of the version.
+# An additional latest version can be used for the latest build.
+#
+# The operating system is described with the version name.
+# If the operating system version is numeric, the operating
+# system name will be included. For example, `centos:7` would
+# be `centos7` while `ubuntu:xenial` would be `xenial`.
+# An additional tag without the operating system included
+# will be generated when the default operating system is used.
+#
+#   DOCKER_CACHE_FROM:
+#      Optional images passed to the `docker build` commands
+#      via the `--cache-from` option. This option tells Docker
+#      images to consider as cache sources.
+##########################################################
+
+import argparse
+import datetime
+import os
+import re
+import subprocess
+import sys
+
+ME = os.path.abspath(__file__)
+ROOT = os.path.abspath(os.path.join(os.path.dirname(ME), ".."))
+
+DEFAULT_OS = 'ubuntu:xenial'
+DEFAULT_TARGETS = ['kudu','kudu-python']
+DEFAULT_REPOSITORY = 'apache/kudu'
+
+REQUIRED_CPUS = 4
+REQUIRED_MEMORY_GIB = 4
+
+def parse_args():
+  """ Parses the command-line arguments """
+  parser = argparse.ArgumentParser(description='Build the Apache Kudu Docker 
images',
+                                   
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+  parser.add_argument('--bases', nargs='+', default=DEFAULT_OS, choices=[
+                      'centos:6', 'centos:7', 'centos:8',
+                      'debian:jessie', 'debian:stretch',
+                      'ubuntu:trusty', 'ubuntu:xenial', 'ubuntu:bionic'],
+                      help='The base operating systems to build with')
+  # These targets are defined in the Dockerfile. Dependent targets of a passed 
image will be built,
+  # but not tagged. Note that if a target is not tagged it is subject removal 
by Dockers system
+  # and image pruning.
+  parser.add_argument('--targets', nargs='+', default=DEFAULT_TARGETS, 
choices=[
+                      'runtime', 'dev', 'thirdparty', 'build',
+                      'kudu', 'kudu-python', 'impala-build', 'impala' ],
+                      help='The targets to build and tag')
+  parser.add_argument('--repository', default=DEFAULT_REPOSITORY,
+                      help='The repository string to use when tagging the 
image')
+
+  parser.add_argument('--publish', action='store_true',
+                      help='If passed, the tagged images will be pushed to the 
Docker repository')
+  parser.add_argument('--skip-latest', action='store_true',
+                      help='If passed, skips adding a tag using `-latest` 
along with the '
+                      'versioned tag')
+  parser.add_argument('--tag-hash', action='store_true',
+                      help='If passed, keeps the tags using the short git hash 
as the version '
+                      'for non-release builds. Leaving this as false ensures 
the tags '
+                      'containing the short git hash are removed which keeps 
the '
+                      '`docker images` list cleaner when only the latest image 
is relevant')
+
+  parser.add_argument('--cache-from', default='',
+                      help='Optional images passed to the `docker build` 
commands via the '
+                      '`--cache-from` option. This option tells Docker images 
to '
+                      'consider as cache sources')
+
+  parser.add_argument('--ignore-resource-checks', action='store_true',
+                      help='Do not fail the script with resource validation 
errors')
+  parser.add_argument('--dry-run', action='store_true',
+                      help='Do not execute any Docker commands, only print 
what would be executed')
+
+  return parser.parse_args()
+
+def run_command(cmd, opts):
+  """ Prints the command and run it if not in dry-run mode. """
+  print('Running: %s' % cmd)
+  if not opts.dry_run:
+    subprocess.check_output(cmd, shell=True)
+
+def read_version():
+  with open(os.path.join(ROOT, 'version.txt'), 'r') as vfile:
+    return vfile.read().strip()
+
+def read_vcs_ref():
+  return subprocess.check_output(['git', 'rev-parse', '--short', 
'HEAD']).strip().decode('utf-8')
+
+def is_release_version(version):
+  return not re.search('-SNAPSHOT', version)
+
+def get_version_tag(version, vcs_ref):
+    if is_release_version(version):
+        return version
+    else:
+      if not vcs_ref:
+        print('ERROR: Snapshot builds need to be built in a Git working 
directory')
+        sys.exit(1)
+      return vcs_ref
+
+def get_minor_version(version):
+  major_pos = version.find('.')
+  minor_pos = version.find('.', major_pos + 1)
+  return version[0:minor_pos]
+
+def get_os_tag(base):
+  """ Constructs an OS tag based on the passed base.
+      The operating system is described with the version name.
+      If the operating system version is numeric, the version will also be 
appended.
+  """
+  os_name = base.split(':')[0]
+  os_version = base.split(':')[1]
+  os_tag = os_name
+  if os_version.isnumeric():
+    os_tag += os_version
+  return os_tag
+
+def get_full_tag(repository, target, version_tag, os_tag):
+  """ Constructs a tag, excluding the OS_TAG if it is empty.
+      Additionally ignores the target when it is the default target "kudu".
+      Examples:
+        get_tag "kudu" "latest" ""        = apache/kudu:latest
+        get_tag "base" "1.8.0" ""         = apache/kudu:base-1.8.0
+        get_tag "base" "1.8.0" "centos6"  = apache/kudu:base-1.8.0-centos6
+  """
+  full_tag = ''
+  # Only include the target if this isn't the default.
+  if target != 'kudu':
+    full_tag += '%s-' % target
+  full_tag += '%s-' % version_tag
+  if os_tag:
+    full_tag += '%s-' %  os_tag
+  # Remove the last character to eliminate the extra '-'.
+  full_tag = full_tag[:-1]
+  return "%s:%s" % (repository, full_tag)
+
+def unique_bases(opts):
+  if type(opts.bases) is list:
+    return list(dict.fromkeys(opts.bases))
+  else:
+    return [opts.bases]
+
+def unique_targets(opts):
+  if type(opts.targets) is list:
+    return list(dict.fromkeys(opts.targets))
+  else:
+    return [opts.targets]
+
+def build_args(base, version, vcs_ref, cache_from):
+  """ Constructs the build the arguments to pass to the Docker build. """
+  args = ''
+  args += ' --build-arg BASE_OS="%s"' % base
+  args += ' --build-arg DOCKERFILE="docker/Dockerfile"'
+  args += ' --build-arg MAINTAINER="Apache Kudu <[email protected]>"'
+  args += ' --build-arg URL="https://kudu.apache.org";'
+  args += ' --build-arg VERSION="%s"' % version
+  args += ' --build-arg VCS_REF="%s"' % vcs_ref
+  args += ' --build-arg VCS_TYPE="git"'
+  args += ' --build-arg VCS_URL="https://gitbox.apache.org/repos/asf/kudu.git";'
+  if cache_from:
+    args += ' --cache-from %s' % cache_from
+  return args
+
+def verify_docker_resources(opts):
+  cpus = int(subprocess.check_output(['docker', 'system', 'info',
+                                      '--format', '{{.NCPU}}'])
+             .strip().decode('utf-8'))
+  if cpus < REQUIRED_CPUS:
+    print('ERROR: At least %s CPUs are suggested to be configured for Docker 
(Found %s). '
+          'To ignore this error pass --ignore-resource-checks' % 
(REQUIRED_CPUS, cpus))
+    if not opts.ignore_resource_checks:
+      sys.exit(1)
+
+  memory_bytes = int(subprocess.check_output(['docker', 'system', 'info',
+                                              '--format', '{{.MemTotal}}'])
+                     .strip().decode('utf-8'))
+  memory_gib = memory_bytes / (1024 * 1024 * 1024)
+  if memory_gib < REQUIRED_MEMORY_GIB:
+    print('ERROR: At least %s GiBs of memory is suggested to be configured for 
Docker'
+          ' (Found %s GiBs). To ignore this error pass 
--ignore-resource-checks'
+          % (REQUIRED_MEMORY_GIB, memory_gib))
+    if not opts.ignore_resource_checks:
+      sys.exit(1)
+
+def main():
+  start_time = datetime.datetime.now()
+  print('Starting docker build: %s' % start_time.isoformat())
+  opts = parse_args()
+  verify_docker_resources(opts)
+
+  # Enabled the docker buildkit so we can use advanced features
+  # like skipping unused stages and mounting scripts that don't
+  # need to remain in the image along with an improvement on
+  # performance, storage management, feature functionality, and security.
+  # https://docs.docker.com/develop/develop-images/build_enhancements/
+  os.environ['DOCKER_BUILDKIT'] = '1'
+
+  version = read_version()
+  vcs_ref = read_vcs_ref()
+  print('Version: %s (%s)' % (version, vcs_ref))
+  version_tag = get_version_tag(version, vcs_ref)
+
+  bases = unique_bases(opts)
+  targets = unique_targets(opts)
+  print('Bases: %s' % bases)
+  print('Targets: %s' % targets)
+
+  tags = [] # Keep track of the tags for publishing at the end.
+  for base in bases:
+    print('Building targets for %s...' % base)
+    os_tag = get_os_tag(base)
+
+    for target in targets:
+      print('Building %s target...' % target)
+      full_tag = get_full_tag(opts.repository, target, version_tag, os_tag)
+      print(full_tag)
+
+      # Build the target and tag with the full tag.
+      docker_build_cmd = 'docker build'
+      docker_build_cmd += build_args(base, version, vcs_ref, opts.cache_from)
+      docker_build_cmd += ' --file %s' % os.path.join(ROOT, 'docker', 
'Dockerfile')
+      docker_build_cmd += ' --target %s --tag %s' % (target, full_tag)
+      docker_build_cmd += ' %s' % ROOT
+      run_command(docker_build_cmd, opts)
+      tags.append(full_tag)
+
+      # If this is the default OS, also tag it without the OS-specific tag.
+      if base == DEFAULT_OS:
+        default_os_tag = get_full_tag(opts.repository, target, version, '')
+        default_os_cmd = 'docker tag %s %s' % (full_tag, default_os_tag)
+        run_command(default_os_cmd, opts)
+        tags.append(default_os_tag)
+
+      # Add the minor version tag if this is a release version.
+      if is_release_version(version):
+        minor_version = get_minor_version(version)
+        minor_tag = get_full_tag(opts.repository, target, minor_version, 
os_tag)
+        minor_cmd = 'docker tag %s %s' % (full_tag, minor_tag)
+        run_command(minor_cmd, opts)
+        tags.append(minor_tag)
+
+        # Add the default OS tag.
+        if base == DEFAULT_OS:
+          minor_default_os_tag = get_full_tag(opts.repository, target, 
minor_version, '')
+          minor_default_os_cmd = 'docker tag %s %s' % (full_tag, 
minor_default_os_tag)
+          run_command(minor_default_os_cmd, opts)
+          tags.append(minor_default_os_tag)
+
+      # Add the latest version tags.
+      if not opts.skip_latest:
+        latest_tag = get_full_tag(opts.repository, target, 'latest', os_tag)
+        latest_cmd = 'docker tag %s %s' % (full_tag, latest_tag)
+        run_command(latest_cmd, opts)
+        tags.append(latest_tag)
+
+        # Add the default OS tag.
+        if base == DEFAULT_OS:
+          latest_default_os_tag = get_full_tag(opts.repository, target, 
'latest', '')
+          latest_default_os_cmd = 'docker tag %s %s' % (full_tag, 
latest_default_os_tag)
+          run_command(latest_default_os_cmd, opts)
+          tags.append(latest_default_os_tag)
+
+      # Remove the hash tags if the aren't wanted.
+      if not opts.tag_hash and not is_release_version(version):
+        print('Removing hash based Docker tags...')
+        hash_tag_pattern = '%s:*%s*' % (opts.repository, vcs_ref)
+        rmi_command = 'docker rmi $(docker images -q "%s" --format 
"{{.Repository}}:{{.Tag}}")'\
+                      % (hash_tag_pattern, )
+        run_command(rmi_command, opts)
+
+  if opts.publish:
+    print('Publishing Docker images...')
+    if not is_release_version(version):
+      print('ERROR: Only release versions can be published. Found version %s 
(%s)'
+            % (version, vcs_ref))
+      sys.exit(1)
+    for tag in tags:
+      push_cmd = "docker push %s" % tag
+      run_command(push_cmd, opts)
+
+  end_time = datetime.datetime.now()
+  runtime = end_time - start_time
+  print('Finished Docker build: %s (%s)' % (end_time.isoformat(), runtime))
+
+if __name__ == '__main__':
+    main()
diff --git a/docker/docker-build.sh b/docker/docker-build.sh
deleted file mode 100755
index 8799ea7..0000000
--- a/docker/docker-build.sh
+++ /dev/null
@@ -1,251 +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 handles the coordination of building all of
-# the Apache Kudu docker images.
-#
-# The format for tagging images is:
-#   kudu:[image-type]-[version]-[operating-system]
-#
-# The image type is the name of any target image. However,
-# the default image `kudu` will not include the image type
-# in the tag because it is redundant with the repository
-# name and intended to be the image used by most users.
-# This allows us to support the common syntax of
-# `kudu:latest` for normal users.
-#
-# The version tag for release images will be the full semantic
-# version. An additional tag with just the minor version will
-# also be created to allow for roll-forward semantics of
-# maintenance releases. Tags with just the major version are not
-# created because automatically rolling forward to a major version
-# is not recommended. Images created for a snapshot version
-# will use the short git hash in place of the version.
-# An additional latest version can be used for the latest build.
-#
-# The operating system is described with the version name.
-# If the operating system version is numeric, the operating
-# system name will be included. For example, `centos:6` would
-# be `centos6` while `ubuntu:trusty` would be `trusty`.
-# An additional tag without the operating system included
-# will be generated when the default operating system is used.
-#
-# Environment variables may be used to customize operation:
-#
-#   BASES: Default: "ubuntu:xenial"
-#     A csv string with the list of base operating systems to build with.
-#
-#   TARGETS: Default: "kudu"
-#     A csv string with the list of targets to build and tag.
-#     These targets are defined in the Dockerfile.
-#     Dependent targets of a passed image will be build, but not
-#     tagged. Note that if a target is not tagged it is subject
-#     removal by dockers system and image pruning.
-#
-#   REPOSITORY: Default: "apache/kudu"
-#     The repository string to use when tagging the image.
-#
-#   PUBLISH: Default: "0"
-#     If set to 1, the tagged images will be pushed to the docker repository.
-#     Only release versions can be published.
-#
-#   TAG_LATEST: Default: "1"
-#     If set to 1, adds a tag using `-latest` along with the
-#     versioned tag.
-#
-#   TAG_HASH: Default: "0"
-#     If set to 1, keeps the tags using the short git hash as
-#     the version for non-release builds. Leaving this as 0
-#     ensures the tags containing the short git hash are removed
-#     which keeps the `docker images` list cleaner when only the
-#     latest image is relevant.
-#
-#   DOCKER_CACHE_FROM:
-#      Optional images passed to the `docker build` commands
-#      via the `--cache-from` option. This option tells docker
-#      images to consider as cache sources.
-##########################################################
-
-set -xe
-set -o pipefail
-
-ROOT=$(cd $(dirname "$BASH_SOURCE")/.. ; pwd)
-
-# Tested options:
-#   centos:6
-#   centos:7
-#   centos:8
-#   debian:jessie
-#   debian:stretch
-#   ubuntu:trusty
-#   ubuntu:xenial
-#   ubuntu:bionic
-DEFAULT_OS="ubuntu:xenial"
-BASES=${BASES:="$DEFAULT_OS"}
-TARGETS=${TARGETS:="kudu,kudu-python"}
-REPOSITORY=${REPOSITORY:="apache/kudu"}
-PUBLISH=${PUBLISH:=0}
-TAG_LATEST=${TAG_LATEST:=1}
-TAG_HASH=${TAG_HASH:=0}
-DOCKER_CACHE_FROM=${DOCKER_CACHE_FROM:=""}
-
-# Enabled the docker buildkit so we can use advanced features
-# like skipping unused stages and mounting scripts that don't
-# need to remain in the image along with an improvement on
-# performance, storage management, feature functionality, and security.
-# https://docs.docker.com/develop/develop-images/build_enhancements/
-export DOCKER_BUILDKIT=1
-
-VERSION=$(cat "$ROOT/version.txt")
-VCS_REF=$(git rev-parse --short HEAD || echo "")
-
-# Create the VERSION_TAG.
-if [[ "$VERSION" == *-SNAPSHOT ]]; then
-  if [[ "$VCS_REF" == "" ]]; then
-      echo "ERROR: Snapshot builds need to be built in a Git working directory"
-      exit 1
-  fi
-
-  IS_RELEASE_VERSION=0
-  VERSION_TAG="$VCS_REF"
-else
-  IS_RELEASE_VERSION=1
-  VERSION_TAG="$VERSION"
-  MINOR_VERSION_TAG=$(echo "$VERSION" | sed "s/.[^.]*$//")
-fi
-
-# Constructs an OS tag based on the passed BASE_IMAGE.
-# The operating system is described with the version name.
-# If the operating system version is numeric, the version
-# will also be appended.
-function get_os_tag() {
-  local BASE_IMAGE=$1
-  local OS_NAME=$(echo "$BASE_IMAGE" | cut -d':' -f1)
-  local OS_VERSION=$(echo "$BASE_IMAGE" | cut -d':' -f2)
-  if [[ "$OS_VERSION" == [[:digit:]]* ]]; then
-    echo "$OS_NAME$OS_VERSION"
-  else
-    echo "$OS_VERSION"
-  fi
-}
-
-# Constructs a tag, excluding the OS_TAG if it is empty.
-# Additionally ignores the target when it is the default target "kudu".
-# Examples:
-#   get_tag "kudu" "latest" ""        = apache/kudu:latest
-#   get_tag "base" "1.8.0" ""         = apache/kudu:base-1.8.0
-#   get_tag "base" "1.8.0" "centos6"  = apache/kudu:base-1.8.0-centos6
-function get_tag() {
-  local TARGET_TAG=$1
-  local VERSION_TAG=$2
-  local OS_TAG=$3
-  local TAG=""
-  # Only include the target if this isn't the default.
-  if [[ "$TARGET_TAG" != "kudu" ]]; then
-    local TAG="$TARGET_TAG-"
-  fi
-  local TAG="$TAG$VERSION_TAG-"
-  if [[ -n "$OS_TAG" ]]; then
-    local TAG="$TAG$OS_TAG-"
-  fi
-  # Remove the last character to eliminate the extra '-'.
-  local TAG=${TAG%?}
-  echo "$REPOSITORY:$TAG"
-}
-
-TAGS=()
-for BASE_OS in $(echo "$BASES" | tr ',' '\n'); do
-  # Generate the arguments to pass to the docker build.
-  BUILD_ARGS=(
-    --build-arg BASE_OS="$BASE_OS"
-    --build-arg DOCKERFILE="docker/Dockerfile"
-    --build-arg MAINTAINER="Apache Kudu <[email protected]>"
-    --build-arg URL="https://kudu.apache.org";
-    --build-arg VERSION="$VERSION"
-    --build-arg VCS_REF="$VCS_REF"
-    --build-arg VCS_TYPE="git"
-    --build-arg VCS_URL="https://gitbox.apache.org/repos/asf/kudu.git";
-  )
-  if [[ -n "$DOCKER_CACHE_FROM" ]]; then
-    BUILD_ARGS+=(--cache-from "$DOCKER_CACHE_FROM")
-  fi
-  OS_TAG=$(get_os_tag "$BASE_OS")
-
-  for TARGET in $(echo "$TARGETS" | tr ',' '\n'); do
-    FULL_TAG=$(get_tag "$TARGET" "$VERSION_TAG" "$OS_TAG")
-
-    # Build the target and tag with the full tag.
-    docker build "${BUILD_ARGS[@]}" -f "$ROOT/docker/Dockerfile" \
-      --target "$TARGET" -t "$FULL_TAG" ${ROOT}
-    TAGS+=("$FULL_TAG")
-
-    # If this is the default OS, also tag it without the OS-specific tag.
-    if [[ "$BASE_OS" == "$DEFAULT_OS" ]]; then
-      DEFAULT_OS_TAG=$(get_tag "$TARGET" "$VERSION_TAG" "")
-      docker tag "$FULL_TAG" "$DEFAULT_OS_TAG"
-      TAGS+=("$DEFAULT_OS_TAG")
-    fi
-
-    # Add the minor version tag if this is a release version.
-    if [[ "$IS_RELEASE_VERSION" == "1" ]]; then
-      MINOR_TAG=$(get_tag "$TARGET" "$MINOR_VERSION_TAG" "$OS_TAG")
-      docker tag "$FULL_TAG" "$MINOR_TAG"
-      TAGS+=("$MINOR_TAG")
-
-      # Add the default OS tag.
-      if [[ "$BASE_OS" == "$DEFAULT_OS" ]]; then
-        MINOR_DEFAULT_OS_TAG=$(get_tag "$TARGET" "$MINOR_VERSION_TAG" "")
-        docker tag "$FULL_TAG" "$MINOR_DEFAULT_OS_TAG"
-        TAGS+=("$MINOR_DEFAULT_OS_TAG")
-      fi
-    fi
-
-    # Add the latest version tags.
-    if [[ "$TAG_LATEST" == "1" ]]; then
-      LATEST_TAG=$(get_tag "$TARGET" "latest" "$OS_TAG")
-      docker tag "$FULL_TAG" "$LATEST_TAG"
-      TAGS+=("$LATEST_TAG")
-
-      # Add the default OS tag.
-      if [[ "$BASE_OS" == "$DEFAULT_OS" ]]; then
-        LATEST_DEFAULT_OS_TAG=$(get_tag "$TARGET" "latest" "")
-        docker tag "$FULL_TAG" "$LATEST_DEFAULT_OS_TAG"
-        TAGS+=("$LATEST_DEFAULT_OS_TAG")
-      fi
-    fi
-
-    # Remove the hash tags if the aren't wanted.
-    if [[ "$TAG_HASH" != "1" && "$IS_RELEASE_VERSION" != "1" ]]; then
-      HASH_TAG_PATTERN="$REPOSITORY:*$VCS_REF*"
-      docker rmi $(docker images -q "$HASH_TAG_PATTERN" --format 
"{{.Repository}}:{{.Tag}}")
-    fi
-  done
-done
-
-if [[ "$PUBLISH" == 1 ]]; then
-  if [[ "$IS_RELEASE_VERSION" != "1" ]]; then
-    echo "ERROR: Only release versions can be published. Found version 
$VERSION ($VCS_REF)"
-    exit 1
-  fi
-  for TAG in "${TAGS[@]}"; do
-    docker push "${TAG}"
-  done
-fi
diff --git a/kubernetes/README.adoc b/kubernetes/README.adoc
index 0d9cec4..c06f509 100644
--- a/kubernetes/README.adoc
+++ b/kubernetes/README.adoc
@@ -33,7 +33,7 @@ NOTE: Read more about Kubernetes here 
https://kubernetes.io/docs/tutorials/kuber
 
 ==== Build Kudu Docker Image
 
-    ../../docker/docker-build.sh
+    ../../docker/docker-build.py
 
 ==== Creating Namespace
 
diff --git a/kubernetes/helm/README.adoc b/kubernetes/helm/README.adoc
index 3b50d97..0bc9019 100644
--- a/kubernetes/helm/README.adoc
+++ b/kubernetes/helm/README.adoc
@@ -34,7 +34,7 @@ NOTE: Read more about Helm here 
https://helm.sh/docs/using_helm/#quickstart
 
 ==== Build Kudu Docker Image
 
-    ../../docker/docker-build.sh
+    ../../docker/docker-build.py
 
 ==== Creating Namespace
 

Reply via email to