[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible: refactor

Holger Levsen holger at moszumanska.debian.org
Wed Sep 9 14:20:03 UTC 2015


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 8b4e8c709ce69883c3874b97b063de21da9de3d2
Author: Holger Levsen <holger at layer-acht.org>
Date:   Wed Sep 9 16:19:04 2015 +0200

    reproducible: refactor
---
 bin/jenkins_master_wrapper.sh  | 1 +
 bin/reproducible_common.sh     | 9 +++++++--
 bin/reproducible_info.sh       | 5 ++++-
 bin/reproducible_nodes_info.sh | 4 ++--
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh
index 6f472ef..77c9002 100755
--- a/bin/jenkins_master_wrapper.sh
+++ b/bin/jenkins_master_wrapper.sh
@@ -3,6 +3,7 @@
 set -u
 set -e
 
+# 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)
     exec ssh -p 2222 $NODE_NAME "$JOB_NAME"
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 0d13a6f..e939a4f 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -42,12 +42,17 @@ JENKINS_URL=${JENKINS_URL:0:-1}
 SUITES="testing unstable experimental"
 # architectures being tested
 ARCHS="armhf amd64"
-# number of cores to be used
-NUM_CPU=$(grep -c '^processor' /proc/cpuinfo)
+
+# define build nodes in use
+BUILD_NODES="bpi0-armhf-rb.debian.net hb0-armhf-rb.debian.net wbq0-armhf-rb.debian.net cbxi4pro0-armhf-rb.debian.net profitbricks-build1-amd64.debian.net profitbricks-build2-amd64.debian.net" # these also needs to be defined in bin/jenkins_master_wrapper.sh
+BUILD_ENV_VARS="ARCH NUM_CPU CPU_MODEL DATETIME" # these also needs to be defined in bin/reproducible_info.sh
 
 # existing usertags
 USERTAGS="toolchain infrastructure timestamps fileordering buildpath username hostname uname randomness buildinfo cpu signatures environment umask ftbfs locale"
 
+# number of cores to be used
+NUM_CPU=$(grep -c '^processor' /proc/cpuinfo)
+
 # we only need them for html creation but we cannot declare them in a function
 declare -A SPOKENTARGET
 
diff --git a/bin/reproducible_info.sh b/bin/reproducible_info.sh
index e6d0bb5..3b66e6e 100755
--- a/bin/reproducible_info.sh
+++ b/bin/reproducible_info.sh
@@ -4,12 +4,15 @@
 # released under the GPLv=2
 
 set -e
+# common code defining BUILD_ENV_VARS
+. /srv/jenkins/bin/reproducible_common.sh
 
+# these variables also need to be in bin/reproducible_common.sh where they define $BUILD_ENV_VARS (see right below)
 ARCH=$(dpkg --print-architecture)
 NUM_CPU=$(grep -c '^processor' /proc/cpuinfo)
 CPU_MODEL=$(cat /proc/cpuinfo |grep "model name"|head -1|cut -d ":" -f2|xargs echo)
 DATETIME=$(date +'%Y-%m-%d %H:%M %Z')
 
-for i in ARCH NUM_CPU CPU_MODEL DATETIME ; do
+for i in $BUILD_ENV_VARS ; do
 	echo "$i=${!i}"
 done
diff --git a/bin/reproducible_nodes_info.sh b/bin/reproducible_nodes_info.sh
index 7283f05..fd5baaf 100755
--- a/bin/reproducible_nodes_info.sh
+++ b/bin/reproducible_nodes_info.sh
@@ -15,13 +15,13 @@ mkdir -p $TARGET_DIR
 TMPFILE_SRC=$(mktemp)
 TMPFILE_NODE=$(mktemp)
 
-for NODE in bpi0-armhf-rb.debian.net hb0-armhf-rb.debian.net wbq0-armhf-rb.debian.net cbxi4pro0-armhf-rb.debian.net profitbricks-build1-amd64.debian.net profitbricks-build2-amd64.debian.net ; do
+for NODE in $BUILD_NODES ; do
 	# call jenkins_master_wrapper.sh so we only need to track different ssh ports in one place
 	# jenkins_master_wrapper.sh needs NODE_NAME and JOB_NAME
 	export NODE_NAME=$NODE
 	export JOB_NAME=/srv/jenkins/bin/reproducible_info.sh
 	/srv/jenkins/bin/jenkins_master_wrapper.sh > $TMPFILE_SRC
-	for KEY in ARCH NUM_CPU CPU_MODEL DATETIME ; do
+	for KEY in $BUILD_ENV_VARS ; do
 		VALUE=$(egrep "^$KEY=" $TMPFILE_SRC | cut -d "=" -f2-)
 		if [ ! -z "$VALUE" ] ; then
 			echo "$KEY=$VALUE" >> $TMPFILE_NODE

-- 
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