From d2c5a1dde91d10b4f3f9f5ac0b1570527247e03c Mon Sep 17 00:00:00 2001 From: "Stefan K. Berg" Date: Sat, 23 Jan 2016 20:56:48 +0100 Subject: Cache as we go instead of in the end In order to speed up the build process when building with the cache enabled, cache immediately following the build of a sub artifact instead of at the end. Should the build fail, we don't need to rebuild those parts that already were successful in the last build. Change-Id: I23b59f7ba4a04272aea855cf451793158fe12241 Signed-off-by: Stefan K. Berg --- build/Makefile | 7 +++---- build/cache.sh | 7 ++++++- build/f_isoroot/f_bgpvpn-pluginbuild/Makefile | 3 +++ build/f_isoroot/f_odlpluginbuild/Makefile | 3 +++ build/f_isoroot/f_onosfwpluginbuild/Makefile | 3 +++ build/f_isoroot/f_ovs-nsh-dpdk-pluginbuild/Makefile | 3 +++ build/f_isoroot/f_ovsnfv-dpdk-pluginbuild/Makefile | 3 +++ build/f_isoroot/f_qemupluginbuild/Makefile | 3 +++ build/f_isoroot/f_repobuild/Makefile | 3 +++ build/f_isoroot/f_vsperfpluginbuild/Makefile | 3 +++ 10 files changed, 33 insertions(+), 5 deletions(-) diff --git a/build/Makefile b/build/Makefile index d867df021..f77a14538 100644 --- a/build/Makefile +++ b/build/Makefile @@ -120,10 +120,9 @@ $(ISOCACHE): # Repeat build up to ten times sudo ./fuel_build_loop cp /tmp/fuel-main/build/artifacts/fuel*.iso . - - # Attempt to store ISO in cache to speed up the next - # build attempt. If cache is not enabled no harm is done. - $(MAKE) -f Makefile put-cache + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 .PHONY: mount-origiso umount-origiso mount-origiso: $(ISOCACHE) diff --git a/build/cache.sh b/build/cache.sh index 52d28fa33..b5f090210 100755 --- a/build/cache.sh +++ b/build/cache.sh @@ -19,7 +19,6 @@ exit_trap() { trap exit_trap EXIT CACHETRANSPORT=${CACHETRANSPORT:-"curl --silent"} -CACHEBASE=${CACHEBASE:-"file://${HOME}/cache"} CACHEMAXAGE=${CACHEMAXAGE:-$[14*24*3600]} CACHEDEBUG=${CACHEDEBUG:-1} @@ -139,6 +138,12 @@ getcommitid() { fi } + + +if [ -z "$CACHEBASE" ]; then + errorexit "CACHEBASE not set - exiting..." +fi + case $1 in getbiweek) if [ $# -ne 1 ]; then diff --git a/build/f_isoroot/f_bgpvpn-pluginbuild/Makefile b/build/f_isoroot/f_bgpvpn-pluginbuild/Makefile index a99a426b6..71f2771a5 100644 --- a/build/f_isoroot/f_bgpvpn-pluginbuild/Makefile +++ b/build/f_isoroot/f_bgpvpn-pluginbuild/Makefile @@ -51,6 +51,9 @@ release:.bgpvpnbuild $(REPOINFO) -r . > gitinfo_bgpvpnplugin.txt rm -rf fuel-plugin-bgpvpn touch .bgpvpnbuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh diff --git a/build/f_isoroot/f_odlpluginbuild/Makefile b/build/f_isoroot/f_odlpluginbuild/Makefile index 18fbb9e60..4ae81dd11 100644 --- a/build/f_isoroot/f_odlpluginbuild/Makefile +++ b/build/f_isoroot/f_odlpluginbuild/Makefile @@ -37,6 +37,9 @@ release:.odlbuild $(REPOINFO) -r . > gitinfo_odlplugin.txt rm -rf fuel-plugin-opendaylight touch .odlbuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh diff --git a/build/f_isoroot/f_onosfwpluginbuild/Makefile b/build/f_isoroot/f_onosfwpluginbuild/Makefile index 0cf290c1c..9516e3d46 100644 --- a/build/f_isoroot/f_onosfwpluginbuild/Makefile +++ b/build/f_isoroot/f_onosfwpluginbuild/Makefile @@ -49,6 +49,9 @@ release:.onosbuild $(REPOINFO) -r . > gitinfo_onos-plugin.txt @rm -rf fuel-plugin-onos @touch .onosbuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh diff --git a/build/f_isoroot/f_ovs-nsh-dpdk-pluginbuild/Makefile b/build/f_isoroot/f_ovs-nsh-dpdk-pluginbuild/Makefile index 700a93c0d..f89f8d980 100644 --- a/build/f_isoroot/f_ovs-nsh-dpdk-pluginbuild/Makefile +++ b/build/f_isoroot/f_ovs-nsh-dpdk-pluginbuild/Makefile @@ -50,6 +50,9 @@ release:.ovsbuild $(REPOINFO) -r . > gitinfo_ovs-nsh-dpdk-plugin.txt @rm -rf fuel-plugin-ovs @touch .ovsbuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh diff --git a/build/f_isoroot/f_ovsnfv-dpdk-pluginbuild/Makefile b/build/f_isoroot/f_ovsnfv-dpdk-pluginbuild/Makefile index 70fd22409..a74687307 100644 --- a/build/f_isoroot/f_ovsnfv-dpdk-pluginbuild/Makefile +++ b/build/f_isoroot/f_ovsnfv-dpdk-pluginbuild/Makefile @@ -50,6 +50,9 @@ release:.ovsnfvbuild $(REPOINFO) -r . > gitinfo_ovsnfv-dpdk-plugin.txt @rm -rf fuel-plugin-ovsnfv @touch .ovsnfvbuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh diff --git a/build/f_isoroot/f_qemupluginbuild/Makefile b/build/f_isoroot/f_qemupluginbuild/Makefile index 126e20549..0f245aec3 100644 --- a/build/f_isoroot/f_qemupluginbuild/Makefile +++ b/build/f_isoroot/f_qemupluginbuild/Makefile @@ -50,6 +50,9 @@ release:.qemubuild $(REPOINFO) -r . > gitinfo_qemu-plugin.txt @rm -rf fuel-plugin-qemu @touch .qemubuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile index 522722e66..1fc703031 100644 --- a/build/f_isoroot/f_repobuild/Makefile +++ b/build/f_isoroot/f_repobuild/Makefile @@ -45,6 +45,9 @@ nailgun: sudo su - -c /opt/fuel-createmirror-*/fuel-createmirror sudo chmod -R 755 /var/www/nailgun cp -Rp /var/www/nailgun . + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 .PHONY: clean clean: diff --git a/build/f_isoroot/f_vsperfpluginbuild/Makefile b/build/f_isoroot/f_vsperfpluginbuild/Makefile index ccf596a14..c9653d785 100644 --- a/build/f_isoroot/f_vsperfpluginbuild/Makefile +++ b/build/f_isoroot/f_vsperfpluginbuild/Makefile @@ -50,6 +50,9 @@ release:.vsperfbuild $(REPOINFO) -r . > gitinfo_vsperf-plugin.txt @rm -rf fuel-plugin-vsperf @touch .vsperfbuild + # Store artifact in cache straight away if caching is enabled + # (no .cacheid will be present unless this is a cached build) + test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0 ############################################################################# # Cache operations - only used when building through ci/build.sh -- cgit 1.2.3-korg