From ec307077e542fd290701a871fedc7f58db37712c Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 9 Aug 2016 18:40:22 +0200 Subject: build: ISO refactor, use docker, enable cache Previously, Armband Makefile used to call Fuel@OPNFV Makefile target , instead of , which resulted in bypassing using Docker for ISO building completely. Switch to Makefile target, hence bringing back Docker as a build container. This change justifies moving make variables to a separate spec file, armband.mk. While at it, enable caching of builds. This requires Jenkins bash scripts to be updated for the ISO build job, done in [1]. JIRA: ARMBAND-56 [1] https://gerrit.opnfv.org/gerrit/#/c/18453/ CHANGES: - all: release (was all: build) - Common make targets now depend on submodules-init; - clean-build and clean-docker make targets have been replaced by: make clean, make deepclean; FIXME: These issues should be fixed later: - (optional) trim local repo paths from gitinfo files - only account for armband submodules in cache fingerprints; - identify size mismatch culprit Change-Id: I7d73409be44983fa21d4c09d2e07b87a33231e03 Signed-off-by: Alexandru Avadanii --- ci/build.sh | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) (limited to 'ci') diff --git a/ci/build.sh b/ci/build.sh index fbaa7261..3e372f0f 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -5,47 +5,13 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 -error_exit() { - echo "$@" >&2 - exit 1 -} - -write_gitinfo() { - git_url=$(git config --get remote.origin.url) - git_rev=$(git rev-parse HEAD) - echo "$git_url: $git_rev" -} - -if [ $# -eq 0 ]; then - OUTPUT_DIR=$(pwd) -else - OUTPUT_DIR=$(readlink -f $1) - shift -fi - -mkdir -p $OUTPUT_DIR || error_exit "Could not create directory $OUTPUT_DIR" - -echo "Building armband, output dir: $OUTPUT_DIR" -cd .. - SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]})) -BUILD_BASE="${SCRIPT_DIR}/upstream/fuel/build" -RESULT_DIR="${BUILD_BASE}/release" - -make REVSTATE="${OPNFV_ARTIFACT_VERSION}" release || - error_exit "Make release failed" - -write_gitinfo >> ${BUILD_BASE}/gitinfo_armband.txt +BUILD_BASE=$(readlink -e ${SCRIPT_DIR}/../upstream/fuel/build) -echo "Moving results to $OUTPUT_DIR" -sort ${BUILD_BASE}/gitinfo*.txt > ${OUTPUT_DIR}/gitinfo.txt -mv ${RESULT_DIR}/*.iso ${OUTPUT_DIR}/ -mv ${RESULT_DIR}/*.iso.txt ${OUTPUT_DIR}/ +export ARMBAND_BASE=$(readlink -e ${SCRIPT_DIR}/..) +export OPNFV_GIT_SHA=$(git rev-parse HEAD) +export LOCAL_CACHE_ARCH_NAME="armband-cache" -# We need to build our own ODL plugin, and when this happens, fuel -# renames the iso to unofficial-opnfv-${REVSTATE}.iso, so here we remove -# the prefix: -pushd ${OUTPUT_DIR} > /dev/null -rename 's/^unofficial-//' *.iso -rename 's/^unofficial-//' *.iso.txt -popd > /dev/null +# Initialize Armband git submodules & apply patches first +make -C ${ARMBAND_BASE} submodules-clean patches-import +cd ${ARMBAND_BASE}/upstream/fuel/ci && ./build.sh $* -- cgit 1.2.3-korg