configuration/hudson_slave_setup/mounthudsonworkspace
... ...
@@ -0,0 +1,7 @@
1
+#!/bin/bash
2
+# Expects an ephemeral volume to have been mounted at /ephemeral/data and
3
+# mounts that with a "bind" mount to /home/hudson/workspace.
4
+# The directory is then chown/chgrp'ed to hudson
5
+mount -o bind /ephemeral/data /home/hudson/workspace
6
+chgrp hudson /home/hudson/workspace
7
+chown hudson /home/hudson/workspace
configuration/hudson_slave_setup/mounthudsonworkspace.service
... ...
@@ -0,0 +1,12 @@
1
+[Unit]
2
+Description=Mount Hudson Workspace
3
+After=ephemeral-data.mount
4
+
5
+[Service]
6
+Type=oneshot
7
+ExecStart=/usr/local/bin/mounthudsonworkspace
8
+RemainAfterExit=true
9
+StandardOutput=journal
10
+
11
+[Install]
12
+WantedBy=multi-user.target
wiki/howto/development/ci.md
... ...
@@ -62,8 +62,10 @@ The basic idea of setting up a build job is to create a so-called "free-style so
62 62
63 63
In order to elastically scale our build / CI infrastructure, we use AWS to provide Hudson build slaves on demand. The Hudson Master (https://hudson.sapsailing.com) has a script obtained from our git at ``./configuration/launchhudsonslave`` which takes an Amazon Machine Image (AMI), launches it in our default region (eu-west-1) and connects to it. The AWS credentials are stored in the ``root`` account on ``hudson.sapsailing.com``, and the ``hudson`` user is granted access to the script by means of an ``/etc/sudoers.d`` entry.
64 64
65
-The image has been crafted specifically to contain the tools required for the build (as of this writing in particular Google Chrome, chromedriver and an old Firefox 26.0, plus a current Maven installation and the JDKs required for the build). In order to set up such an image based on Ubuntu, consider running the following commands as root (see also https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/):
65
+The image has been crafted specifically to contain the tools required for the build (as of this writing in particular Google Chrome, chromedriver and an old Firefox 26.0, plus a current Maven installation and the JDKs required for the build). In order to set up such an image based on Ubuntu, consider running the following commands as root (see also https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/), starting as the "ubuntu" used:
66
+
66 67
```
68
+ sudo -i
67 69
apt-get update
68 70
apt-get install -y unzip xvfb libxi6 libgconf-2-4
69 71
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
... ...
@@ -74,8 +76,13 @@ The image has been crafted specifically to contain the tools required for the bu
74 76
wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
75 77
cd /usr/bin
76 78
unzip /tmp/chromedriver_linux64.zip
77
-
79
+ exit
80
+ scp trac@sapsailing.com:/home/wiki/gitwiki/configuration/imageupgrade_functions.sh /tmp
81
+ sudo -i
82
+ source /tmp/imageupgrade_functions.sh
83
+ download_and_install_latest_sap_jvm_8
78 84
```
85
+
79 86
Furthermore, the ephemeral storage is partitioned with a ``gpt`` label into a swap partition with 8GB and the remainder as an ``ext4`` partition mounted under ``/ephemeral/data`` with is then bound with a "bind" mount to ``/home/hudson/workspace``. See the ``/etc/systemd/system/mounthudsonworkspace.service`` systemd service definition on the slave instances. The ``launchhudsonslave`` script launches the instance, checks for it to enter the ``running`` state, then tries to connect using SSH with user ``hudson``. The respective keys are baked into the image and match up with the key stored in ``hudson@hudson.sapsailing.com:.ssh``.
80 87
81 88
The ``launchhudsonslave`` script will then establish the SSH connection, launching the ``slave.jar`` connector. When the Hudson Master disconnects, the Java VM running ``slave.jar`` will terminate, and the next script command of ``launchhudsonslave`` will shutdown the host. This is possible for user ``hudson`` due to corresponding entries under ``/etc/sudoers.d``. The hosts are launched such that shutting them down will terminate the Amazon EC2 instance.