[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible Debian: new script, init_node, to initialize new build nodes

Holger Levsen holger at layer-acht.org
Thu Jun 1 23:09:16 UTC 2017


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 2bff201a7737f58a843fd5f052806aca9cb9abb7
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Jun 2 01:09:08 2017 +0200

    reproducible Debian: new script, init_node, to initialize new build nodes
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 init_node     | 43 +++++++++++++++++++++++++++++++++++++++++++
 update_jdn.sh | 20 ++------------------
 2 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/init_node b/init_node
new file mode 100755
index 0000000..89a1fbb
--- /dev/null
+++ b/init_node
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Copyright 2014-2017 Holger Levsen <holger at layer-acht.org>
+#
+# released under the GPLv=2
+#
+# initial setup for new build nodes
+
+START=$(date +'%s')
+GIT_REPO="git://anonscm.debian.org/qa/jenkins.debian.net.git"
+
+echo
+echo -n "$(date) - "
+set -e
+export LANG=C
+sudo addgroup --system jenkins
+sudo adduser --system --shell /bin/bash --home /var/lib/jenkins --ingroup jenkins --disabled-login jenkins
+sudo addgroup --system jenkins-adm
+sudo adduser --system --shell /bin/bash --home /home/jenkins-adm --ingroup jenkins-adm --disabled-login jenkins-adm
+sudo usermod -G jenkins jenkins-adm
+sudo mkdir /home/jenkins-adm
+sudo chown jenkins-adm.jenkins-adm /home/jenkins-adm
+
+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
+
+END=$(date +'%s')
+DURATION=$(( $END - $START ))
+HOUR=$(echo "$DURATION/3600"|bc)
+MIN=$(echo "($DURATION-$HOUR*3600)/60"|bc)
+SEC=$(echo "$DURATION-$HOUR*3600-$MIN*60"|bc)
+echo "$(date) - total duration: ${HOUR}h ${MIN}m ${SEC}s."
+echo
+
diff --git a/update_jdn.sh b/update_jdn.sh
index fd40d0d..8c8d403 100755
--- a/update_jdn.sh
+++ b/update_jdn.sh
@@ -18,6 +18,8 @@
 #
 # so, yes, patches welcome. saying this is crap alone is not helpful,
 # nor is just suggesting some new or old technology. patches most welcome!
+#
+# that said, there's a new one: init_node ;)
 
 set -e
 
@@ -84,25 +86,7 @@ esac
 #
 # set up users and groups
 #
-if ! getent passwd jenkins > /dev/null ; then
-	sudo addgroup --system jenkins
-	sudo adduser --system --shell /bin/bash --home /var/lib/jenkins --ingroup jenkins --disabled-login jenkins
-fi
-if ! getent group jenkins-adm > /dev/null ; then
-	sudo addgroup --system jenkins-adm
-fi
-if ! getent passwd jenkins-adm > /dev/null  ; then
-	sudo adduser --system --shell /bin/bash --home /home/jenkins-adm --ingroup jenkins-adm --disabled-login jenkins-adm
-	sudo usermod -G jenkins jenkins-adm
-fi
-if [ ! -d /home/jenkins-adm ]; then
-    sudo mkdir /home/jenkins-adm
-    sudo chown jenkins-adm.jenkins-adm /home/jenkins-adm
-fi
-
-
 declare -A user_host_groups u_shell
-
 sudo_groups='jenkins,jenkins-adm,sudo,adm'
 
 # if there's a need for host groups, a case statement on $HOSTNAME here that sets $GROUPNAME, say, should do the trick

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