diff options
author | 2017-05-23 14:39:21 +0200 | |
---|---|---|
committer | 2017-05-23 14:39:21 +0200 | |
commit | e5fb35eb200e3476297ba3f0465775a05fb86e86 (patch) | |
tree | 24a37258f0e169c9b9ff973d3e49bc0ace50cf61 | |
parent | 4e4dcbc9464ab69208f528284afff50f10118d2d (diff) |
Add initial job template for application builds within jenkins
This adds the necessary plumbing to build applications for the 3-4 different target architectures
for applications within jenkins as CI builds.
Change-Id: I263c3ba25fa6dbea78d305ff453cca1106724316
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
-rwxr-xr-x | jjb/ci-apps-verify/ci-apps-jjb.local.sh | 5 | ||||
-rw-r--r-- | jjb/ci-apps-verify/ci-apps-jjb.yaml | 551 | ||||
-rw-r--r-- | jjb/common/include-apps-fetch-install-sdk.sh | 49 | ||||
-rw-r--r-- | jjb/common/include-apps-header.sh | 128 |
4 files changed, 733 insertions, 0 deletions
diff --git a/jjb/ci-apps-verify/ci-apps-jjb.local.sh b/jjb/ci-apps-verify/ci-apps-jjb.local.sh new file mode 100755 index 00000000..8c5a74b0 --- /dev/null +++ b/jjb/ci-apps-verify/ci-apps-jjb.local.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -x +. ../common/include-apps-header.sh +. ../common/include-apps-fetch-install-sdk.sh diff --git a/jjb/ci-apps-verify/ci-apps-jjb.yaml b/jjb/ci-apps-verify/ci-apps-jjb.yaml new file mode 100644 index 00000000..03c6b288 --- /dev/null +++ b/jjb/ci-apps-verify/ci-apps-jjb.yaml @@ -0,0 +1,551 @@ +--- +- project: + name: ci-apps-AGL + architecture: + #- aarch64 + #- x86-64 + #- intel-corei7-64 + #- qemux86-64 + - arm + #- porter-nogfx + #- raspberrypi3 + #- dra7xx-evm + project: + - controls +# - dashboard +# - home +# - homescreen +# - hvac +# - low-level-can-service +# - mediaplayer +# - mixer +# - phone +# - radio +# - settings +# - settings-bluetooth +# - settings-wifi + jobs: + - ci-apps-{project}-verify + # - ci-apps-{project}-verify-CIB-start + - ci-apps-{project}-verify-CIB-{architecture} + - ci-apps-{project}-verify-CIB-finish-success + - ci-apps-{project}-verify-failure + # - ci-apps-{project}-verify-CIBT-start + #- ci-apps-{project}-verify-CIBT-{architecture} + #- ci-apps-{project}-verify-CIBT-finish-success + +# +# -verify = trigger from gerrit and control job +# ############################################### + +- job-template: + name: 'ci-apps-{project}-verify' + project-type: multijob + concurrent: true + node: control-slave + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + triggers: + - gerrit-trigger-patch-submitted-manual-verified: + name: 'AGL/{project}' + branch: '**/**/**' + silent: 'true' + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + + builders: + - shell: | + set + export TRIGGERURL=$(echo ${{BUILD_URL}} | sed -e 's,-CIB-start.*,,') + echo \$TRIGGERURL + ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified=0 -n NONE --message="CI-cycle\ started.\ URL:\ ${{BUILD_URL}}" || true + # - multijob: + # name: CIB-{project}-start + # condition: SUCCESSFUL + # projects: + # - name: 'ci-apps-{project}-verify-CIB-start' + # current-parameters: true + # abort-all-job: true + # kill-phase-on: FAILURE + - multijob: + name: CIB-{project} + condition: SUCCESSFUL + projects: + - name: 'ci-apps-{project}-verify-CIB-porter-nogfx' + current-parameters: true + abort-all-job: true + kill-phase-on: FAILURE + - name: 'ci-apps-{project}-verify-CIB-intel-corei7-64' + current-parameters: true + abort-all-job: true + kill-phase-on: FAILURE + - name: 'ci-apps-{project}-verify-CIB-raspberrypi3' + current-parameters: true + abort-all-job: true + kill-phase-on: FAILURE + - name: 'ci-apps-{project}-verify-CIB-dra7xx-evm' + current-parameters: true + abort-all-job: true + kill-phase-on: FAILURE + - name: 'ci-apps-{project}-verify-CIB-qemux86-64' + current-parameters: true + abort-all-job: true + kill-phase-on: FAILURE + - multijob: + name: CIB-{project}-finish-success + condition: SUCCESSFUL + projects: + - name: 'ci-apps-{project}-verify-CIB-finish-success' + current-parameters: true + abort-all-job: true + kill-phase-on: FAILURE + # - multijob: + # name: 'CIBT-{project}-start' + # condition: SUCCESSFUL + # projects: + # - name: 'ci-apps-{project}-verify-CIBT-start' + # current-parameters: true + # abort-all-job: true + # kill-phase-on: FAILURE + #- multijob: +# name: CIBT-{project} +# condition: SUCCESSFUL +# projects: +# - name: 'ci-apps-{project}-verify-CIBT-porter-nogfx' +# current-parameters: true +# abort-all-job: true +# kill-phase-on: FAILURE +# - name: 'ci-apps-{project}-verify-CIBT-intel-corei7-64' +# current-parameters: true +# abort-all-job: true +# kill-phase-on: FAILURE +# - name: 'ci-apps-{project}-verify-CIBT-raspberrypi3' +# current-parameters: true +# abort-all-job: true +# kill-phase-on: FAILURE +# - name: 'ci-apps-{project}-verify-CIBT-dra7xx-evm' +# current-parameters: true +# abort-all-job: true +# kill-phase-on: FAILURE +# - name: 'ci-apps-{project}-verify-CIBT-qemux86-64' +# current-parameters: true +# abort-all-job: true +# kill-phase-on: FAILURE +# - multijob: +# name: 'CIBT-{project}-finish-success' +# condition: SUCCESSFUL +# projects: +# - name: 'ci-apps-{project}-verify-CIBT-finish-success' +# current-parameters: true +# abort-all-job: true +# kill-phase-on: FAILURE + +# publishers: +# - trigger-parameterized-builds: +# - project: +# - ci-apps-{project}-verify-failure +# condition: FAILED +# current-parameters: true + +# +# -verify-failure +# ################### + +- job-template: + name: 'ci-apps-{project}-verify-failure' + project-type: freestyle + concurrent: true + node: control-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + + builders: + - shell: | + set + echo "#### Verified -1 ####" + #ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified -1 -n NONE --message="CI-cycle\ failed.\ URL:\ ${{BUILD_URL}}" || true + ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} -n NONE --message="CI-cycle\ failed.\ URL:\ ${{BUILD_URL}}" || true + +# +# CIB-start (unused) +# ########### + +- job-template: + name: 'ci-apps-{project}-verify-CIB-start' + project-type: freestyle + concurrent: true + node: control-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + - openstack: + single-use: false + + builders: + - shell: | + #set + export TRIGGERURL=$(echo ${{BUILD_URL}} | sed -e 's,-CIB-start.*,,') + # ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified=0 --label ci-image-build=0 --label ci-image-boot-test=0 -n NONE --message="CI-Image-Build\ started.\ URL:\ ${{BUILD_URL}}" || true + ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified=0 -n NONE --message="CI-Image-Build\ started.\ URL:\ \$TRIGGERURL" || true + + +# +# CIB-{architecture} +# ############## + +- job-template: + name: 'ci-apps-{project}-verify-CIB-{architecture}' + project-type: freestyle + concurrent: true + node: agl-test-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + - string: + name: MACHINE + default: '{architecture}' + description: "Machine to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + - openstack: + single-use: true + + builders: + - shell: + # including from ../common into ci-apps-{project}-verify-CIB-{architecture} + !include-raw-escape: + - ../common/include-apps-fetch-install-sdk.sh + - ../common/include-apps-header.sh + + publishers: + - naginator: + rerun-unstable-builds: true + progressive-delay-increment: 5 + progressive-delay-maximum: 15 + max-failed-builds: 2 + #regular-expression: "Unexpected termination of the channel" + + + +# +# CIB-finish-success +# ################### + +- job-template: + name: 'ci-apps-{project}-verify-CIB-finish-success' + project-type: freestyle + concurrent: true + node: control-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + + builders: + - shell: | + set + echo "#### CIB +1 #### Verified +1 ####" + ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified +1 --label ci-image-build=+1 -n NONE --message="CI-Image-Build\ finished,\ CIB+1,\ Verified+1" || true + +# +# CIBT-{architecture} 'BOOT TEST' +# ########################### + +- job-template: + name: 'ci-apps-{project}-verify-CIBT-{architecture}' + project-type: freestyle + concurrent: true + node: hwtest-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + - string: + name: MACHINE + default: '{architecture}' + description: "Machine to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + - openstack: + single-use: false + - credentials-binding: + - username-password-separated: + credential-id: agl_main_lava_instance + username: AGLLAVAUSER + password: AGLLAVATOKEN + + builders: + - shell: + # including from ../common into ci-apps-{project}-verify-CIBT-{architecture} + !include-raw-escape: + - ../common/include-agl-header.sh + - ../common/include-agl-repo.sh + - ../common/include-agl-select.sh + - ../common/include-agl-run-test-prepare.sh + - ../common/include-agl-run-test-short.sh + + publishers: + - naginator: + max-failed-builds: 2 + + +# +# CIBT-start +# ############### + +- job-template: + name: 'ci-apps-{project}-verify-CIBT-start' + project-type: freestyle + concurrent: true + node: control-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + - openstack: + single-use: false + + builders: + - shell: | + echo "CIBT Started" + # set + # ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --label ci-image-boot-test=0 -n NONE --message='CI-Image-Boot-Test\ started' || true + + +# +# CIBT-finish-success +# #################### + +- job-template: + name: 'ci-apps-{project}-verify-CIBT-finish-success' + project-type: freestyle + concurrent: true + node: control-slave + + parameters: + - string: + name: GERRIT_PROJECT + default: 'AGL/{project}' + description: "Project to build" + - string: + name: GERRIT_BRANCH + default: master + description: "branch to build" + - string: + name: GERRIT_REFSPEC + default: refs/heads/master + description: "refspec to build" + - string: + name: GERRIT_CHANGE_NUMBER + default: "8313" + description: "change # to build" + - string: + name: GERRIT_PATCHSET_NUMBER + default: "2" + description: "patchset # to build" + + build-discarder: + days-to-keep: 30 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + - openstack: + single-use: false + + builders: + - shell: | + # set + echo "#### CIBT +1 ####" + ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified +1 --label ci-image-build=+1 --label ci-image-boot-test=+1 -n NONE --message='CI-Image-Boot-Test\ finished' || true diff --git a/jjb/common/include-apps-fetch-install-sdk.sh b/jjb/common/include-apps-fetch-install-sdk.sh new file mode 100644 index 00000000..436c3843 --- /dev/null +++ b/jjb/common/include-apps-fetch-install-sdk.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# (c) 2017 Jan-Simon Moeller dl9pf(at)gmx.de +# License GPLv2 +# +# debugging purposes +set -e + +SDKHOSTDIR="~/agl-sdk" + +################################################################################ +## apps-fetch-install-sdk.sh +################################################################################ + +SDKBASEURL="https://download.automotivelinux.org/AGL/snapshots/master/latest/${TARGETSDKMACHINE}/deploy/sdk/" +export TARGETSDKNAME=$(curl -s "$SDKBASEURL" | grep -e "crosssdk.*\.sh<" | sed -e "s#.*<a href=\"##g" -e "s#\">poky-agl.*##g") + +if test x"" = x"${TARGETSDKNAME}" ; then + echo "Could not retrieve TARGETSDKNAME from download.automotivelinux.org" + echo "Abort." + exit 1 +fi + +if test ! -f ${TARGETSDKNAME} ; then + echo "Downloading $TARGETSDKNAME for $MACHINE" + wget -nd -c "${SDKBASEURL}/${TARGETSDKNAME}" +fi + +chmod a+x ${TARGETSDKNAME} + +eval export TARGETSDKENVSCRIPT="${SDKHOSTDIR}/environment-setup-${TARGETSDKARCH}-agl-linux-gnueabi" + +if test ! -f ${TARGETSDKENVSCRIPT} ; then + bash ${TARGETSDKNAME} -d ${SDKHOSTDIR}/ -y +fi +if test ! -f ${TARGETSDKENVSCRIPT} ; then + echo "Script not there after extracting sdk ?!" + echo "Abort." + exit 1 +fi + +source "${TARGETSDKENVSCRIPT}" + +ls -alh ~/ + +ls + +ls -alh + +set
\ No newline at end of file diff --git a/jjb/common/include-apps-header.sh b/jjb/common/include-apps-header.sh new file mode 100644 index 00000000..7c60b1af --- /dev/null +++ b/jjb/common/include-apps-header.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# (c) 2017 Jan-Simon Moeller dl9pf(at)gmx.de +# License GPLv2 +# +# debugging purposes +set -e + +################################################################################ +## Header +################################################################################ + + +# VARIABLES +OPTIND=1 +#export DLHOST="http://download.automotivelinux.org/" +# DLHOST in auto.conf +export NOGFX=false +export VERBOSE=false +export DEBUG=false +function vprint() { + : +} +function dprint() { + : +} + +#export TARGETARCHALL="arm aarch64 x86-64" + +if test x"" = x"${architecture}"; then + export TARGETARCH="arm" +else + export TARGETARCH="${architecture}" +fi + +# finally cmdline arguments +while getopts ":b:a:p:r:dvx" opt; do + case "$opt" in + b) + export TARGETBRANCH="$OPTARG" + ;; + d) + DEBUG=true + function dprint() { + echo "DEBUG: $@" + } + ;; + p) + export TARGETPROJECT="$OPTARG" + ;; + a) + export TARGETARCH="arm" + ;; + r) + export TARGETREFSPEC="$OPTARG" + ;; + v) + VERBOSE=true + function vprint() { + echo "VERBOSE: \"$@\"" + } + ;; + x) + set -x + ;; + h|\?) + echo "$0 [-h/-?] -bdinpqrvx" + echo "--------------------------------------------------------------------------------" + echo " -b <branch> - name of the branch to use (default=master)" + echo " -d - debug" + echo " -a - arch" + echo " one of:" + echo " -- arm" + echo " -- x86-64" + echo " -- aarch64" + echo " -p <project> - project to use (default=AGL/AGL-repo)" + echo " -r <refspec> - refspec to use (default=refs/heads/master)" + echo " -v - verbose" + echo " -x - set -x" + echo "--------------------------------------------------------------------------------" + echo " GERRIT_PROJECT, GERRIT_BRANCH, GERRIT_REFSPEC are used if present," + echo " but cmdline arguments take precedence." + echo "--------------------------------------------------------------------------------" + exit 1 + ;; + :) + echo "Option -$OPTARG required an argument." + exit 1 + ;; + esac +done + +if test ! -f ~/.gitconfig ; then + git config --global user.email "jenkins-dontreply@build.automotivelinux.org" + git config --global user.name "jenkins-dontreply@build.automotivelinux.org" +fi + +##### map architecture to a machine SDK (until we have generic SDKs) ######### + +if test x"" = x"$TARGETARCH" ; then + echo "No TARGETARCH variable. Exiting." + exit 1 +fi + +case "$TARGETARCH" in + arm) + export TARGETSDKARCH="armv7vehf-neon-vfpv4" + export TARGETSDKMACHINE="raspberrypi3" + ;; + x86-64) + export TARGETSDKARCH="corei7-64" + export TARGETSDKMACHINE="intel-corei7-64" + ;; + aarch64) + export TARGETSDKARCH="aarch64" + export TARGETSDKMACHINE="dragonboard-410c" + ;; +esac + +# failsafe +if test x"" = x"$TARGETSDKARCH" ; then + echo "No TARGETSDKARCH variable. Exiting." + exit 1 +fi +# failsafe +if test x"" = x"$TARGETSDKMACHINE" ; then + echo "No TARGETSDKMACHINE variable. Exiting." + exit 1 +fi |