MAE Continuous Integration Administration guide July 8th, 2013.

24
MAE Continuous Integration Administration guide July 8th, 2013

Transcript of MAE Continuous Integration Administration guide July 8th, 2013.

Page 1: MAE Continuous Integration Administration guide July 8th, 2013.

MAE Continuous Integration Administration guide

July 8th, 2013

Page 2: MAE Continuous Integration Administration guide July 8th, 2013.

Agenda

• Introducing Jenkins

• Installing and running Jenkins

• Jenkins Terminology

• Securing Jenkins

• Managing plugins

• Jobs creation and configuration

Page 3: MAE Continuous Integration Administration guide July 8th, 2013.

Introducing Jenkins

• Jenkins is a powerful and widely used open source continuous integration server providing development teams with a reliable way to monitor changes in source control and trigger a variety of builds.

• Jenkins plugin system allows Jenkins to be extended to meet specific needs of individual projects.

Page 4: MAE Continuous Integration Administration guide July 8th, 2013.

Installing and running Jenkins

• Software Prerequisites:

─ only one prerequisite, a Java Runtime Environment (JRE) compatible with Java 6 or higher

─ sudo yum install java• On Red Hat Enterprise Linux (RHEL), you can

install Jenkins through yum:

─ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

─ sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

─ sudo yum install jenkins

Page 5: MAE Continuous Integration Administration guide July 8th, 2013.

Installing and Running Jenkins

• Starting and Stopping Jenkins on RHEL

─ sudo service jenkins start/stop/restart• Jenkins Log Files on RHEL

─ Log file will be placed in /var/log/jenkins/jenkins.log

• Jenkins Configuration on RHEL

─ /etc/sysconfig/jenkins will capture configuration parameters for the launch

• Upgrading Jenkins on RHEL

─ sudo yum update jenkins

Page 6: MAE Continuous Integration Administration guide July 8th, 2013.

Jenkins Terminology

Term Description

Master/Slave Slaves are Jenkins nodes that are configured to build projects for a master. Jenkins runs a separate program called "slave agent" on slaves. When slaves are registered to a master, a master starts distributing loads to slaves.

Job/Project A runnable task that is controlled / monitored by Jenkins

Publisher A publisher is part of the build process other than compilation, for example JUnit test runs. A publisher may report stable or unstable result depending on the result of its processing. For example, if a JUnit test fails, then the whole JUnit publisher may report unstable.

Page 7: MAE Continuous Integration Administration guide July 8th, 2013.

Jenkins Terminology

Term Description

Completed Build A build is completed, if it was started and finished with any result, including failed builds.

Stable build A build is stable if it was built successfully and no publisher reports it as unstable.

Unstable build A build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the build will be marked unstable.

Broken/Failed build A build is broken if it failed during building. That is, it is not successful.

Successful build A build is successful when the compilation reported no errors.

Page 8: MAE Continuous Integration Administration guide July 8th, 2013.

Jenkins Terminology

Term Description

Upstream project A project can have one or several upstream projects, which means that a build for the current project may be scheduled when an upstream build is finished.

Downstream project

A project can have one or several downstream projects, which means that a build for the downstream project may be scheduled when the current build is finished.

Page 9: MAE Continuous Integration Administration guide July 8th, 2013.

Securing Jenkins

─ Out of the box Jenkins has no security enabled.

─ To enable security, check Enable security in the global configuration.

─ Once security is enabled it is possible to set up desired security settings:

Page 10: MAE Continuous Integration Administration guide July 8th, 2013.

Securing Jenkins

• Authentication and Authorization

─ Security Realm: Atlassian Crowd

Page 11: MAE Continuous Integration Administration guide July 8th, 2013.

Securing Jenkins

• Authentication and Authorization

─ Access-control: Project-based Matrix Authorization Strategy

Page 12: MAE Continuous Integration Administration guide July 8th, 2013.

Securing Jenkins

• Project-based Matrix Authorization Strategy permissions

o Overall - global activities such as administration rights

o Slave - management of Jenkins slave instanceso Job - create, manage, edit, and delete jobso Run - specific build jobso View - build job viewso SCM - source code management systemso Artifactory - release/promote artifacts in binary

repository

Page 13: MAE Continuous Integration Administration guide July 8th, 2013.

Securing Jenkins - Troubleshooting

• Disabling security when locked out:

─ edit the file config.xml in your JENKINS_HOME and set:<useSecurity>false</useSecurity>

─ with security disabled you will have full access to Jenkins and be able to troubleshoot and fix security configuration.

• !!! Warning: with security disabled all Jenkins management functions will be available to non-authenticated user, be sure to block public access to Jenkins instance before disabling security.

Page 14: MAE Continuous Integration Administration guide July 8th, 2013.

Managing Plugins

• Jenkins plugin management is available via Manage Jenkins and selecting the Manage Plugins link.

• administration interface allows you see what plugin versions are currently installed, update them and install new ones as well as manage some advanced settings

• plugins allow you to support many new features beyond a basic Jenkins install as well as modify the user interface and transform Jenkins into the CI server your project needs

Page 15: MAE Continuous Integration Administration guide July 8th, 2013.

Managing Plugins

Page 16: MAE Continuous Integration Administration guide July 8th, 2013.

Creating New Job

• To create a new Jenkins project

─ click on New Job in the left navigation menu, which will display the New Job form

Page 17: MAE Continuous Integration Administration guide July 8th, 2013.

Common Job Configuration Settings

• General Project Settings

─ project name, description and other general parameters

• Advanced Project Options

─ miscellaneous settings for advanced usage.• Source Code Management

─ source code management-related parameters for various systems

• Build Triggers

─ how builds are started• Post-build Actions

─ steps taken after a build completion

Page 18: MAE Continuous Integration Administration guide July 8th, 2013.

Working with Maven Builds

• After configuring the general project options one or more build steps can be configured

• To add a build step, click on the Add build step button and select Invoke Maven 3

Page 19: MAE Continuous Integration Administration guide July 8th, 2013.

Working with Apache Ant builds

• After configuring the general project options one or more build steps can be configured

• To add a build step, click on the Add build step button and select Invoke Ant

Page 20: MAE Continuous Integration Administration guide July 8th, 2013.

Working with Gradle Builds

• After configuring the general project options one or more build steps can be configured

• To add a build step, click on the Add build step button and select Invoke Gradle

Page 21: MAE Continuous Integration Administration guide July 8th, 2013.

Working with Source Control - Git

• By default Jenkins has support for Git, Subversion and CVS pre-installed.

• Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

• Atlassian Stash provides a central place to create and manage Git repositories hosted on MAE

Page 22: MAE Continuous Integration Administration guide July 8th, 2013.

Working with source control - Git

• By default Jenkins has support for Git, Subversion and CVS pre-installed.

• Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

• Atlassian Stash provides a central place to create and manage Git repositories hosted on MAE

Page 23: MAE Continuous Integration Administration guide July 8th, 2013.

Git – Global Configuration

• Once Git is configured in the global Jenkins configuration project-specific Git settings can be configured.

Page 24: MAE Continuous Integration Administration guide July 8th, 2013.

Git - Project Configuration

• Select Git under the Source Code Management section of the Job configuration