> 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/overview-3/google-cloud-run-services.md).

# Google Cloud Run services

Define a Harness service for Google Cloud Run deployments, including the service manifest and artifact source.

A Harness service for Google Cloud Run represents the application you want to deploy. It holds the service manifest (a Cloud Run YAML file) and the container image artifact source that Harness uses when deploying to your Cloud Run service.

Services are independent of pipelines. Configure one once and reuse it across stages and pipelines.

{% hint style="info" %}
**Supported artifact sources**

Only **Google Artifact Registry** and **Docker Registry** are supported as artifact sources for Google Cloud Run services.
{% endhint %}

***

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

* How to create a Harness service for Google Cloud Run with a manifest and artifact source.
* How to add a Cloud Run service manifest from Harness Code, GitHub, or another Git provider.
* How to add an artifact source using Google Artifact Registry or Docker Hub.
* How to use an existing service in a pipeline stage.

***

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

* **A GCP connector:** A Harness GCP connector to authenticate with your Google account. Go to [Google Cloud Run infrastructure](/continuous-delivery/3.0/use-deployments/overview-3/google-cloud-run-infrastructure.md) to set one up.
* **A container image:** An image pushed to Google Artifact Registry or Docker Hub.
* **A Cloud Run service manifest:** A YAML file compatible with `gcloud run services replace`. All manifest files must use the `.yaml` extension. Go to the [Google Cloud Run YAML reference](https://cloud.google.com/run/docs/reference/yaml/v1) to review the manifest format.

***

### Create a Google Cloud Run service <a href="#create-a-google-cloud-run-service" id="create-a-google-cloud-run-service"></a>

1. Go to **Deployments**, expand the drop-down, and select **Services** under **Resources**.
2. Click **+ New Service**.
3. In the **Create service** dialog, the **Deployment Target** is set to **Google Cloud Run**. Enter a name. Harness auto-generates an ID that you can edit.
4. Under **Storage**, select **Inline** (Harness stores the service configuration) or a Git repository.
5. Click **Save**.

Harness opens the service editor with two sections: **Google Cloud Run Manifest Definition** and **Artifact source**. An **Advanced** section is also available for Config Files and Variables.

6. Add a service manifest and artifact source as described below.

***

### Add a manifest <a href="#add-a-manifest" id="add-a-manifest"></a>

The service manifest is a Cloud Run YAML file that defines your service configuration. Harness downloads this manifest at deploy time, injects the container image URL, and uses `gcloud run services replace` to apply it.

1. Under **Google Cloud Run Manifest Definition**, click **+ Add**.
2. The manifest type is pre-set to **Google Cloud Run Manifest Definition**. Select the **Source** where the manifest is stored.

The following sources are supported:

| Source           | Description                                         |
| ---------------- | --------------------------------------------------- |
| **Harness Code** | A repository in Harness Code.                       |
| **GitHub**       | A GitHub repository using a GitHub connector.       |
| **Git**          | A generic Git repository using a Git connector.     |
| **GitLab**       | A GitLab repository using a GitLab connector.       |
| **Bitbucket**    | A Bitbucket repository using a Bitbucket connector. |

3. Enter an **ID** to identify this manifest.
4. Configure the source-specific fields. The following fields apply to all Git-based sources:

| Field                | Description                                                                           |
| -------------------- | ------------------------------------------------------------------------------------- |
| **Connector**        | The connector for the selected source (for example, a GitHub connector).              |
| **Repository**       | The repository name or, for Harness Code, select from a list of Harness repositories. |
| **Fetch**            | How to fetch the manifest: **Branch** or **Commit**.                                  |
| **Branch**           | The branch to fetch from. Available when **Fetch** is set to **Branch**.              |
| **File/Folder Path** | The path to the manifest YAML file in the repository.                                 |

5. Click **Submit**.

Harness replaces the container image field in the manifest with the artifact you configure below before applying it.

***

### Add an artifact source <a href="#add-an-artifact-source" id="add-an-artifact-source"></a>

The artifact source tells Harness which container image to deploy. Harness injects the resolved image URL into the service manifest before running `gcloud run services replace`.

1. Under **Artifact source**, click **+ Add**.
2. Select the artifact **Type** from the drop-down. The following types are supported:

#### Google Artifact Registry <a href="#google-artifact-registry" id="google-artifact-registry"></a>

Select **Google Artifact Registry** to pull images from GAR. Configure the following fields:

| Field               | Required | Description                                                                                  |
| ------------------- | -------- | -------------------------------------------------------------------------------------------- |
| **ID**              | Yes      | An identifier for this artifact source.                                                      |
| **Connector**       | Yes      | A Harness GCP connector with access to your GAR repository.                                  |
| **Repository Type** | Yes      | The repository format. Select **Docker** for container images.                               |
| **Project**         | Yes      | The GCP project ID that hosts the GAR repository.                                            |
| **Region**          | Yes      | The GAR repository region (for example, `us-central1`).                                      |
| **Repository Name** | Yes      | The name of the GAR repository.                                                              |
| **Package**         | Yes      | The image name (package) within the repository.                                              |
| **Version Details** | Yes      | How to specify the version: **Value** (fixed tag), **Regex**, or **Latest from Branch**.     |
| **Version**         | Yes      | The specific image tag or version expression.                                                |
| **Digest**          | No       | A specific image digest (SHA value). Set this to pin the deployment to an exact image layer. |

#### Docker Registry <a href="#docker-registry" id="docker-registry"></a>

Select **Docker Registry** to pull images from Docker Hub or a private Docker-compatible registry. Configure the following fields:

| Field          | Required | Description                                                                  |
| -------------- | -------- | ---------------------------------------------------------------------------- |
| **ID**         | Yes      | An identifier for this artifact source.                                      |
| **Connector**  | Yes      | A Harness Docker Registry connector with access to the registry.             |
| **Image Path** | Yes      | The full image name, including the namespace (for example, `myorg/myimage`). |
| **Tag**        | Yes      | A fixed tag or a regex to select the tag at runtime.                         |

3. Click **Save** after configuring the artifact source.

***

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

Expand the **Advanced** section in the service editor to configure the following:

* **Config Files**: attach configuration files to the service for use at runtime.
* **Variables**: define service-level variables that you can reference in manifests and steps using expressions.

***

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

* Go to [Google Cloud Run infrastructure](/continuous-delivery/3.0/use-deployments/overview-3/google-cloud-run-infrastructure.md) to configure your GCP environment and authentication.
* Go to [Deployment strategies](https://github.com/harness/harness-developer-hub/tree/main/3k-docs/delivery/continuous-delivery/use-deployments/google-cloud-run/google-cloud-run-deployment-strategies/README.md) to add execution steps to your stage.

{% @harness-feedback/feedback %}
