X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=jenkins-init-scripts%2FREADME;h=edc6d28ea508b7dc0006b6f1149332b293b15351;hb=7c8c0136203f61317e6904030f86dfbd5a6c402e;hp=2d85978ca931e86439b48887f7c5453f4990966c;hpb=7241784762aac203e0c1c35bf4d65a70d85a1b66;p=releng%2Fglobal-jjb.git diff --git a/jenkins-init-scripts/README b/jenkins-init-scripts/README index 2d85978c..edc6d28e 100644 --- a/jenkins-init-scripts/README +++ b/jenkins-init-scripts/README @@ -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 --recurse-submodules 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"