> 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/continuous-delivery/3.0/use-deployments/google-cloud-functions/step-library/google-cloud-functions-rollback.md).

# Google Cloud Functions Rollback

Restore a Google Cloud Function's previous serving traffic split on rollback.

The rollback step restores the previous serving traffic split on a Google Cloud Function's backing Cloud Run service. It reads rollback data saved by the deploy step, so it must run in the stage's rollback steps, after a deploy step has run in the same stage.

***

### Rollback YAML <a href="#rollback-yaml" id="rollback-yaml"></a>

Minimal form:

```yaml
- name: Google Cloud Function Rollback
  id: googleCloudFunctionRollbackStep
  template:
    uses: googleCloudFunctionRollbackStep
    with:
      function_name: ${{rollback.data.FUNCTION_NAME}}
      active_cloud_run_revisions: ${{rollback.data.ACTIVE_CLOUD_RUN_REVISIONS}}
```

With explicit overrides:

```yaml
- name: Google Cloud Function Rollback
  id: googleCloudFunctionRollbackStep
  template:
    uses: googleCloudFunctionRollbackStep
    with:
      function_name: ${{rollback.data.FUNCTION_NAME}}
      active_cloud_run_revisions: ${{rollback.data.ACTIVE_CLOUD_RUN_REVISIONS}}
      command_timeout: 15m
      log_level: debug
```

***

### How the rollback step works <a href="#how-the-rollback-step-works" id="how-the-rollback-step-works"></a>

When the step runs, Harness executes the following actions in order:

1. Authenticates with Google Cloud using the connector configured on the infrastructure definition.
2. Reads **Cloud Function Name** and **Previous Traffic Split** from the rollback data saved by the deploy step.
3. For subsequent deployments, restores the previous serving traffic split on the backing Cloud Run service.

{% hint style="warning" %}
**First-deployment rollback behavior is unconfirmed**

For a function's first deployment, there is no previous revision to restore traffic to. The exact outcome, such as whether Harness leaves the new revision in place, routes it to zero traffic, or deletes it, has not been verified against a real execution log. Verify this against your own environment before relying on it.
{% endhint %}

***

### Rollback fields <a href="#rollback-fields" id="rollback-fields"></a>

The following fields configure which function the rollback step restores traffic for.

| Field                            | Default                                         | Description                                                                                                                     |
| -------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Cloud Function Manifest Path** | `${{runtime.manifestPath}}`                     | The rendered Cloud Function manifest path, used to identify the function configuration during rollback.                         |
| **Cloud Function Name**          | `${{rollback.data.FUNCTION_NAME}}`              | The function to roll back. Auto-resolved from the deploy step's rollback data.                                                  |
| **Previous Traffic Split**       | `${{rollback.data.ACTIVE_CLOUD_RUN_REVISIONS}}` | The revision and traffic percentage that were active before the deployment. Auto-resolved from the deploy step's rollback data. |
| **GCP Connector**                | —                                               | The Google Cloud connector used to authenticate and roll back. Required.                                                        |
| **GCP Region**                   | `${{infra.region}}`                             | The Google Cloud region of the function. Auto-resolved from the infrastructure definition.                                      |
| **GCP Project**                  | `${{infra.project}}`                            | The Google Cloud project of the function. Auto-resolved from the infrastructure definition.                                     |
| **Command Timeout**              | `10m`                                           | Maximum time for the step to complete.                                                                                          |
| **Log Level**                    | `info`                                          | Log verbosity for the step execution.                                                                                           |

{% hint style="info" %}
**Advanced section**

The step template also has a collapsible **Advanced** section for additional overrides not covered above.
{% endhint %}

***

### Next steps <a href="#next-steps" id="next-steps"></a>

* Go to [Google Cloud Functions step library](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/step-library.md) for the full list of available steps.
* Go to [Basic](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/google-cloud-functions-deployment-strategies/basic.md) to use this step in a managed strategy.
