Presentation on theme: "MAE Continuous Integration Administration guide July 8th, 2013."— Presentation transcript:
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
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.
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
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 Conﬁguration on RHEL ─ /etc/sysconfig/jenkins will capture configuration parameters for the launch Upgrading Jenkins on RHEL ─ sudo yum update jenkins
Jenkins Terminology TermDescription Master/SlaveSlaves 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/ProjectA runnable task that is controlled / monitored by Jenkins PublisherA 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.
Jenkins Terminology TermDescription Completed BuildA build is completed, if it was started and finished with any result, including failed builds. Stable buildA build is stable if it was built successfully and no publisher reports it as unstable. Unstable buildA 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 buildA build is broken if it failed during building. That is, it is not successful. Successful buildA build is successful when the compilation reported no errors.
Jenkins Terminology TermDescription Upstream projectA 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.
Securing Jenkins ─ Out of the box Jenkins has no security enabled. ─ To enable security, check Enable security in the global conﬁguration. ─ Once security is enabled it is possible to set up desired security settings:
Securing Jenkins Project-based Matrix Authorization Strategy permissions o Overall - global activities such as administration rights o Slave - management of Jenkins slave instances o Job - create, manage, edit, and delete jobs o Run - speciﬁc build jobs o View - build job views o SCM - source code management systems o Artifactory - release/promote artifacts in binary repository
Securing Jenkins - Troubleshooting Disabling security when locked out: ─ edit the ﬁle conﬁg.xml in your JENKINS_HOME and set: false ─ with security disabled you will have full access to Jenkins and be able to troubleshoot and fix security conﬁguration. !!! 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.
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
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
Common Job Conﬁguration 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
Working with Maven Builds After conﬁguring 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
Working with Apache Ant builds After conﬁguring 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
Working with Gradle Builds After conﬁguring 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
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
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
Git – Global Configuration Once Git is configured in the global Jenkins conﬁguration project-speciﬁc Git settings can be configured.
Git - Project Configuration Select Git under the Source Code Management section of the Job configuration