Commit 874a6e23 authored by Holger Levsen's avatar Holger Levsen
Browse files

reproducible: drop code relating to ssh client ports. this is handled via ~/ssh/config now

parent 83eaf481
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ fi

# define Debian build nodes in use
. /srv/jenkins/bin/jenkins_node_definitions.sh
PORT=0

if [ "${NODE_NAME%.*}" = "$NODE_NAME" ]; then
	# The NODE_NAME variable does not contain a dot, so it is not a FQDN.
@@ -51,7 +50,7 @@ fi
# main
#
set +e
ssh -o "BatchMode = yes" -p $PORT $NODE_NAME /bin/true
ssh -o "BatchMode = yes" $NODE_NAME /bin/true
RESULT=$?
# abort job if host is down
if [ $RESULT -ne 0 ] ; then
@@ -70,7 +69,7 @@ set -e
# actually run things on the target node
#
RETVAL=0
ssh -o "BatchMode = yes" -p $PORT $NODE_NAME "$PARAMS" || {
ssh -o "BatchMode = yes" $NODE_NAME "$PARAMS" || {
	# mention failures, but continue since we might want the artifacts anyway
	RETVAL=$?
	printf "\nSSH EXIT CODE: %s\n" $RETVAL
@@ -83,8 +82,8 @@ if [ "$RETRIEVE_ARTIFACTS" = "yes" ] ; then
	echo "$(date -u) - retrieving artifacts."
	set -x
	mkdir -p "$RESULTS"
	rsync -r --delete -v -e "ssh -o 'Batchmode = yes' -p $PORT" "$NODE_NAME:$NODE_RESULTS/" "$RESULTS/"
	ssh -o "BatchMode = yes" -p $PORT $NODE_NAME "rm -r $NODE_RESULTS"
	rsync -r --delete -v -e "ssh -o 'Batchmode = yes'" "$NODE_NAME:$NODE_RESULTS/" "$RESULTS/"
	ssh -o "BatchMode = yes" $NODE_NAME "rm -r $NODE_RESULTS"
fi

#
+0 −118
Original line number Diff line number Diff line
@@ -60,150 +60,32 @@ osuosl-build172-amd64.debian.net
osuosl-build173-amd64.debian.net
osuosl-build174-amd64.debian.net"

# return the ports sshd is listening on
NODE_RUN_IN_THE_FUTURE=false
get_node_information() {
	local NODE_NAME=$1
	case "$NODE_NAME" in
	  bbx15*)
	    PORT=2242
	    ;;
	  wbq0*)
	    PORT=2225
	    ;;
	  cbxi4a*)
	    PORT=2239
	    ;;
	  cbxi4b*)
	    PORT=2240
	    ;;
	  cbxi4pro0*)
	    PORT=2226
	    ;;
	  odxu4a*)
	    PORT=2229
	    ;;
	  odxu4b*)
	    PORT=2232
	    ;;
	  odxu4c*)
	    PORT=2233
	    ;;
	  ff2a*)
	    PORT=2234
	    ;;
	  ff2b*)
	    PORT=2237
	    ;;
	  ff4a*)
	    PORT=2241
	    ;;
	  ff64a*)
	    PORT=2250
	    ;;
	  opi2a*)
	    PORT=2236
	    ;;
	  opi2b*)
	    PORT=2238
	    ;;
	  odu3a*)
	    PORT=2243
	    ;;
	  cb3a*)
	    PORT=2244
	    ;;
	  opi2c*)
	    PORT=2245
	    ;;
	  jtk1a*)
	    PORT=2246
	    ;;
	  jtk1b*)
	    PORT=2252
	    ;;
	  jtx1a*)
	    PORT=2249
	    ;;
	  jtx1b*)
	    PORT=2253
	    ;;
	  jtx1c*)
	    PORT=2254
	    ;;
	  p64b*)
	    PORT=2247
	    ;;
	  p64c*)
	    PORT=2248
	    ;;
	  profitbricks-build[56]*|profitbricks-build1[56]*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=22
	    ;;
	  profitbricks-build*)
	    PORT=22
	    ;;
	  codethink-sled9*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=10109
	    ;;
	  codethink-sled10*)
	    PORT=10110
	    ;;
	  codethink-sled11*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=10111
	    ;;
	  codethink-sled12*)
	    PORT=10112
	    ;;
	  codethink-sled13*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=10113
	    ;;
	  codethink-sled14*)
	    PORT=10114
	    ;;
	  codethink-sled15*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=10115
	    ;;
	  codethink-sled16*)
	    PORT=10116
	    ;;
	  osuosl-build167*)
	    PORT=45046
	    ;;
	  osuosl-build168*)
	    PORT=45047
	    ;;
	  osuosl-build169*)
	    PORT=45048
	    ;;
	  osuosl-build170*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=45049
	    ;;
	  osuosl-build171*)
	    PORT=45050
	    ;;
	  osuosl-build172*)
	    NODE_RUN_IN_THE_FUTURE=true
	    PORT=45051
	    ;;
	  osuosl-build173*)
	    PORT=45052
	    ;;
	  osuosl-build174*)
	    PORT=45053
	    ;;
	  jenkins|jenkins.debian.net)
	    PORT=22
	    ;;
	  *)
	    echo >&2 "Unknown node $NODE_NAME."
	    exit 1
	    ;;
	esac
}
+9 −11
Original line number Diff line number Diff line
@@ -702,8 +702,7 @@ check_node_is_up() {
	# - ssh login works
	# - /tmp is not mounted in read-only mode
	local NODE=$1
	local PORT=$2
	local SLEEPTIME=$3
	local SLEEPTIME=$2
	set +e
	echo "$(date -u) - checking ~/offline_nodes if $NODE is marked as down."
	if grep -q $NODE ~/offline_nodes >/dev/null 2>&1 ; then
@@ -713,7 +712,7 @@ check_node_is_up() {
		exit 0
	fi
	echo "$(date -u) - checking via ssh if $NODE is up."
	ssh -o "BatchMode = yes" -p $PORT $NODE 'rm -v $(mktemp --tmpdir=/tmp read-only-fs-test-XXXXXX)'
	ssh -o "BatchMode = yes" $NODE 'rm -v $(mktemp --tmpdir=/tmp read-only-fs-test-XXXXXX)'
	RESULT=$?
	# abort job if host is down
	if [ $RESULT -ne 0 ] ; then
@@ -728,9 +727,9 @@ check_node_is_up() {
check_nodes_are_up() {
	local SLEEPTIME=30
	get_node_information $NODE1
	check_node_is_up $NODE1 $PORT $SLEEPTIME
	check_node_is_up $NODE1 $SLEEPTIME
	get_node_information $NODE2
	check_node_is_up $NODE2 $PORT $SLEEPTIME
	check_node_is_up $NODE2 $SLEEPTIME
}

remote_build() {
@@ -741,16 +740,16 @@ remote_build() {
	# sleep 15min if first node is down
	# but 1h if the 2nd node is down
	local SLEEPTIME=$(echo "$BUILDNR*$BUILDNR*15"|bc)
	check_node_is_up $NODE $PORT $SLEEPTIME
	check_node_is_up $NODE $SLEEPTIME
	set +e
	ssh -o "BatchMode = yes" -p $PORT $NODE /srv/jenkins/bin/reproducible_build.sh $BUILDNR ${SRCPACKAGE} ${SUITE} ${TMPDIR} "$VERSION"
	ssh -o "BatchMode = yes" $NODE /srv/jenkins/bin/reproducible_build.sh $BUILDNR ${SRCPACKAGE} ${SUITE} ${TMPDIR} "$VERSION"
	local BUILD_RESULT=$?
	rsync -e "ssh -o 'BatchMode = yes' -p $PORT" -r $NODE:$TMPDIR/b$BUILDNR $TMPDIR/
	rsync -e "ssh -o 'BatchMode = yes'" -r $NODE:$TMPDIR/b$BUILDNR $TMPDIR/
	local RSYNC_RESULT=$?
	if [ $RSYNC_RESULT -ne 0 ] ; then
		log_warning "rsync from $NODE failed, sleeping 2m before re-trying..."
		sleep 2m
		rsync -e "ssh -o 'BatchMode = yes' -p $PORT" -r $NODE:$TMPDIR/b$BUILDNR $TMPDIR/
		rsync -e "ssh -o 'BatchMode = yes'" -r $NODE:$TMPDIR/b$BUILDNR $TMPDIR/
		local RSYNC_RESULT=$?
		if [ $RSYNC_RESULT -ne 0 ] ; then
			unregister_build
@@ -759,7 +758,7 @@ remote_build() {
	fi
	ls -lR $TMPDIR
	log_info "Deleting \$TMPDIR on $NODE."
	ssh -o "BatchMode = yes" -p $PORT $NODE "rm -r $TMPDIR"
	ssh -o "BatchMode = yes" $NODE "rm -r $TMPDIR"
	set -e
	if [ $BUILDNR -eq 1 ] ; then
		log_file $TMPDIR/b1/build.log
@@ -884,7 +883,6 @@ 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
+6 −7
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ remote_build() {
	local FQDN=$NODE.debian.net
	get_node_information $NODE
	set +e
	ssh -o "Batchmode = yes" -p $PORT $FQDN /bin/true
	ssh -o "Batchmode = yes" $FQDN /bin/true
	RESULT=$?
	# abort job if host is down
	if [ $RESULT -ne 0 ] ; then
@@ -295,10 +295,10 @@ remote_build() {
		unregister_build
		exit 0
	fi
	ssh -o "Batchmode = yes" -p $PORT $FQDN /srv/jenkins/bin/reproducible_build_archlinux_pkg.sh $BUILDNR $REPOSITORY ${SRCPACKAGE} ${TMPDIR} ${SOURCE_DATE_EPOCH}
	ssh -o "Batchmode = yes" $FQDN /srv/jenkins/bin/reproducible_build_archlinux_pkg.sh $BUILDNR $REPOSITORY ${SRCPACKAGE} ${TMPDIR} ${SOURCE_DATE_EPOCH}
	RESULT=$?
	if [ $RESULT -ne 0 ] ; then
		ssh -o "Batchmode = yes" -p $PORT $FQDN "rm -r $TMPDIR" || true
		ssh -o "Batchmode = yes" $FQDN "rm -r $TMPDIR" || true
		if [ $RESULT -eq 23 ] ; then
			unregister_build
			handle_remote_error "job on $NODE could not end schroot session properly and sent error 23 so we could abort silently."
@@ -310,12 +310,12 @@ remote_build() {
			handle_remote_error "Warning: remote build failed with exit code $RESULT from $NODE for build #$BUILDNR for ${SRCPACKAGE} from $REPOSITORY."
		fi
	fi
	rsync -e "ssh -o 'Batchmode = yes' -p $PORT" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
	rsync -e "ssh -o 'Batchmode = yes'" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
	RESULT=$?
	if [ $RESULT -ne 0 ] ; then
		echo "$(date -u ) - rsync from $NODE failed, sleeping 2m before re-trying..."
		sleep 2m
		rsync -e "ssh -o 'Batchmode = yes' -p $PORT" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
		rsync -e "ssh -o 'Batchmode = yes'" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
		RESULT=$?
		if [ $RESULT -ne 0 ] ; then
			unregister_build
@@ -323,7 +323,7 @@ remote_build() {
		fi
	fi
	ls -lR $TMPDIR
	ssh -o "Batchmode = yes" -p $PORT $FQDN "rm -r $TMPDIR"
	ssh -o "Batchmode = yes" $FQDN "rm -r $TMPDIR"
	set -e
}

@@ -400,7 +400,6 @@ else
	NODE1=$N2
	NODE2=$N1
fi
PORT=22
echo "============================================================================="
echo "Initialising reproducibly build of ${SRCPACKAGE} in ${REPOSITORY} on ${ARCH} now."
echo "1st build will be done on $NODE1."
+6 −7
Original line number Diff line number Diff line
@@ -144,9 +144,8 @@ remote_build() {
	local BUILDNR=$1
	local NODE=$RPM_BUILD_NODE
	local FQDN=$NODE.debian.net
	local PORT=22
	set +e
	ssh -o "Batchmode = yes" -p $PORT $FQDN /bin/true
	ssh -o "Batchmode = yes" $FQDN /bin/true
	RESULT=$?
	# abort job if host is down
	if [ $RESULT -ne 0 ] ; then
@@ -155,25 +154,25 @@ remote_build() {
		sleep ${SLEEPTIME}m
		exec /srv/jenkins/bin/abort.sh
	fi
	ssh -o "Batchmode = yes" -p $PORT $FQDN /srv/jenkins/bin/reproducible_build_rpm.sh $BUILDNR $RELEASE $ARCH $UNIQUEEXT ${SRCPACKAGE} ${TMPDIR}
	ssh -o "Batchmode = yes" $FQDN /srv/jenkins/bin/reproducible_build_rpm.sh $BUILDNR $RELEASE $ARCH $UNIQUEEXT ${SRCPACKAGE} ${TMPDIR}
	RESULT=$?
	if [ $RESULT -ne 0 ] ; then
		ssh -o "Batchmode = yes" -p $PORT $FQDN "rm -r $TMPDIR" || true
		ssh -o "Batchmode = yes" $FQDN "rm -r $TMPDIR" || true
		handle_remote_error "with exit code $RESULT from $NODE for build #$BUILDNR for ${SRCPACKAGE} from $RELEASE ($ARCH)"
	fi
	rsync -e "ssh -o 'Batchmode = yes' -p $PORT" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
	rsync -e "ssh -o 'Batchmode = yes'" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
	RESULT=$?
	if [ $RESULT -ne 0 ] ; then
		echo "$(date -u ) - rsync from $NODE failed, sleeping 2m before re-trying..."
		sleep 2m
		rsync -e "ssh -o 'Batchmode = yes' -p $PORT" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
		rsync -e "ssh -o 'Batchmode = yes'" -r $FQDN:$TMPDIR/b$BUILDNR $TMPDIR/
		RESULT=$?
		if [ $RESULT -ne 0 ] ; then
			handle_remote_error "when rsyncing remote build #$BUILDNR results from $NODE"
		fi
	fi
	ls -lR $TMPDIR
	ssh -o "Batchmode = yes" -p $PORT $FQDN "rm -r $TMPDIR"
	ssh -o "Batchmode = yes" $FQDN "rm -r $TMPDIR"
	set -e
}

Loading