diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2016-05-18 11:16:07 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2016-05-18 11:16:07 +0200 |
commit | 9d1ef6b9b4cbebedcabdfeff62891f62d66a6512 (patch) | |
tree | 901550c702e1bd1c3dcffc22b48139355a04cd91 /milo-kbuilder.yaml | |
parent | f8c0f4a371417c2f1936d2abbe343e196dc232de (diff) |
milo-kbuilder: Add new job
* Copy khilman-kbuilder job for testing purposes.
Change-Id: Ib7064fa1fa5ab4d0838cf9900af02576aa17742c
Diffstat (limited to 'milo-kbuilder.yaml')
-rw-r--r-- | milo-kbuilder.yaml | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/milo-kbuilder.yaml b/milo-kbuilder.yaml new file mode 100644 index 0000000000..797e577bee --- /dev/null +++ b/milo-kbuilder.yaml @@ -0,0 +1,222 @@ +- job: + name: milo-kbuilder + project-type: matrix + defaults: global + parameters: + - string: + name: ARCH_LIST + default: 'arm' + - string: + name: DEFCONFIG_LIST + default: 'defconfig' + - string: + name: TREE + default: 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git' + - string: + name: BRANCH + default: 'master' + - string: + name: COMMIT_ID + default: '' + - string: + name: TREE_NAME + default: 'mainline' + - bool: + name: PUBLISH + properties: + - authorization: + anonymous: + - job-read + - job-extended-read + khilman@kernel.org: + - job-read + - job-extended-read + - job-build + - job-cancel + milo.casagrande@linaro.org: + - job-read + - job-extended-read + - job-build + - job-cancel + - build-discarder: + days-to-keep: 7 + num-to-keep: 30 + - throttle: + max-total: 6 + option: project + - inject + disabled: false + node: x86_64 + retry-count: 3 + child-workspace: . + display-name: 'khilman - kbuilder' + auth-token: ${AUTH_TOKEN} + axes: + - axis: + type: slave + name: label + values: + - kernel_build_vps + - axis: + type: dynamic + name: arch + values: + - ARCH_LIST + - axis: + type: dynamic + name: defconfig + values: + - DEFCONFIG_LIST + wrappers: + - timestamps + - matrix-tie-parent: + node: x86_64 + - timeout: + timeout: 45 + builders: + - shell: | + #!/bin/bash + + set -x + + # local copy of build scripts + if [ ! -d local ]; then + mkdir -p local + (cd local; git clone --depth=1 https://github.com/MiloCasagrande/kernelci-build.git) + fi + + (cd local/kernelci-build; git pull) + export PATH=${WORKSPACE}/local/kernelci-build:${PATH} + + # Ensure TREE URL is decoded + TREE=`python -c "import urllib, sys; print urllib.unquote(sys.argv[1])" ${TREE}` + BRANCH=`python -c "import urllib, sys; print urllib.unquote(sys.argv[1])" ${BRANCH}` + + # + # Kernel tree -- clone Linus' tree and add ${TREE} as remote. This takes advantage + # of all the tags in Linus' tree for more useful git-describe output. + # + MIRROR=/srv/mirrors/linux.git + REFSPEC=+refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH} + if [ -e ${TREE_NAME} ]; then + cd ${TREE_NAME} && \ + timeout --preserve-status -k 10s 5m git fetch --tags linus && \ + timeout --preserve-status -k 10s 5m git fetch --tags ${TREE} ${REFSPEC} + else + git clone -o linus --reference ${MIRROR} https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ${TREE_NAME} + cd ${TREE_NAME} && \ + git remote add origin ${TREE} && \ + timeout --preserve-status -k 10s 5m git fetch origin + # (cd ${TREE_NAME}; git remote add origin ${TREE}; git fetch origin ${REFSPEC}) + fi + if [ $? != 0 ]; then + exit 1 + fi + + cd ${TREE_NAME} + #rm -rf _install_ + git clean -df + timeout --preserve-status -k 10s 5m git fetch origin ${REFSPEC} + if [ $? != 0 ]; then + exit 1 + fi + if [ -z ${COMMIT_ID} ]; then + git checkout -f origin/${BRANCH} + else + git checkout -f origin/${BRANCH} + git branch -D local/${BRANCH} + git checkout -b local/${BRANCH} -f ${COMMIT_ID} + fi + if [ $? != 0 ]; then + exit 1 + fi + + # Ensure abbrev SHA1s are 12 chars + git config --global core.abbrev 12 + + # Only use v3.x tags in arm-soc tree + unset describe_args + [ ${TREE_NAME} = "arm-soc" ] && describe_args="--match=v\*" + GIT_DESCRIBE=$(eval git describe $describe_args) + GIT_DESCRIBE=${GIT_DESCRIBE//\//_} # replace any '/' with '_' + echo GIT_DESCRIBE=${GIT_DESCRIBE} > env.properties + export GIT_DESCRIBE # so it overrides default done by build.py + + #export CCACHE_DISABLE=true + + # Convert defconfig of form "foo+bar" into "foo -c bar" + defconfig_translated=`echo ${defconfig} | sed 's/\+/ \-c /g'` + + # Build kernel/modules and install (default: ./_install_ dir) + export LANG=C + export ARCH=${arch} + if [ $PUBLISH != true ]; then + buildv2.py -i -c ${defconfig_translated} + else + buildv2.py -i -p production -c ${defconfig_translated} + fi + RC=$? + + # Remove the build output (important stuff in _install_ dir) + rm -rf build + + echo "Kernel build result: ${RC}" + echo ${RC} > build.result + + # Always return success here so pass/fail results can still be published + exit 0 + - inject: + properties-file: ${TREE_NAME}/env.properties + + - shell: | + #!/bin/bash + # + # This script determines overall result of jenkins job + # + exit `cat ${TREE_NAME}/build.result` + + BUILD_DIR=${TREE_NAME}/_install_/${GIT_DESCRIBE}/${arch}-${defconfig} + BUILD_META=${BUILD_DIR}/build.meta + + grep build_result: ${BUILD_META} |grep -cq PASS + RC=$? + + exit $RC + publishers: + - groovy-postbuild: + script: | + def build_number = manager.build.getEnvironment(manager.listener)['BUILD_NUMBER'] + def tree_name = manager.build.getEnvironment(manager.listener)['TREE_NAME'] + def branch = manager.build.getEnvironment(manager.listener)["BRANCH"] + def description = manager.build.getEnvironment(manager.listener)['GIT_DESCRIBE'] + def arch = manager.build.getEnvironment(manager.listener)['ARCH_LIST'] + def publish = manager.build.getEnvironment(manager.listener)['PUBLISH'] + def resultsUrl="http://status.armcloud.us/build/${tree_name}/kernel/${description}/" + + def jobDescription = " ARCH: ${arch}" + // FIXME: resultsURL is only valid when PUBLISH = "true" + jobDescription = jobDescription + ", <a href='${resultsUrl}'>Results db</a>" + + manager.build.setDisplayName("#" + build_number + "-" + tree_name + '/' + branch + "-" + description) + manager.build.setDescription(jobDescription) + + def cause = manager.build.getAction(hudson.model.CauseAction.class).getCauses() + def upstreamBuild = cause[0].upstreamBuild + def upstreamProject = cause[0].upstreamProject + def jobName = upstreamProject + def jobConfiguration = upstreamProject + + // Multi-configuration project + if (upstreamProject.contains("/")) { + jobName = upstreamProject.split("/")[0] + jobConfiguration = upstreamProject.split("/")[1] + } + + def jobs = hudson.model.Hudson.instance.getItem(jobName).getAllJobs() + + for (job in jobs) { + if(job.name == jobConfiguration) { + job.getLastBuild().setDisplayName("#" + build_number + "-" + tree_name + '/' + branch + "-" + description) + job.getLastBuild().setDescription(jobDescription) + } + } |