[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 5 commits: deploy_jdn: define the default $real_command later on, so it can easily be a function of $HOST

Mattia Rizzolo gitlab at salsa.debian.org
Thu Apr 12 18:03:27 BST 2018


Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net


Commits:
d62c8b65 by Mattia Rizzolo at 2018-04-12T18:53:01+02:00
deploy_jdn: define the default $real_command later on, so it can easily be a function of $HOST

could have used a `eval`, but brr

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
e1665a6f by Mattia Rizzolo at 2018-04-12T18:53:20+02:00
deploy_jdn: turn the inline check for "is node X in the future" into a function

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
832a52e1 by Mattia Rizzolo at 2018-04-12T18:53:30+02:00
deploy_jdn: pass '-c http.sslVerify=false' to git clone/pull when the node is in the future

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
1c33257d by Mattia Rizzolo at 2018-04-12T19:01:21+02:00
deploy_jdn: also support cs$d for codethink nodes, other than c$d

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
b80d818a by Mattia Rizzolo at 2018-04-12T19:02:07+02:00
deploy_jdn: no need to export anything

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


1 changed file:

- deploy_jdn


Changes:

=====================================
deploy_jdn
=====================================
--- a/deploy_jdn
+++ b/deploy_jdn
@@ -1,6 +1,8 @@
 #!/bin/bash
+# vim: set noexpandtab:
 #
 # Copyright 2014-2017 Holger Levsen <holger at layer-acht.org>
+#           ©    2018 Mattia Rizzolo <mattia at debian.org>
 #
 # released under the GPLv=2
 #
@@ -29,7 +31,7 @@
 
 START=$(date +'%s')
 GIT_REPO="https://salsa.debian.org/qa/jenkins.debian.net.git"
-export HOSTS="
+HOSTS="
 codethink-sled9-arm64.debian.net
 codethink-sled10-arm64.debian.net
 codethink-sled11-arm64.debian.net
@@ -85,24 +87,16 @@ root at jenkins.debian.net
 
 ALL_HOSTS=$HOSTS
 
+node_in_the_future () {
+	case "$1" in
+		profitbricks-build4-amd64|profitbricks-build5-amd64|profitbricks-build6-i386|profitbricks-build15-amd64|profitbricks-build16-i386) true ;;
+		codethink-sled9*|codethink-sled11*|codethink-sled13*|codethink-sled15*) true ;;
+		*) false ;;
+	esac
+}
+
 echo
 echo -n "$(date) - "
-# real command, for running manually: cd ~jenkins-adm/jenkins.debian.net/ ; sudo -u jenkins-adm git pull ; ./update_jdn.sh
-read -r -d '' real_command <<-EOF
-set -e
-export LANG=C
-cd ~jenkins-adm
-if [ ! -d jenkins.debian.net ]; then
-    [ -x /usr/bin/git ] || sudo apt-get install -y git
-    sudo -u jenkins-adm git clone $GIT_REPO
-    cd jenkins.debian.net
-else
-    cd jenkins.debian.net
-
-    sudo -u jenkins-adm git pull $GIT_REPO
-fi
-./update_jdn.sh 2>&1 | sudo tee -a /var/log/jenkins/update_jdn.log
-EOF
 reset_clock=true
 if [ "$1" = "all" ] ; then
 	echo -n "Running j.d.n.git updates on $HOSTS now"
@@ -129,9 +123,10 @@ elif [ "$1" = "check" ] ; then
 	reset_clock=false
 	shift
 elif [ "$1" = "" ] ; then
-        export HOSTS="root at jenkins.debian.net"
+	HOSTS="root at jenkins.debian.net"
+	echo -n "Running j.d.n.git updates on $HOSTS now"
 elif [ "$1" = "jenkins" ] ; then
-	export HOSTS="root at jenkins.debian.net"
+	HOSTS="root at jenkins.debian.net"
 	shift
 	for i in $@ ; do
 		case $i in
@@ -147,19 +142,19 @@ elif [ "$1" = "jenkins" ] ; then
 			10|pb10) HOSTS="$HOSTS profitbricks-build10-amd64.debian.net" ;;
 			11|pb11) HOSTS="$HOSTS profitbricks-build11-amd64.debian.net" ;;
 			15|pb15) HOSTS="$HOSTS profitbricks-build15-amd64.debian.net" ;;
