- 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: 'milo-test' - 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: 3 num-to-keep: 5 - throttle: max-total: 6 option: project - inject disabled: false node: x86_64 retry-count: 3 child-workspace: . display-name: 'milo - 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 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 -q -d -c ${defconfig_translated} else buildv2.py -i -q -d -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` echo "Old build number" echo $PREV_BUILD_NUMBER 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="https://kernelci.org/build/${tree_name}/kernel/${description}/" def jobDescription = " ARCH: ${arch}" // FIXME: resultsURL is only valid when PUBLISH = "true" jobDescription = jobDescription + ", Results db" 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) } } - trigger-parameterized-builds: - project: milo-kernel-build-complete property-file: ${TREE_NAME}/env.properties condition: ALWAYS predefined-parameters: | PUBLISH=${PUBLISH} TREE_NAME=${TREE_NAME} ARCH_LIST=${ARCH_LIST} GIT_DESCRIBE=${GIT_DESCRIBE}