From 38781b49a564ef21687e0a9aeb98c073e564c7cf Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 8 Jan 2016 19:06:31 +0100 Subject: reproducible: refactoring to only define build nodes and their ssh ports in one central place, bin/jenkins_node_definitions.sh --- bin/jenkins_master_wrapper.sh | 62 +++++++---------------------------------- bin/jenkins_node_definitions.sh | 60 +++++++++++++++++++++++++++++++++++++++ bin/reproducible_build.sh | 15 +++++----- bin/reproducible_common.sh | 4 ++- 4 files changed, 80 insertions(+), 61 deletions(-) create mode 100755 bin/jenkins_node_definitions.sh (limited to 'bin') diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh index 64195cc3..cd7d08e4 100755 --- a/bin/jenkins_master_wrapper.sh +++ b/bin/jenkins_master_wrapper.sh @@ -9,60 +9,18 @@ if [ "$HOSTNAME" = "jenkins-test-vm" ] ; then exit 0 fi -# real start +# define Debian build nodes in use +. /srv/jenkins/bin/jenkins_node_definitions.sh +PORT=0 +get_node_ssh_port $NODE_NAME + +# by default we just use the job name as param PARAMS="$JOB_NAME" -# these nodes also need to be listed in bin/reproducible_common.sh where they define $BUILD_NODES -case "$NODE_NAME" in - bpi0-armhf-rb.debian.net) - PORT=2222 - ;; - hb0-armhf-rb.debian.net) - PORT=2224 - ;; - wbq0-armhf-rb.debian.net) - PORT=2225 - ;; - cbxi4pro0-armhf-rb.debian.net) - PORT=2226 - ;; - odxu4-armhf-rb.debian.net) - PORT=2229 - ;; - wbd0-armhf-rb.debian.net) - PORT=2223 - ;; - rpi2b-armhf-rb.debian.net) - PORT=2230 - ;; - rpi2c-armhf-rb.debian.net) - PORT=2235 - ;; - odxu4b-armhf-rb.debian.net) - PORT=2232 - ;; - odxu4c-armhf-rb.debian.net) - PORT=2233 - ;; - ff2a-armhf-rb.debian.net) - PORT=2234 - ;; - ff2b-armhf-rb.debian.net) - PORT=2237 - ;; - opi2a-armhf-rb.debian.net) - PORT=2236 - ;; - profitbricks-build?-amd64.debian.net) - PORT=22 - if [[ "$JOB_NAME" =~ rebootstrap_.* ]] ; then - PARAMS="$PARAMS $@" - fi - ;; - *) - echo >&2 "Unknown node $NODE_NAME." - exit 1 -esac +# though this could be used for other jobs as well... +if [[ "$JOB_NAME" =~ rebootstrap_.* ]] ; then + PARAMS="$PARAMS $@" +fi # pseudo job used to cleanup nodes if [ "$JOB_NAME" = "cleanup_nodes" ] ; then diff --git a/bin/jenkins_node_definitions.sh b/bin/jenkins_node_definitions.sh new file mode 100755 index 00000000..1e548e51 --- /dev/null +++ b/bin/jenkins_node_definitions.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Copyright 2015-2016 Holger Levsen +# released under the GPLv=2 + +# define Debian build nodes in use +BUILD_NODES="profitbricks-build1-amd64.debian.net profitbricks-build2-amd64.debian.net profitbricks-build5-amd64.debian.net profitbricks-build6-amd64.debian.net wbq0-armhf-rb.debian.net cbxi4pro0-armhf-rb.debian.net bpi0-armhf-rb.debian.net hb0-armhf-rb.debian.net odxu4-armhf-rb.debian.net wbd0-armhf-rb.debian.net rpi2b-armhf-rb.debian.net rpi2c-armhf-rb.debian.net odxu4b-armhf-rb.debian.net odxu4c-armhf-rb.debian.net ff2a-armhf-rb.debian.net ff2b-armhf-rb.debian.net opi2a-armhf-rb.debian.net" + +# return the ports sshd is listening on +get_node_ssh_port() { + local NODE_NAME=$1 + case "$NODE_NAME" in + bpi0-armhf-rb.debian.net) + PORT=2222 + ;; + hb0-armhf-rb.debian.net) + PORT=2224 + ;; + wbq0-armhf-rb.debian.net) + PORT=2225 + ;; + cbxi4pro0-armhf-rb.debian.net) + PORT=2226 + ;; + odxu4-armhf-rb.debian.net) + PORT=2229 + ;; + wbd0-armhf-rb.debian.net) + PORT=2223 + ;; + rpi2b-armhf-rb.debian.net) + PORT=2230 + ;; + rpi2c-armhf-rb.debian.net) + PORT=2235 + ;; + odxu4b-armhf-rb.debian.net) + PORT=2232 + ;; + odxu4c-armhf-rb.debian.net) + PORT=2233 + ;; + ff2a-armhf-rb.debian.net) + PORT=2234 + ;; + ff2b-armhf-rb.debian.net) + PORT=2237 + ;; + opi2a-armhf-rb.debian.net) + PORT=2236 + ;; + profitbricks-build?-amd64.debian.net) + PORT=22 + ;; + *) + echo >&2 "Unknown node $NODE_NAME." + exit 1 + esac +} + diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 79eed106..5f7b9b90 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -675,7 +675,8 @@ check_buildinfo() { echo "$(date -u) - The build environment varies according to the two .buildinfo files, probably due to mirror update. Doing the first build on $NODE1 again." echo "=============================================================================" echo - remote_build 1 $NODE1 $PORT1 + get_node_ssh_port $NODE1 + remote_build 1 $NODE1 $PORT grep-dctrl -s Build-Environment -n ${SRCPACKAGE} ./b1/$BUILDINFO > $TMPFILE1 set +e diff $TMPFILE1 $TMPFILE2 @@ -692,7 +693,8 @@ check_buildinfo() { build_rebuild() { FTBFS=1 mkdir b1 b2 - remote_build 1 $NODE1 $PORT1 + get_node_ssh_port $NODE1 + remote_build 1 $NODE1 $PORT if [ ! -f b1/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] && [ -f b1/${SRCPACKAGE}_*_${ARCH}.changes ] ; then echo "Version mismatch between main node (${SRCPACKAGE}_${EVERSION}_${ARCH}.dsc expected) and first build node ($(ls b1/*dsc)) for $SUITE/$ARCH, aborting. Please upgrade the schroots..." | tee -a ${RBUILDLOG} # reschedule the package for later and quit the build without saving anything @@ -701,7 +703,8 @@ build_rebuild() { exit 0 elif [ -f b1/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] ; then # the first build did not FTBFS, try rebuild it. - remote_build 2 $NODE2 $PORT2 + get_node_ssh_port $NODE2 + remote_build 2 $NODE2 $PORT if [ -f b2/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] ; then # both builds were fine, i.e., they did not FTBFS. FTBFS=0 @@ -724,6 +727,7 @@ DATE=$(date -u +'%Y-%m-%d %H:%M') START=$(date +'%s') RBUILDLOG=$(mktemp --tmpdir=$TMPDIR) JOB="${JOB_NAME#reproducible_builder_}/${BUILD_ID}" +PORT=0 # # determine mode @@ -753,11 +757,6 @@ elif [ "$2" != "" ] ; then MODE="master" NODE1="$(echo $1 | cut -d ':' -f1).debian.net" NODE2="$(echo $2 | cut -d ':' -f1).debian.net" - PORT1="$(echo $1 | cut -d ':' -f2)" - PORT2="$(echo $2 | cut -d ':' -f2)" - # if no port is given, assume 22 - if [ "$NODE1" = "${PORT1}.debian.net" ] ; then PORT1=22 ; fi - if [ "$NODE2" = "${PORT2}.debian.net" ] ; then PORT2=22 ; fi # overwrite ARCH for remote builds for i in $ARCHS ; do # try to match ARCH in nodenames diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 4db049d6..b9045011 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -47,7 +47,9 @@ SUITES="testing unstable experimental" ARCHS="amd64 armhf" # define Debian build nodes in use -BUILD_NODES="profitbricks-build1-amd64.debian.net profitbricks-build2-amd64.debian.net profitbricks-build5-amd64.debian.net profitbricks-build6-amd64.debian.net wbq0-armhf-rb.debian.net cbxi4pro0-armhf-rb.debian.net bpi0-armhf-rb.debian.net hb0-armhf-rb.debian.net odxu4-armhf-rb.debian.net wbd0-armhf-rb.debian.net rpi2b-armhf-rb.debian.net rpi2c-armhf-rb.debian.net odxu4b-armhf-rb.debian.net odxu4c-armhf-rb.debian.net ff2a-armhf-rb.debian.net ff2b-armhf-rb.debian.net opi2a-armhf-rb.debian.net" # these also needs to be defined in bin/jenkins_master_wrapper.sh +. /srv/jenkins/bin/jenkins_node_definitions.sh + +# variables on the nodes we are interested in BUILD_ENV_VARS="ARCH NUM_CPU CPU_MODEL DATETIME KERNEL1 KERNEL2" # these also needs to be defined in bin/reproducible_info.sh # existing usertags in the Debian BTS -- cgit v1.2.3-54-g00ecf