Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / jenkins-init-scripts / README
index 8548786..edc6d28 100644 (file)
@@ -1,15 +1,37 @@
-The files in this directory are for initializing a Jenkins minion just before
-the cloud plugin hands the minion over to Jenkins.
+The files in this directory are for initializing a Jenkins minion just
+before the cloud plugin hands the minion over to Jenkins.
 
-init.sh is the entry point script which then calls all other scripts.
+The Jenkins 'init.sh' script will check for a project specific init
+script: '$ciman_root/jenkins-init-scripts/local-init.sh'.  If the file
+exits and is executable, it will be executed. Note the local init
+script will be executed before the 'jenkins' user has been created.
+You can also call a project specific script from the Jenkins Manged
+File after the call to 'init.sh'.
 
-init.sh also provides a local init script entry point by checking for the
-existance of the file CIMAN_ROOT/jenkins-init-scripts/local-init.sh. If this
-file exists it can be used to further customize the server node before handing
-it to Jenkins for job use.
-
-To use this create a managed file in Jenkins with the contents:
+To use this create a Jenkins Managed File with the contents:
 
     #!/bin/bash
-    git clone https://gerrit.example.org/r/ci-management.git /opt/ciman
-    /opt/ciman/jjb/global-jjb/jenkins-init-scripts/init.sh
+
+    exec > /var/log/jenkins-init.log 2>&1
+
+    gerrit_host=gerrit.example.org
+    ciman_root=/opt/ciman
+
+    until host $gerrit_host &>/dev/null ; do
+        echo "Waiting until $gerrit_host is resolvable..."
+        sleep 1
+    done
+
+    git clone --recurse-submodules https://$gerrit_host/r/ci-management $ciman_root
+
+    # Specify swapspace on the minion
+    # SWAP_SIZE specifies the size of swapspace in GB If set to '0' no
+    # swapspace will be allocated If unset, 1GB swapspace will be
+    # allocated
+    #export SWAP_SIZE=0
+
+    $ciman_root/global-jjb/jenkins-init-scripts/init.sh
+
+    rm -rf $ciman_root
+
+    echo "jenkins-init: Done"