- job: name: khilman-kbuilder project-type: matrix defaults: global logrotate: daysToKeep: 7 numToKeep: 30 parameters: - string: name: ARCH_LIST default: 'arm' - string: name: DEFCONFIG_LIST default: 'defconfig' - string: name: TREE default: 'git://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 kevin.hilman@linaro.org: - job-read - job-extended-read - job-build - job-cancel - 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 builders: - shell: | #!/bin/bash set -x # local copy of build scripts if [ ! -d local ]; then mkdir -p local (cd local; git clone --depth=1 git://git.linaro.org/people/khilman/build-scripts.git) fi (cd local/build-scripts; git pull) export PATH=${WORKSPACE}/local/build-scripts:${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}; git fetch --tags linus; git fetch --tags ${TREE} ${REFSPEC}) else git clone -o linus --reference ${MIRROR} git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ${TREE_NAME} (cd ${TREE_NAME}; git remote add origin ${TREE}; 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 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} build.py -i -c ${defconfig_translated} 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 set -x if [ $PUBLISH != true ]; then exit 0 fi if [ -e ${TREE_NAME}/_install_/${GIT_DESCRIBE} ]; then RC=1 while [[ RC -ne 0 ]] do (set -x; rsync -avz --timeout=120 ${TREE_NAME}/_install_/${GIT_DESCRIBE} storage.armcloud.us:/var/www/images/kernel-ci/${TREE_NAME}) RC=$? done else echo "WARNING: ${TREE_NAME}/_install_/${GIT_DESCRIBE} doesn't exist" fi exit 0 - 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: | def build_number = manager.build.getEnvVars()['BUILD_NUMBER'] def tree_name = manager.build.getEnvVars()['TREE_NAME'] def branch = manager.build.getEnvVars()["BRANCH"] def description = manager.build.getEnvVars()['GIT_DESCRIBE'] def arch = manager.build.getEnvVars()['ARCH_LIST'] def publish = manager.build.getEnvVars()['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 + ", 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: khilman-kernel-build-complete property-file: ${TREE_NAME}/env.properties condition: ALWAYS predefined-parameters: | PUBLISH=${PUBLISH} SUBMIT_TO_LAVA=${SUBMIT_TO_LAVA} TREE_NAME=${TREE_NAME} ARCH_LIST=${ARCH_LIST}