Always provide a tag when building with build-all-docker-images
When we're not providing a tag, the build script will use one based on the short SHA of the tip of the current git branch. Make the `build-all-docker-images` script always provide a tag to `build-docker-image` in order to prevent issues with Docker not being able to find the base image when changing branches during an ongoing build. Closes-Bug: #1458739 Change-Id: Id6925b792f46d14b20a7dbebfaf0d351ddec6538
This commit is contained in:
parent
9249ed0d1d
commit
2844a25102
@ -146,7 +146,7 @@ trap 'interrupted' INT
|
||||
|
||||
|
||||
ARGS=$@
|
||||
PARSED_ARGS=$(getopt -q -o hr:n: -l help,namespace:,private-registry:,from:,to:,testmode -- "$@")
|
||||
PARSED_ARGS=$(getopt -q -o hr:n:t: -l help,namespace:,release,tag:,private-registry:,from:,to:,testmode -- "$@")
|
||||
|
||||
eval set -- "$PARSED_ARGS"
|
||||
|
||||
@ -162,6 +162,15 @@ while :; do
|
||||
FORCE_NAMESPACE="$1"
|
||||
;;
|
||||
|
||||
(--release)
|
||||
RELEASE_SPECIFIED=1
|
||||
;;
|
||||
|
||||
(--tag|-t)
|
||||
shift
|
||||
TAG_SPECIFIED=1
|
||||
;;
|
||||
|
||||
(--private-registry|-r)
|
||||
shift
|
||||
REGISTRY="$1"
|
||||
@ -199,6 +208,12 @@ BASE=$(echo "${PREFIX}" | cut -d- -f1)
|
||||
# TYPE == binary, source, rdo
|
||||
TYPE=$(echo "${PREFIX}" | cut -d- -f2)
|
||||
|
||||
# Ensure a tag is specified otherwise build may fail when changing git branch
|
||||
# The release tag is automatically appended when --release flag is used.
|
||||
if [[ $RELEASE_SPECIFIED != 1 ]] && [[ $TAG_SPECIFIED != 1 ]]; then
|
||||
TAG=$(git rev-parse --short HEAD)
|
||||
ARGS+=" --tag $TAG"
|
||||
fi
|
||||
|
||||
# Do a first pass to find images to build and their dependencies
|
||||
for dockerfile in $(find "${DOCKERDIR}/${BASE}/${TYPE}" -name Dockerfile); do
|
||||
|
Loading…
Reference in New Issue
Block a user