diff options
author | Laurent Bonnans <laurent.bonnans@here.com> | 2018-06-22 15:09:57 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2018-06-25 14:07:17 +0200 |
commit | a3c960df21c5f820cd7aa592a449be667f65cf86 (patch) | |
tree | 18e167f0665ea3898dd3474b36fb0257396ba07b /scripts | |
parent | d25358cf0127f769c6d2b3b73b1a50acae78cee9 (diff) | |
download | meta-updater-a3c960df21c5f820cd7aa592a449be667f65cf86.tar.gz |
Add caching to CI bitbaking
Also fix various issues with environment variables and file transfers to
Docker
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/ci/Jenkinsfile | 9 | ||||
-rwxr-xr-x | scripts/ci/configure.sh | 25 |
2 files changed, 30 insertions, 4 deletions
diff --git a/scripts/ci/Jenkinsfile b/scripts/ci/Jenkinsfile index 84eebca..803664f 100644 --- a/scripts/ci/Jenkinsfile +++ b/scripts/ci/Jenkinsfile | |||
@@ -1,9 +1,10 @@ | |||
1 | pipeline { | 1 | pipeline { |
2 | agent none | 2 | agent none |
3 | environment { | 3 | environment { |
4 | TEST_AKTUALIZR_REMOTE = 'aktualizr' | ||
4 | TEST_AKTUALIZR_DIR = 'aktualizr' | 5 | TEST_AKTUALIZR_DIR = 'aktualizr' |
5 | TEST_AKTUALIZR_BRANCH = 'aktualizr/master' | 6 | TEST_AKTUALIZR_BRANCH = 'master' |
6 | TEST_BITBAKE_COMMON_DIR = "${env.HOME}/bitbake-common" | 7 | TEST_BITBAKE_COMMON_DIR = "/opt/jenkins/bitbake-common" |
7 | } | 8 | } |
8 | stages { | 9 | stages { |
9 | stage('checkout') { | 10 | stage('checkout') { |
@@ -41,6 +42,9 @@ pipeline { | |||
41 | showAllChanges: false, | 42 | showAllChanges: false, |
42 | ]) | 43 | ]) |
43 | 44 | ||
45 | // ignore bitbake build directories in docker | ||
46 | sh 'echo \'build*\' > .dockerignore' | ||
47 | |||
44 | // override meta-updater commit with currently tested branch | 48 | // override meta-updater commit with currently tested branch |
45 | sh ''' | 49 | sh ''' |
46 | META_UPDATER_COMMIT=$(git rev-parse HEAD) | 50 | META_UPDATER_COMMIT=$(git rev-parse HEAD) |
@@ -53,6 +57,7 @@ pipeline { | |||
53 | agent { | 57 | agent { |
54 | dockerfile { | 58 | dockerfile { |
55 | filename 'scripts/ci/Dockerfile.bitbake' | 59 | filename 'scripts/ci/Dockerfile.bitbake' |
60 | args '-v /opt/jenkins/bitbake-common:/opt/jenkins/bitbake-common' | ||
56 | } | 61 | } |
57 | } | 62 | } |
58 | steps { | 63 | steps { |
diff --git a/scripts/ci/configure.sh b/scripts/ci/configure.sh index cf42825..1e87a7b 100755 --- a/scripts/ci/configure.sh +++ b/scripts/ci/configure.sh | |||
@@ -9,7 +9,8 @@ TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} | |||
9 | 9 | ||
10 | TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} | 10 | TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} |
11 | TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} | 11 | 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_BRANCH}")} | 12 | 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:-} | ||
13 | 14 | ||
14 | # move existing conf directory to backup, before generating a new one | 15 | # move existing conf directory to backup, before generating a new one |
15 | rm -rf "${TEST_BUILD_DIR}/conf.old" || true | 16 | rm -rf "${TEST_BUILD_DIR}/conf.old" || true |
@@ -22,12 +23,32 @@ echo ">> Running envsetup.sh" | |||
22 | . "${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}" |
23 | ) | 24 | ) |
24 | 25 | ||
25 | echo ">> Set aktualizr branch in bitbake's config" | 26 | set +x |
26 | 27 | ||
28 | echo ">> Set common bitbake config options" | ||
27 | cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf" | 29 | cat << EOF > "${TEST_BUILD_DIR}/conf/site.conf" |
28 | SANITY_TESTED_DISTROS = "" | 30 | SANITY_TESTED_DISTROS = "" |
31 | SSTATE_MIRRORS ?= "file://.* https://bitbake-cache.atsgarage.com/PATH;downloadfilename=PATH" | ||
32 | IMAGE_FEATURES += "ssh-server-openssh" | ||
33 | |||
34 | EOF | ||
35 | |||
36 | echo ">> Set aktualizr branch in bitbake's config" | ||
37 | cat << EOF >> "${TEST_BUILD_DIR}/conf/site.conf" | ||
29 | SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV" | 38 | SRCREV_pn-aktualizr = "$TEST_AKTUALIZR_REV" |
30 | SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}" | 39 | SRCREV_pn-aktualizr-native = "\${SRCREV_pn-aktualizr}" |
31 | BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH" | 40 | BRANCH_pn-aktualizr = "$TEST_AKTUALIZR_BRANCH" |
32 | BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}" | 41 | BRANCH_pn-aktualizr-native = "\${BRANCH_pn-aktualizr}" |
42 | |||
43 | EOF | ||
44 | |||
45 | if [[ -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" | ||
51 | SSTATE_DIR = "$SSTATE_DIR" | ||
52 | DL_DIR = "$DL_DIR" | ||
33 | EOF | 53 | EOF |
54 | fi | ||