> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/management-and-administration/pipelines.md).

# Pipelines

Harness Feature Management & Experimentation (FME) integrates with Harness pipelines, allowing you to include feature flag logic directly within your deployment or automation workflows. The **Pipelines** page in Harness FME displays a list of [Harness pipelines](/harness-ai/new-to-harness-platform/overview.md#pipelines) created in your [project](/feature-management-experimentation/management-and-administration/projects.md).

![](/files/J0w7bs4QrqLBrtpArufD)

### Create a Harness pipeline <a href="#create-a-harness-pipeline" id="create-a-harness-pipeline"></a>

To create a pipeline, click **+ Create a Pipeline**. You can create a pipeline manually in the UI or import one from a Git repository. Clicking on a pipeline opens the Pipeline Studio, where you can design and manage the pipeline using either the **Visual** or **YAML** editor.

{% tabs %}
{% tab title="Visual" %}
The **Visual** tab lets you configure stages and steps using the UI, including [adding FME steps](#add-fme-steps-to-a-pipeline-stage) supported in Custom stages. Add a custom stage and click **Add Step** to open the Step Library.

![](/files/a0iEs5TD0crNQBgLDhNE)
{% endtab %}

{% tab title="YAML" %}
The **YAML** tab displays the full pipeline definition as YAML. Click **Edit YAML** to modify the pipeline configuration in code.

![](/files/MNSL36Vq3YnWeAjMEuSq)
{% endtab %}
{% endtabs %}

Both views stay in sync; changes made in the **Visual** editor are reflected in the YAML, and changes made in YAML are reflected back in the **Visual** editor.

When you configure a pipeline, you set it up like any standard pipeline, with the addition of FME steps at the stage level. These steps let you integrate feature flag operations directly into your deployment or automation workflow.

### Permissions <a href="#permissions" id="permissions"></a>

Pipeline permissions are controlled through [Harness RBAC for FME](/feature-management-experimentation/management-and-administration/permissions/rbac.md). Pipeline runs that include FME steps require the same permissions you would need to [edit feature flags in Harness FME](/harness-ai/use-harness-platform/platform-access-control/permissions-reference.md#feature-management-and-experimentation).

* You need view (`core_pipeline_view`), create/edit (`core_pipeline_edit`), and execute (`core_pipeline_execute`) [pipeline permissions](/harness-ai/use-harness-platform/platform-access-control/permissions-reference.md#pipelines).
* You also need create/edit (`fme_fmefeatureflag_edit`) [permissions for feature flags in any FME environment](/feature-management-experimentation/management-and-administration/environments.md) the pipeline modifies. If a pipeline run tries to update a flag in an environment where you don't have edit access, the step will fail.

### How FME steps work in Harness pipelines <a href="#how-fme-steps-work-in-harness-pipelines" id="how-fme-steps-work-in-harness-pipelines"></a>

When you add a step to a Custom stage in the Pipeline Studio, the Step Library includes a **Feature Management & Experimentation** section with FME-specific steps.

![](/files/pe3bz9qPFVKSEBiQQmcO)

Each FME step runs like [any other Harness pipeline step](/harness-ai/use-harness-platform/pipelines/add-a-stage.md#steps-available-for-custom-stages) and performs a single, discrete feature management operation. These steps can create or modify feature flags, control rollouts, evaluate feature flag metrics, or execute flag lifecycle actions. FME steps execute in sequence with the rest of your pipeline logic and support standard pipeline capabilities, including [approvals](/harness-ai/use-harness-platform/approvals/approvals-tutorial.md), [notifications](/harness-ai/use-harness-platform/notifications-alerts-and-banners/notifications/configure-notifications.md#configure-pipeline-notifications), and [custom failure strategies](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md).

### How approvals work with FME steps <a href="#how-approvals-work-with-fme-steps" id="how-approvals-work-with-fme-steps"></a>

Approvals can be added in Harness pipelines to prevent the execution from proceeding without approval. An [Approval stage or step](/harness-ai/use-harness-platform/approvals/approvals-tutorial.md) pauses the pipeline and requires an approver to approve or reject before the pipeline continues. For more information about approval stages or steps, see the [Platform documentation](/harness-ai/use-harness-platform/approvals/approvals-tutorial.md).

When using FME steps in pipelines, these Harness approvals control the execution flow. [FME environment-level approval settings](/feature-management-experimentation/management-and-administration/environments.md#create-environments) **do not** apply to pipeline runs.

```mermaid
flowchart LR
    A[Custom Stage: Deploy Application] --> B[**Create Feature Flag**
or
**Update Feature Flag**]
    B --> C[**Set Individual Targets**
or
**Set Default Allocations**]
    C --> D{Issue Detected?}
    D -- Yes --> E[**Kill Feature Flag**]
    D -- No --> F[Continue Pipeline]
```

<br>

This approach lets teams coordinate automated workflows and feature flag changes within a single, auditable pipeline. By adding FME steps to your pipeline stages, you can:

* Create and manage feature flags as part of your deployment or promote workflows using **Create Feature Flag** and **Update Feature Flag**, including defining flags across all environments and updating metadata such as status, owners, and tags
* Manage individual targeting lists deterministically with **Set Individual Targets** and **Add/Remove Individual Targets**, allowing you to define or modify explicit target membership during a pipeline run
* Control default rollout behavior using **Set Default Allocations**, configuring how traffic is allocated when no targeting rules apply
* Immediately disable a feature flag with **Kill Feature Flag** as part of an incident runbook

FME steps in Harness pipelines allow feature flag operations to be predictable, reusable, and executed alongside application deployments and other automated workflows, helping teams coordinate releases while reducing manual configuration and operational risk.

### Add FME steps to a pipeline stage <a href="#add-fme-steps-to-a-pipeline-stage" id="add-fme-steps-to-a-pipeline-stage"></a>

FME steps are compatible with the [Custom stage](/harness-ai/use-harness-platform/pipelines/add-a-stage.md#add-a-custom-stage) in Harness pipelines.

To add FME steps to a pipeline:

1. Navigate to the **Pipelines** page from the FME navigation menu.
2. Click **+ Create a Pipeline** or click **+Import From Git** to import a pipeline from an existing Git repository.
3. Enter a name for the pipeline. Optionally, add a description and include tags for this pipeline.
4. Click **Inline** to store the pipeline in Harness or **Remote** to store the pipeline in a Git repository.
5. Click **Start**.
6. Click **Add Stage** and select **Custom Stage**.
7. Click **+ Add Step**. The **Step Library** panel opens on the right.
8. Navigate to the **Feature Management & Experimentation (FME)** section and select a step.

   | FME step                                                                  | Use case                                       | When to use it                                                                                                                                                                                                          |
   | ------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | [**Create Feature Flag**](#create-feature-flag)                           | Create a new feature flag                      | Use when introducing a new feature flag as part of deployment or feature development. This step instantiates the flag across all environments with default rollout plans.                                               |
   | [**Update Feature Flag**](#update-feature-flag)                           | Update flag metadata                           | Use when you need to edit flag properties such as the description, rollout status, owners, or tags without changing targeting or traffic allocation.                                                                    |
   | [**Delete Feature Flag**](#delete-feature-flag)                           | Permanently delete a feature flag              | Use when a feature flag is no longer needed and should be removed entirely. Optionally deletes all flag definitions across environments before deletion.                                                                |
   | [**Archive Feature Flag**](#archive-feature-flag)                         | Archive a feature flag                         | Use when a feature flag is no longer active but should be preserved for historical reference rather than permanently deleted.                                                                                           |
   | [**Set Default Allocations**](#set-default-allocations)                   | Control default rollout percentages            | Use when you want to define how traffic is split across treatments for users who do not match any targeting rules (for example, 50/50, 75/25, or 100% on).                                                              |
   | [**Metric Check**](#metric-check)                                         | Evaluate feature flag metrics                  | Use when you want to validate application metrics during a rollout and automatically determine whether a pipeline should continue, pause, or execute a failure strategy.                                                |
   | [**Set Individual Targets**](#set-individual-targets)                     | Define the full set of individual targets      | Use when you want to deterministically set the complete list of individual targets for a flag in an environment, replacing any existing list.                                                                           |
   | [**Add/Remove Individual Targets**](#addremove-individual-targets)        | Incrementally modify targeting                 | Use when you need to add or remove specific users or segments without overwriting existing individual target lists. Useful for gradual rollouts or hand-picked targets.                                                 |
   | [**Kill Feature Flag**](#kill-feature-flag)                               | Immediately disable a feature                  | Use to kill the flag in the specified environment, serving the [default treatment](/feature-management-experimentation/use-fme/feature-management/setup/default-treatment.md).                                          |
   | [**Restore Feature Flag**](#restore-feature-flag)                         | Restore a killed feature flag                  | Use to restore a feature flag that was previously killed in a specific environment, returning it to its prior serving state.                                                                                            |
   | [**Set Treatments**](#set-treatments)                                     | Define treatments for a feature flag           | Use when you want to define or replace the set of treatments for a feature flag in a specific environment, including setting the default treatment.                                                                     |
   | [**Set Dynamic Configurations**](#set-dynamic-configurations)             | Set dynamic configurations for treatments      | Use when you want to attach or update dynamic configuration values for each treatment of a feature flag in a specific environment.                                                                                      |
   | [**Set Targeting Rules**](#set-targeting-rules)                           | Define targeting rules for a feature flag      | Use when you want to define or replace the targeting rules that determine which treatment is served based on conditions such as segment membership, attributes, or other flag states.                                   |
   | [**Limit Exposure**](#limit-exposure)                                     | Control exposure to targeting rules            | Use when you want to set the percentage of users exposed to targeting rules in a specific environment, with everyone else going to the default treatment.                                                               |
   | [**Reallocate Traffic**](#reallocate-traffic)                             | Reassign users across treatments               | Use to reassign users across treatments for a feature flag in a specific environment without changing the targeting rules. This regenerates the seed value used for randomizing assignment in percentage distributions. |
   | [**Patch Definition**](#patch-definition)                                 | Apply patch operations to a flag definition    | Use when you want to apply granular patch operations to a feature flag definition in a specific environment.                                                                                                            |
   | [**Definition Instructions**](#definition-instructions)                   | Apply flag definition instructions atomically  | Use when you want to apply structured, UI-driven changes to a feature flag definition in a single, atomic operation in a specific environment.                                                                          |
   | [**Create Segment**](#create-segment)                                     | Create standard or rule-based segments         | Use when you want to create reusable audience segments for targeting feature flags based on user attributes, traffic type, or targeting rules.                                                                          |
   | [**Update Segment**](#update-segment)                                     | Update segment metadata                        | Use when you need to modify segment metadata such as descriptions or owners without changing the segment targeting logic.                                                                                               |
   | [**Delete Segment**](#delete-segment)                                     | Permanently delete a segment                   | Use when a segment is no longer needed and should be removed from Harness FME.                                                                                                                                          |
   | [**Add/Remove Segment Targets**](#addremove-segment-targets)              | Incrementally modify segment targets           | Use when you need to add or remove specific target keys from a segment without replacing the entire target list.                                                                                                        |
   | [**Set Rule-Based Segment Targeting**](#set-rule-based-segment-targeting) | Define targeting rules for rule-based segments | Use when you want to define or replace the targeting rules used to dynamically populate a rule-based segment.                                                                                                           |
   | [**Create Flag set**](#create-flagset)                                    | Create a flag set                              | Use when you want to organize related feature flags into a shared grouping for management and governance workflows.                                                                                                     |
   | [**Delete Flag set**](#delete-flagset)                                    | Permanently delete a flag set                  | Use when a flag set is no longer needed and should be removed from Harness FME.                                                                                                                                         |
   | [**Add/Remove Flags from Flag sets**](#addremove-flags-from-flagsets)     | Manage flag set membership                     | Use when you want to add or remove feature flags from existing flag sets without recreating the flag set.                                                                                                               |
   | [**Set Impression Tracking**](#set-impression-tracking)                   | Enable or disable impression tracking          | Use when you want to control whether impression events are collected for a feature flag for observability or experimentation analysis.                                                                                  |
9. Configure the step in the **Step Parameters** tab.
10. Optionally, add additional configuration in the **Advanced** tab.
11. Click **Save** to add the step to the stage.

<details>

<summary>Example Pipeline YAML Configuration</summary>

The following example shows a Harness pipeline that uses multiple FME steps within a Custom stage to coordinate feature flag creation, rollout, targeting, and kill actions alongside standard pipeline steps:

```yaml
pipeline:
  name: <PIPELINE_NAME>
  identifier: <PIPELINE_ID>
  projectIdentifier: Default
  orgIdentifier: <ORG_ID>
  tags: {}
  variables:
    - name: flagName
      type: String
      description: "The feature flag name for this feature rollout."
      required: true
      value: <+input>
  stages:
    - stage:
        name: demo_stage
        identifier: demo_stage
        description: "Custom stage with FME steps for this feature rollout."
        type: Custom
        spec:
          execution:
            steps:
              - step:
                  type: FmeFlagCreate
                  name: initial setup
                  identifier: initial_setup
                  spec:
                    name: <+pipeline.variables.flagName>
                    trafficType: user
                    description: live demo flag
              - step:
                  type: FmeFlagSetIndividualTargets
                  name: add testers to on
                  identifier: add_testers_to_on
                  spec:
                    flagName: <+pipeline.variables.flagName>
                    environment: Prod-Default
                    treatments:
                      - treatment: "on"
                        keys:
                          - user1
                          - user2
                        segments: []
              - step:
                  type: FmeFlagAddRemoveIndividualTargets
                  name: add beta user
                  identifier: add_beta_user
                  spec:
                    flagName: <+pipeline.variables.flagName>
                    environment: Prod-Default
                    treatments:
                      - treatment: "on"
                        addKeys:
                          - beta_user1
                        removeKeys: []
                        addSegments: []
                        removeSegments: []
              - step:
                  type: Wait
                  name: Wait_1
                  identifier: Wait_1
                  spec:
                    duration: 10s
              - step:
                  type: FmeFlagDefaultAllocation
                  name: 50-50 Rollout
                  identifier: _rollout
                  spec:
                    flagName: <+pipeline.variables.flagName>
                    environment: Prod-Default
                    allocation:
                      - treatment: "on"
                        amount: 50
                      - treatment: "off"
                        amount: 50
              - step:
                  type: FmeFlagUpdate
                  name: Change status to ramping
                  identifier: FmeFlagUpdate_1
                  spec:
                    name: <+pipeline.variables.flagName>
                    tags:
                      - demo
                    rolloutStatus: Ramping
              - step:
                  type: HarnessApproval
                  name: Harness Manual Approval
                  identifier: Harness_Manual_Approval
                  spec:
                    approvalMessage: Please review the change and approve.
                    includePipelineExecutionHistory: true
                    isAutoRejectEnabled: false
                    approvers:
                      userGroups:
                        - account._fme_admins
                      minimumCount: 1
                      disallowPipelineExecutor: false
                    approverInputs: []
                  timeout: 1d
              - step:
                  type: FmeFlagDefaultAllocation
                  name: Rollout out to everyone
                  identifier: FmeFlagDefaultAllocation_2
                  spec:
                    flagName: <+pipeline.variables.flagName>
                    environment: Prod-Default
                    allocation:
                      - treatment: "on"
                        amount: 100
                      - treatment: "off"
                        amount: 0
              - step:
                  type: FmeFlagKill
                  name: Kill flag on incident
                  identifier: kill_flag_on_incident
                  spec:
                    flagName: <+pipeline.variables.flagName>
                    environment: Prod-Default
        tags: {}
```

</details>

### Configure FME steps <a href="#configure-fme-steps" id="configure-fme-steps"></a>

Each FME step is configured at the stage level of a pipeline. After adding an FME step from the Step Library, you can configure its behavior using the **Step Parameters** tab, and optionally refine execution behavior using the **Advanced** tab.

The following section walks through how to configure each FME step.

#### Create Feature Flag <a href="#create-feature-flag" id="create-feature-flag"></a>

Use this step to create a feature flag and define it across all environments with default rollout plans.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Create Feature Flag** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Create Feature Flag`).
   * **Feature Flag Name**: Add a name for the feature flag or use a [pipeline variable](/harness-ai/use-harness-platform/variables-and-expressions/add-a-variable.md#define-variables) (for example, `<+pipeline.variables.FeatureName>`).
   * **Traffic Type**: Select the traffic type (for example, `user`).
   * **Description**: Optionally, enter a description for the feature flag.
   * **Owners**: Optionally, select one or more owners for the feature flag.
   * **Tags**: Optionally, add tags to help organize and filter feature flags.
4. Click **Apply Changes** to add the step to the pipeline.

#### Update Feature Flag <a href="#update-feature-flag" id="update-feature-flag"></a>

Use this step to update feature flag metadata without changing rollout behavior or targeting.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Update Feature Flag** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Update Feature Flag`).
   * **Feature Flag Name**: Add a name of the existing feature flag.
   * **Description**: Optionally, update the feature flag description.
   * **Owners**: Optionally, update feature flag ownership.
   * **Rollout Status**: Optionally, update the feature flag rollout status.
   * **Tags**: Optionally, add or modify tags.
4. Click **Apply Changes** to add the step to the pipeline.

#### Delete Feature Flag <a href="#delete-feature-flag" id="delete-feature-flag"></a>

Use this step to permanently delete a feature flag.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Delete Feature Flag** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Delete Feature Flag`).
   * **Feature Flag Name**: Add the name of the feature flag to delete.
   * **Delete All Definitions**: Optionally, enable this option to delete all feature flag definitions across environments before deleting the flag.
4. Click **Apply Changes** to add the step to the pipeline.

#### Archive Feature Flag <a href="#archive-feature-flag" id="archive-feature-flag"></a>

Use this step to archive a feature flag, preserving it for historical reference without permanently deleting it.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Archive Feature Flag** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Archive Feature Flag`).
   * **Feature Flag Name**: Add the name of the feature flag to archive.
4. Click **Apply Changes** to add the step to the pipeline.

#### Set Default Allocations <a href="#set-default-allocations" id="set-default-allocations"></a>

Use this step to control how traffic is allocated across treatments for users who do not match any targeting rules.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Default Allocations** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. Under the **Flag Change** section, define one or more allocations by clicking **+ Add Allocation**:
   * **Treatment**: Select a treatment to apply.
   * **Allocation Percentage**: Enter the percentage of traffic for this treatment (0–100).
5. Ensure the total allocation across all treatments equals 100%.
6. Click **Apply Changes** to add the step to the pipeline.

#### Set Individual Targets <a href="#set-individual-targets" id="set-individual-targets"></a>

Use this step to define the complete set of individual targets for a feature flag in a specific environment. This replaces any existing individual targeting configuration.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Individual Targets** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment where targeting should be applied.
   * **Feature Flag**: Add the feature flag name.
4. Under the **Set Individual Targets** section, configure one or more treatments where you want to override the current individual targets list by clicking **+ Add Treatment**:
   * **For Treatment**: Select a treatment to apply.
   * **Keys**: Optionally, enter the individual target keys to include.
   * **Segments**: Optionally, enter individual segments to include.
5. Click **Apply Changes** to add the step to the pipeline.

#### Add/Remove Individual Targets <a href="#addremove-individual-targets" id="addremove-individual-targets"></a>

Use this step to incrementally add or remove individual targets without replacing the existing target list.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Add/Remove Individual Targets** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the target environment.
   * **Feature Flag**: Add the feature flag name.
4. Under the **Flag Change** section, configure one or more treatments by clicking **+ Add Treatment**:
   * **For Treatment**: Select a treatment to apply.
   * **Add Segments**: Optionally, enter segments to include.
   * **Add Keys**: Optionally, enter individual target keys to include.
   * **Remove Segments**: Optionally, enter segments to remove.
   * **Remove Keys**: Optionally, enter individual keys to remove.
5. Click **Apply Changes** to add the step to the pipeline.

#### Kill Feature Flag <a href="#kill-feature-flag" id="kill-feature-flag"></a>

Use this step to immediately disable a feature flag in a specific environment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Kill Feature Flag** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. Click **Apply Changes** to add the step to the pipeline.

#### Restore Feature Flag <a href="#restore-feature-flag" id="restore-feature-flag"></a>

Use this step to restore a feature flag that was previously killed in a specific environment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Restore Feature Flag** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. Click **Apply Changes** to add the step to the pipeline.

#### Set Treatments <a href="#set-treatments" id="set-treatments"></a>

Use this step to define or replace the set of treatments for a feature flag in a specific environment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Treatments** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
   * **Default Treatment**: Select the treatment to serve by default.
4. Under the **Treatments** section, define two or more treatments by clicking **+ Add Treatment**:

   * **Treatment**: Enter the treatment name.
   * **Description**: Enter a description for the treatment.

   You can add new treatments or remove existing ones by passing an updated list. However, a treatment that has traffic allocated to it (through default allocations or targeting rules) cannot be omitted. The step will fail if a treatment with assigned traffic is missing from the list.
5. Click **Apply Changes** to add the step to the pipeline.

#### Set Dynamic Configurations <a href="#set-dynamic-configurations" id="set-dynamic-configurations"></a>

Use this step to attach or update dynamic configuration values for each treatment of a feature flag in a specific environment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Dynamic Configurations** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. Under the **Treatments** section, configure one or more treatments by clicking **+ Add Treatment**:
   * **Treatment**: Select a treatment.
   * **Configuration**: Enter the dynamic configuration value for the treatment.
5. Optionally, define [input variables](/harness-ai/use-harness-platform/variables-and-expressions/harness-variables.md#input-and-output-variables) that can be referenced within this step and others in the pipeline.
6. Click **Apply Changes** to add the step to the pipeline.

#### Set Targeting Rules <a href="#set-targeting-rules" id="set-targeting-rules"></a>

Use this step to define or replace the targeting rules for a feature flag in a specific environment. Targeting rules determine which treatment is served based on conditions such as segment membership, user attributes, or other feature flag states.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Targeting Rules** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. Under the **Targeting Rules** section, define one or more rules by clicking **+ Add Rule**. Each rule consists of a condition and an allocation:
   * **Condition**: Define one or more condition rules. Each rule specifies a matcher type (such as `IN_SEGMENT`, `BOOLEAN`, `EQUAL_NUMBER`, `CONTAINS_STRING`, or `BETWEEN_DATE`), an optional attribute, a value, and an optional negate flag.
   * **Allocation**: For each condition, define how traffic is split across treatments. Each allocation entry specifies a treatment and a size (0–100).
5. Click **Apply Changes** to add the step to the pipeline.

#### Limit Exposure <a href="#limit-exposure" id="limit-exposure"></a>

Use this step to set the percentage of users exposed to targeting rules in a specific environment, with everyone else going to the default treatment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Limit Exposure** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
   * **Exposure Limit**: Enter the maximum percentage of traffic to expose (0–100).
4. Click **Apply Changes** to add the step to the pipeline.

#### Reallocate Traffic <a href="#reallocate-traffic" id="reallocate-traffic"></a>

Use this step to reassign users across treatments for a feature flag in a specific environment without changing the targeting rules. This regenerates the seed value used for randomizing assignment in percentage distributions, so users may receive different treatments than before.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Reallocate Traffic** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. Click **Apply Changes** to add the step to the pipeline.

#### Patch Definition <a href="#patch-definition" id="patch-definition"></a>

Use this step to apply patch operations to a feature flag definition in a specific environment. This step supports bundling multiple changes into a single operation and can be used for advanced configurations. For available operations, refer to the [FME Admin API partial update endpoint](https://docs.split.io/reference/partial-update-feature-flag-definition-in-environment).

1. In your pipeline stage, click **+ Add Step**.
2. Select **Patch Definition** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
   * **Operations**: Enter the patch operations to apply to the flag definition.
4. Optionally, define [input variables](/harness-ai/use-harness-platform/variables-and-expressions/harness-variables.md#input-and-output-variables) that can be referenced within this step and others in the pipeline.
5. Click **Apply Changes** to add the step to the pipeline.

#### Definition Instructions <a href="#definition-instructions" id="definition-instructions"></a>

Use this step to apply structured change instructions to a feature flag definition in a specific environment. All changes are applied atomically, ensuring consistency across multiple updates in a single execution. This step is ideal when you want a UI-driven way to update flag configurations without writing raw patch operations.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Definition Instructions** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Add the feature flag name.
4. In the **Flag Definition Changes** section, click **Add a Flag Change** and select an operation from the following options:

   ![](/files/kjYDaAR5v4F1VKs4MYGA)

   <br>
5. Add additional changes by clicking **+ Add a Flag Change**. Each change type can be used at most once per step.
6. In the `Optional Configuration` section, you can configure treatments if the flag definition does not already exist in the target environment. These settings are ignored when a flag definition already exists.

   To configure treatments:

   * Click **+ Add Treatment**.
   * Enter a treatment name.
   * Optionally, enter a description.
   * Repeat as needed for additional treatments.

   Then configure the following:

   * In the `Default Treatment` field, select a default treatment.
   * In the `Baseline Treatment` field, select a baseline treatment.
7. Click **Apply Changes** to add the step to the pipeline.

#### Metric Check <a href="#metric-check" id="metric-check"></a>

Use this step to evaluate metrics for a feature flag during a pipeline execution. The **Metric Check** step acts as a release monitoring gate by evaluating metric values against a JEXL failure condition. If the failure condition evaluates to `true`, the step fails and the pipeline follows the configured failure strategy, if one is defined.

![](/files/xdHWCSgvo2N2xs74w3Wc)

Common use cases include validating error rates, latency, conversion rates, or other application metrics before continuing a deployment or feature rollout. Use the following JEXL expression examples for common release monitoring scenarios::

| Use case                            | Failure condition                                                                                             |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| Error rate increased                | `<+metric("error_rate").treatment("on").mean> > 0.05`                                                         |
| API latency increased               | `<+metric("api_latency").treatment("on").p95> > 500`                                                          |
| Conversion rate decreased           | `<+metric("conversion_rate").treatment("on").mean> < 0.12`                                                    |
| Multiple guardrail metrics exceeded | `<+metric("error_rate").treatment("on").mean> > 0.05 \|\| <+metric("api_latency").treatment("on").p95> > 500` |

1. In your pipeline stage, click **+ Add Step**.
2. Select **Metric Check** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (for example, `Validate Checkout Metrics`).
   * **Timeout**: Specify the maximum amount of time the step can wait for metric evaluation to complete before it fails.
   * **Environment**: Specify the environment where the feature flag is configured.
   * **Feature Flag**: Add the feature flag name.
   * **Lookback Window**: Specify the period of time used to evaluate metric data (for example, `15m` or `1h`).
   * **Metrics**: Select one or more metrics to evaluate. Click **+Add a metric** to create a metric.
4. In the **Failure Condition** field, enter a [JEXL expression](/harness-ai/use-harness-platform/variables-and-expressions/expression-v2.md#write-expressions-using-jexl) that evaluates to `true` when the step should fail.

   ```
   <+metric("checkout_error_rate").treatment("on").mean> > 0.05 ||
   <+metric("checkout_latency").treatment("on").p95> > 500
   ```

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>FAILURE CONDITION</strong></p><p>The failure condition determines when the <strong>Metric Check</strong> step should fail. You can configure a failure strategy to define what happens next, such as stopping the pipeline or triggering a rollback. <strong>Metric Check</strong> evaluates predefined thresholds and conditions rather than waiting for statistical significance, making it suitable for automated release decisions.</p></div>

   This condition fails the step if:

   * The average checkout error rate exceeds 5%.
   * The 95th percentile checkout latency exceeds 500 ms.

   In this example, `on` refers to the feature flag treatment being evaluated. Replace it with the treatment name configured for your feature flag.
5. Optionally, configure a [failure strategy](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md) in the **Advanced** tab to define what happens when the metric check fails, such as rolling back a deployment or stopping the pipeline.
6. Click **Apply Changes** to add the step to the pipeline.

After the step executes, you can view the metric evaluation results in the step execution details view, including metric details, evaluated metric values, and the pass/fail result.

![Metric Check step execution details view showing the Details, Input, Output, and Execution Context tabs in the Pipeline execution page](/files/vSCHwO6Nf3A0PsPgCeBw) *The step execution details view displays the **Details**, **Input**, **Output**, and **Execution Context** tabs, where you can review the Metric Check execution status, configured inputs, evaluated metric results, and runtime information.*

#### Create Segment <a href="#create-segment" id="create-segment"></a>

Use this step to create a standard, large, or rule-based segment for feature flag targeting.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Create Segment** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Create Segment`).
   * **Segment Name**: Add a name for the segment.
   * **Traffic Type**: Select the traffic type for the segment.
   * **Description**: Optionally, enter a description for the segment.
   * **Owners**: Optionally, select one or more owners for the segment.
   * **Tags**: Optionally, select one or more tags for the segment.
4. Click **Apply Changes** to add the step to the pipeline.

#### Update Segment <a href="#update-segment" id="update-segment"></a>

Use this step to update segment metadata without changing segment targeting behavior.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Update Segment** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Update Segment`).
   * **Segment Name**: Add the name of the existing segment.
   * **Description**: Optionally, update the segment description.
   * **Owners**: Optionally, update segment ownership.
   * **Tags**: Optionally, select one or more tags for the segment.
4. Click **Apply Changes** to add the step to the pipeline.

#### Delete Segment <a href="#delete-segment" id="delete-segment"></a>

Use this step to permanently delete a segment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Delete Segment** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Delete Segment`).
   * **Segment Name**: Add the name of the segment to delete.
4. **Delete all segment definitions** is selected by default. Click **Apply Changes** to add the step to the pipeline.

#### Add/Remove Segment Targets <a href="#addremove-segment-targets" id="addremove-segment-targets"></a>

Use this step to incrementally add or remove target keys from a segment in a specific environment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Add/Remove Segment Targets** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Segment Name**: Add the name of the segment.
   * **Environment**: Specify the environment.
   * **Add Keys**: Optionally, specify one or more targeting keys to add to the segment.
   * **Remove Keys**: Optionally, specify one or more targeting keys to remove from the segment.
4. Click **Apply Changes** to add the step to the pipeline.

#### Set Rule-Based Segment Targeting <a href="#set-rule-based-segment-targeting" id="set-rule-based-segment-targeting"></a>

Use this step to define or replace targeting rules for a rule-based segment.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Segment Targeting Rules** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Segment Name**: Add the name of the segment.
   * **Environment**: Specify the environment.
4. Under the **Targeting Rules** section, configure one or more targeting rules. To add a targeting rule, click **+ Add Rule**.
   * **Exclude Keys**: Optionally, specify one or more targeting keys to exclude.
   * **Exclude Segments**: Optionally, specify one or more segments to exclude.
   * **Comment**: Optionally, include a comment.
   * **Title**: Optionally, enter a title for the targeting rule.
5. Click **Apply Changes** to add the step to the pipeline.

#### Create Flagset <a href="#create-flagset" id="create-flagset"></a>

Use this step to create a flagset for organizing related feature flags.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Create Flagset** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Create Flagset`).
   * **Flagset Name**: Add a name for the flagset.
   * **Description**: Optionally, enter a description for the flagset.
4. Click **Apply Changes** to add the step to the pipeline.

#### Delete Flagset <a href="#delete-flagset" id="delete-flagset"></a>

Use this step to permanently delete a flagset.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Delete Flagset** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name (such as `Delete Flagset`).
   * **Flagset Name**: Add the name of the flagset to delete.
4. Click **Apply Changes** to add the step to the pipeline.

#### Add/Remove Flags from Flagsets <a href="#addremove-flags-from-flagsets" id="addremove-flags-from-flagsets"></a>

Use this step to add or remove feature flags from existing flagsets.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Add/Remove Flags from Flagsets** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Specify the feature flag.
   * **Add Flag sets**: Specify one or more flag sets to add to the feature flag.
   * **Remove Flag sets**: Specify one or more flag sets to be removed from the feature flag.
4. Click **Apply Changes** to add the step to the pipeline.

#### Set Impression Tracking <a href="#set-impression-tracking" id="set-impression-tracking"></a>

Use this step to enable or disable impression tracking for a feature flag.

1. In your pipeline stage, click **+ Add Step**.
2. Select **Set Impression Tracking** under **Feature Management & Experimentation** in the Step Library.
3. In the **Step Parameters** tab, configure the following:
   * **Name**: Add a step name.
   * **Environment**: Specify the environment.
   * **Feature Flag**: Specify the feature flag.
   * **Impression Tracking**: Enable or disable impression tracking.
4. Click **Apply Changes** to add the step to the pipeline.

Once you have added FME steps to a Custom stage and designed your pipeline, click **Save** and execute the pipeline by clicking **Run**.

<details>

<summary>Advanced Pipeline Configuration</summary>

You can also control how an FME step runs or recovers by configuring [conditional execution](/harness-ai/use-harness-platform/pipelines/step-skip-condition-settings.md), [failure strategy](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md), and [looping strategy settings](/harness-ai/use-harness-platform/pipelines/looping-strategies/looping-strategies-matrix-repeat-and-parallelism.md) on the **Advanced** tab of each step.

![](/files/EgabWb0hm3ip1tl7CcmX)

Conditional execution lets you run or skip FME steps based on [pipeline variables](/harness-ai/use-harness-platform/variables-and-expressions/add-a-variable.md#define-variables), expressions, or runtime inputs. For example, you can update a feature flag only in production or configure a flag kill step to run only if the previous deployment step fails.

If both a stage and a step define conditional execution rules, the **step-level condition takes precedence** and overrides the stage-level condition.

</details>

### Pipeline notifications <a href="#pipeline-notifications" id="pipeline-notifications"></a>

You can create [notification rules](/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/notify-users-of-pipeline-events.md) to send notifications about events in your pipeline and notify your team using Slack, Microsoft Teams, Email, or PagerDuty as one of the notification channels.

### Advanced options <a href="#advanced-options" id="advanced-options"></a>

To configure how your pipeline executes and behaves under different conditions, click **Advanced Options** in the Pipeline Studio sidebar.

{% tabs %}
{% tab title="Pipeline Timeout Settings" %}
Set a [timeout for the entire pipeline](/harness-ai/use-harness-platform/pipelines/pipeline-settings.md#pipeline-timeout-and-stage-timeout-execution-time-limits). If a pipeline run exceeds the configured duration, it will automatically fail.
{% endtab %}

{% tab title="Stage Execution Settings" %}
Choose whether to allow selective stage execution. This setting controls whether stages can be run or skipped based on stage-level [execution rules](/continuous-delivery/use-continuous-delivery/cd-building-blocks/executions/step-and-stage-conditional-execution-settings.md#stage-conditional-execution-settings).
{% endtab %}

{% tab title="Re-run Settings" %}
Control whether input data is editable when [re-running a pipeline](/harness-ai/use-harness-platform/pipelines/re-run-with-no-input-changes.md). If set to **No**, inputs cannot be modified during reruns.
{% endtab %}
{% endtabs %}
