diff options
author | Aníbal Limón <anibal.limon@linaro.org> | 2018-04-04 15:42:18 -0500 |
---|---|---|
committer | Anibal Limon <anibal.limon@linaro.org> | 2018-04-19 23:02:23 +0000 |
commit | b4dd86f1a66fd563a1cdb91dfeb8b0e8ed31ec1b (patch) | |
tree | 89996ade1debf60ebbeb7fc41efbb8e21d48ea5d /lt-qcom-linux-automerge | |
parent | 1b1082aa468e42036231a76aaa9946838f340456 (diff) |
lt-qcom-linux-automerge: Add buildset to do linux integration automerge
Uses automerge ci tool [1], the configuration could be stored inside
a configuration repository/branch, if not a default one is used only
with baseline.
This job support persistent storage for kernel upstream repository to avoid
clone every time [2].
After merge the kernel integration repo will be build for arm and arm64,
if both builds are succeed then push to a repo that Kernel CI looks for
testing.
For now my github repo [3] is used for automerge while merge process is
made on upstream repo [1].
[1] https://git.linaro.org/power/automerge.git/
[2] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[3] https://github.com/alimon/automerge.git
Change-Id: I4a70845df858aceeeaaecd00cb6101949fc4e5f5
Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
Diffstat (limited to 'lt-qcom-linux-automerge')
-rwxr-xr-x | lt-qcom-linux-automerge/builders.sh | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/lt-qcom-linux-automerge/builders.sh b/lt-qcom-linux-automerge/builders.sh new file mode 100755 index 0000000000..f254d98997 --- /dev/null +++ b/lt-qcom-linux-automerge/builders.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +echo "Starting ${JOB_NAME} with the following parameters:" +echo "AUTOMERGE_REPO_URL: ${AUTOMERGE_REPO_URL}" +echo "AUTOMERGE_BRANCH: ${AUTOMERGE_BRANCH}" +echo "CONFIG_REPO_URL: ${CONFIG_REPO_URL}" +echo "CONFIG_BRANCH: ${CONFIG_BRANCH}" +echo "KERNEL_REPO_URL: ${KERNEL_REPO_URL}" +echo "INTEGRATION_REPO_URL: ${INTEGRATION_REPO_URL}" +echo "INTEGRATION_BRANCH: ${INTEGRATION_BRANCH}" +echo "KERNEL_CI_REPO_URL: ${KERNEL_CI_REPO_URL}" +echo "KERNEL_CI_BRANCH: ${KERNEL_CI_BRANCH}" + +set -ex + +function build_integration_kernel() +{ + export ARCH=$1 + export KERNEL_CONFIGS=$2 + + toolchain_url_arm=http://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz + toolchain_url_arm64=http://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz + toolchain_url=toolchain_url_$ARCH + toolchain_url=${!toolchain_url} + + tcdir=${HOME}/srv/toolchain + tcbindir="${tcdir}/$(basename $toolchain_url .tar.xz)/bin" + + export CROSS_COMPILE="ccache $(basename $(ls -1 ${tcbindir}/*-gcc) gcc)" + export PATH=${tcbindir}:$PATH + + make distclean + make ${KERNEL_CONFIGS} + make savedefconfig + cp defconfig arch/${ARCH}/configs + + make KERNELRELEASE=qcomlt-integration-${ARCH} -j$(nproc) Image +} + +git config --global user.name "Linaro CI" +git config --global user.email "ci_notify@linaro.org" + +# Use a persistent storage to avoid clone every time the integration repository +PERSISTENT_PATH=${HOME}/srv/qcomlt/linux_automerge +mkdir -p ${PERSISTENT_PATH} +KERNEL_REPO_BARE_PATH=${PERSISTENT_PATH}/$(basename ${KERNEL_REPO_URL}) +if [ -d "${KERNEL_REPO_BARE_PATH}" ]; then + echo "Updating kernel bare repo ..." + pushd $(pwd) + cd ${KERNEL_REPO_BARE_PATH} + git fetch --all -v + git update-server-info + popd +else + echo "Cloning integration bare repo ..." + git clone --bare ${KERNEL_REPO_URL} ${KERNEL_REPO_BARE_PATH} +fi +INTEGRATION_REPO_PATH=$(pwd)/$(basename ${INTEGRATION_REPO_URL}) +echo "Cloning integration repo ..." +git clone ${KERNEL_REPO_BARE_PATH} ${INTEGRATION_REPO_PATH} + +pushd $(pwd) +export INTG_REMOTE=automerge-intg +cd ${INTEGRATION_REPO_PATH} + +git remote add ${INTG_REMOTE} ${INTEGRATION_REPO_URL} +git fetch ${INTG_REMOTE} +set +e +git branch -a | grep "remotes/${INTG_REMOTE}/${INTEGRATION_BRANCH}$" +branch_exists=$? +set -e +if [ $branch_exists -ne 0 ]; then + echo "Creating initial integration branch ..." + git push ${INTG_REMOTE} HEAD:${INTEGRATION_BRANCH} + git fetch -v ${INTG_REMOTE} +fi +git checkout -b ${INTEGRATION_BRANCH} ${INTG_REMOTE}/${INTEGRATION_BRANCH} +popd + +echo "Initializing automerge execution ..." +pushd $(pwd) +AUTOMERGE_PATH=$(pwd)/automerge +git clone ${AUTOMERGE_REPO_URL} -b ${AUTOMERGE_BRANCH} ${AUTOMERGE_PATH} +export PATH=${AUTOMERGE_PATH}:$PATH + +cd ${AUTOMERGE_PATH} +export CONFIG_PATH='' +if [ ! -z ${CONFIG_REPO_URL} ]; then + export CONFIG_REPO_PATH=${AUTOMERGE_PATH}/$(basename ${CONFIG_REPO_URL}) + git clone ${CONFIG_REPO_URL} -b ${CONFIG_BRANCH} ${CONFIG_REPO_PATH} + + if [ -f ${CONFIG_REPO_PATH}/automerge-ci.conf ]; then + export CONFIG_PATH=${CONFIG_REPO_PATH}/automerge-ci.conf + fi +fi + +if [ -f ${CONFIG_PATH} ]; then + echo "Using configuration from repository" + cat ${CONFIG_PATH} +else + echo "Using default configuration" + cat <<EOF > automerge-ci.conf +baseline git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master +EOF + + export CONFIG_PATH=${AUTOMERGE_PATH}/automerge-ci.conf +fi + +AUTOMERGE_CONFIG=$(cat ${CONFIG_PATH}) + +# * Disable exit when fail to collect build logs +set +e +yes | ci-merge -l ${INTEGRATION_REPO_PATH} -r ${INTEGRATION_REPO_URL} -i ${INTEGRATION_BRANCH} | tee automerge.log +ci_exit=$? +AUTOMERGE_BRANCH_FAILED=$(grep "Merge failed," automerge.log) +set -e +popd + +echo "AUTOMERGE_CONFIG=\"${AUTOMERGE_CONFIG}\"" > automerge_result_variables +echo "AUTOMERGE_BRANCH_FAILED=\"${AUTOMERGE_BRANCH_FAILED}\"" >> automerge_result_variables +cat automerge_result_variables + +if [ $ci_exit -ne 0 ]; then + exit $ci_exit +fi + +cd ${INTEGRATION_REPO_PATH} +build_integration_kernel "arm" "multi_v7_defconfig" +build_integration_kernel "arm64" "defconfig" + +if [ ! -z ${KERNEL_CI_REPO_URL} ]; then + git push -f ${KERNEL_CI_REPO_URL} ${INTEGRATION_BRANCH}:${KERNEL_CI_BRANCH} +fi |