Create your first pipeline
This quickstart walks you through creating and running your first Harness pipeline using the Pipeline Studio.
This topic uses a Custom stage with a Shell Script step. A Custom stage does not require build infrastructure or deployment prerequisites, allowing you to focus on creating and running the pipeline.
After completing this quickstart, you can add CI Build stages, CD Deploy stages, or any other stage type.
What you will learn from this topic
- How to create a pipeline in Pipeline Studio.
- How to add a stage and steps to the pipeline.
- How to run the pipeline and view the execution.
- How to view execution logs for a step.
Before you begin
- Harness account: You need an active Harness account. If you do not have one, sign up for free.
- Project: You need an existing project. For more information, refer to Organizations and Projects.
- Permissions: You need the Pipeline: Create/Edit permission in the project. For more information, refer to RBAC in Harness.
- Delegate: A Harness Delegate is required to execute steps on your infrastructure. If you do not have a delegate yet, go to Install a delegate to install one.
Pipeline creation architecture
You create and manage pipelines in a Harness project. If you are new to Harness pipelines, use this flow to get started:
The exact configuration depends on what you want the pipeline to do and which Harness module you are using.
Pipeline studio modes
Harness Pipeline Studio provides two interchangeable editors. To switch between editors, use the Visual / YAML toggle at the top of Pipeline Studio.

- Visual
- YAML
Visual
The Visual editor is a graphical canvas where you configure stages and steps using the Harness UI. It is the recommended starting point for new pipeline authors.
Key areas in the visual editor:
- Pipeline canvas: Shows stages as cards arranged left to right. Select a stage to open its configuration panel.
- Stage configuration panel: Contains the Overview, Infrastructure, Execution, and Advanced tabs for the selected stage.
- Step Library: A searchable catalog of available steps. Open it by selecting Add Step in a stage's execution view.
- Pipeline header: Contains Run, Save, Triggers, Input Sets, Variables, and Notifications controls.

YAML
The YAML editor is a full-featured text editor for the pipeline YAML. Use it when you prefer to write or review pipeline configuration as code.
Key features:
-
Autocomplete: Press
Cmd/Ctrl + Spaceto see context-aware suggestions for keys and values.- On a blank line: Suggestions include valid keys at that level, such as
timeout,stage, andstep.
- In context: Suggestions narrow to keys valid at the current nesting level.

- For a key without a value: Suggestions include valid values for that key.

- On a blank line: Suggestions include valid keys at that level, such as
-
Find and replace: Press
Cmd/Ctrl + F. -
Command palette: Press
F1to see all available commands and shortcuts.
-
Inline validation: Errors are highlighted in real time. Hover over an error marker to see details.


Everything you configure in the visual editor is reflected immediately in the YAML editor, and vice versa.
YAML schema
The Harness YAML schema formally defines all valid keys, values, and structures. It is available at github.com/harness/harness-schema. That repository also includes instructions for embedding the schema in VS Code and Sublime Text for local validation and autocomplete support.
You can also inspect the schema at runtime using Chrome DevTools:
- Open Chrome DevTools and select the Network tab.
- Open the relevant configuration section in Harness and reload it if necessary.
- Identify the successful network request that loads the configuration or schema metadata for that section.
- Open the request's Preview or Response tab.
- Inspect the returned metadata or schema for the relevant definitions, properties, or configuration fields.

Schema conventions
| Convention | Description |
|---|---|
key: value | Standard YAML associative arrays. Settings are not quoted. |
| 2-space indentation | Default indentation. Lines prefaced by - use 4-space indentation from the position of the -. |
<+input> | Marks a field as a runtime input. The value is provided at execution time. |
<+expression> | Marks a field as an expression. Harness evaluates it at runtime. |
[] (empty brackets) | Inline empty array. To add items: delete the brackets, add a new line, enter - followed by the item, and use autocomplete to see valid item structures. |
{} (empty braces) | Inline empty map. To add entries: delete the braces, add a new line, and enter key: value pairs. |
| (block style) | Multiline string. Every new line becomes a literal new line, with one added at the end. |
|- (block scalar, strip) | Multiline string. Strips trailing new lines. Use for multi-line scripts. |
Create a pipeline
This section demonstrates how to create a pipeline with a Custom stage and a Shell Script step using the visual editor. The same workflow applies when you create pipelines with other stage types and steps.
Perform the following steps to create a pipeline.
-
In Harness, navigate to your project.
-
In the left navigation, select Pipelines.
-
Select + Create a Pipeline.
-
In the Create new Pipeline dialog, enter a Name for your pipeline. For this quickstart, enter
DemoPipeline.Harness automatically generates an ID from the name. You can edit the ID now; after saving, the ID cannot be changed.
-
Choose where to store the pipeline definition:
- Select Inline to store the pipeline configuration in Harness.
- Select Remote to store it as code in a Git repository. For more information, refer to Git Experience.
-
Select Start.

Harness opens Pipeline Studio in the visual editor.
YAML
You can also create this pipeline using the YAML editor by replacing the default YAML with the following definition:
pipeline:
name: DemoPipeline # Enter the pipeline name.
identifier: DemoPipeline # Pipeline ID. Harness generates this from the name.
tags: {} # Optional: Add pipeline tags.
projectIdentifier: KrishnamoorthyTest # Project where the pipeline is created.
orgIdentifier: default # Organization that contains the project.
Add a Custom stage
Perform the following steps to add a Custom stage to the pipeline.
-
On the pipeline canvas, select Add Stage.
-
Select Custom Stage as the stage type.
tipTo create a CI build pipeline instead, select Build and go to Get started with Harness CI. To create a CD deployment pipeline, select Deploy and go to Get started with Harness CD.
-
Enter a Stage Name. For this quickstart, enter
Teststage. -
Select Set Up Stage.
The stage configuration panel opens with the following tabs: Overview, Execution, and Advanced.
Overview tab
The Overview tab contains basic stage information and optional settings.

