Skip to content

Jenkins CI/CD Pipeline

A Jenkins CI/CD Pipeline is an automated workflow used to build, test, and deliver software within a DevOps environment.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] It serves as the bridge between source code repositories (like Git) and runtime environments (such as Kubernetes clusters), transforming code into deployable artifacts like container images.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]

Workflow Architecture

In a typical Kubernetes-based delivery architecture, the Pipeline functions as the central automation engine^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md].

  1. Pull: Developers commit code to a Git repository. Jenkins pulls the specified source code from this repository.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
  2. Build: Jenkins compiles the source code. For Java applications, this typically involves tools like Maven to package the code into a JAR file.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
  3. Package: The compiled artifacts are moved into a specific directory (e.g., project_dir) to be prepared for containerization.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
  4. Image: A Dockerfile is generated or applied, and the code is built into a container image.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md] This image is then pushed to a Docker Registry, such as Harbor.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]
  5. Deploy: The final image is applied to the Kubernetes cluster using resource manifests (YAML files), making the service live.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]

Configuration

Pipelines are typically configured using a "Pipeline script" which defines the stages of the workflow^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]. This script often accepts parameters to customize the build process, such as:

  • app_name: The name of the application.
  • git_repo: The URL of the source code repository.
  • git_ver: The specific branch or commit hash to build.
  • image_name: The target name for the Docker image.
  • base_image: The foundational OS or runtime image (e.g., jre8:8u112).
  • mvn_cmd: Maven commands to execute for compilation.^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]

Integration with BlueOcean

The BlueOcean plugin is often used to enhance the user experience of Jenkins Pipelines^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]. It provides a visual representation of the Continuous Delivery (CD) pipeline, allowing users to visualize complex pipelines, view branch status, and trace the flow of features from build to deployment more intuitively than the standard interface^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md].

Sources

^[400-devops-06-kubernetes-k8s-paas-05k8scicd.md]