[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: refactoring to only define build nodes and their ssh ports in one central place, bin/jenkins_node_definitions.sh

Holger Levsen holger at moszumanska.debian.org
Fri Jan 8 18:06:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 38781b49a564ef21687e0a9aeb98c073e564c7cf
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Jan 8 19:06:31 2016 +0100

    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 ++-
 job-cfg/reproducible.yaml       | 62 ++++++++++++++++++++---------------------
 5 files changed, 111 insertions(+), 92 deletions(-)

diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh
index 64195cc..cd7d08e 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 0000000..1e548e5
--- /dev/null
+++ b/bin/jenkins_node_definitions.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# Copyright 2015-2016 Holger Levsen <holger at layer-acht.org>
+# 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 79eed10..5f7b9b9 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 4db049d..b904501 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.debia [...]
+. /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
diff --git a/job-cfg/reproducible.yaml b/job-cfg/reproducible.yaml
index c806a4c..1be4f6a 100644
--- a/job-cfg/reproducible.yaml
+++ b/job-cfg/reproducible.yaml
@@ -471,37 +471,37 @@
             my_description: 'Try to reproducibly build a scheduled package. This is one of several builder jobs.'
             my_arch: 'armhf'
             my_num:
-                -  '1': { my_node1: 'bpi0-armhf-rb:2222',      my_node2: 'odxu4-armhf-rb:2229'     }
-                -  '2': { my_node1: 'wbq0-armhf-rb:2225',      my_node2: 'cbxi4pro0-armhf-rb:2226' }
-                -  '3': { my_node1: 'hb0-armhf-rb:2224',       my_node2: 'odxu4-armhf-rb:2229'     }
-                -  '4': { my_node1: 'cbxi4pro0-armhf-rb:2226', my_node2: 'wbq0-armhf-rb:2225'      }
-                -  '5': { my_node1: 'cbxi4pro0-armhf-rb:2226', my_node2: 'bpi0-armhf-rb:2222'      }
-                -  '6': { my_node1: 'wbq0-armhf-rb:2225',      my_node2: 'cbxi4pro0-armhf-rb:2226' }
-                -  '7': { my_node1: 'wbq0-armhf-rb:2225',      my_node2: 'odxu4-armhf-rb:2229'     }
-                -  '8': { my_node1: 'hb0-armhf-rb:2224',       my_node2: 'wbq0-armhf-rb:2225'      }
-                -  '9': { my_node1: 'odxu4-armhf-rb:2229',     my_node2: 'bpi0-armhf-rb:2222'      }
-                - '10': { my_node1: 'odxu4-armhf-rb:2229',     my_node2: 'rpi2b-armhf-rb:2230'     }
-                - '11': { my_node1: 'odxu4-armhf-rb:2229',     my_node2: 'wbd0-armhf-rb:2223'      }
-                - '12': { my_node1: 'wbd0-armhf-rb:2223',      my_node2: 'cbxi4pro0-armhf-rb:2226' }
-                - '13': { my_node1: 'cbxi4pro0-armhf-rb:2226', my_node2: 'rpi2b-armhf-rb:2230'     }
-                - '14': { my_node1: 'wbq0-armhf-rb:2225',      my_node2: 'odxu4b-armhf-rb:2232'    }
-                - '15': { my_node1: 'rpi2b-armhf-rb:2230',     my_node2: 'odxu4c-armhf-rb:2233'    }
-                - '16': { my_node1: 'odxu4b-armhf-rb:2232',    my_node2: 'wbd0-armhf-rb:2223'      }
-                - '17': { my_node1: 'odxu4c-armhf-rb:2223',    my_node2: 'hb0-armhf-rb:2224'       }
-                - '18': { my_node1: 'odxu4b-armhf-rb:2232',    my_node2: 'ff2a-armhf-rb:2234'      }
-                - '19': { my_node1: 'odxu4c-armhf-rb:2233',    my_node2: 'ff2a-armhf-rb:2234'      }
-                - '20': { my_node1: 'ff2a-armhf-rb:2234',      my_node2: 'odxu4b-armhf-rb:2232'    }
-                - '21': { my_node1: 'ff2a-armhf-rb:2234',      my_node2: 'odxu4c-armhf-rb:2233'    }
-                - '22': { my_node1: 'ff2a-armhf-rb:2234',      my_node2: 'rpi2c-armhf-rb:2235'     }
-                - '23': { my_node1: 'rpi2c-armhf-rb:2235',     my_node2: 'odxu4b-armhf-rb:2232'    }
-                - '24': { my_node1: 'rpi2c-armhf-rb:2235',     my_node2: 'odxu4c-armhf-rb:2233'    }
-                - '25': { my_node1: 'odxu4b-armhf-rb:2232',    my_node2: 'ff2b-armhf-rb:2237'      }
-                - '26': { my_node1: 'opi2a-armhf-rb:2236',     my_node2: 'ff2a-armhf-rb:2234'      }
-                - '27': { my_node1: 'odxu4c-armhf-rb:2233',    my_node2: 'ff2b-armhf-rb:2237'      }
-                - '28': { my_node1: 'opi2a-armhf-rb:2236',     my_node2: 'ff2b-armhf-rb:2237'      }
-                - '29': { my_node1: 'ff2b-armhf-rb:2237',      my_node2: 'opi2a-armhf-rb:2236'     }
-                - '30': { my_node1: 'ff2b-armhf-rb:2237',      my_node2: 'opi2a-armhf-rb:2236'     }
-                - '31': { my_node1: 'ff2b-armhf-rb:2237',      my_node2: 'opi2a-armhf-rb:2236'     }
+                -  '1': { my_node1: 'bpi0-armhf-rb',      my_node2: 'odxu4-armhf-rb'     }
+                -  '2': { my_node1: 'wbq0-armhf-rb',      my_node2: 'cbxi4pro0-armhf-rb' }
+                -  '3': { my_node1: 'hb0-armhf-rb',       my_node2: 'odxu4-armhf-rb'     }
+                -  '4': { my_node1: 'cbxi4pro0-armhf-rb', my_node2: 'wbq0-armhf-rb'      }
+                -  '5': { my_node1: 'cbxi4pro0-armhf-rb', my_node2: 'bpi0-armhf-rb'      }
+                -  '6': { my_node1: 'wbq0-armhf-rb',      my_node2: 'cbxi4pro0-armhf-rb' }
+                -  '7': { my_node1: 'wbq0-armhf-rb',      my_node2: 'odxu4-armhf-rb'     }
+                -  '8': { my_node1: 'hb0-armhf-rb',       my_node2: 'wbq0-armhf-rb'      }
+                -  '9': { my_node1: 'odxu4-armhf-rb',     my_node2: 'bpi0-armhf-rb'      }
+                - '10': { my_node1: 'odxu4-armhf-rb',     my_node2: 'rpi2b-armhf-rb'     }
+                - '11': { my_node1: 'odxu4-armhf-rb',     my_node2: 'wbd0-armhf-rb'      }
+                - '12': { my_node1: 'wbd0-armhf-rb',      my_node2: 'cbxi4pro0-armhf-rb' }
+                - '13': { my_node1: 'cbxi4pro0-armhf-rb', my_node2: 'rpi2b-armhf-rb'     }
+                - '14': { my_node1: 'wbq0-armhf-rb',      my_node2: 'odxu4b-armhf-rb'    }
+                - '15': { my_node1: 'rpi2b-armhf-rb',     my_node2: 'odxu4c-armhf-rb'    }
+                - '16': { my_node1: 'odxu4b-armhf-rb',    my_node2: 'wbd0-armhf-rb'      }
+                - '17': { my_node1: 'odxu4c-armhf-rb',    my_node2: 'hb0-armhf-rb'       }
+                - '18': { my_node1: 'odxu4b-armhf-rb',    my_node2: 'ff2a-armhf-rb'      }
+                - '19': { my_node1: 'odxu4c-armhf-rb',    my_node2: 'ff2a-armhf-rb'      }
+                - '20': { my_node1: 'ff2a-armhf-rb',      my_node2: 'odxu4b-armhf-rb'    }
+                - '21': { my_node1: 'ff2a-armhf-rb',      my_node2: 'odxu4c-armhf-rb'    }
+                - '22': { my_node1: 'ff2a-armhf-rb',      my_node2: 'rpi2c-armhf-rb'     }
+                - '23': { my_node1: 'rpi2c-armhf-rb',     my_node2: 'odxu4b-armhf-rb'    }
+                - '24': { my_node1: 'rpi2c-armhf-rb',     my_node2: 'odxu4c-armhf-rb'    }
+                - '25': { my_node1: 'odxu4b-armhf-rb',    my_node2: 'ff2b-armhf-rb'      }
+                - '26': { my_node1: 'opi2a-armhf-rb',     my_node2: 'ff2a-armhf-rb'      }
+                - '27': { my_node1: 'odxu4c-armhf-rb',    my_node2: 'ff2b-armhf-rb'      }
+                - '28': { my_node1: 'opi2a-armhf-rb',     my_node2: 'ff2b-armhf-rb'      }
+                - '29': { my_node1: 'ff2b-armhf-rb',      my_node2: 'opi2a-armhf-rb'     }
+                - '30': { my_node1: 'ff2b-armhf-rb',      my_node2: 'opi2a-armhf-rb'     }
+                - '31': { my_node1: 'ff2b-armhf-rb',      my_node2: 'opi2a-armhf-rb'     }
             my_shell: '/srv/jenkins/bin/reproducible_build.sh {my_node1} {my_node2}'
             my_timed: '* * * * *'
             my_hname: ''

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list