What is a Jenkins pipeline?

The CI/CD pipeline is a crucial part of DevOps operations. It automates steps in the software delivery process, such as:

  • initiating code builds
  • running automated tests
  • deploying to a staging or production environment

Automated pipelines remove manual errors, provide standardized development feedback loops, and enable fast product iterations.

A basic CI/CD pipeline process works like this:

svg viewer

Pipelines in Jenkins

In the traditional Jenkins, we created pipelines using “freestyle jobs” with the help of GUI. These freestyle jobs were replaced with the Jenkinsfile, which defined the pipeline in Jenkins-specific, Groovy-based, domain-specific language (DSL). The Groovy-based pipeline came with its own set of challenges. Therefore, it was later replaced with the declarative pipeline. The declarative pipeline format is a simplified way to write Jenkinsfile definitions. To distinguish one from the other, we call the older pipeline syntax a scripted pipeline, and the newer syntax a declarative pipeline.

Pipeline in Jenkins X

In Jenkins X, pipelines are defined in the YAML format in the file jenkins-x.yml. YAML is the golden standard for having any type of configurations and definitions, including Kubernetes. An example of a Jenkins X pipeline is given below.

extends:
import: classic
file: pipeline.yaml
agent:
label: jenkins-go
container: gcr.io/jenkinsxio/builder-go
pipelines:
release:
build:
steps:
- dir: env
steps:
- sh: jx step helm apply
name: helm-apply
pullRequest:
build:
steps:
- dir: env
steps:
- sh: jx step helm build
name: helm-build
Copyright ©2024 Educative, Inc. All rights reserved