Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Jenkins Setup

Jenkins Setup

Overview

The DevOps Automation Accelerator Kit provides tools to install and configure Jenkins on clean servers with connectivity to a GIT SCM provider..

The Jenkins master and slave servers need to be provisioned as described by Prepare Infrastructure (CI Master) and Prepare Infrastructure (CI Slave).

Note: DevOps Automation Accelerator

For a copy of the DevOps Automation accelerator, see Download Prerequisites.

Configure Jenkins setup script

  1. Unzip the DevOps Automation accelerator to a local drive.
  2. Configure the property values in jenkins-setup/jenkins.properties.
    Property Description Example
    jdk_home The path to the JDK directory /opt/jdk1.7.0_51
    jdk_name The JDK display name jdk7u51
    jenkins_url The URL of the Jenkins server http://<server-host>:8080
    jenkins_git_username The username for Jenkins to use when executing Git commands "Build Master"
    jenkins_git_email The email address for Jenkins to use when executing Git commands jenkins@company.com
    admin_email The email address of the admin user. Used for password recovery. admin-user@company.com
    default_domain The company's default email domain @company.com
    smtp_host The SMTP host used to send email. smtp@company.com
    smtp_port The SMTP port 25

Run setup script

  1. Login to the server using the account created during server provisioning.
  2. Copy the jenkins-setup directory from the DevOps Automation project to your home directory on the server
  3. Execute the following commands:
    cd ~/jenkins-setup
    chmod u+x setup-jenkins-master.sh
    ./setup-jenkins-master.sh
  4. Open the Jenkins control panel at http://<server-url>:8080/

Configure Jenkins manually

There is additional manual configuration that needs to be done using the Jenkins control panel.

Tip:

If you need additional guidance, refer to Jenkins documentation:

Upgrade plugins

  1. Go to Manage Jenkins --> Manage Plugins
  2. Select Updates tab
  3. Select Maven Project Plugin check box
  4. Click the Download now and install after restart button

This also updates the Mailer plugin.

Configure and test email

  1. Go to Manage Jenkins --> Configure System
  2. Scroll to the E-Mail Notification section at the bottom of the page
  3. For additional SMTP configuration, click Advanced button
  4. To test SMTP connectivity, click Test configuration by sending test e-mail
  5. When done, click Save

Configure Jenkins slaves

  1. Go to Manage Jenkins --> Manage Nodes
  2. For each slave, click New node
    1. Enter Node name - by convention use slave username as node name
    2. Select Dumb slave
    3. Click OK, fill in the form as follows, then click Save
      Field Value Description
      Description (optional) Description of slave
      # of executors 1 The number of concurrent builds that Jenkins can perform.
      Remote FS root e.g. /home/<slave-username>/ The path to a directory on the slave system for this Jenkins node. Each slave node needs a separate directory.
      Labels slave Used to group slaves into logical groups.
      Usage Utilize this slave as much as possible Controls how Jenkins schedules builds on this machine.
      Launch method Launch slaves on UNIX machines via SSH Controls how Jenkins starts this slave.
      Host (required) The IP address or host name of the slave
      Credentials

      Click Add, then enter the username and password.

      When done, select the newly entered credential from the dropdown list.

      Credentials to login to the slave.

Add Git credentials

The Jenkins Git plugin requires a SSH key to connect to private Git repositories. For public Git repositories you can use the HTTPS URL to clone the repository without supplying credentials.

  1. Log onto Jenkins master using SSH
  2. Generate an SSH key.
    ssh-keygen -t rsa
    Hit enter when prompted for filename and passphrase.
  3. Add the private key to Jenkins master:
    sudo mv ~/.ssh/id_rsa /etc/ssh/github.key
    chmod 644 /etc/ssh/github.key
    sudo vi /etc/ssh/ssh_config
    Add the following to the bottom of the ssh_config file and save
    Host <github.host.name>
            IdentityFile /etc/ssh/github.key
            StrictHostKeyChecking no
            UserKnownHostsFile=/dev/null
  4. Add the public key to GitHub.
    1. Copy the text from running
      cat ~/.ssh/id_rsa.pub
    2. Add the public key to a GitHub account the Jenkins uses to access GitHub.
  5. Copy the github.key to all Jenkins slave servers.
    scp /etc/ssh/github.key <SLAVE_ADMIN>@<SLAVE_IP>:~
  6. On each slave server do:
    sudo mv ~/github.key /etc/ssh
    chmod 644 /etc/ssh/github.key
    sudo vi /etc/ssh/ssh_config 
    Add the following to the bottom of the ssh_config file and save
    Host <github.host.name>
            IdentityFile /etc/ssh/github.key
            StrictHostKeyChecking no
            UserKnownHostsFile=/dev/null
Note:

Remember to use the SSH GitHub URLs when defining Jenkins jobs, e,g. git@host:organization/repository.git

Create users

When Jenkins is first installed anonymous users have full administrative rights. The Jenkins Wiki explains how to setup security at https://wiki.jenkins-ci.org/display/JENKINS/Standard+Security+Setup.

Server administration

To start Jenkins: sudo service jenkins start

To stop Jenkins: sudo service jenkins stop