For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

Supported artifact sources

Only Google Artifact Registry and Docker Registry are supported as artifact sources for Google Cloud Run services.


What you will learn

  • 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 GCP connector: A Harness GCP connector to authenticate with your Google account. Go to Google Cloud Run infrastructure 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 to review the manifest format.


Create a Google Cloud Run service

  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.

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


Add a manifest

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.

  1. Enter an ID to identify this manifest.

  2. 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.

  1. Click Submit.

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


Add an artifact source

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

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

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.

  1. Click Save after configuring the artifact source.


Configure advanced options

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

Last updated

Was this helpful?