summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2017-04-26 15:52:03 +0200
committerHolger Levsen <holger@layer-acht.org>2017-04-26 15:52:03 +0200
commita660d207be25f9abbfcf972a2bf0e603b7f0b10d (patch)
tree75434c7ff19877ff992a0278d784a2cbabeed163 /bin
parent8a58007dccebfe57be82fa6e59d556ace9c0cca0 (diff)
downloadjenkins.debian.net-a660d207be25f9abbfcf972a2bf0e603b7f0b10d.tar.xz
reproducible Debian: add comments explaining the code
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_build_service_worker.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/reproducible_build_service_worker.sh b/bin/reproducible_build_service_worker.sh
index 7406dcd1..62006f79 100755
--- a/bin/reproducible_build_service_worker.sh
+++ b/bin/reproducible_build_service_worker.sh
@@ -3,14 +3,15 @@
# Copyright © 2017 Holger Levsen (holger@layer-acht.org)
# released under the GPLv=2
-# normally defined by jenkins
-JENKINS_URL=https://jenkins.debian.net
set -e
WORKER_NAME=$1
NODE1=$2
NODE2=$3
+# normally defined by jenkins and used by reproducible_common.sh
+JENKINS_URL=https://jenkins.debian.net
+
DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
@@ -18,7 +19,11 @@ common_init "$@"
# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh
+# endless loop
while true ; do
+ #
+ # check if we really should be running
+ #
RUNNING=$(ps fax|grep -v grep|grep "$0 $1 ")
if [ -z "$RUNNING" ] ; then
echo "$(date --utc) - '$0 $1' already running, thus stopping this."
@@ -34,6 +39,9 @@ while true ; do
# sleep up to 2.3 seconds (additionally to the random sleep reproducible_build.sh does anyway)
/bin/sleep $(echo "scale=1 ; $(shuf -i 1-23 -n 1)/10" | bc )
+ #
+ # increment BUILD_ID
+ #
BUILD_BASE=/var/lib/jenkins/userContent/reproducible/debian/build_service/$WORKER_NAME
OLD_ID=$(ls -1rt $BUILD_BASE|egrep -v "(latest|worker.log)" |sort -n|tail -1)
let BUILD_ID=OLD_ID+1
@@ -41,12 +49,16 @@ while true ; do
rm -f $BUILD_BASE/latest
ln -sf $BUILD_ID $BUILD_BASE/latest
+ #
+ # prepare variables for export
+ #
export BUILD_URL=https://jenkins.debian.net/userContent/build_service/$WORKER_NAME/
export BUILD_ID=$BUILD_ID
export JOB_NAME="reproducible_builder_$WORKER_NAME"
export
+ #
+ # actually run reproducible_build.sh
+ #
/srv/jenkins/bin/reproducible_build.sh $NODE1 $NODE2 >$BUILD_BASE/$BUILD_ID/console.log 2>&1
done
-
-