O'Reilly logo
live online training icon Live Online training

Jenkins 2: Up and running

Consistency, security, robustness, and maintainability with pipelines as code

Brent Laster

Jenkins, the industry-standard continuous delivery (CD) orchestrator, has evolved. In the past, using Jenkins was all about filling in web forms and knowing the right incantations to get applications to integrate correctly to create a working pipeline. Jenkins 2 is centered around using pipelines as code and the associated programming environment. Pipelines can now be written as structured code, with a rich, descriptive DSL, and use powerful features to automate and simplify CD job chains.

Moving from the traditional Jenkins model to the pipeline-as-code model represents a huge opportunity for companies to evolve their CD pipeline to new standards of consistency, security, robustness, and maintainability. However, since Jenkins 2 is still relatively new, there is very little information available on how to do so. Join Jenkins expert Brent Laster to get up and running with Jenkins 2. In this three-hour course drawn from Brent's previous Migrating Jenkins Environments to Jenkins 2 training, you'll gain hands-on experience with Jenkins 2's object model and interface as you explore its new features and learn how to create pipelines as code.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • The new Jenkins 2 object model and interface
  • The new pipeline DSL (scripted version)

And you’ll be able to:

  • Use the new features and project types in Jenkins 2
  • Write a multistage pipeline as a Jenkins DSL script
  • Develop and execute pipelines as code

This training course is for you because...

  • You’re a Jenkins user or support person with investments in the traditional Jenkins model, and you need to understand the Jenkins 2 model.
  • You're a developer or tester with dependencies on Jenkins processing, and you want to learn what changes you may encounter using a pipeline-as-code model and what value it can provide.

Prerequisites

  • Experience working with the traditional Jenkins model
  • Basic familiarity with continuous delivery pipeline concepts
  • A working knowledge of Git (useful but not required)

Required materials and setup:

Recommended preparation:

Jenkins 2: Up and Running (book)

About your instructor

  • Brent Laster is a global trainer, author, and speaker on open source technologies as well as a senior R&D manager at a top technology company. He has been involved in the software industry for more than 25 years, holding various technical and management positions.

    Brent has always tried to make time to learn and develop both technical and leadership skills and share them with others. He believes that regardless of the topic or technology, there’s no substitute for the excitement and sense of potential that come from providing others with the knowledge they need to accomplish their goals.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Introduction to Jenkins 2 (30 minutes)

  • Lecture: Reasons for the evolution; installation differences; new project types; advantages of pipeline as code; about the DSL; using the script editor; understanding the stage view
  • Hands-on exercise: Start up your VM image and use Jenkins 2 to create a simple first pipeline

Pipeline tooling basics (30 minutes)

  • Lecture: DSL syntax; using username and password credentials in your script; using SSH credentials in your script; defining and accessing global tools; introducing the replay functionality
  • Hands-on exercise: Add a new build stage onto your pipeline; observe what encountering an error in a pipeline script looks like and use the replay functionality to construct a fix and verify that it works

Break (10 minutes)

Managing security with pipeline scripts and using shared libraries (30 minutes)

  • Lecture: Controlling script security—script approval, Groovy sandboxing; shared pipeline libraries—defining global shared libraries, using libraries and resources
  • Hands-on exercise: Add a global reference to a shared library in Jenkins; modify your pipeline script to incorporate the reference in place of the previous functionality

Incorporating external code directly and managing flow control (30 minutes)

  • Lecture: Plugin compatibility for pipeline scripts; loading external code to use; using the Snippet Generator; flow control in the pipeline—user inputs, timeouts, retries, other; controlling concurrency with milestones
  • Hands-on exercise: Modify your scripts to include external code and leverage the Snippet Generator to create code for flow control in the script (You’ll interact with a script waiting for user input.)

Break (10 minutes)

Global functions; exception handling in pipelines (30 minutes)

  • Lecture: Continuous passing style and what it means for pipelines; defining global functions; exception handling in pipelines
  • Hands-on exercise: Add a stage to your pipeline that uses a global function; work with user input in pipeline DSL and add exception handling

Wrap-up and Q&A (10 minutes)