diff options
author | Holger Levsen <holger@layer-acht.org> | 2017-04-27 12:24:36 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2017-04-27 12:24:36 +0200 |
commit | 87d434c263fd3532b3df636572da9ab2919f276a (patch) | |
tree | e7bcd1cfde499952591040e7ffe19f2cefcea0e4 | |
parent | b5858b10769e18f8a1c113dec5818e24f64e0f7c (diff) | |
download | jenkins.debian.net-87d434c263fd3532b3df636572da9ab2919f276a.tar.xz |
reproducible Debian: refactor
Signed-off-by: Holger Levsen <holger@layer-acht.org>
-rwxr-xr-x | bin/reproducible_build_service.sh | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/bin/reproducible_build_service.sh b/bin/reproducible_build_service.sh index 657ff74e..04ee0e33 100755 --- a/bin/reproducible_build_service.sh +++ b/bin/reproducible_build_service.sh @@ -5,6 +5,10 @@ set -e +# those should be global variables +NODE1="" +NODE2="" + choose_node() { case $1 in amd64_1) NODE1=profitbricks-build1-amd64 NODE2=profitbricks-build5-amd64 ;; @@ -184,29 +188,33 @@ choose_node() { esac } -NODE1="" -NODE2="" -for ARCH in amd64 i386 arm64 armhf ; do - case $ARCH in - amd64) MAX=40 ;; - i386) MAX=24 ;; - arm64) MAX=32 ;; - armhf) MAX=66 ;; - *) ;; - esac - for i in $(seq 1 $MAX) ; 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 ) +startup_workers() { + for ARCH in amd64 i386 arm64 armhf ; do + case $ARCH in + amd64) MAX=40 ;; + i386) MAX=24 ;; + arm64) MAX=32 ;; + armhf) MAX=66 ;; + *) ;; + esac + for i in $(seq 1 $MAX) ; 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 ) - WORKER_NAME=${ARCH}_$i - choose_node $WORKER_NAME - BUILD_BASE=/var/lib/jenkins/userContent/reproducible/debian/build_service/$WORKER_NAME - mkdir -p $BUILD_BASE - echo "$(date --utc) - Starting $WORKER_NAME" - /srv/jenkins/bin/reproducible_worker.sh $WORKER_NAME $NODE1 $NODE2 >$BUILD_BASE/worker.log 2>&1 & + WORKER_NAME=${ARCH}_$i + choose_node $WORKER_NAME + BUILD_BASE=/var/lib/jenkins/userContent/reproducible/debian/build_service/$WORKER_NAME + mkdir -p $BUILD_BASE + echo "$(date --utc) - Starting $WORKER_NAME" + /srv/jenkins/bin/reproducible_worker.sh $WORKER_NAME $NODE1 $NODE2 >$BUILD_BASE/worker.log 2>&1 & + done done -done +} +# +# main +# +startup_workers # keep running forever… while true ; do sleep 1337m ; done |