summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2018-06-22 15:09:57 +0200
committerLaurent Bonnans <laurent.bonnans@here.com>2018-06-25 14:07:17 +0200
commita3c960df21c5f820cd7aa592a449be667f65cf86 (patch)
tree18e167f0665ea3898dd3474b36fb0257396ba07b /scripts
parentd25358cf0127f769c6d2b3b73b1a50acae78cee9 (diff)
downloadmeta-updater-a3c960df21c5f820cd7aa592a449be667f65cf86.tar.gz
Add caching to CI bitbaking
Also fix various issues with environment variables and file transfers to Docker
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ci/Jenkinsfile9
-rwxr-xr-xscripts/ci/configure.sh25
2 files changed, 30 insertions, 4 deletions
diff --git a/scripts/ci/Jenkinsfile b/scripts/ci/Jenkinsfile
index 84eebca..803664f 100644
--- a/scripts/ci/Jenkinsfile
+++ b/scripts/ci/Jenkinsfile
@@ -1,9 +1,10 @@
1pipeline { 1pipeline {
2 agent none 2 agent none
3 environment { 3 environment {
4 TEST_AKTUALIZR_REMOTE = 'aktualizr'
4 TEST_AKTUALIZR_DIR = 'aktualizr' 5 TEST_AKTUALIZR_DIR = 'aktualizr'
5 TEST_AKTUALIZR_BRANCH = 'aktualizr/master' 6 TEST_AKTUALIZR_BRANCH = 'master'
6 TEST_BITBAKE_COMMON_DIR = "${env.HOME}/bitbake-common" 7 TEST_BITBAKE_COMMON_DIR = "/opt/jenkins/bitbake-common"
7 } 8 }
8 stages { 9 stages {
9 stage('checkout') { 10 stage('checkout') {
@@ -41,6 +42,9 @@ pipeline {
41 showAllChanges: false, 42 showAllChanges: false,
42 ]) 43 ])
43 44
45 // ignore bitbake build directories in docker
46 sh 'echo \'build*\' > .dockerignore'
47
44 // override meta-updater commit with currently tested branch 48 // override meta-updater commit with currently tested branch
45 sh ''' 49 sh '''
46 META_UPDATER_COMMIT=$(git rev-parse HEAD) 50 META_UPDATER_COMMIT=$(git rev-parse HEAD)
@@ -53,6 +57,7 @@ pipeline {
53 agent { 57 agent {
54 dockerfile { 58 dockerfile {
55 filename 'scripts/ci/Dockerfile.bitbake' 59 filename 'scripts/ci/Dockerfile.bitbake'
60 args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common'
56 } 61 }
57 } 62 }
58 steps { 63 steps {
diff --git a/scripts/ci/configure.sh b/scripts/ci/configure.sh
index cf42825..1e87a7b 100755
--- a/scripts/ci/configure.sh
+++ b/scripts/ci/configure.sh
@@ -9,7 +9,8 @@ TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo}
9 9
10TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} 10TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.}
11TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} 11TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master}
12TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="${TEST_AKTUALIZR_DIR}/.git" git rev-parse "${TEST_AKTUALIZR_BRANCH}")} 12TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="$TEST_AKTUALIZR_DIR/.git" git rev-parse "$TEST_AKTUALIZR_REMOTE/$TEST_AKTUALIZR_BRANCH")}
13TEST_BITBAKE_COMMON_DIR=${TEST_BITBAKE_COMMON_DIR:-}
13 14
14# move existing conf directory to backup, before generating a new one 15# move existing conf directory to backup, before generating a new one
15rm -rf "${TEST_BUILD_DIR}/conf.old" || true 16rm -rf "${TEST_BUILD_DIR}/conf.old" || true
@@ -22,12 +23,32 @@ echo ">> Running envsetup.sh"
22. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" 23. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}"
23) 24)
24 25
25echo ">> Set aktualizr branch in bitbake's config" 26set +x
26 27
28echo ">> Set common bitbake config options"
27cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf" 29cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf"
28SANITY_TESTED_DISTROS = "" 30SANITY_TESTED_DISTROS = ""
31SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH"
32IMAGE_FEATURES += "ssh-server-openssh"
33
34EOF
35
36echo ">> Set aktualizr branch in bitbake's config"
37cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf"
29SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV" 38SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV"
30SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}" 39SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}"
31BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH" 40BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH"
32BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}" 41BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}"
42
43EOF
44
45if [[ -n $TEST_BITBAKE_COMMON_DIR ]]; then
46 echo ">> Set caching"
47 SSTATE_DIR="$TEST_BITBAKE_COMMON_DIR/sstate-cache"
48 DL_DIR="$TEST_BITBAKE_COMMON_DIR/downloads"
49 mkdir -p "$SSTATE_DIR" "$DL_DIR"
50 cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf"
51SSTATE_DIR = "$SSTATE_DIR"
52DL_DIR = "$DL_DIR"
33EOF 53EOF
54fi