ros-industrial / jenkins_config

Contains jenkins CI configuration scripts.
4 stars 6 forks source link
Jenkins Configuration Instructions

============== Instructions to configure jenkins for building ros industrial repos

Required packages

Installation steps

  1. Install jenkins

  1. Install associated tools

    sudo apt-get install cppcheck
    sudo apt-get install cloc
    sudo apt-get install python-rosinstall
  2. Access jenkins from a browser

  1. Install the following plugins

    • Go to the jenkins home page and then to the Manage Plugins link:
    • Manage Jenkins -> Manage Plugins
  1. Configure jenkins

    • From jenkins home page go to:
    • Manage Jenkins -> Configure System
    • Under "Home directory" hit the "Advanced..." button
    • Set the "Workspace Root Directory" as "${ITEM_ROOTDIR}/workspace"
    • Set the "Build Record Root Directory" as "${ITEM_ROOTDIR}/build"
  2. Installing the "jenkins_config" repo

  1. User Controls (Optional)

    If access controls or other security are used on the jenkins server, then some care must be taken to ensure that the job scripts run correctly.

Credentials are required in order to create jobs. For a terminal session, credentials can be entered using the jenkins login command cd java -jar jenkins-cli.jar -s login --username --password . ./jenkins_config/scripts/trigger_jobs.sh

In most cases, credentials aren't required for the scripts to initiate a build

  1. Email setup (Optional)

The automatically created jenkins jobs aren't configured to send emails after each build. In order to have jenkins send email notifications after each build open jenkins from a browser and do the following:

SMTP server - smtp.gmail.com
Default user e-mail suffix - @gmail.com

Use SMTP Authentication - yes
User Name - your.email
Password - p**d

Use SSL - yes
SMTP Port -465
Reply-To Address - noreply@gmail.com
Charset - UTF-8

Note:

The configuration above requires a vaild gmail account. If a non gmail account is used then the SMTP server information needs to be changed accordingly. Regardless of the SMTP, the job can send notifications to emails from any domain.

Creating new jenkins jobs

my_new_job.rosinstall:
    - git: {local-name: src/great_repo, version: stable-branch, uri: 'https://github.com/my_repos/great_repo.git'}  
    - git: {local-name: src/really_cool_repo, version: awesome-branch, uri: 'https://github.com/my_repos/really_cool_repo.git'}  
    - git: {local-name: src/broken_repo, version: broken-branch, uri: 'https://github.com/my_repos/broken_repo.git'}  
    - git: {local-name: src/much_cooler_repo, version: awesome-branch, uri: 'https://github.com/my_repos/much_cooler_repo.git'}  
Note:

It is required that each repository gets saved in the "src" directory of the job's workspace, otherwise it will not be built.

Jenkins tips

Login as the jenkins user

    sudo su jenkins

Go to the jenkins home

    sudo su jenkins
    cd

Force a jenkins restart from a terminal

    sudo /etc/init.d/jenkins restart