Add MAX_STAGES variable

If set, only runs up to that stage
pull/21/head
Greg MacLellan 2016-09-28 23:29:24 -04:00
parent 62406bad92
commit 140238dbc2
1 changed files with 10 additions and 0 deletions

View File

@ -128,6 +128,11 @@ if [ -z "${IMG_NAME}" ]; then
exit 1
fi
if [ -z "${MAX_STAGE}" ]; then
MAX_STAGE=4
fi
echo "Running stage${MAX_STAGE} build"
export IMG_DATE=${IMG_DATE:-"$(date -u +%Y-%m-%d)"}
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@ -166,6 +171,11 @@ mkdir -p ${WORK_DIR}
log "Begin ${BASE_DIR}"
for STAGE_DIR in ${BASE_DIR}/stage*; do
if [[ $STAGE_DIR =~ stage$((MAX_STAGE + 1))$ ]]; then
echo "Skipping ${STAGE_DIR} (and remaining stages)"
break
fi
run_stage
done