Propagate and Override CD Services
You can use the same CD stage Services across your Pipeline stages. Once you have multiple Services, Harness lets you select from these Services in any stage.
In many cases, you'll want to use some of the propagated Service's settings, such as manifests, but want to override others, such as values.yaml files, artifacts, or variables. Harness lets you propagate and override.
This topic describes how to propagate and override Services.
In this topic:
- Before You Begin
- Visual Summary
- Step: Propagate a Service
- Option: Override Service Settings
- Overriding Manifests
- YAML Example
- Option: Overriding Values without Propagation
Before You Begin
- Service propagation is progressive: you can only propagate Services from stage to stage in a forward direction in your Pipeline. For example, Stage 2 cannot propagate a Service from Stage 3.
- When propagation is set up between a parent stage and child stage, moving the parent or child stage out of sequence resets any propagated settings to their defaults. If you do this, you will be prompted to confirm. If you confirm, the stages are reset to their defaults.
The following video provides a quick overview of Service propagation and overriding.
Step: Propagate a Service
Open or create a Pipeline with at least one stage.
Click the plus sign (+) or click Add Stage after the first stage to add another stage to the Pipeline and click Deploy.
Enter a stage name and click Set Up Stage.
The new stage is added to the Pipeline.
Click the Service tab if it is not already selected.
The propagation option appears.
Click Propagate from and then select the stage with the Service you want to use.
You can see the stage name and Service name.
This stage now uses the exact same Service as the stage you selected.
Option: Override Service Settings
Once you select a stage, the Override artifacts, manifests, service variables for this stage option appears.
Enable this option.
Now Service settings appear.
Any settings you configure here will override their corresponding settings in the propagated Service.
A common example is to add a new values.yaml file for this stage's Service:
This values.yaml file will override the values.yaml file from the propagated Service.
If you want to override the Kubernetes manifest, Helm Chart, Kustomize manifest, or OpenShift Template from the Service you are propagating, you must match the Id used by the manifest in the Service you are propagating.
Here you can see the same Id used in the parent stage and the child stage that propagates and overrides:
If you do not use the same Id, you will see an error like the following during deployment:
"Invalid request: There can be only a single manifest. Select one from K8sManifest, HelmChart, Kustomize, OpenshiftTemplate"
When you propagate a stage's Service, the child stage's settings in YAML indicate propagation with
useFromStage and overrides are indicated with
Option: Overriding Values without Propagation
There are other ways to override the values.yaml file without propagation.
You can overlay values files in Harness by adding multiple files or you can replace file paths dynamically at runtime.