diff options
Diffstat (limited to 'ci/build.sh')
-rwxr-xr-x | ci/build.sh | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/ci/build.sh b/ci/build.sh index 7a1ef523..82d5b637 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -24,7 +24,7 @@ fi;' EXIT usage () { cat << EOF -$0 Builds the Foreman OPNFV Deployment ISO +$0 Builds the Apex OPNFV Deployment Toolchain usage: $0 [-s spec-file] [-c cache-URI] [-l log-file] [-f Flags] build-directory @@ -41,6 +41,7 @@ OPTIONS: o s: Do nothing, succeed o f: Do nothing, fail o t: run build unit tests + o M: Use master branch code o i: run interactive (-t flag to docker run) o P: Populate a new local cache and push it to the (-c cache-URI) cache artifactory if -c option is present, currently file://, http:// and ftp:// are supported o d: Detatch - NOT YET SUPPORTED @@ -58,7 +59,7 @@ To reduce build time it uses build cache on a local or remote location. The cach - The git Commit-Id on the remote repos/HEAD defined in the spec file does not correspont with the Commit-Id for what the cache was built with. 3) A valid cache does not exist on the specified -c cache-base-URI. -The cache URI object name is foreman_cache-"md5sum(spec file)" +The cache URI object name is apex_cache-"md5sum(spec file)" Logging by default to console, but can be directed elsewhere with the -l option in which case both stdout and stderr is redirected to that destination. @@ -72,7 +73,7 @@ Return codes: - 200 Build failure Examples: -build -c http://opnfv.org/artifactory/foreman/cache -d ~/jenkins/genesis/foreman/ci/output -f ti +build -c http://opnfv.org/artifactory/apex/cache -d ~/jenkins/genesis/apex/ci/output -f ti NOTE: At current the build scope is set to the git root of the repository, -d destination locations outside that scope will not work EOF } @@ -87,8 +88,8 @@ BUILD_BASE=$(readlink -e ../build/) RESULT_DIR="${BUILD_BASE}/release" BUILD_SPEC="${BUILD_BASE}/config.mk" CACHE_DIR="cache" -LOCAL_CACHE_ARCH_NAME="foreman-cache" -REMOTE_CACHE_ARCH_NAME="foreman_cache-$(md5sum ${BUILD_SPEC}| cut -f1 -d " ")" +LOCAL_CACHE_ARCH_NAME="apex-cache" +REMOTE_CACHE_ARCH_NAME="apex_cache-$(md5sum ${BUILD_SPEC}| cut -f1 -d " ")" REMOTE_ACCESS_METHD=curl INCLUDE_DIR=../include # @@ -104,6 +105,7 @@ CACHE_TMP="${SCRIPT_DIR}/tmp" TEST_SUCCEED=0 TEST_FAIL=0 UNIT_TEST=0 +USE_MASTER=0 UPDATE_CACHE=0 POPULATE_CACHE=0 RECURSIV=0 @@ -210,6 +212,10 @@ for ((i=0; i<${#BUILD_FLAGS};i++)); do UNIT_TEST=1 ;; + M) + USE_MASTER=1 + ;; + i) INTERACTIVE=1 ;; @@ -303,7 +309,7 @@ if [ ! -z ${BUILD_CACHE_URI} ]; then POPULATE_CACHE=1 else echo "Unpacking cache file ..." - tar -C ${CACHE_TMP}/cache -xvf ${CACHE_TMP}/cache/${LOCAL_CACHE_ARCH_NAME}.tgz + tar --atime-preserve -C ${CACHE_TMP}/cache -xvf ${CACHE_TMP}/cache/${LOCAL_CACHE_ARCH_NAME}.tgz cp ${CACHE_TMP}/cache/cache/.versions ${BUILD_BASE}/. set +e make -C ${BUILD_BASE} validate-cache; @@ -345,6 +351,10 @@ else MAKE_ARGS+="UNIT_TEST=FALSE " fi +if [ ${USE_MASTER} -eq 1 ]; then + MAKE_ARGS+="USE_MASTER=-master " +fi + if [ ${INTERACTIVE} -eq 1 ]; then MAKE_ARGS+="INTERACTIVE=TRUE " else @@ -376,16 +386,19 @@ if [ $rc -gt 0 ]; then rc=100 exit $rc fi -echo "Copying built OPNFV .iso file to target directory ${BUILD_DIR} ..." +echo "Linking built OPNFV .iso file to target directory ${BUILD_DIR} ..." rm -rf ${BUILD_DIR} mkdir -p ${BUILD_DIR} -cp ${BUILD_BASE}/.versions ${BUILD_DIR} -cp ${RESULT_DIR}/*.iso* ${BUILD_DIR} +ln -s ${BUILD_BASE}/.versions ${BUILD_DIR} +ln -s ${RESULT_DIR}/*.iso* ${BUILD_DIR} +echo "Linking built OPNFV .rpm files to target directory ${BUILD_DIR} ..." +ln -s ${BUILD_BASE}/*.rpm ${BUILD_DIR} +ln -s ${BUILD_BASE}/noarch/*.rpm ${BUILD_DIR} if [ $POPULATE_CACHE -eq 1 ]; then if [ ! -z ${BUILD_CACHE_URI} ]; then echo "Building cache ..." - tar --dereference -C ${BUILD_BASE} -caf ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz ${CACHE_DIR} + tar --atime-preserve --dereference -C ${BUILD_BASE} -caf ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz ${CACHE_DIR} echo "Uploading cache ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}" ${REMOTE_ACCESS_METHD} -T ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}.tgz rm ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz |