diff options
author | lbonn <lbonn@users.noreply.github.com> | 2018-09-07 11:20:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-07 11:20:02 +0200 |
commit | b252a30428b448b610edf59c0c0116a45039e4c8 (patch) | |
tree | 9ca5146bfb805be1c44a7ab7a35c73e51aa40242 /scripts/ci | |
parent | d3e2c58e8655338b33738e495168a82a74e5b86c (diff) | |
parent | 12ee01db91117005b79a9264d8509a2daf86fa80 (diff) | |
download | meta-updater-b252a30428b448b610edf59c0c0116a45039e4c8.tar.gz |
Merge pull request #384 from advancedtelematic/ci/oe-selftest
Ci/oe selftest
Diffstat (limited to 'scripts/ci')
-rw-r--r-- | scripts/ci/Dockerfile.bitbake | 6 | ||||
-rw-r--r-- | scripts/ci/Jenkinsfile.bleeding | 17 | ||||
-rw-r--r-- | scripts/ci/Jenkinsfile.bleeding-selftest | 89 | ||||
-rwxr-xr-x | scripts/ci/configure.sh | 25 | ||||
-rwxr-xr-x | scripts/ci/oe-selftest.sh | 18 |
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 | ||
34 | ARG uid=1000 | ||
35 | ARG gid=1000 | ||
36 | RUN groupadd -g $gid bitbake | ||
37 | RUN useradd -m -u $uid -g $gid bitbake | ||
38 | |||
33 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen | 39 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen |
34 | ENV LC_ALL="en_US.UTF-8" | 40 | ENV LC_ALL="en_US.UTF-8" |
35 | ENV LANG="en_US.UTF-8" | 41 | ENV 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 | ||
5 | node { | ||
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 | |||
4 | pipeline { | 12 | pipeline { |
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 | ||
5 | node { | ||
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 | |||
12 | pipeline { | ||
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 | |||
6 | TEST_MACHINE=${TEST_MACHINE:-qemux86-64} | 6 | TEST_MACHINE=${TEST_MACHINE:-qemux86-64} |
7 | TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} | 7 | TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} |
8 | TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} | 8 | TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} |
9 | TEST_BITBAKE_COMMON_DIR=${TEST_BITBAKE_COMMON_DIR:-} | ||
9 | 10 | ||
10 | TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} | 11 | TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} |
11 | TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} | 12 | TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} |
12 | TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="$TEST_AKTUALIZR_DIR/.git" git rev-parse "$TEST_AKTUALIZR_REMOTE/$TEST_AKTUALIZR_BRANCH")} | 13 | TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="$TEST_AKTUALIZR_DIR/.git" git rev-parse "$TEST_AKTUALIZR_REMOTE/$TEST_AKTUALIZR_BRANCH")} |
13 | TEST_BITBAKE_COMMON_DIR=${TEST_BITBAKE_COMMON_DIR:-} | 14 | TEST_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 |
16 | rm -rf "${TEST_BUILD_DIR}/conf.old" || true | 17 | rm -rf "$TEST_BUILD_DIR/conf.old" || true |
17 | mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true | 18 | mv "$TEST_BUILD_DIR/conf" "$TEST_BUILD_DIR/conf.old" || true |
18 | 19 | ||
19 | ( | 20 | ( |
20 | set +euo pipefail | 21 | set +euo pipefail |
21 | set +x | 22 | set +x |
22 | echo ">> Running envsetup.sh" | 23 | echo ">> 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 | ||
26 | set +x | 27 | set +x |
27 | 28 | ||
29 | SITE_CONF="$TEST_BUILD_DIR/conf/site.conf" | ||
30 | |||
28 | echo ">> Set common bitbake config options" | 31 | echo ">> Set common bitbake config options" |
29 | cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf" | 32 | cat << EOF > "$SITE_CONF" |
30 | SANITY_TESTED_DISTROS = "" | 33 | SANITY_TESTED_DISTROS = "" |
31 | SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH" | 34 | SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH" |
32 | IMAGE_FEATURES += "ssh-server-openssh" | 35 | IMAGE_FEATURES += "ssh-server-openssh" |
@@ -34,7 +37,7 @@ IMAGE_FEATURES += "ssh-server-openssh" | |||
34 | EOF | 37 | EOF |
35 | 38 | ||
36 | echo ">> Set aktualizr branch in bitbake's config" | 39 | echo ">> Set aktualizr branch in bitbake's config" |
37 | cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf" | 40 | cat << EOF >> "$SITE_CONF" |
38 | SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV" | 41 | SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV" |
39 | SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}" | 42 | SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}" |
40 | BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH" | 43 | BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH" |
@@ -42,12 +45,20 @@ BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}" | |||
42 | 45 | ||
43 | EOF | 46 | EOF |
44 | 47 | ||
48 | if [[ -n $TEST_AKTUALIZR_CREDENTIALS ]]; then | ||
49 | echo ">> Set aktualizr credentials" | ||
50 | cat << EOF >> "$SITE_CONF" | ||
51 | SOTA_PACKED_CREDENTIALS = "$TEST_AKTUALIZR_CREDENTIALS" | ||
52 | EOF | ||
53 | fi | ||
54 | |||
45 | if [[ -n $TEST_BITBAKE_COMMON_DIR ]]; then | 55 | if [[ -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" | ||
51 | SSTATE_DIR = "$SSTATE_DIR" | 62 | SSTATE_DIR = "$SSTATE_DIR" |
52 | DL_DIR = "$DL_DIR" | 63 | DL_DIR = "$DL_DIR" |
53 | EOF | 64 | EOF |
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 | |||
5 | set -euo pipefail | ||
6 | set -x | ||
7 | |||
8 | TEST_MACHINE=${TEST_MACHINE:-qemux86-64} | ||
9 | TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} | ||
10 | TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} | ||
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 | oe-selftest -r updater | ||
18 | ) | ||