From b425523f444cb68c0497463e33345548a50fda05 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 21 Sep 2021 10:04:41 -0400 Subject: [PATCH] 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 --- entrypoint.sh | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0636d58..b690db6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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}" -fi +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