- In the Stage Name field, enter
Teststage(if not already entered). - Optionally, add a Description for the stage.
- Optionally, add Tags to categorize the stage.
- Optionally add a Timeout.
- Add a stage variable if needed using Stage variable.
-
Select + New Variable.
-
In Type, select the variable type.
-
In Name, enter a name for the variable.
-
In Value, enter the variable value.
-
To require the value when the pipeline runs, select Set variable as required during runtime. You can configure a pipeline setting to accept a value when the pipeline runs instead of specifying a fixed value when you create the pipeline. When you run the pipeline, Harness prompts you to provide a value for the variable. For more information, go to Use runtime input.
-
Optionally, enter a description in Description.
-
Select Save to add the variable.
YAML-Stage variable
variables:- name: nametype: Stringdescription: Name descriptionrequired: falsevalue: TestReference pipeline variables with
<+pipeline.variables.name>.Reference stage variables with
<+stage.variables.name>.For more information, refer to Harness expressions reference.
If Set variable as required during runtime is selected, the variable value is provided when the pipeline is run rather than being set as a fixed value when you create the variable.
-
- Click Next
The Service, Environment/Infrastructure tabs are required for Deploy stages and other stage types that require deployment configuration. They are not required for a Custom stage.
For more information, see the Service YAML schema, Environment YAML schema, and Infrastructure Definition YAML schema.
Execution tab
The Execution tab is where you add and configure the steps that run in this stage. For more information, refer to Add a Shell Script step.

Advanced tab
The Advanced tab includes optional configuration that you can add at the stage or step level, depending on your requirements:
- Conditional Execution: Run the stage only when specific conditions are met. For more information, refer to Conditional execution.
- Failure Strategy: Define what happens when the stage fails. For more information, refer to Failure strategies.
- Looping Strategy: Repeat the stage for multiple items or configurations. For more information, refer to Looping strategies.
- Delegate Selector: Choose which delegate runs this stage. For more information, refer to Delegate overview.

For example, you can add the pipeline marked as failed for unknown errors as a Failure Strategy.

YAML - Failure strategy
failureStrategies:
- onFailure:
errors:
- Unknown
action:
type: MarkAsFailure
Add a Shell Script step
Perform the following steps to add a shell script step to the stage.
-
In the Execution tab, select Add Step.
-
In the Step Library, search for Shell Script and select it.
-
Configure the step:
Field Value Name Print messageTimeout 10m(default)Script Type BashSelect script location InlineScript echo "Hello from Harness!"
-
Select Apply Changes. The step appears on the stage execution canvas.
YAML - Pipeline step
step:
type: ShellScript
name: Print message
identifier: Print_message
spec:
shell: Bash
executionTarget: {}
source:
type: Inline
spec:
script: echo "Hello from Harness!"
environmentVariables: []
outputVariables: []
timeout: 10m
You can arrange steps sequentially, in step groups, or in parallel. Each step type has its own configuration options. For more information about organizing steps into groups, go to Organize steps in step groups.
Run the pipeline
-
In Pipeline Studio, select Run in the top right corner.
-
The Run Pipeline dialog opens. This pipeline has no runtime inputs, so no additional configuration is needed.
-
Select Run Pipeline.
Harness queues and starts the execution. You are redirected to the execution view.
View execution logs
After the pipeline starts running, the execution view shows the pipeline graph with stage and step status.
-
On the execution graph, select the Teststage stage.
-
Select the Print message step.
-
The Console View panel opens on the right, showing real-time logs for the step.
You should see output similar to the following:
Executing command...Hello from Harness!Command completed with ExitCode (0) -
After the step completes, the stage and pipeline statuses update to Success.

Pipeline YAML
The following example shows the complete YAML for the pipeline created in this quickstart,including the pipeline, stage, step, variables, and failure strategy.
Pipeline YAML
pipeline:
name: DemoPipeline # Your pipeline name.
identifier: DemoPipeline # Your pipeline identifier.
tags: {} # Your pipeline tags.
projectIdentifier: KrishnamoorthyTest # Your project identifier.
orgIdentifier: default # Your organization identifier.
stages: # Your pipeline stages.
- stage:
name: Teststage # Your stage name.
identifier: Teststage # Your stage identifier.
description: "" # Your stage description.
type: Custom # Your stage type.
spec: # Your stage configuration.
execution: # Your stage execution settings.
steps: # Your stage steps.
- step:
type: ShellScript # Your step type.
name: Print message # Your step name.
identifier: Print_message # Your step identifier.
spec: # Your step configuration.
shell: Bash # Your script type.
executionTarget: {} # Your execution target.
source: # Your script source.
type: Inline # Your script location.
spec:
script: echo "Hello from Harness!" # Your script.
environmentVariables: [] # Your environment variables.
outputVariables: [] # Your output variables.
timeout: 10m # Your step timeout.
tags: {} # Your stage tags.
variables: # Your stage variables.
- name: name # Your variable name.
type: String # Your variable type.
description: Name description # Your variable description.
required: false # Your runtime requirement setting.
value: Test # Your variable value.
failureStrategies: # Your failure strategy.
- onFailure:
errors:
- Unknown # Your failure condition.
action:
type: MarkAsFailure # Your failure action.
Next steps
- Get started with Harness CI: Add a Build stage to compile code, run tests, and push artifacts.
- Get started with Harness CD: Add a Deploy stage to deploy a service to Kubernetes, a VM, or a serverless target.
- Triggers overview: Automate pipeline runs on Git events or a schedule.
- Input sets and overlays: Parameterize the pipeline with runtime inputs and save reusable input sets.