> 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/google-cloud-functions-deployment-strategies/basic.md).

# Basic deployment

Deploy a new Google Cloud Function revision and route full traffic to it immediately.

Basic deployment deploys a new function revision and routes all traffic to it immediately, with no intermediate traffic shifting. Use this strategy when you do not need a progressive or zero-downtime cutover.

***

### What you will learn from this topic <a href="#what-you-will-learn-from-this-topic" id="what-you-will-learn-from-this-topic"></a>

* Understand how Harness deploys a new function revision and routes all traffic to it in a single step, with no intermediate traffic shifting.
* See how the deploy step is configured, and how Harness handles it if the deployment fails.

***

### Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

* **A Google Cloud Functions service:** Go to [Google Cloud Functions services](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/google-cloud-functions-services.md) to set up a service with a manifest and artifact source.
* **A Google Cloud Functions infrastructure definition:** Go to [Google Cloud Functions infrastructure](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/google-cloud-functions-infrastructure.md) to connect a Google Cloud account and configure authentication.

***

### Basic strategy step sequence <a href="#basic-strategy-step-sequence" id="basic-strategy-step-sequence"></a>

When you select **Basic**, Harness adds the following step to your stage execution:

1. **Google Cloud Function Deploy:** Deploys the new function revision. **Skip Traffic** stays at its default of `false`, so the revision receives full traffic as soon as the deployment completes. There is no separate traffic shift step.

On rollback, Harness runs the **Google Cloud Function Rollback** step inside a **Google Cloud Function Basic Rollback** step group.

***

### Stage YAML <a href="#stage-yaml" id="stage-yaml"></a>

A minimal basic stage looks like this.

{% tabs %}
{% tab title="Run on Delegate" %}
This example runs on a delegate and deploys to every infrastructure definition in the environment:

```yaml
- name: Deploy Google Cloud Function
  id: Deploy_Google_Cloud_Function
  service:
    type: google-cloud-functions
    items:
    - service_google_cloud_function
  environment:
    items:
    - id: environment_env
      all-infra: true
      deploy-to: all
  runtime: delegate
  steps:
  - name: Google Cloud Function Deploy
    id: googleCloudFunctionDeployStep
    template:
      uses: googleCloudFunctionDeployStep
  rollback:
  - group:
      steps:
      - 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}}
    id: googleCloudFunctionBasicRollback
    name: Google Cloud Function Basic Rollback
  on-failure:
    errors: all
    action: stage-rollback
```

{% endtab %}

{% tab title="Run on Harness Cloud" %}
This example runs on Harness Cloud and deploys to a single, specific infrastructure definition:

```yaml
- name: s1
  id: s1
  service:
    items:
    - gcf_nodejs_service
  environment:
    items:
    - id: environment_env
      deploy-to: infrastructure_gcf
  runtime: cloud
  steps:
  - name: Google Cloud Function Deploy
    id: googleCloudFunctionDeployStep
    template:
      uses: googleCloudFunctionDeployStep
  rollback:
  - group:
      steps:
      - 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}}
    id: googleCloudFunctionBasicRollback
    name: Google Cloud Function Basic Rollback
  on-failure:
    errors: all
    action: stage-rollback
```

{% endtab %}
{% endtabs %}

***

### Configure the Google Cloud Function Deploy step <a href="#configure-the-google-cloud-function-deploy-step" id="configure-the-google-cloud-function-deploy-step"></a>

For the basic strategy, the deploy step leaves **Skip Traffic** at its default so the new revision receives full traffic immediately.

| Field               | Default | Description                                                                                                                                                                                                         |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Skip Traffic**    | `false` | When `true`, the deployed revision does not receive traffic until a separate traffic shift step runs. Basic leaves this at the default, so the revision receives full traffic as soon as the deploy step completes. |
| **Command Timeout** | `10m`   | Maximum time for the step to complete.                                                                                                                                                                              |
| **Log Level**       | `info`  | Log verbosity for the step execution.                                                                                                                                                                               |

***

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

When the stage failure strategy triggers rollback, the **Google Cloud Function Rollback** step inside the **Google Cloud Function Basic Rollback** step group runs automatically.

The rollback step receives the following inputs:

| Field                      | Value                                           | Description                                                                                    |
| -------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| **Cloud Function Name**    | `${{rollback.data.FUNCTION_NAME}}`              | The function to roll back.                                                                     |
| **Previous Traffic Split** | `${{rollback.data.ACTIVE_CLOUD_RUN_REVISIONS}}` | The revisions that were active before the deployment. Used to restore traffic during rollback. |

{% hint style="info" %}
**Gen 2 functions run on a backing Cloud Run service**

Google Cloud Functions Gen 2 deploys each function as a Cloud Run service. The deploy step reads and modifies this backing service directly, which is why rollback data stores Cloud Run revisions.
{% endhint %}

Rollback behavior differs by deployment history:

* **Subsequent deployments:** Harness restores the previous serving traffic split on the backing Cloud Run service. **Previous Traffic Split** holds the revision and traffic percentage that were active before the deployment, and the rollback step applies that split back to the service.
* **First deployment:** There is no previous revision to restore traffic to, so **Previous Traffic Split** has nothing to roll back to.

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

The exact outcome of a rollback on a function's first deployment, 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 %}

***

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

* Go to [Canary](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/google-cloud-functions-deployment-strategies/canary.md) for a progressively rolled out deployment.
* Go to [Blue-green](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/google-cloud-functions-deployment-strategies/blue-green.md) for a zero-downtime traffic cutover deployment.
* Go to [Blank canvas](https://developer.harness.io/continuous-delivery/3.0/use-deployments/google-cloud-functions/google-cloud-functions-deployment-strategies/blank-canvas.md) to compose steps manually.
