summaryrefslogtreecommitdiffstats
path: root/scripts/ci
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2018-06-12 14:48:48 +0200
committerLaurent Bonnans <laurent.bonnans@here.com>2018-06-18 15:41:45 +0200
commit855b031e7597b0c16b2bd9f4c18321b6320c8ffe (patch)
tree614c9ee9fef062f07121d606dafaebb722ee003b /scripts/ci
parent55e49cdb4b2d1d818844703a44483ff92041d80d (diff)
downloadmeta-updater-855b031e7597b0c16b2bd9f4c18321b6320c8ffe.tar.gz
Bitbake build from Jenkins
Diffstat (limited to 'scripts/ci')
-rw-r--r--scripts/ci/Jenkinsfile29
-rwxr-xr-xscripts/ci/build.sh18
-rwxr-xr-xscripts/ci/configure.sh33
-rw-r--r--scripts/ci/local.conf.append5
4 files changed, 83 insertions, 2 deletions
diff --git a/scripts/ci/Jenkinsfile b/scripts/ci/Jenkinsfile
index 0b4afa9..e7bcf6c 100644
--- a/scripts/ci/Jenkinsfile
+++ b/scripts/ci/Jenkinsfile
@@ -1,12 +1,20 @@
1pipeline { 1pipeline {
2 agent any 2 agent none
3 environment {
4 TEST_LOCAL_CONF_APPEND = 'scripts/ci/local.conf.append'
5 TEST_AKTUALIZR_DIR = '.'
6 TEST_AKTUALIZR_BRANCH = 'aktualizr/master'
7 }
3 stages { 8 stages {
4 stage('checkout') { 9 stage('checkout') {
10 agent {
11 label 'bitbake'
12 }
5 steps { 13 steps {
6 checkout([$class: 'RepoScm', 14 checkout([$class: 'RepoScm',
7 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo', 15 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo',
8 manifestBranch: null, 16 manifestBranch: null,
9 manifestFile: null, 17 manifestFile: 'master.xml',
10 manifestGroup: null, 18 manifestGroup: null,
11 mirrorDir: null, 19 mirrorDir: null,
12 jobs: 0, 20 jobs: 0,
@@ -20,6 +28,23 @@ pipeline {
20 trace: false, 28 trace: false,
21 showAllChanges: false, 29 showAllChanges: false,
22 ]) 30 ])
31
32 // override meta-updater commit with currently tested branch
33 sh '''
34 META_UPDATER_COMMIT=$(git rev-parse HEAD)
35 cd updater-repo/meta-updater
36 git checkout $META_UPDATER_COMMIT
37 '''
38 }
39 }
40 stage('build-core-image-minimal') {
41 agent {
42 label 'bitbake'
43 }
44 steps {
45 sh 'scripts/ci/configure.sh'
46
47 sh 'scripts/ci/build.sh core-image-minimal'
23 } 48 }
24 } 49 }
25 } 50 }
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh
new file mode 100755
index 0000000..6235428
--- /dev/null
+++ b/scripts/ci/build.sh
@@ -0,0 +1,18 @@
1#!/bin/bash
2
3set -euo pipefail
4set -x
5
6TEST_MACHINE=${TEST_MACHINE:-qemux86-64}
7TEST_BUILD_DIR=${TEST_BUILD_DIR:-build}
8TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo}
9
10IMAGE_NAME=${1:-core-image-minimal}
11
12(
13set +euo pipefail
14set +x
15. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}"
16
17bitbake "${IMAGE_NAME}"
18)
diff --git a/scripts/ci/configure.sh b/scripts/ci/configure.sh
new file mode 100755
index 0000000..36ed059
--- /dev/null
+++ b/scripts/ci/configure.sh
@@ -0,0 +1,33 @@
1#!/bin/bash
2
3set -euo pipefail
4set -x
5
6TEST_MACHINE=${TEST_MACHINE:-qemux86-64}
7TEST_BUILD_DIR=${TEST_BUILD_DIR:-build}
8TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo}
9
10TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.}
11TEST_LOCAL_CONF_APPEND=${TEST_LOCAL_CONF_APPEND:-}
12TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master}
13TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="${TEST_AKTUALIZR_DIR}/.git" git rev-parse "${TEST_AKTUALIZR_BRANCH}")}
14
15# remove existing local.conf, keep
16rm -rf "${TEST_BUILD_DIR}/conf.old" || true
17mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true
18
19(
20set +euo pipefail
21set +x
22echo ">> Running envsetup.sh"
23. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}"
24)
25
26if [[ -n $TEST_LOCAL_CONF_APPEND ]]; then
27 echo ">> Appending to local.conf"
28 REMOTE_AKTUALIZR_BRANCH=$(sed 's#^[^/]*/##g' <<< "$TEST_AKTUALIZR_BRANCH")
29 cat "$TEST_LOCAL_CONF_APPEND" | \
30 sed "s/\$<rev-sha1>/$TEST_AKTUALIZR_REV/g" | \
31 sed "s/\$<rev-branch>/$REMOTE_AKTUALIZR_BRANCH/g" \
32 >> "${TEST_BUILD_DIR}/conf/local.conf"
33fi
diff --git a/scripts/ci/local.conf.append b/scripts/ci/local.conf.append
new file mode 100644
index 0000000..350e466
--- /dev/null
+++ b/scripts/ci/local.conf.append
@@ -0,0 +1,5 @@
1SANITY_TESTED_DISTROS = ""
2SRCREV_pn-aktualizr = "$<rev-sha1>"
3SRCREV_pn-aktualizr-native = "${SRCREV_pn-aktualizr}"
4BRANCH_pn-aktualizr = "$<rev-branch>"
5BRANCH_pn-aktualizr-native = "${BRANCH_pn-aktualizr}"