Change workspace cleanup to prebuild step
This commit is contained in:
parent
daa787d719
commit
d33134ba32
|
@ -1 +0,0 @@
|
|||
CIBUILD=1
|
|
@ -20,30 +20,15 @@
|
|||
# Author: Martin Stockhammer <martin_s@apache.org>
|
||||
# Date: 2017-05-24
|
||||
#
|
||||
# Clears the workspace, if the build number is higher
|
||||
# for automatic workspace cleanup on the build slaves
|
||||
#
|
||||
# To request a workspace cleanup increase the number for CIBUILD
|
||||
# in the file ../env/build-info.txt and
|
||||
# Removes directories that are not used anymore.
|
||||
##
|
||||
ATTIC_DIRS="redback-common/redback-common-jdo \
|
||||
redback-rbac/redback-rbac-providers/redback-rbac-jdo \
|
||||
redback-users/redback-users-providers/redback-users-jdo \
|
||||
redback-keys/redback-keys-providers/redback-keys-jdo"
|
||||
|
||||
##
|
||||
BUILDINFO_DIR=${WORKSPACE}/ci
|
||||
BUILDINFO_FILE=${BUILDINFO_DIR}/buildinfo.sh
|
||||
REQ_BUILDINFO_FILE=$(dirname $0)/../env/build-info.txt
|
||||
git checkout ${REQ_BUILDINFO_FILE}
|
||||
if [ -f ${REQ_BUILDINFO_FILE} ]; then
|
||||
. ${REQ_BUILDINFO_FILE}
|
||||
else
|
||||
CIBUILD=0
|
||||
fi
|
||||
REQUESTED_BUILD=${CIBUILD}
|
||||
CIBUILD=0
|
||||
if [ -f ${BUILDINFO_FILE} ]; then
|
||||
. ${BUILDINFO_FILE}
|
||||
fi
|
||||
if [ ${CIBUILD} -lt ${REQUESTED_BUILD} ]; then
|
||||
echo "Clearing workspace"
|
||||
rm -rf ${WORKSPACE}/*
|
||||
mkdir -p ${BUILDINFO_DIR}
|
||||
echo "CIBUILD=${REQUESTED_BUILD}" >${BUILDINFO_FILE}
|
||||
fi
|
||||
for i in ${ATTIC_DIRS}; do
|
||||
if [ "X${i}" != "X" -a -d ${i} ]; then
|
||||
rm -rf ${i}
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue