summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Niels Ole Salscheider <olesalscheider@exherbo.org> 2017-06-18 14:21:33 +0200
committerAvatar Niels Ole Salscheider <olesalscheider@exherbo.org> 2017-06-18 14:21:43 +0200
commit2c50e555a494422409a0c1f0e6e099ff1303b16d (patch)
tree6bf95a4c5e1317c556b44ffaeb72506b6e19e063
parent0cbf6d1dc3bfd0bff9f36c2b812a0c4d72f09c9e (diff)
downloadinfra-scripts-2c50e555a494422409a0c1f0e6e099ff1303b16d.tar.gz
infra-scripts-2c50e555a494422409a0c1f0e6e099ff1303b16d.tar.xz
Gitlab CI: Test all pushed commits
-rw-r--r--continuous-integration/gitlab/buildtest60
1 files changed, 35 insertions, 25 deletions
diff --git a/continuous-integration/gitlab/buildtest b/continuous-integration/gitlab/buildtest
index 7dab67b..0911cb2 100644
--- a/continuous-integration/gitlab/buildtest
+++ b/continuous-integration/gitlab/buildtest
@@ -5,8 +5,6 @@ chgrp paludisbuild /dev/tty
# Sydbox does not work with all Docker configurations
export PALUDIS_DO_NOTHING_SANDBOXY=1
-TMPFILE=$(mktemp -uq)
-
rm -Rf /tmp/ciwork
mkdir /tmp/ciwork
pushd /tmp/ciwork
@@ -19,8 +17,17 @@ git clone ${CI_REPOSITORY_URL} ${REPO}
pushd ${REPO}
git checkout ${CI_COMMIT_REF_NAME}
-PKG=$(git diff-tree --no-commit-id --name-only -r ${CI_COMMIT_SHA} | grep -v "^$" | awk -F/ '$1~/packages/{print $2"/"$3}' | sort -u | xargs)
-if [[ -z ${PKG} ]]; then
+SHAS=($(/usr/local/bin/commits_to_build.rb --project-id ${CI_PROJECT_ID} --sha ${CI_COMMIT_SHA} --endpoint ${API_ENDPOINT} --token ${API_TOKEN}))
+
+PKGS=()
+for SHA in "${SHAS[@]}"; do
+ PKG=$(git diff-tree --no-commit-id --name-only -r ${SHA} | grep -v "^$" | awk -F/ '$1~/packages/{print $2"/"$3}' | sort -u | xargs)
+ if [[ -n ${PKG} ]]; then
+ PKGS+=(${PKG})
+ fi
+done
+
+if [[ -z ${PKGS} ]]; then
echo "No package to build. No exlib recognised. Don't know what to do. Exiting."
exit 0
fi
@@ -37,29 +44,32 @@ if [[ ${rc} -gt 0 ]]; then
exit ${rc}
fi
-cave resolve ${PKG} --display-resolution-program "cave print-resolution-required-confirmations" > ${TMPFILE}
-ARGS=$(handle_confirmations < ${TMPFILE})
-if [[ "${ARGS}" == *unknown\ confirmation:* ]]; then
- echo "***** I FAILED! ***********************************************"
- cat ${TMPFILE}
- echo "*************** COMMITTING SUICIDE NOW! ***********************"
- exit 1
-fi
+for PKG in "${PKGS[@]}"; do
+ TMPFILE=$(mktemp -uq)
-echo "ARGS: ${ARGS}"
+ cave resolve ${PKG} --display-resolution-program "cave print-resolution-required-confirmations" > ${TMPFILE}
+ ARGS=$(handle_confirmations < ${TMPFILE})
+ if [[ "${ARGS}" == *unknown\ confirmation:* ]]; then
+ echo "***** I FAILED! ***********************************************"
+ cat ${TMPFILE}
+ echo "*************** COMMITTING SUICIDE NOW! ***********************"
+ exit 1
+ fi
-echo "**************************************************************"
-cave resolve -zx --skip-phase test --change-phases-for \!targets ${PKG} ${ARGS}
+ echo "ARGS: ${ARGS}"
-rc=$?
-if [[ ${rc} -gt 0 ]]; then
- echo "Build failed!"
-else
- echo "**************************************************************"
- echo "Dependencies I believe to have found (excluding system):"
- /usr/local/bin/mscan2.rb -i system ${PKG/::*} 2>&1
echo "**************************************************************"
-fi
-
-exit ${rc}
+ cave resolve -zx --skip-phase test --change-phases-for \!targets ${PKG} ${ARGS}
+
+ rc=$?
+ if [[ ${rc} -gt 0 ]]; then
+ echo "Build failed!"
+ exit ${rc}
+ else
+ echo "**************************************************************"
+ echo "Dependencies I believe to have found (excluding system):"
+ /usr/local/bin/mscan2.rb -i system ${PKG/::*} 2>&1
+ echo "**************************************************************"
+ fi
+done