diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..2fc6fdc --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +def targets = [ 'qemux86', 'qemux86-64', 'qemuarm', 'qemuarm64' ] + +def machine_builds = [:] + +for (int i = 0; i < targets.size(); i++) { + def machine = targets.get(i) + + machine_builds["$machine"] = { + node { + try { + stage('Checkout') { + checkout scm + } + stage('Setup Environment') { + sh "./scripts/setup-env.sh" + } + stage('Yocto Fetch') { + sh "GIT_LOCAL_REF_DIR=/srv/git-cache/ ./scripts/fetch.sh master" + } + stage('Build') { + sh "MACHINE=${machine} ./scripts/build.sh" + } + } catch (e) { + echo "Caught: ${e}" + throw e + } finally { + stage('Cleanup Environment') { + sh "./scripts/cleanup-env.sh" + deleteDir() + } + } + } + } +} + +parallel machine_builds diff --git a/conf/local.conf.sample b/conf/local.conf.sample index a7b2d80..08e6e7e 100644 --- a/conf/local.conf.sample +++ b/conf/local.conf.sample @@ -220,6 +220,10 @@ 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" + +SOURCE_MIRROR_URL ?= "http://build-cache.asterius.io/downloads/" +INHERIT += "own-mirrors rm_work" # # Qemu configuration diff --git a/scripts/cleanup-env.sh b/scripts/cleanup-env.sh new file mode 100755 index 0000000..1367724 --- /dev/null +++ b/scripts/cleanup-env.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +sudo umount build + +exit 0 diff --git a/scripts/fetch.sh b/scripts/fetch.sh index 2d4897a..4a54df3 100755 --- a/scripts/fetch.sh +++ b/scripts/fetch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # the repos we want to check out, must setup variables below # NOTE: poky must remain first @@ -33,7 +33,11 @@ update_repo() { git fetch origin || die "unable to fetch ${uri}" else echo "Cloning '${path}'" - git clone ${uri} ${path} || die "unable to clone ${uri}" + if [ -z "${GIT_LOCAL_REF_DIR}" ]; then + git clone ${uri} ${path} || die "unable to clone ${uri}" + else + git clone --reference ${GIT_LOCAL_REF_DIR}/`basename ${path}` ${uri} ${path} + fi pushd ${path} > /dev/null fi diff --git a/scripts/setup-env.sh b/scripts/setup-env.sh new file mode 100755 index 0000000..e5fc3b1 --- /dev/null +++ b/scripts/setup-env.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +mkdir -p build + +sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build + +exit 0