Skip to content

Pipeline parameterization

Pipeline parameterization is a configuration strategy within Continuous Deployment (CD) tools, such as Spinnaker, that allows users to pass dynamic variables into a deployment pipeline at runtime.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]

Overview

In complex CD workflows, hardcoding values such as image tags, branch names, or specific repository details reduces the flexibility and reusability of deployment pipelines. Parameterization resolves this by allowing these values to be defined as parameters.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md] When a pipeline is executed, the user or an upstream system (like a build trigger) provides the specific values for these parameters, enabling a single pipeline definition to handle numerous deployment scenarios.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]

Common Parameters

Typical parameters used in pipeline stages include:

  • Image Name: Identifies the container image (e.g., dubbo-demo-service).^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]
  • Git Version: Represents the specific source code commit or branch.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]
  • Add Tag: An additional identifier appended to the image tag.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]
  • Commit ID: The unique hash for the code commit.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]

Application in Deployment Stages

Once parameters are defined in a pipeline configuration, they are referenced in subsequent stages using a specific syntax, often ${parameters.parameter_name}.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]

For example, when defining the container image for a Kubernetes Deployment, the image ID and tag can be constructed dynamically:

"imageId": "harbor.od.com/${parameters.image_name}:${parameters.git_ver}_${parameters.add_tag}",
"registry": "harbor.od.com",
"repository": "${parameters.image_name}",
"tag": "${parameters.git_ver}_${parameters.add_tag}"
^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]

This configuration ensures that the deployment stage uses the exact image version defined by the input parameters, facilitating a smooth transition from testing environments (like test) to production environments (like prod) without modifying the pipeline code itself.^[400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md]

  • [[Continuous Deployment]]
  • [[Infrastructure as Code]]
  • [[Software Delivery Pipeline]]

Sources

  • 400-devops__06-Kubernetes__k8s-paas__08.spinaker部署与应用.md