summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlbonn <lbonn@users.noreply.github.com>2018-09-07 11:20:02 +0200
committerGitHub <noreply@github.com>2018-09-07 11:20:02 +0200
commitb252a30428b448b610edf59c0c0116a45039e4c8 (patch)
tree9ca5146bfb805be1c44a7ab7a35c73e51aa40242
parentd3e2c58e8655338b33738e495168a82a74e5b86c (diff)
parent12ee01db91117005b79a9264d8509a2daf86fa80 (diff)
downloadmeta-updater-b252a30428b448b610edf59c0c0116a45039e4c8.tar.gz
Merge pull request #384 from advancedtelematic/ci/oe-selftest
Ci/oe selftest
-rw-r--r--scripts/ci/Dockerfile.bitbake6
-rw-r--r--scripts/ci/Jenkinsfile.bleeding17
-rw-r--r--scripts/ci/Jenkinsfile.bleeding-selftest89
-rwxr-xr-xscripts/ci/configure.sh25
-rwxr-xr-xscripts/ci/oe-selftest.sh18
5 files changed, 146 insertions, 9 deletions
diff --git a/scripts/ci/Dockerfile.bitbake b/scripts/ci/Dockerfile.bitbake
index 4dfafec..c91f94c 100644
--- a/scripts/ci/Dockerfile.bitbake
+++ b/scripts/ci/Dockerfile.bitbake
@@ -18,6 +18,7 @@ RUN apt-get update -q && apt-get install -qy \
18 libpython-dev \ 18 libpython-dev \
19 libsdl1.2-dev \ 19 libsdl1.2-dev \
20 locales \ 20 locales \
21 ovmf \
21 procps \ 22 procps \
22 python \ 23 python \
23 python3 \ 24 python3 \
@@ -30,6 +31,11 @@ RUN apt-get update -q && apt-get install -qy \
30 xterm \ 31 xterm \
31 xz-utils 32 xz-utils
32 33
34ARG uid=1000
35ARG gid=1000
36RUN groupadd -g $gid bitbake
37RUN useradd -m -u $uid -g $gid bitbake
38
33RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen 39RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
34ENV LC_ALL="en_US.UTF-8" 40ENV LC_ALL="en_US.UTF-8"
35ENV LANG="en_US.UTF-8" 41ENV LANG="en_US.UTF-8"
diff --git a/scripts/ci/Jenkinsfile.bleeding b/scripts/ci/Jenkinsfile.bleeding
index 6d0f1e7..6d340fd 100644
--- a/scripts/ci/Jenkinsfile.bleeding
+++ b/scripts/ci/Jenkinsfile.bleeding
@@ -1,8 +1,16 @@
1// This CI setup checks out aktualizr, meta-updater and updater-repo and builds 1// This CI setup checks out aktualizr, meta-updater and updater-repo and builds
2// master branches whenever a change is pushed to any of these 2// master branches whenever a change is pushed to any of these
3 3
4// define these for docker image creation
5node {
6 // might cause some problems:
7 // https://stackoverflow.com/questions/44805076/setting-build-args-for-dockerfile-agent-using-a-jenkins-declarative-pipeline
8 JENKINS_UID = sh(returnStdout: true, script: 'id -u').trim()
9 JENKINS_GID = sh(returnStdout: true, script: 'id -g').trim()
10}
11
4pipeline { 12pipeline {
5 agent none 13 agent any
6 environment { 14 environment {
7 TEST_AKTUALIZR_REMOTE = 'aktualizr' 15 TEST_AKTUALIZR_REMOTE = 'aktualizr'
8 TEST_AKTUALIZR_DIR = 'aktualizr' 16 TEST_AKTUALIZR_DIR = 'aktualizr'
@@ -11,8 +19,8 @@ pipeline {
11 } 19 }
12 stages { 20 stages {
13 stage('checkout') { 21 stage('checkout') {
14 agent any
15 steps { 22 steps {
23
16 checkout([$class: 'GitSCM', 24 checkout([$class: 'GitSCM',
17 userRemoteConfigs: [ 25 userRemoteConfigs: [
18 [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr'] 26 [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr']
@@ -61,8 +69,13 @@ pipeline {
61 dockerfile { 69 dockerfile {
62 filename 'scripts/ci/Dockerfile.bitbake' 70 filename 'scripts/ci/Dockerfile.bitbake'
63 args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common' 71 args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common'
72 additionalBuildArgs "--build-arg uid=${JENKINS_UID} --build-arg gid=${JENKINS_GID}"
73 reuseNode true
64 } 74 }
65 } 75 }
76 environment {
77 TEST_AKTUALIZR_CREDENTIALS = credentials('garage-credentials')
78 }
66 steps { 79 steps {
67 sh 'scripts/ci/configure.sh' 80 sh 'scripts/ci/configure.sh'
68 81
diff --git a/scripts/ci/Jenkinsfile.bleeding-selftest b/scripts/ci/Jenkinsfile.bleeding-selftest
new file mode 100644
index 0000000..e50b4b6
--- /dev/null
+++ b/scripts/ci/Jenkinsfile.bleeding-selftest
@@ -0,0 +1,89 @@
1// This CI setup checks out aktualizr, meta-updater and updater-repo and builds
2// master branches whenever a change is pushed to any of these
3
4// define these for docker image creation
5node {
6 // might cause some problems:
7 // https://stackoverflow.com/questions/44805076/setting-build-args-for-dockerfile-agent-using-a-jenkins-declarative-pipeline
8 JENKINS_UID = sh(returnStdout: true, script: 'id -u').trim()
9 JENKINS_GID = sh(returnStdout: true, script: 'id -g').trim()
10}
11
12pipeline {
13 agent any
14 environment {
15 TEST_AKTUALIZR_REMOTE = 'aktualizr'
16 TEST_AKTUALIZR_DIR = 'aktualizr'
17 TEST_AKTUALIZR_BRANCH = 'master'
18 TEST_BITBAKE_COMMON_DIR = "/opt/jenkins/bitbake-common"
19 }
20 stages {
21 stage('checkout') {
22 steps {
23
24 checkout([$class: 'GitSCM',
25 userRemoteConfigs: [
26 [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr']
27 ],
28 branches: [[name: 'refs/heads/master']],
29 extensions: [
30 [$class: 'DisableRemotePoll'],
31 [$class: 'PruneStaleBranch'],
32 [$class: 'RelativeTargetDirectory',
33 relativeTargetDir: 'aktualizr'
34 ]
35 ],
36 ])
37
38 checkout([$class: 'RepoScm',
39 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo',
40 manifestBranch: null,
41 manifestFile: 'master.xml',
42 manifestGroup: null,
43 mirrorDir: null,
44 jobs: 0,
45 depth: 0,
46 localManifest: null,
47 destinationDir: 'updater-repo',
48 repoUrl: null,
49 currentBranch: false,
50 resetFirst: true,
51 quiet: false,
52 trace: false,
53 showAllChanges: false,
54 ])
55
56 // ignore bitbake build directories in docker
57 sh 'echo \'build*\' > .dockerignore'
58
59 // override meta-updater commit with currently tested branch
60 sh '''
61 META_UPDATER_COMMIT=$(git rev-parse HEAD)
62 cd updater-repo/meta-updater
63 git checkout $META_UPDATER_COMMIT
64 '''
65 }
66 }
67 stage('build-core-image-minimal+oe-selftest') {
68 agent {
69 dockerfile {
70 filename 'scripts/ci/Dockerfile.bitbake'
71 args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common'
72 additionalBuildArgs "--build-arg uid=${JENKINS_UID} --build-arg gid=${JENKINS_GID}"
73 reuseNode true
74 }
75 }
76 environment {
77 TEST_AKTUALIZR_CREDENTIALS = credentials('garage-credentials')
78 }
79 steps {
80 sh 'scripts/ci/configure.sh'
81
82 sh 'scripts/ci/build.sh core-image-minimal'
83
84 sh 'scripts/ci/oe-selftest.sh'
85 }
86 }
87 }
88}
89// vim: set ft=groovy tabstop=2 shiftwidth=2 expandtab:
diff --git a/scripts/ci/configure.sh b/scripts/ci/configure.sh
index 1e87a7b..960a0cc 100755
--- a/scripts/ci/configure.sh
+++ b/scripts/ci/configure.sh
@@ -6,27 +6,30 @@ set -x
6TEST_MACHINE=${TEST_MACHINE:-qemux86-64} 6TEST_MACHINE=${TEST_MACHINE:-qemux86-64}
7TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} 7TEST_BUILD_DIR=${TEST_BUILD_DIR:-build}
8TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} 8TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo}
9TEST_BITBAKE_COMMON_DIR=${TEST_BITBAKE_COMMON_DIR:-}
9 10
10TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} 11TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.}
11TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} 12TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master}
12TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="$TEST_AKTUALIZR_DIR/.git" git rev-parse "$TEST_AKTUALIZR_REMOTE/$TEST_AKTUALIZR_BRANCH")} 13TEST_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:-} 14TEST_AKTUALIZR_CREDENTIALS=${TEST_AKTUALIZR_CREDENTIALS:-}
14 15
15# move existing conf directory to backup, before generating a new one 16# move existing conf directory to backup, before generating a new one
16rm -rf "${TEST_BUILD_DIR}/conf.old" || true 17rm -rf "$TEST_BUILD_DIR/conf.old" || true
17mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true 18mv "$TEST_BUILD_DIR/conf" "$TEST_BUILD_DIR/conf.old" || true
18 19
19( 20(
20set +euo pipefail 21set +euo pipefail
21set +x 22set +x
22echo ">> Running envsetup.sh" 23echo ">> Running envsetup.sh"
23. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" 24. "$TEST_REPO_DIR/meta-updater/scripts/envsetup.sh" "$TEST_MACHINE" "$TEST_BUILD_DIR"
24) 25)
25 26
26set +x 27set +x
27 28
29SITE_CONF="$TEST_BUILD_DIR/conf/site.conf"
30
28echo ">> Set common bitbake config options" 31echo ">> Set common bitbake config options"
29cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf" 32cat << EOF > "$SITE_CONF"
30SANITY_TESTED_DISTROS = "" 33SANITY_TESTED_DISTROS = ""
31SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH" 34SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH"
32IMAGE_FEATURES += "ssh-server-openssh" 35IMAGE_FEATURES += "ssh-server-openssh"
@@ -34,7 +37,7 @@ IMAGE_FEATURES += "ssh-server-openssh"
34EOF 37EOF
35 38
36echo ">> Set aktualizr branch in bitbake's config" 39echo ">> Set aktualizr branch in bitbake's config"
37cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf" 40cat << EOF >> "$SITE_CONF"
38SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV" 41SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV"
39SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}" 42SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}"
40BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH" 43BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH"
@@ -42,12 +45,20 @@ BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}"
42 45
43EOF 46EOF
44 47
48if [[ -n $TEST_AKTUALIZR_CREDENTIALS ]]; then
49 echo ">> Set aktualizr credentials"
50 cat << EOF >> "$SITE_CONF"
51SOTA_PACKED_CREDENTIALS = "$TEST_AKTUALIZR_CREDENTIALS"
52EOF
53fi
54
45if [[ -n $TEST_BITBAKE_COMMON_DIR ]]; then 55if [[ -n $TEST_BITBAKE_COMMON_DIR ]]; then
46 echo ">> Set caching" 56 echo ">> Set caching"
47 SSTATE_DIR="$TEST_BITBAKE_COMMON_DIR/sstate-cache" 57 SSTATE_DIR="$TEST_BITBAKE_COMMON_DIR/sstate-cache"
48 DL_DIR="$TEST_BITBAKE_COMMON_DIR/downloads" 58 DL_DIR="$TEST_BITBAKE_COMMON_DIR/downloads"
49 mkdir -p "$SSTATE_DIR" "$DL_DIR" 59 mkdir -p "$SSTATE_DIR" "$DL_DIR"
50 cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf" 60
61 cat << EOF >> "$SITE_CONF"
51SSTATE_DIR = "$SSTATE_DIR" 62SSTATE_DIR = "$SSTATE_DIR"
52DL_DIR = "$DL_DIR" 63DL_DIR = "$DL_DIR"
53EOF 64EOF
diff --git a/scripts/ci/oe-selftest.sh b/scripts/ci/oe-selftest.sh
new file mode 100755
index 0000000..3124cce
--- /dev/null
+++ b/scripts/ci/oe-selftest.sh
@@ -0,0 +1,18 @@
1#!/bin/bash
2
3# run meta-updater's oe-selftests
4
5set -euo pipefail
6set -x
7
8TEST_MACHINE=${TEST_MACHINE:-qemux86-64}
9TEST_BUILD_DIR=${TEST_BUILD_DIR:-build}
10TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo}
11
12(
13set +euo pipefail
14set +x
15. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}"
16
17oe-selftest -r updater
18)