Pipelines define your release process using multiple Workflows and approvals in sequential and/or parallel stages. Pipelines can involve multiple Services, Environments, and Workflows. A Pipeline can be triggered either manually or automatically (see Triggers).
This topic covers the following:
Before You Begin
RBAC and Pipelines
Your ability to read, create, delete, and update Pipelines depends on the Pipeline Application Permissions of your User Group:
Your ability to deploy Pipelines also depends on your Deployments Application Permissions:
Create a Pipeline
The following procedure creates a simple pipeline using a single service and a single workflow.
To create a pipeline, do the following:
- Click Setup.
- Click the application with a service you want to deploy.
- Click Pipelines. The Pipelines page appears.
- Click Add Pipeline. The Add Pipeline dialog appears.
- Enter a name and description for your pipeline and click SUBMIT. The first stage dialog appears. It has the following fields.
You can add a title to your stage. For example, Prepare. This will be visible in the Pipeline Overview.
Select this option to execute this stage when the pipeline runs.
Select this option to require approval before the next stage executes. You can use Harness User Groups, a Custom Shell Script, or Jira.
Name the step in this stage. This name acts as a subheading to the stage name.
Select the workflow to execute in this pipeline. The workflows in your application are available.
Execute in parallel with previous step
Select this option to execute steps in parallel.
Select this option to disable this step in this stage. This allows you to control which stages and steps in the deployment pipeline are executed.
- Click SUBMIT. The pipeline stage and its step are added to the pipeline.
- To add another stage to the pipeline, click the plus icon. A new stage dialog appears.
Workflow Variables in Pipelines
Once you have templatized a workflow, you can use it in multiple stages of a pipeline. For example, you can templatize the Environment and Service Infrastructure/Infrastructure Definition of a workflow, and then use the same workflow for both the QA and Production stages of a pipeline. When you add the workflow to each stage, you simply provide QA and Production-specific values for Environment and Service Infrastructure/Infrastructure Definition variables.
For more information, see Templatized Workflows in Pipelines.
Deploy a Pipeline
Once you have set up a pipeline, you can deploy it, running all the stages within the pipeline. Before running a pipeline, verify that all the artifact servers and cloud providers are available to the accounts you used to set them up.
To deploy a pipeline, do the following:
- In your application, click a pipeline. The Pipeline Overview appears.
- In the pipeline title bar, click Deploy. The Start New Deployment dialog appears.When you set up the pipeline stage(s), you picked the workflow(s) the pipeline will execute. The workflow you selected is linked to a service. The Start New Deployment dialog is configured with the services linked to the workflows included in the pipeline. Here is an example of a pipeline linked to three workflows, each with a separate service.
- For each service in the pipeline, select Build/Version that the pipeline will deploy.
- To run your pipeline, click SUBMIT. The pipeline is deployed and the deployment steps are displayed in the Deployment Detail page.Click each phase in the process to see logs and other details of the process.
Abort or Rollback a Running Deployment
If you deploy a pipeline and choose the Abort option during the running deployment, the Rollback Steps for the workflow(s) in the pipeline are not executed. Abort stops the deployment execution without rollback or clean up. To execute the Rollback Steps, click the Rollback button.
In most deployment processes there are multiple stages and approvals. Harness enables you to quickly configure the common three stage deployment pipeline (Dev, Stage, Production) along with the approval steps. Here is an example of a pipeline involving the common deployment process.
In this pipeline, the Dev and Stage workflows are each completed with an approval step where DevOps can verify that the stage has completed successfully without rollback before approving the next stage. Finally, with all stages successful and approved, the pipeline completes with a production release. The production release is also verified and rolled back if necessary.