From 855b031e7597b0c16b2bd9f4c18321b6320c8ffe Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Tue, 12 Jun 2018 14:48:48 +0200 Subject: Bitbake build from Jenkins --- scripts/ci/Jenkinsfile | 29 +++++++++++++++++++++++++++-- scripts/ci/build.sh | 18 ++++++++++++++++++ scripts/ci/configure.sh | 33 +++++++++++++++++++++++++++++++++ scripts/ci/local.conf.append | 5 +++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100755 scripts/ci/build.sh create mode 100755 scripts/ci/configure.sh create mode 100644 scripts/ci/local.conf.append (limited to 'scripts') diff --git a/scripts/ci/Jenkinsfile b/scripts/ci/Jenkinsfile index 0b4afa9..e7bcf6c 100644 --- a/scripts/ci/Jenkinsfile +++ b/scripts/ci/Jenkinsfile @@ -1,12 +1,20 @@ pipeline { - agent any + agent none + environment { + TEST_LOCAL_CONF_APPEND = 'scripts/ci/local.conf.append' + TEST_AKTUALIZR_DIR = '.' + TEST_AKTUALIZR_BRANCH = 'aktualizr/master' + } stages { stage('checkout') { + agent { + label 'bitbake' + } steps { checkout([$class: 'RepoScm', manifestRepositoryUrl: 'https://github.com/advancedtelematic/updater-repo', manifestBranch: null, - manifestFile: null, + manifestFile: 'master.xml', manifestGroup: null, mirrorDir: null, jobs: 0, @@ -20,6 +28,23 @@ pipeline { trace: false, showAllChanges: false, ]) + + // override meta-updater commit with currently tested branch + sh ''' + META_UPDATER_COMMIT=$(git rev-parse HEAD) + cd updater-repo/meta-updater + git checkout $META_UPDATER_COMMIT + ''' + } + } + stage('build-core-image-minimal') { + agent { + label 'bitbake' + } + steps { + sh 'scripts/ci/configure.sh' + + sh 'scripts/ci/build.sh core-image-minimal' } } } 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 @@ +#!/bin/bash + +set -euo pipefail +set -x + +TEST_MACHINE=${TEST_MACHINE:-qemux86-64} +TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} +TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} + +IMAGE_NAME=${1:-core-image-minimal} + +( +set +euo pipefail +set +x +. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" + +bitbake "${IMAGE_NAME}" +) diff --git a/scripts/ci/configure.sh b/scripts/ci/configure.sh new file mode 100755 index 0000000..36ed059 --- /dev/null +++ b/scripts/ci/configure.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -euo pipefail +set -x + +TEST_MACHINE=${TEST_MACHINE:-qemux86-64} +TEST_BUILD_DIR=${TEST_BUILD_DIR:-build} +TEST_REPO_DIR=${TEST_REPO_DIR:-updater-repo} + +TEST_AKTUALIZR_DIR=${TEST_AKTUALIZR_DIR:-.} +TEST_LOCAL_CONF_APPEND=${TEST_LOCAL_CONF_APPEND:-} +TEST_AKTUALIZR_BRANCH=${TEST_AKTUALIZR_BRANCH:-master} +TEST_AKTUALIZR_REV=${TEST_AKTUALIZR_REV:-$(GIT_DIR="${TEST_AKTUALIZR_DIR}/.git" git rev-parse "${TEST_AKTUALIZR_BRANCH}")} + +# remove existing local.conf, keep +rm -rf "${TEST_BUILD_DIR}/conf.old" || true +mv "${TEST_BUILD_DIR}/conf" "${TEST_BUILD_DIR}/conf.old" || true + +( +set +euo pipefail +set +x +echo ">> Running envsetup.sh" +. "${TEST_REPO_DIR}/meta-updater/scripts/envsetup.sh" "${TEST_MACHINE}" "${TEST_BUILD_DIR}" +) + +if [[ -n $TEST_LOCAL_CONF_APPEND ]]; then + echo ">> Appending to local.conf" + REMOTE_AKTUALIZR_BRANCH=$(sed 's#^[^/]*/##g' <<< "$TEST_AKTUALIZR_BRANCH") + cat "$TEST_LOCAL_CONF_APPEND" | \ + sed "s/\$/$TEST_AKTUALIZR_REV/g" | \ + sed "s/\$/$REMOTE_AKTUALIZR_BRANCH/g" \ + >> "${TEST_BUILD_DIR}/conf/local.conf" +fi diff --git a/scripts/ci/local.conf.append b/scripts/ci/local.conf.append new file mode 100644 index 0000000..350e466 --- /dev/null +++ b/scripts/ci/local.conf.append @@ -0,0 +1,5 @@ +SANITY_TESTED_DISTROS = "" +SRCREV_pn-aktualizr = "$" +SRCREV_pn-aktualizr-native = "${SRCREV_pn-aktualizr}" +BRANCH_pn-aktualizr = "$" +BRANCH_pn-aktualizr-native = "${BRANCH_pn-aktualizr}" -- cgit v1.2.3-54-g00ecf