Atchai scripts and configuration related to the Jenkins CI server
-
Your project needs to have the following structure:
- project root
- drupal.py
- fabfile.py - Customised version of
fabfile-example.py
- public - Your Drupal install, you can set the name of this directory in your fabfile using the
public_path
parameter todrupal.deploy()
- test
- TestSuite.html - A selenium test suite as created by the Selenium IDE
- TestXXXX.html - Selenium tests
- project root
-
If the server that's hosting your git repository (git server) or the stage/build server have not been used by Jenkins before you will need to perform the following ssh key setup on each server:
ssh <hostname>
sudo su jenkins
cat ~/.ssh/id_rsa.pub
- Copy the key (output of the above command) and add to the git server
cd /tmp
git clone <repo url>
-
Navigate and log in to the Jenkins server
-
Click "New Job"
-
Enter a name and select "Build a free-style software project" then click "OK"
-
Under "Source Code Management" select "Git"
-
Set your repository URL (e.g. "Repository URL"). If you haven't setup jenkins with this git server before you'll need to do the following:
-
Set your branch. Usually just
master
but you can use**
to build all branches. -
Under "Build Triggers" select "Poll SCM"
-
Set the schedule. To poll the git for changes once a day at midnight, for example, use the following:
0 0 * * *
-
Under "Build" add a new build step of type "Execute shell"
-
Set the following to deploy the test site:
fab -f $WORKSPACE/fabfile.py test deploy
-
Under "Build" add a new build step of type "Execute shell"
-
Set the following to run Selenium tests (be sure to change
<test site url>
):DISPLAY=":99" java -jar $JENKINS_HOME/selenium-server-standalone-2.19.0.jar -browserSessionReuse -htmlSuite *firefox <test site url> $WORKSPACE/test/TestSuite.html $WORKSPACE/seleniumhq/result.html
-
Under "Post-build Actions" select "Publish Selenium Report"
-
Set "Test report HTMLs" to
seleniumhq/result.html
-
Under "Post-build Actions" select "E-mail Notification"
-
Set "Recipients" as appropraite
-
Select "Send e-mail for every unstable build"
-
Click "Save"