From 28c962f68c15fec433f711018ee1303833b102c7 Mon Sep 17 00:00:00 2001 From: Martyn Welch <martyn.welch@collabora.com> Date: Tue, 5 Mar 2019 09:31:23 +0000 Subject: [PATCH] Include SABRE Lite U-Boot installer script in the Jenkinsfile Signed-off-by: Martyn Welch <martyn.welch@collabora.com> --- Jenkinsfile | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f462396f..d23a1554 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -125,6 +125,8 @@ def architectures = [ ] ] +def installerTargets = [ 'mx6qsabrelite-uboot' ] + properties([ parameters([ string(name: 'buildOnly', defaultValue: '', description: 'If set, only the selected images are built. Comma and slash separated, e.g. armhf/minimal, amd64/target', trim: true), @@ -390,6 +392,65 @@ def buildSysroot(architecture, type, debosarguments = "") { } } +def buildInstallers(installerTargets) { + return { + node("docker-slave") { + checkout scm + docker.withRegistry("https://${docker_registry_name}") { + buildenv = docker.image(docker_image_name) + /* Pull explicitly to ensure we have the latest */ + buildenv.pull() + + buildenv.inside("--device=/dev/kvm") { + stage("setup installers") { + env.PIPELINE_VERSION = VersionNumber(versionNumberString: '${BUILD_DATE_FORMATTED,"yyyyMMdd"}.${BUILDS_TODAY_Z}') + sh ("env ; mkdir -p ${PIPELINE_VERSION}/installer") + } + + def buildStatus = [:] + + try { + for(String target: installerTargets) { + try { + stage("${target} installer image") { + sh(script: """ + mkdir -p ${PIPELINE_VERSION}/installer/${target} + cd ${PIPELINE_VERSION}/installer/${target} + debos --show-boot \ + -t suite:${release} \ + ${WORKSPACE}/${target}-installer.yaml""") + } + buildStatus["installer-${target}"] = true + } catch (e) { + // If image build failed -- do not fail other types but do not need to start tests for it + buildStatus["installer-${target}"] = false + } + } + + // Mark the whole pipeline as failed in case of failure at any stage + if (buildStatus.containsValue(false)) { + currentBuild.result = 'FAILURE' + // mark builds where some artifacts have failed to build + dir ("${env.PIPELINE_VERSION}/meta/") { + writeFile (file: "failed-installers", text: '') + } + } + + // Upload artifacts + stage("installers upload") { + uploadDirectory (env.PIPELINE_VERSION, "installers/${release}") + } + } finally { + stage("Cleanup installers") { + deleteDir() + } + } + } + } + } + } +} + /** * Build OSPack for architecture and start a parallel build of artifacts related @@ -554,6 +615,18 @@ buildCandidates.each { name, arch -> } } +/* Add installer */ +if (buildOnlyList) { + if (buildOnlyList.containsKey('installers')) { + first_pass << [("installers"): + buildInstallers(installerTargets) + ] + } +} else { + first_pass << [("installers"): + buildInstallers(installerTargets) + ] +} parallel first_pass parallel second_pass -- GitLab