Skip to content

Jenkins-Spinnaker integration pipeline

A Jenkins-Spinnaker integration pipeline connects continuous integration (CI) and continuous delivery (CD) workflows by leveraging Jenkins to build application artifacts and Spinnaker to orchestrate their deployment to infrastructure, such as Kubernetes.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

This setup allows teams to utilize Jenkins for compiling code and creating Docker images, while using Spinnaker to manage complex deployment strategies, versioning, and release orchestration across different environments (e.g., testing and production).^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

Architecture

The integration relies on a series of microservices within Spinnaker communicating with Jenkins.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

  • Igor: The Spinnaker service responsible for triggering Jenkins jobs. It acts as the bridge between the Spinnaker pipeline and the Jenkins CI server.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]
  • Orca: The orchestration engine that executes the pipeline stages defined in Spinnaker.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]
  • Gate: The API gateway that serves as the entry point for Spinnaker's UI and external API calls.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

In this configuration, Jenkins handles the "Build" stage (e.g., mvn clean package and docker build), and Spinnaker manages the subsequent "Deploy" stages.

Configuration

To enable the integration, Spinnaker must be configured with Jenkins credentials and endpoint details.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

A typical configuration (defined in igor-local.yml) includes:

jenkins:
  enabled: true
  masters:
    - name: jenkins-admin
      address: http://jenkins.od.com
      username: admin
      password: admin123
  primaryAccount: jenkins-admin

Once configured, Spinnaker can trigger parameterized builds in Jenkins, retrieving build metadata such as version numbers and commit IDs.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

Pipeline Stages

A standard Jenkins-Spinnaker pipeline typically consists of the following stages:

  1. Jenkins Build: Spinnaker triggers a Jenkins job using parameters like git_ver (branch or tag) and add_tag (custom version tag).^[400-devops-06-kubernetes-k8s-paas-08spinaker.md] Jenkins builds the binary, creates a Docker image, and pushes it to a registry (e.g., Harbor).^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

  2. Find Image: Spinnaker locates the newly created image in the registry using the tag produced by the Jenkins build.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

  3. Deploy (Manifest/Server Group): Spinnaker deploys the image to a Kubernetes cluster. This involves creating or updating a Kubernetes Deployment (referred to as a Server Group in Spinnaker).^[400-devops-06-kubernetes-k8s-paas-08spinaker.md] The deployment configuration specifies details such as:

    • Account: The Kubernetes cloud account (e.g., cluster-admin).
    • Namespace: The target environment (e.g., test or prod).
    • Containers: The specific Docker image and container ports.
    • Strategy: The deployment method, typically "Rolling Update" (Red/Black) or "Recreate".^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]
  4. Advanced Configuration: Spinnaker allows for complex configurations during deployment, such as:

    • Environment Variables: Injecting variables like JAR paths or configuration references (e.g., Apollo configuration).
    • Resource Limits: Setting CPU and memory requests/limits.
    • Sidecars: Adding containers like filebeat for logging purposes.
    • Health Checks: Defining readiness probes to ensure the application is live before receiving traffic.^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]

Sources

^[400-devops-06-kubernetes-k8s-paas-08spinaker.md]