From 699f625a528e719f3e2ee46ee8bbaf2dc4e6b896 Mon Sep 17 00:00:00 2001 From: Derek Straka Date: Tue, 14 Feb 2017 12:44:11 -0500 Subject: [PATCH] Add the ability to use and store build cache artifacts Signed-off-by: Derek Straka (cherry picked from commit 0adcc6e0bc9284e63762a13c9db299c9e3b2b31b) --- Jenkinsfile | 3 +++ conf/local.conf.sample | 2 +- scripts/publish-build-cache.sh | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 scripts/publish-build-cache.sh diff --git a/Jenkinsfile b/Jenkinsfile index cb4ee6f..4360742 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,6 +24,9 @@ for (int i = 0; i < targets.size(); i++) { echo "Caught: ${e}" throw e } finally { + stage("push build cache $machine") { + sh "./scripts/publish-build-cache.sh master" + } stage("cleanup $machine") { sh "./scripts/cleanup-env.sh" deleteDir() diff --git a/conf/local.conf.sample b/conf/local.conf.sample index 3429110..c5ccf1b 100644 --- a/conf/local.conf.sample +++ b/conf/local.conf.sample @@ -220,7 +220,7 @@ BB_DISKMON_DIRS = "\ #file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ #file://.* file:///some/local/dir/sstate/PATH" -SSTATE_MIRRORS ?= "file://.* http://build-cache.asterius.io/sstate/PATH;downloadfilename=PATH \n" +SSTATE_MIRRORS ?= "file://.* http://build-cache.asterius.io/master/sstate-cache/PATH;downloadfilename=PATH \n" SOURCE_MIRROR_URL ?= "http://build-cache.asterius.io/downloads/" INHERIT += "own-mirrors rm_work" diff --git a/scripts/publish-build-cache.sh b/scripts/publish-build-cache.sh new file mode 100755 index 0000000..871d97d --- /dev/null +++ b/scripts/publish-build-cache.sh @@ -0,0 +1,13 @@ +#!/bin/bash -e + +if [[ $# -lt 1 ]]; then + echo "No Yocto branch specified, defaulting to master" + echo "To change this pass a Yocto branch name as an argument to this script" +fi +branch=${1-master} + +rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress build/downloads yocto-cache@build-cache.asterius.io:/srv/yocto-cache/ + +rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress build/sstate-cache yocto-cache@build-cache.asterius.io:/srv/yocto-cache/${branch}/ + +exit 0