---
sidebar_label: Override scope workflows
toc_max_heading_level: 3
doc_id: 1774195e-4ae4-45fd-9132-55717119a7cd
description: >-
  Learn how to modify base workflow files by merging, replacing, skipping, or
  adding steps using override configurations.
keywords:
  - workflow override
  - service workflow
  - configuration management
  - YAML automation
  - workflow customization
title: How to override a base scope workflow
canonical: >-
  https://docs.nullplatform.com/docs/agent-backed-scopes/workflows-and-execution/override-scope-service-workflow
---
# How to override a base scope workflow

To override or add configurations to your base workflow file, run the following command:

```bash
np service workflow exec --workflow $path_to_workflow_file --overrides $path_to_overrides_file
```

Use the `--overrides` flag to modify the steps defined in the base workflow file:
- **merge** - merges configurations with the base definition
- **replace** - replaces a configuration of the base workflow file
- **skip** - skips a step from the base workflow file
- **add** - adds a step in the base workflow file

:::tip
You can include the `--dry-run` flag, which returns a final `.yaml` file instead of executing the command.

This file shows the applied overrides to the base workflow.
:::

## Example: updating a base scope workflow

We'll use the following base workflow file as an example:

```bash
steps:
- name: step 1
  type: command
  command: echo "first step"
- name: step 2
  type: script
  file: final-step.sh
  configuration:
    env: production
```

The example above will be updated depending on the new configurations defined in the overrides file.

Below are examples of override configurations that will either **merge**, **replace**, **skip**, or **add** steps to your base workflow file.

<details>
  <summary>Merging configurations</summary>

  New configurations added in the overrides file:

  ```bash
  steps:
  - name: step 2
    configuration:
      extra: configurations
    post:
      type: command
      command: echo "validate step"
  ```

  Resulting configuration:

    ```bash
    steps:
    - name: step 1
      type: command
      command: echo "first step"
    - name: step 2 
      type: script
      file: final-step.sh
      configuration:       
        env: production
        extra: configurations            // extra configuration
      post:                              // new post script 
        type: command
        command: echo "validate step"
    ```
</details>

<details>
  <summary>Replacing configurations</summary>

  New configurations added in the overrides file:

  :::warning
  You must provide the complete definition of the step you want to replace.
  :::

  ```bash
  steps:
  - name: step 2
    type: script
    action: replace
    file: other-step.sh
    configuration:
      extra: configurations
    post:
      type: command
      command: echo "validate step"
  ```

  Resulting configuration:

    ```bash
    steps:
    - name: step 1
      type: command
      command: echo "first step"
    - name: step 2
      type: script
      file: other-step.sh  // replaced step
      configuration:
        extra: configurations
      post:
        type: command
        command: echo "validate step"
    ```

</details>

<details>
  <summary>Skipping steps</summary>

  New configurations added in the overrides file:

    ```bash
    steps:
      - name: step 2
        action: skip
    ```

  Resulting configuration:

    ```bash
      steps:
      - name: step 1           //only step one is executed
       type: command
       command: echo "first step"
    ```

</details>

<details>
  <summary>Adding steps</summary>

  New configurations added in the overrides file:

```bash
  steps:
   - name: step 0       // new step
    type: command
    command: echo "I will be executed first!"    
     before: step 1       // defines when in the workflow the step will be executed
   - name: step 3
     type: command
     command: echo "I will be executed last!"
     after: step 2
```

Resulting configuration:

  ```bash
  steps:
  - name: step 0        // new step executed first
    type: command
    command: echo "I will be executed first!"
  - name: step 1
    type: command
    command: echo "first step"
  - name: step 2
    type: script
    file: final-step.sh
    configuration:
      env: production
  - name: step 3
    type: command
    command: echo "I will be executed last!"
  ```

</details>
