summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlbonn <lbonn@users.noreply.github.com>2018-06-27 16:01:51 +0200
committerGitHub <noreply@github.com>2018-06-27 16:01:51 +0200
commitb08439c2756ee1cc4020d92ce0abf087e64e94ef (patch)
treefd22981b32d615e881f6ed495cfd8df1510b372a
parent81bdec797138ce2cdcfcea666caa5e64c8e4feb6 (diff)
parentea7cf6a4a8cc4dcd04dac6fcdd6faf606f56e115 (diff)
downloadmeta-updater-b08439c2756ee1cc4020d92ce0abf087e64e94ef.tar.gz
Merge pull request #348 from advancedtelematic/ci/dockerize
Ci/dockerize
-rw-r--r--scripts/ci/Dockerfile.bitbake36
-rw-r--r--scripts/ci/Jenkinsfile.bleeding (renamed from scripts/ci/Jenkinsfile)41
-rw-r--r--scripts/ci/README.adoc14
-rwxr-xr-xscripts/ci/configure.sh41
-rw-r--r--scripts/ci/local.conf.append5
5 files changed, 108 insertions, 29 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 b/scripts/ci/Jenkinsfile.bleeding
index 83bd49c..6d0f1e7 100644
--- a/scripts/ci/Jenkinsfile
+++ b/scripts/ci/Jenkinsfile.bleeding
@@ -1,24 +1,31 @@
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
1pipeline { 4pipeline {
2 agent none 5 agent none
3 environment { 6 environment {
4 TEST_LOCAL_CONF_APPEND = 'scripts/ci/local.conf.append' 7 TEST_AKTUALIZR_REMOTE = 'aktualizr'
5 TEST_AKTUALIZR_DIR = 'aktualizr' 8 TEST_AKTUALIZR_DIR = 'aktualizr'
6 TEST_AKTUALIZR_BRANCH = 'origin/master' 9 TEST_AKTUALIZR_BRANCH = 'master'
10 TEST_BITBAKE_COMMON_DIR = "/opt/jenkins/bitbake-common"
7 } 11 }
8 stages { 12 stages {
9 stage('checkout') { 13 stage('checkout') {
10 agent { 14 agent any
11 label 'bitbake'
12 }
13 steps { 15 steps {
14 dir('aktualizr') { 16 checkout([$class: 'GitSCM',
15 checkout([$class: 'GitSCM', 17 userRemoteConfigs: [
16 userRemoteConfigs: [[url: 'https://github.com/advancedtelematic/aktualizr']], 18 [url: 'https://github.com/advancedtelematic/aktualizr', name: 'aktualizr']
17 branches: [[name: '*/master']], 19 ],
18 changelog: true, 20 branches: [[name: 'refs/heads/master']],
19 poll: true, 21 extensions: [
20 ]) 22 [$class: 'DisableRemotePoll'],
21 } 23 [$class: 'PruneStaleBranch'],
24 [$class: 'RelativeTargetDirectory',
25 relativeTargetDir: 'aktualizr'
26 ]
27 ],
28 ])
22 29
23 checkout([$class: 'RepoScm', 30 checkout([$class: 'RepoScm',
24 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo', 31 manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo',
@@ -38,6 +45,9 @@ pipeline {
38 showAllChanges: false, 45 showAllChanges: false,
39 ]) 46 ])
40 47
48 // ignore bitbake build directories in docker
49 sh 'echo \'build*\' > .dockerignore'
50
41 // override meta-updater commit with currently tested branch 51 // override meta-updater commit with currently tested branch
42 sh ''' 52 sh '''
43 META_UPDATER_COMMIT=$(git rev-parse HEAD) 53 META_UPDATER_COMMIT=$(git rev-parse HEAD)
@@ -48,7 +58,10 @@ pipeline {
48 } 58 }
49 stage('build-core-image-minimal') { 59 stage('build-core-image-minimal') {
50 agent { 60 agent {
51 label 'bitbake' 61 dockerfile {
62 filename 'scripts/ci/Dockerfile.bitbake'
63 args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common'
64 }
52 } 65 }
53 steps { 66 steps {
54 sh 'scripts/ci/configure.sh' 67 sh 'scripts/ci/configure.sh'
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/configure.sh b/scripts/ci/configure.sh
index 36ed059..1e87a7b 100755
--- a/scripts/ci/configure.sh
+++ b/scripts/ci/configure.sh
@@ -8,11 +8,11 @@ TEST_BUILD_DIR=${TEST_BUILD_DIR:-build}
8TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} 8TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo}
9 9
10TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} 10TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.}
11TEST_LOCAL_CONF_APPEND=${TEST_LOCAL_CONF_APPEND:-}
12TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} 11TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master}
13TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="${TEST_AKTUALIZR_DIR}/.git" git rev-parse "${TEST_AKTUALIZR_BRANCH}")} 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 14
15# remove existing local.conf, keep 15# move existing conf directory to backup, before generating a new one
16rm -rf "${TEST_BUILD_DIR}/conf.old" || true 16rm -rf "${TEST_BUILD_DIR}/conf.old" || true
17mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true 17mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true
18 18
@@ -23,11 +23,32 @@ echo ">> Running envsetup.sh"
23. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" 23. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}"
24) 24)
25 25
26if [[ -n $TEST_LOCAL_CONF_APPEND ]]; then 26set +x
27 echo ">> Appending to local.conf" 27
28 REMOTE_AKTUALIZR_BRANCH=$(sed 's#^[^/]*/##g' <<< "$TEST_AKTUALIZR_BRANCH") 28echo ">> Set common bitbake config options"
29 cat "$TEST_LOCAL_CONF_APPEND" | \ 29cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf"
30 sed "s/\$<rev-sha1>/$TEST_AKTUALIZR_REV/g" | \ 30SANITY_TESTED_DISTROS = ""
31 sed "s/\$<rev-branch>/$REMOTE_AKTUALIZR_BRANCH/g" \ 31SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH"
32 >> "${TEST_BUILD_DIR}/conf/local.conf" 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
33fi 54fi
diff --git a/scripts/ci/local.conf.append b/scripts/ci/local.conf.append
deleted file mode 100644
index 350e466..0000000
--- a/scripts/ci/local.conf.append
+++ /dev/null
@@ -1,5 +0,0 @@
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}"