diff options
-rw-r--r-- | scripts/ci/Jenkinsfile | 61 | ||||
-rwxr-xr-x | scripts/ci/build.sh | 18 | ||||
-rwxr-xr-x | scripts/ci/configure.sh | 33 | ||||
-rw-r--r-- | scripts/ci/local.conf.append | 5 |
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 @@ | |||
1 | pipeline { | ||
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 | |||
3 | set -euo pipefail | ||
4 | set -x | ||
5 | |||
6 | TEST_MACHINE=${TEST_MACHINE:-qemux86-64} | ||
7 | TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} | ||
8 | TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} | ||
9 | |||
10 | IMAGE_NAME=${1:-core-image-minimal} | ||
11 | |||
12 | ( | ||
13 | set +euo pipefail | ||
14 | set +x | ||
15 | . "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" | ||
16 | |||
17 | bitbake "${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 | |||
3 | set -euo pipefail | ||
4 | set -x | ||
5 | |||
6 | TEST_MACHINE=${TEST_MACHINE:-qemux86-64} | ||
7 | TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} | ||
8 | TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} | ||
9 | |||
10 | TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} | ||
11 | TEST_LOCAL_CONF_APPEND=${TEST_LOCAL_CONF_APPEND:-} | ||
12 | TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} | ||
13 | TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="${TEST_AKTUALIZR_DIR}/.git" git rev-parse "${TEST_AKTUALIZR_BRANCH}")} | ||
14 | |||
15 | # remove existing local.conf, keep | ||
16 | rm -rf "${TEST_BUILD_DIR}/conf.old" || true | ||
17 | mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true | ||
18 | |||
19 | ( | ||
20 | set +euo pipefail | ||
21 | set +x | ||
22 | echo ">> Running envsetup.sh" | ||
23 | . "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" | ||
24 | ) | ||
25 | |||
26 | if [[ -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" | ||
33 | fi | ||
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 @@ | |||
1 | SANITY_TESTED_DISTROS = "" | ||
2 | SRCREV_pn-aktualizr = "$<rev-sha1>" | ||
3 | SRCREV_pn-aktualizr-native = "${SRCREV_pn-aktualizr}" | ||
4 | BRANCH_pn-aktualizr = "$<rev-branch>" | ||
5 | BRANCH_pn-aktualizr-native = "${BRANCH_pn-aktualizr}" | ||