From 2fcbd35320c6783cf854575d17492f5e70251341 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Fri, 2 Sep 2016 10:21:04 -0400 Subject: [PATCH] ceph-dev-setup: prevent building branches that have slashes in their name Signed-off-by: Alfredo Deza --- ceph-dev-setup/build/build | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ceph-dev-setup/build/build b/ceph-dev-setup/build/build index aacaa7c3..c967a5b9 100644 --- a/ceph-dev-setup/build/build +++ b/ceph-dev-setup/build/build @@ -1,8 +1,17 @@ #!/bin/bash -ex -# split on '/' to get just 'wip-mybranch' when input is like: origin/wip-mybranch +branch_slashes=$(grep -o "/" <<< ${GIT_BRANCH} | wc -l) BRANCH=`echo ${GIT_BRANCH} | rev | cut -d '/' -f 1 | rev` +# Prevent building branches that have slashes in their name +if [ "$((branch_slashes))" -gt 1 ] ; then + echo "Will refuse to build branch: ${GIT_BRANCH}" + echo "Invalid branch name (contains slashes): ${BRANCH}" + exit 1 +fi + +# split on '/' to get just 'wip-mybranch' when input is like: origin/wip-mybranch + HOST=$(hostname --short) echo "Building on ${HOST}" echo " DIST=${DIST}" -- 2.39.5