DEV@cloud » Getting started with Jenkins

Getting started with Jenkins

Last modified by John Baker on 2012/01/21 20:14

Welcome to CloudBees Jenkins as a Service!

In this article, we'll explain how to setup your first continuous integration project so that Jenkins will email you whenever anyone breaks your build.

Subscribing to the CloudBees Jenkins Service

To get to your Jenkins instance, select the Home tab on any CloudBees page (e.g. https://grandcentral.cloudbees.com/) and select Jenkins Builds under My Services.  This will take you to your Jenkins instance.
SelectJenkins.png

Configuring a Job

  1. Click on the New Job link on the left.
     NewJob.png 
  2. Enter the job name and choose the type of build you want to perform. Use freestyle jobs for non-maven builds. Click ok.
    newjob.png
  3. You should now be on the configuration page for the job you just created. You should config Jenkins to discard old builds to help not go over quota. 60 days is a good default.discardoldbuilds.png
  4. Next lets choose the JDK you want to build with
    jdk.png
  5. The SCM section allows you to tell Jenkins how to checkout your code.  We're using Subversion, but you can also follow this guide if you are using Git.
    svn.png
  6. After you enter the repository URL and click  somewhere else on the page, you will be prompted to enter your Subversion credentials if they are required. Enter the credentials, press OK, and close the pop-up window (or tab).
    credentials.png
  7. Now you want to tell Jenkins when to build our project.
    • Back on the build configuration screen, in the Build Triggers section you can select the Poll SCM option.
    • Whenever changes are detected, a new build will be started.
    • Set it to poll SVN every 15 minutes.  
      pollscm.png
  8. In the Build section, you can configure maven versions and targets.
    • Use the default target (install), but make sure to choose the Use private Maven repository option.  This will cache your maven artifacts with your project source code so each build doesn't have to re-download these every time.
      buildmaven.png
  9. We would like to be notified any time the build fails, so click Email Notification and enter the list of email addresses who should be notified in the Recipients field.emailnotification.png
  10. Finally, we want this project to deploy any snapshot artifacts to our private snapshot repository.  This will allow downstream (dependent) builds to see these artifacts in future builds.  Click on the Deploy artifacts to my Private CloudBees Repository
    deployToPrivateRepo.png
  11. Now you can click Save and the job is ready to be run.
  12. To force the first build, click the Build Now link on the left menu.
    buildnow.png
  13. The build will be queued up, waiting for a build executor. This may take a couple of minutes, depending on overall system load, but is usually very fast.  Once the build is in progress you will see an animation indicating a build is in progress.  You can click on this animation to see the build output.
    inprogress.png
  14. Watching the build output is a good idea so that you can see if there are any problems without having to wait for the entire build.
    buildconsole.png
  15. Once the build is complete, we can click on the build number and see the list of Maven modules which were built.  By clicking on an individual maven build, we can see it's artifacts.  If there were any tests run, their results would also be displayed here.
    artifacts.png
  16. Jenkins will continue to monitor this project and perform a build whenever someone commits new code. If those commits break the build or any tests, you and your team will be notified.
Tags:
Created by Ivan Meredith on 2011/07/21 00:48
 


All Rights Reserved - CloudBees, Inc. - 2012
XWiki Enterprise