WA2944

Jenkins Pipeline Scripting Training

This Jenkins course goes beyond basic build jobs, providing a comprehensive overview of pipelines.  Pipelines support sophisticated CI/CD processes using a rich domain-specific language augmented by Groovy programming to automate tasks across multiple machines.

Course Details

Duration

2 days

Prerequisites

A knowledge of basic Jenkins is assumed, but no prior experience with pipelines is required.

Target Audience

Developers who will implement Continuous Integration using Maven, Jenkins and the Nexus repository manager.

Skills Gained

Ability to start automating your software build, test, and deployment activities following Jenkins best practices.
Course Outline

Chapter 1 Jenkins essentials refresh

Review of the fundamentals of Jenkins; baseline knowledge to study pipelines.

  • Continuous integration, continuous delivery
  • Jenkins as orchestration for build tasks
  • Jenkins job types
  • Scheduling and triggering jobs
  • Security

Chapter 2 Pipeline concepts

  • Role for pipelines
  • Declarative and scripted pipelines
  • Declarative pipeline end to end example
  • Scripted pipeline end to end example

Chapter 3 Pipeline domain specific language

  • Agents and nodes
  • Stages and steps
  • Workspaces
  • Shell and tools
  • Credentials and secret management
  • User input
  • Flow control
  • Stashing and archiving
  • Notification

Chapter 4 Distributed builds

  • Designing for scale
  • Controlling where jobs run
  • Configuration management
  • Considerations for distributed builds
  • State management
  • Concurrency concerns
  • Latency concerns

Chapter 5 Selected plugins

  • Git, GitHub, GitLab, Bitbucket
  • Gerrit
  • Artifactory
  • Jira
  • Sonar

Chapter 6 Groovy for pipelines

  • Groovy and Pipeline Groovy
  • How pipeline Groovy works
  • @NonCPS annotation
  • Good practices for pipeline code

Chapter 7 LIbraries

  • Role of libraries
  • Defining libraries
  • Library structure
  • Using libraries

Chapter 8 Extending pipelines with Groovy

  • Groovy syntax
  • Data types
  • Operators
  • Flow control
  • Try/catch and exceptions
  • Functions
  • Closures
  • Classes

Chapter 9 Best practices

  • A collection of best practices for writing and using pipelines.  Some common mistakes and how to avoid them.


The course features four labs, one for each half-day, for hands-on exploration of the topics covered in lecture and discussion.

Declarative and scripted pipelines

Explores pipelines, both declarative and scripted, using common commands.

Distributed and concurrent builds

Build on multiple nodes.  Parallel builds.  Jobs that run on nodes other than master.Parallel execution of jobs.  Sharing assets across parallel jobs;.  Demonstraton of race condition.

Libraries

Refactor a pipeline and move reusable code to a shared library.  Parameterize the library function to make it a more general utility.  Consume the library in a pipeline and make use of the utility function.

Groovy

Write a pipeline that uses Groovy to configure and run a complex combination of build and test conditions.