summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/ci/Jenkinsfile61
-rwxr-xr-xscripts/ci/build.sh18
-rwxr-xr-xscripts/ci/configure.sh33
-rw-r--r--scripts/ci/local.conf.append5
4 files changed, 117 insertions, 0 deletions
diff --git a/scripts/ci/Jenkinsfile b/scripts/ci/Jenkinsfile
new file mode 100644
index 0000000..83bd49c
--- /dev/null
+++ b/scripts/ci/Jenkinsfile
@@ -0,0 +1,61 @@
1pipeline {
2 agent none
3 environment {
4 TEST_LOCAL_CONF_APPEND = 'scripts/ci/local.conf.append'
5 TEST_AKTUALIZR_DIR = 'aktualizr'
6 TEST_AKTUALIZR_BRANCH = 'origin/master'
7 }
8 stages {
9 stage('checkout') {
10 agent {
11 label 'bitbake'
12 }
13 steps {
14 dir('aktualizr') {
15 checkout([$class: 'GitSCM',
16 userRemoteConfigs: [[url: 'https://github.com/advancedtelematic/aktualizr']],
17 branches: [[name: '*/master']],
18 changelog: true,
19 poll: true,
20 ])
21 }
22
23 checkout([$class: 'RepoScm',
24 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo',
25 manifestBranch: null,
26 manifestFile: 'master.xml',
27 manifestGroup: null,
28 mirrorDir: null,
29 jobs: 0,
30 depth: 0,
31 localManifest: null,
32 destinationDir: 'updater-repo',
33 repoUrl: null,
34 currentBranch: false,
35 resetFirst: true,
36 quiet: false,
37 trace: false,
38 showAllChanges: false,
39 ])
40
41 // override meta-updater commit with currently tested branch
42 sh '''
43 META_UPDATER_COMMIT=$(git rev-parse HEAD)
44 cd updater-repo/meta-updater
45 git checkout $META_UPDATER_COMMIT
46 '''
47 }
48 }
49 stage('build-core-image-minimal') {
50 agent {
51 label 'bitbake'
52 }
53 steps {
54 sh 'scripts/ci/configure.sh'
55
56 sh 'scripts/ci/build.sh core-image-minimal'
57 }
58 }
59 }
60}
61// vim: set ft=groovy tabstop=2 shiftwidth=2 expandtab:
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}"