A stage is a part of a pipeline that contains the logic to perform a major segment of a larger workflow defined in a pipeline. Stages are often based on the different workflow milestones, such as building, approving, and delivering.
The process of adding a stage to a pipeline is the same for all Harness modules. When you add a stage to a pipeline, you select the stage type, such as Build for CI or Deploy for CD. The available stage settings are determined by the stage type, and, if applicable, the module associated with the selected stage type.
This functionality is limited to the modules and settings that you have access to.
Add a stage
Create a pipeline in any module in your project.
In your pipeline, select Add stage and configure the stage settings.
You must provide a few initial settings to add a stage to a pipeline, and then you configure additional settings, such as Infrastructure or Stage Variables after adding the stage.
The available settings depend on the module and stage type. Go to your module's documentation for more information about that module's stage settings.
You can create the following stage types:
- Build: Build, test, and push artifacts to repositories.
- Deploy: Deploy services, serverless functions, or other workloads.
- Approval: Approve or reject changes during pipeline progress.
- Feature Flag: Enable or disable functionality remotely without redeploying code.
- Security Tests: Scan code, artifacts, and infrastructure for security vulnerabilities.
- Pipeline: Run a pipeline as a stage in another pipeline.
- Custom Stage: Set up a stage configurable to your needs.
For certain modules (CI, CD, STO, etc.), in the Execution tab, add steps to the stage to define the tasks to perform in that stage. The available steps depend on the stage type.
If a specific module or stage type isn't shown, make sure the module is enabled in your project. For more information, go to Create organizations and projects.
When you create a stage, you give it a name. Harness automatically creates and Id (Entity Identifier) based on the name. You can change the Id during initial stage creation; however, once the stage is saved, the Id becomes immutable.
You can change the Name at any time, but you can't change the Id.
Stage variables are variables that you add to a stage and then reference in the entity settings and steps in that stage. Stage variables can be custom variables or modify known variables (service variables, environment variables, etc.).
You can add stage variables in the Pipeline Studio's Visual Editor or YAML Editor.
To add stage variables, go to a stage's Overview tab, expand the Advanced section, and then select Add Variable.
- name: VAR_NAME
type: String ## String or Secret
Variable values can be fixed values, runtime inputs, or expressions.
Stage variables are available across the pipeline and you can override their values in later stages. You can also reference stage variables in files fetched at runtime. For example, you could create a stage variable called
NAME and then reference it in the Kubernetes
values.yaml file used by that stage by calling the stage variable expression:
<+stage.variables.NAME>. For example:
When you run this pipeline, the value you set for
NAME in the stage settings is supplied to the
To reference stage variables in the same stage where they are defined, use the expression
To reference stage variables in other stages, use the expression
Advanced stage settings
On the Advanced tab, you can configure: