entrypoint: handle adding build tags through a function

The previous code was somewhat dependent on always having the ceph
version build tag set first. Change the code to use a function so that
constructing the build tags is no longer order dependent and relocate
the actual tag stetting if-statements to below the various function
definitions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-09-21 10:04:41 -04:00 committed by mergify[bot]
parent 8835a26c9b
commit b425523f44
1 changed files with 25 additions and 15 deletions

View File

@ -115,21 +115,14 @@ while true ; do
esac
done
if [ -n "${CEPH_VERSION}" ]; then
BUILD_TAGS="${CEPH_VERSION}"
fi
if [ -n "${USE_PTRGUARD}" ]; then
BUILD_TAGS+=",ptrguard"
fi
if [ -z "${NO_PREVIEW}" ]; then
BUILD_TAGS+=",ceph_preview"
fi
if [ -n "${BUILD_TAGS}" ]; then
BUILD_TAGS="-tags ${BUILD_TAGS}"
add_build_tag() {
local val="$1"
if [ -n "$BUILD_TAGS" ]; then
BUILD_TAGS+=",${val}"
else
BUILD_TAGS="${val}"
fi
}
show() {
local ret
@ -297,6 +290,23 @@ pause_if_needed() {
fi
}
if [ -n "${CEPH_VERSION}" ]; then
add_build_tag "${CEPH_VERSION}"
fi
if [ -n "${USE_PTRGUARD}" ]; then
add_build_tag "ptrguard"
fi
if [ -z "${NO_PREVIEW}" ]; then
add_build_tag "ceph_preview"
fi
if [ -n "${BUILD_TAGS}" ]; then
BUILD_TAGS="-tags ${BUILD_TAGS}"
fi
test_go_ceph
pause_if_needed