Environment overrides for builder image tags
New environment variables to set docker image tags for the images used by the helm chart, as well as the images we download from Docker Hub. When these new vars are missing, the scripts behave as before this patch. TESTS ============================ * Re-create the environment with/without the new env vars, with/without "--rebuild" * Make sure "stx control start/stop" works * Make sure images created by stx-init-env use tags matching new env vars Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: I66e061aef52fdb26c99303ecfbcd1fa9b43bc6bc
This commit is contained in:
parent
2f8f58e041
commit
5e70ce6c7e
23
import-stx
23
import-stx
@ -1,4 +1,5 @@
|
||||
# bash
|
||||
# vim:syn=sh
|
||||
|
||||
#
|
||||
# ENVIRONMENT
|
||||
@ -58,6 +59,15 @@
|
||||
# passed to docker-in-docker's command line. This must be <= to the k8s
|
||||
# container network's MTU.
|
||||
#
|
||||
# STX_BUILDER_IMAGE_TAG
|
||||
# Assign this tag to builder images generated or downloaded by stx-init-env,
|
||||
# and reference them in builder helm charts.
|
||||
# Default: $USER-$PROJECT-$DOCKER_TAG_VERSION
|
||||
#
|
||||
# STX_PREBUILT_BUILDER_IMAGE_TAG
|
||||
# Download pre-built images with this tag. This is used by "stx-init-env"
|
||||
# without the "--rebuild" flag.
|
||||
# Default: master-debian-latest
|
||||
|
||||
notice_warn () {
|
||||
local tty_on tty_off
|
||||
@ -106,9 +116,16 @@ fi
|
||||
# Host side path, exports STX lib to user's PATH
|
||||
export PRJDIR=$(pwd)
|
||||
export PATH=$PRJDIR/stx/bin:$PATH
|
||||
# Used by helm/stx-init to tag the user images
|
||||
DOCKER_TAG_VERSION="v0.1.0"
|
||||
export DOCKER_TAG_LOCAL="${USER}-${PROJECT}-${DOCKER_TAG_VERSION}"
|
||||
if [[ -n "$STX_BUILDER_IMAGE_TAG" ]] ; then
|
||||
export DOCKER_TAG_LOCAL="$STX_BUILDER_IMAGE_TAG"
|
||||
else
|
||||
DOCKER_TAG_VERSION="v0.1.0"
|
||||
export DOCKER_TAG_LOCAL="${USER}-${PROJECT}-${DOCKER_TAG_VERSION}"
|
||||
fi
|
||||
if [[ -z "$STX_PREBUILT_BUILDER_IMAGE_TAG" ]] ; then
|
||||
STX_PREBUILT_BUILDER_IMAGE_TAG="master-debian-latest"
|
||||
fi
|
||||
export STX_PREBUILT_BUILDER_IMAGE_TAG
|
||||
# Platform 'minikube' or 'kubernetes'
|
||||
export STX_PLATFORM="${STX_PLATFORM:-minikube}"
|
||||
# Max cpus for the build parallel jobs, replaces MINIKUBECPUS env var
|
||||
|
18
stx-init-env
18
stx-init-env
@ -37,6 +37,17 @@ notice() {
|
||||
echo >&2 "${tty_on}$*${tty_off}"
|
||||
}
|
||||
|
||||
info() {
|
||||
local tty_on tty_off
|
||||
if [[ -t 2 ]] ; then
|
||||
tty_on=$'\033[0;36m'
|
||||
tty_off=$'\033[0m'
|
||||
fi
|
||||
echo >&2 "${tty_on}$*${tty_off}"
|
||||
}
|
||||
|
||||
source "$(dirname "$0")"/import-stx || return 1
|
||||
|
||||
PROGNAME=$(basename "$0")
|
||||
MINIKUBE=minikube
|
||||
HELM=helm
|
||||
@ -45,7 +56,7 @@ PYTHON3=python3
|
||||
KUBECTL=kubectl
|
||||
DOCKER_PREFIX="starlingx/"
|
||||
DOCKER_IMAGES="stx-builder stx-pkgbuilder stx-lat-tool stx-aptly"
|
||||
DOCKER_TAG="master-debian-latest"
|
||||
DOCKER_TAG="$STX_PREBUILT_BUILDER_IMAGE_TAG"
|
||||
|
||||
BUILD_DOCKER=0
|
||||
DELETE_ENV=0
|
||||
@ -193,9 +204,6 @@ if [[ $CLEAN_CONFIG -eq 1 ]] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# import environment
|
||||
source import-stx || return 1
|
||||
|
||||
# Make sure $STX_BUILD_HOME exists
|
||||
if [[ ! -d "$STX_BUILD_HOME" ]] ; then
|
||||
echo >&2 "The directory $STX_BUILD_HOME doesn't exist, please create it with the command:"
|
||||
@ -283,6 +291,7 @@ if [[ -n "${BUILD_DOCKER_IMAGES}" ]] ; then
|
||||
fi
|
||||
for img in $BUILD_DOCKER_IMAGES; do
|
||||
docker build "${docker_build_args[@]}" -t $img:$DOCKER_TAG_LOCAL -f stx/dockerfiles/$img.Dockerfile . || exit 1
|
||||
info "built image $img:$DOCKER_TAG_LOCAL"
|
||||
done
|
||||
fi
|
||||
|
||||
@ -307,6 +316,7 @@ if [[ -n "$PULL_DOCKER_IMAGES" ]] ; then
|
||||
for img in $PULL_DOCKER_IMAGES; do
|
||||
docker pull ${DOCKER_PREFIX}${img}:${DOCKER_TAG} || exit 1
|
||||
docker tag ${DOCKER_PREFIX}${img}:${DOCKER_TAG} ${img}:${DOCKER_TAG_LOCAL} || exit 1
|
||||
info "created image ${img}:${DOCKER_TAG_LOCAL} from pre-built ${DOCKER_PREFIX}${img}:${DOCKER_TAG}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user