summaryrefslogtreecommitdiffstats
path: root/scripts/ci
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ci')
-rw-r--r--scripts/ci/Dockerfile.bitbake36
-rw-r--r--scripts/ci/Jenkinsfile.bleeding74
-rw-r--r--scripts/ci/README.adoc14
-rwxr-xr-xscripts/ci/build.sh18
-rwxr-xr-xscripts/ci/configure.sh54
5 files changed, 196 insertions, 0 deletions
diff --git a/scripts/ci/Dockerfile.bitbake b/scripts/ci/Dockerfile.bitbake
new file mode 100644
index 0000000..4dfafec
--- /dev/null
+++ b/scripts/ci/Dockerfile.bitbake
@@ -0,0 +1,36 @@
1FROM debian:stable
2LABEL Description="Image for bitbaking"
3
4RUN sed -i 's#deb http://deb.debian.org/debian stable main#deb http://deb.debian.org/debian stable main contrib#g' /etc/apt/sources.list
5RUN sed -i 's#deb http://deb.debian.org/debian stable-updates main#deb http://deb.debian.org/debian stable-updates main contrib#g' /etc/apt/sources.list
6RUN apt-get update -q && apt-get install -qy \
7 build-essential \
8 bzip2 \
9 chrpath \
10 cpio \
11 default-jre \
12 diffstat \
13 gawk \
14 gcc-multilib \
15 git-core \
16 iputils-ping \
17 iproute \
18 libpython-dev \
19 libsdl1.2-dev \
20 locales \
21 procps \
22 python \
23 python3 \
24 python3-pexpect \
25 qemu \
26 socat \
27 texinfo \
28 unzip \
29 wget \
30 xterm \
31 xz-utils
32
33RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
34ENV LC_ALL="en_US.UTF-8"
35ENV LANG="en_US.UTF-8"
36ENV LANGUAGE="en_US.UTF-8"
diff --git a/scripts/ci/Jenkinsfile.bleeding b/scripts/ci/Jenkinsfile.bleeding
new file mode 100644
index 0000000..6d0f1e7
--- /dev/null
+++ b/scripts/ci/Jenkinsfile.bleeding
@@ -0,0 +1,74 @@
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
4pipeline {
5 agent none
6 environment {
7 TEST_AKTUALIZR_REMOTE = 'aktualizr'
8 TEST_AKTUALIZR_DIR = 'aktualizr'
9 TEST_AKTUALIZR_BRANCH = 'master'
10 TEST_BITBAKE_COMMON_DIR = "/opt/jenkins/bitbake-common"
11 }
12 stages {
13 stage('checkout') {
14 agent any
15 steps {
16 checkout([$class: 'GitSCM',
17 userRemoteConfigs: [
18 [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr']
19 ],
20 branches: [[name: 'refs/heads/master']],
21 extensions: [
22 [$class: 'DisableRemotePoll'],
23 [$class: 'PruneStaleBranch'],
24 [$class: 'RelativeTargetDirectory',
25 relativeTargetDir: 'aktualizr'
26 ]
27 ],
28 ])
29
30 checkout([$class: 'RepoScm',
31 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo',
32 manifestBranch: null,
33 manifestFile: 'master.xml',
34 manifestGroup: null,
35 mirrorDir: null,
36 jobs: 0,
37 depth: 0,
38 localManifest: null,
39 destinationDir: 'updater-repo',
40 repoUrl: null,
41 currentBranch: false,
42 resetFirst: true,
43 quiet: false,
44 trace: false,
45 showAllChanges: false,
46 ])
47
48 // ignore bitbake build directories in docker
49 sh 'echo \'build*\' > .dockerignore'
50
51 // override meta-updater commit with currently tested branch
52 sh '''
53 META_UPDATER_COMMIT=$(git rev-parse HEAD)
54 cd updater-repo/meta-updater
55 git checkout $META_UPDATER_COMMIT
56 '''
57 }
58 }
59 stage('build-core-image-minimal') {
60 agent {
61 dockerfile {
62 filename 'scripts/ci/Dockerfile.bitbake'
63 args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common'
64 }
65 }
66 steps {
67 sh 'scripts/ci/configure.sh'
68
69 sh 'scripts/ci/build.sh core-image-minimal'
70 }
71 }
72 }
73}
74// vim: set ft=groovy tabstop=2 shiftwidth=2 expandtab:
diff --git a/scripts/ci/README.adoc b/scripts/ci/README.adoc
new file mode 100644
index 0000000..222982b
--- /dev/null
+++ b/scripts/ci/README.adoc
@@ -0,0 +1,14 @@
1= Jenkins setup for running meta-updater CI
2
3As bitbake is quite resource-hungry, there are some special steps that are
4needed to run Jenkins CI tasks:
5
6- docker should be installed and the `jenkins` unix user should belong to
7 the `docker` group
8- `/opt/jenkins` should exist and have `jenkins:jenkins` permissions, it
9 will be mapped as a volume on the same location in the docker build
10 container
11
12Note that for nodes running Jenkins slaves as a docker container, the
13`/opt/jenkins` directory must exist on the host system as well, with
14permissions matching the user and groupd ids in Jenkins' docker
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..1e87a7b
--- /dev/null
+++ b/scripts/ci/configure.sh
@@ -0,0 +1,54 @@
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_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_BITBAKE_COMMON_DIR=${TEST_BITBAKE_COMMON_DIR:-}
14
15# move existing conf directory to backup, before generating a new one
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
26set +x
27
28echo ">> Set common bitbake config options"
29cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf"
30SANITY_TESTED_DISTROS = ""
31SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH"
32IMAGE_FEATURES += "ssh-server-openssh"
33
34EOF
35
36echo ">> Set aktualizr branch in bitbake's config"
37cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf"
38SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV"
39SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}"
40BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH"
41BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}"
42
43EOF
44
45if [[ -n $TEST_BITBAKE_COMMON_DIR ]]; then
46 echo ">> Set caching"
47 SSTATE_DIR="$TEST_BITBAKE_COMMON_DIR/sstate-cache"
48 DL_DIR="$TEST_BITBAKE_COMMON_DIR/downloads"
49 mkdir -p "$SSTATE_DIR" "$DL_DIR"
50 cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf"
51SSTATE_DIR = "$SSTATE_DIR"
52DL_DIR = "$DL_DIR"
53EOF
54fi