From 189114b97869413a8b39a2d846cddbb0a5c4bf47 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Fri, 4 Jan 2019 13:34:00 -0500 Subject: [PATCH] Add master openstack support to stx-base build tool Update the build-stx-base.sh tool to support building stx-centos for use with images based on Openstack master. Change-Id: Ic77036e15529dadf39df57e5e88a2000b88bd6cb Story: 2004520 Task: 28726 Signed-off-by: Don Penney --- build-tools/build-docker-images/build-stx-base.sh | 14 ++++++++++---- .../stx-centos/Dockerfile.master | 13 +++++++++++++ .../stx-centos/{Dockerfile => Dockerfile.pike} | 0 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 build-tools/build-docker-images/stx-centos/Dockerfile.master rename build-tools/build-docker-images/stx-centos/{Dockerfile => Dockerfile.pike} (100%) diff --git a/build-tools/build-docker-images/build-stx-base.sh b/build-tools/build-docker-images/build-stx-base.sh index 67ad57cc..c28d746c 100755 --- a/build-tools/build-docker-images/build-stx-base.sh +++ b/build-tools/build-docker-images/build-stx-base.sh @@ -18,6 +18,7 @@ fi SUPPORTED_OS_ARGS=('centos') OS=centos OS_VERSION=7.5.1804 +OPENSTACK_RELEASE=pike IMAGE_VERSION= PUSH=no DOCKER_USER=${USER} @@ -39,6 +40,7 @@ Options: --os: Specify base OS (valid options: ${SUPPORTED_OS_ARGS[@]}) --os-version: Specify OS version --version: Specify version for output image + --release: Openstack release (default: pike) --repo: Software repository (Format: name,baseurl), can be specified multiple times --local: Use local build for software repository (cannot be used with --repo) --push: Push to docker repo @@ -52,7 +54,7 @@ Options: EOF } -OPTS=$(getopt -o h -l help,os:,os-version:,version:,repo:,push,latest,latest-tag:,user:,registry:,local,clean,hostname: -- "$@") +OPTS=$(getopt -o h -l help,os:,os-version:,version:,release:,repo:,push,latest,latest-tag:,user:,registry:,local,clean,hostname: -- "$@") if [ $? -ne 0 ]; then usage exit 1 @@ -79,6 +81,10 @@ while true; do IMAGE_VERSION=$2 shift 2 ;; + --release) + OPENSTACK_RELEASE=$2 + shift 2 + ;; --repo) REPO_LIST+=($2) shift 2 @@ -150,7 +156,7 @@ if [ ${#REPO_LIST[@]} -eq 0 ]; then if [ "${LOCAL}" = "yes" ]; then REPO_LIST+=("local-std,http://${HOST}:8088${MY_WORKSPACE}/std/rpmbuild/RPMS") REPO_LIST+=("stx-distro,http://${HOST}:8088${MY_REPO}/cgcs-${OS}-repo/Binary") - else + elif [ "${OPENSTACK_RELEASE}" != "master" ]; then echo "Either --local or --repo must be specified" >&2 exit 1 fi @@ -174,8 +180,8 @@ if [ $? -ne 0 ]; then fi # Get the Dockerfile -SRC_DOCKERFILE=${MY_SCRIPT_DIR}/stx-${OS}/Dockerfile -cp ${SRC_DOCKERFILE} ${BUILDDIR} +SRC_DOCKERFILE=${MY_SCRIPT_DIR}/stx-${OS}/Dockerfile.${OPENSTACK_RELEASE} +cp ${SRC_DOCKERFILE} ${BUILDDIR}/Dockerfile # Generate the stx.repo file STX_REPO_FILE=${BUILDDIR}/stx.repo diff --git a/build-tools/build-docker-images/stx-centos/Dockerfile.master b/build-tools/build-docker-images/stx-centos/Dockerfile.master new file mode 100644 index 00000000..8bf76312 --- /dev/null +++ b/build-tools/build-docker-images/stx-centos/Dockerfile.master @@ -0,0 +1,13 @@ +# Expected build arguments: +# RELEASE: centos release +# +ARG RELEASE=7.5.1804 +FROM centos:${RELEASE} + +RUN set -ex ;\ + yum install -y centos-release-openstack-rocky ;\ + rm -rf \ + /var/log/* \ + /tmp/* \ + /var/tmp/* + diff --git a/build-tools/build-docker-images/stx-centos/Dockerfile b/build-tools/build-docker-images/stx-centos/Dockerfile.pike similarity index 100% rename from build-tools/build-docker-images/stx-centos/Dockerfile rename to build-tools/build-docker-images/stx-centos/Dockerfile.pike