-			c9)      HOSTS="$HOSTS codethink-sled9-arm64.debian.net" ;;
-			c10)     HOSTS="$HOSTS codethink-sled10-arm64.debian.net" ;;
-			c11)     HOSTS="$HOSTS codethink-sled11-arm64.debian.net" ;;
-			c12)     HOSTS="$HOSTS codethink-sled12-arm64.debian.net" ;;
-			c13)     HOSTS="$HOSTS codethink-sled13-arm64.debian.net" ;;
-			c14)     HOSTS="$HOSTS codethink-sled14-arm64.debian.net" ;;
-			c15)     HOSTS="$HOSTS codethink-sled15-arm64.debian.net" ;;
-			c16)     HOSTS="$HOSTS codethink-sled16-arm64.debian.net" ;;
+			c9|cs9)		HOSTS="$HOSTS codethink-sled9-arm64.debian.net" ;;
+			c10|cs10)	HOSTS="$HOSTS codethink-sled10-arm64.debian.net" ;;
+			c11|cs11)	HOSTS="$HOSTS codethink-sled11-arm64.debian.net" ;;
+			c12|cs12)	HOSTS="$HOSTS codethink-sled12-arm64.debian.net" ;;
+			c13|cs13)	HOSTS="$HOSTS codethink-sled13-arm64.debian.net" ;;
+			c14|cs14)	HOSTS="$HOSTS codethink-sled14-arm64.debian.net" ;;
+			c15|cs15)	HOSTS="$HOSTS codethink-sled15-arm64.debian.net" ;;
+			c16|cs16)	HOSTS="$HOSTS codethink-sled16-arm64.debian.net" ;;
 			armhf|amd64|i386|arm64)	 HOSTS="$HOSTS $(echo $ALL_HOSTS | sed 's# #\n#g' | grep $i)" ;;
 			*) 	if ping -c 1 $i ; then HOSTS="$HOSTS $i" ; fi ;;
 		esac
 	done
-	echo -n "Running j.d.n.git ('$real_command') updates on $HOSTS now"
+	echo -n "Running j.d.n.git updates on $HOSTS now"
 fi
 BG=""
 
@@ -170,7 +165,7 @@ get_arch_color() {
 		*arm64*)		BG=orange ;;
 		*armhf*)		BG=lightyellow ;;
 		*jenkins.debian.*)	BG=yellow ;;
-		*)			BG=white ;;
+		*)				BG=white ;;
 	esac
 }
 
@@ -181,21 +176,32 @@ for i in $HOSTS ; do
 done
 HOSTS=$STSOH
 for i in $HOSTS ; do
+	if [ -z "$real_command" ]; then
+		if node_in_the_future "$i"; then GITOPTS="-c http.sslVerify=false" ; fi
+		# real command, for running manually: cd ~jenkins-adm/jenkins.debian.net/ ; sudo -u jenkins-adm git pull ; ./update_jdn.sh
+		read -r -d '' real_command <<-EOF
+			set -e
+			export LANG=C
+			cd ~jenkins-adm
+			if [ ! -d jenkins.debian.net ]; then
+				[ -x /usr/bin/git ] || sudo apt-get install -y git
+				sudo -u jenkins-adm git ${GITOPTS:-} clone $GIT_REPO
+				cd jenkins.debian.net
+			else
+				cd jenkins.debian.net
+				sudo -u jenkins-adm git ${GITOPTS:-} pull $GIT_REPO
+			fi
+			./update_jdn.sh 2>&1 | sudo tee -a /var/log/jenkins/update_jdn.log
+		EOF
+	fi
+
 	echo -n "."
-       	command="$real_command"
+	command="$real_command"
 	if $reset_clock ; then
- 		case $i in
-			profitbricks-build4-amd64*|profitbricks-build5-amd64*|profitbricks-build6-i386*|profitbricks-build15-amd64*|profitbricks-build16-i386*)
-				#  set correct future date
-				command="sudo ntpdate -b de.pool.ntp.org && $real_command && sudo date --set=\"+398 days +6 hours + 23 minutes\" && echo '__$(echo $i|cut -d '.' -f1)=ok__'"
-				;;
-			codethink-sled9*|codethink-sled11*|codethink-sled13*|codethink-sled15*)
-				#  set correct future date
-				command="sudo ntpdate -b de.pool.ntp.org && $real_command && sudo date --set=\"+398 days +6 hours + 23 minutes\" && echo '__$(echo $i|cut -d '.' -f1)=ok__'"
-				;;
-			*)
-				;;
-		esac
+		if node_in_the_future "$i" ; then
+			#  set correct future date
+			command="sudo ntpdate -b de.pool.ntp.org && $real_command && sudo date --set=\"+398 days +6 hours + 23 minutes\" && echo '__$(echo $i|cut -d '.' -f1)=ok__'"
+		fi
 	fi
 	get_arch_color $i
 	xterm -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh -o 'BatchMode = yes' -t $i '$command' | tee $LOG.$i ; sleep 2 ; touch $LOG.$i.done" &



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/0ba4a08928fb46646ec471e233b9744700102115...b80d818a0c2879622b853bd0a082b6132e480ecc

---
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/0ba4a08928fb46646ec471e233b9744700102115...b80d818a0c2879622b853bd0a082b6132e480ecc
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/qa-jenkins-scm/attachments/20180412/b4d3919e/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list