1. Home
  2. Training Library
  3. Jenkins CICD - Intro

Jenkins Scripted Pipelines

play-arrow
Start course
Overview
DifficultyIntermediate
Duration1h 47m
Students114
Ratings
5/5
star star star star star

Description

Introduction

This training course introduces you to Jenkins, a popular open source tool used to perform Continuous Integration and Continuous Delivery.

We spend time early on reviewing the key Jenkins features and associated terminology. We then take you through a deep dive in configuring Jenkins to perform automated builds using the Jenkins web administration console in hands on demonstrations, ensuring that you become familiarised with Jenkins and how to administer it. We’ll demonstrate features such as:

  • Installing and setting up Jenkins
  • Creating and configuring pipelines manually
  • Creating and configuring pipelines using a Jenkinsfile
  • Configuring Jenkins pipelines using the Blue Ocean interface
  • Defining build execution environments using docker containers
  • Triggering build pipelines, manually and automatically
  • Navigating downstream and upstream build projects
  • Connecting to version control repositories such as GitHub
  • Setting up build pipelines for Java based projects using Gradle
  • Recording artifacts and test results
  • Setting up and scaling out Jenkins with multiple build agents and executors using SSH

Learning Objectives

What you'll learn:

  • The basic principles of build automation as implemented within Jenkins and how should be a applied to manage and maintain building, testing, and deploying your own enterprise software projects
  • How to install, setup, and configure Jenkins pipelines
  • The key differences between Jenkins declarative and scripted pipelines
  • How to manage build artifacts and test results
  • How to scale out Jenkins using Master and Build Agent setups using SSH
  • The benefits of codifying pipeline build instructions using a Jenkinsfile
  • How to leverage Docker containers within a Jenkins pipeline to provide additional build isolation and flexibility
  • How to install and use the newer more modern pipeline centric BlueOcean user interface
  • How to integrate and leverage 3rd party build tools like Gradle, Maven, Yarn, Webpack, and many more within a Jenkins pipeline

Demonstration

This training course provides many hands on demonstrations where you will observe first hand how to use Jenkins to build and release different types of software projects, for example:

  • Building a front end application which has been developed using the React Javascript framework, using technologies such as Webpack and Yarn
  • Building a back end application developed using Java, Gradle, and Docker, requiring Jenkins to compile the source code, packaging it into a WebArchive file, and then finally releasing it into a Tomcat based Docker image complete with Splunk based instrumentation for logging and monitoring

Prerequisites

  • A basic understanding of CICD, or Continuous Integration and Continuous Delivery
  • A basic understanding of software development and the software development life cycle
  • A basic understanding of version control and associated workflows

Intended Audience

  • Software Build and Release Engineers
  • Software Developers
  • DevOps Practitioners

Transcript

- [Instructor] Welcome back! In this lecture, we'll introduce you to the Jenkins scripted pipelines syntax. 

The scripted pipeline syntax caters for a freestyle coded approach, meaning that it is a lot more flexible than its counterpart, and therefore is suited towards complex pipeline development, but for which requires you to be more knowledgeable coding wise. 

Okay, let's begin. The scripted pipeline structure looks like the following. Key points of the scripted syntax are: the syntax uses a programmatic or coding style to provide a high degree of flexibility and customization, the syntax uses Groovy as the scripting language, and the script typically starts with the node keyword to indicate that it is a scripted pipeline. 

Okay, let's now take a closer look at a couple of more in-depth examples using the scripted pipeline syntax. In this first example, you should be able to quickly see and appreciate the flexibility and expressiveness that the scripted syntax provides. 

Key points of this scripted pipeline example are: the ability to encapsulate complex logic into helper methods, the ability to define variables and assign and update their values, the ability use control flow statements to control build logic, and seeing that exception handling is possible using try catch blocks, enabling recovery from non-fatal build errors. The next scripted example is used to illustrate not so much how to build a particular flavor of technology such as Java versus .Net, but instead how to manage the Jenkins build environment itself. In this case it highlights how to setup an external workspace, which is then shared by two different nodes within the same pipeline execution. 

Key points of this scripted pipeline example are: multiple different labeled nodes are used, a shared external workspace is used, the first node builds the project using Maven, and the second node then performs testing within a try catch block reusing the same workspace. 

Okay, go ahead and close this lecture and we'll see you shortly in the next one, where you're provided with further hands on demonstrations showing you how to set up, configure, execute, and troubleshoot build pipelines.

About the Author

Students11075
Labs28
Courses65
Learning paths15

Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.

Jeremy holds professional certifications for both the AWS and GCP cloud platforms.