diff options
author | Laurent Bonnans <laurent.bonnans@here.com> | 2018-06-12 14:48:48 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2018-06-18 15:41:45 +0200 |
commit | 855b031e7597b0c16b2bd9f4c18321b6320c8ffe (patch) | |
tree | 614c9ee9fef062f07121d606dafaebb722ee003b | |
parent | 55e49cdb4b2d1d818844703a44483ff92041d80d (diff) | |
download | meta-updater-855b031e7597b0c16b2bd9f4c18321b6320c8ffe.tar.gz |
Bitbake build from Jenkins
-rw-r--r-- | scripts/ci/Jenkinsfile | 29 | ||||
-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, 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 @@ | |||
1 | pipeline { | 1 | pipeline { |
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 | |||
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}" | ||