Jenkins - sitcomlab/IPED-Toolkit GitHub Wiki

Table of Contents

  1. Installation
  2. Create Project

A. Installation

  1. Install Jenkins via apt-get (http://pkg.jenkins-ci.org/debian).
  2. Configure /etc/default/jenkins (e.g., change port)
  3. Browse to Jenkins frontend (e.g., http://giv-sitcomlab.uni-muenster.de:4711).
  4. Go to "Jenkins verwalten" ("Manage Jenkins"), "Globale Sicherheit konfigurieren" ("Configure Global Security") and set settings according to screenshot.
  5. Re-load Jenkins frontend and select option to create a new user account.
  6. Create two new accounts: one for administering Jenkins, one for Github.
  7. Continue as admin (not as github user).
  8. Install the following plugins: GitHub plugin, GIT client plugin, GIT plugin, GitHub API Plugin, Github Authentication plugin, SCM API Plugin. Use the Jenkins frontend to do so. Maybe you have to force a manual refresh of Jenkins' plugin repository ("Plugins verwalten", "Erweiterte Einstellungen", "Letzte Datenaktualisierung des Update-Centers: ..." -> "Jetzt aktualisieren").
  9. Proceed to configure Jenkins as required (e.g., change project title etc.).

B. Create Project

  1. Click on "Neuen Element [sic] anlegen" ("Create new element").
  2. Choose a name and select "'Free Style'-Softwareprojekt bauen".
  3. Edit info to your liking (cf. screenshot).
  4. "Git Repositories": Click on "Add" next to "Credentials". Select "SSH Benutzername und privater Schlüssel". Set "Gültigkeitsbereich" to "Global", "Benutzername" to "jenkins", "Privater Schlüssel" to "Aus ~/.ssh des Jenkins Masters". Use SSH to log onto the server. Change the user ("su - jenkins") and follow Github's Instructions on how to create a public SSH key. Use the copy the content of id_rsa.pub to your clipboard and associate it with your (or someone elses) Github account.. Test the connection by issuing "ssh -T [email protected]" on the server as user "jenkins". Consult Github's help if that does not work out of the box.
  5. "Build-Auslöser": Generate a truly random authentication token. Remember it, Github needs it.
  6. Save the changes.
  7. In the Github Project Settings, select "Webhooks & Services" and click on "Add webhook".
  8. Set the "Payload URL" to "http://ABC:XYZ@JENKINS_URL:PORT/job/PROJECT_TITLE/build?token=AUTH_TOKEN". "ABC" is the Github user we created in step A.6. XYZ is the according password. Choose the URL and the port accordingly to your server (DNS) setup. Match the PROJECT_TITLE to your Jenkins' project title (remember to url-encode white spaces etc.). Paste the auth token from step B.5. Example: http://github:[email protected]:4711/job/iPED%20Toolkit%20Github/build?token=zFParIBTkFjRnGzmNOh9NDpyYFOvFJuKsCUvZZ1aJYoiMhZQbEvib4280KUO4ps
  9. Set "Content Type" to "application/json".
  10. No "Secret"
  11. Select "Just the push event." and "Active" (cf. screenshot).
  12. Save the webhook and test it by pushing something to the master branch.

You may create more Jenkins project as required (e.g., one for the master branch, one for the development branch and so on).