Restore Cache from GCS

Updated 1 month ago by Manish Jaiswal

Caching ensures faster job execution by reusing the data from expensive fetch operations from previous jobs. 

In Harness CI, the Restore Cache from the GCS step can restore the cache saved to GCS using the Save Cache to GCS step. You simply specify the GCS bucket key of the saved cache.

This topic covers restoring the saved cache from GCS bucket.

In this topic:

Before You Begin

Save Cache to GCS: the Save Cache to GCS step saves the cache that the Restore Cache in GCS step reuses.

Step 1: Open the Build Stage

In your Harness Pipeline, open the Stage where you want to restore the cache.

Step 2: Define the Build Farm Infrastructure

In the CI stage Infrastructure, define the build farm for the codebase and steps.

The following example uses a Kubernetes cluster build farm.

  1. In Kubernetes Cluster, select or create a Kubernetes Connector. See Kubernetes Cluster Connector Settings Reference.
    This Connector connects Harness to the cluster to use as the build farm.
  2. In Namespace, enter the Kubernetes namespace to use.
    You can use a Runtime Input (<+input>) or expression for these settings also.
    See Runtime Inputs and Define Kubernetes Cluster Build Infrastructure.
  3. Click Next.

Step 3: Restore Cache from GCS

In Execution, click Add Step, and select Restore Cache from GCS.

For step settings, see Restore Cache from GCS Settings.

In this step, you are configuring the GCS bucket keys on which you have your saved cache.

When you are done, click Apply Changes.

Step 4: Run Pipeline

Click Save to save the changes, and click Run Pipeline

Step 5: View the Results

You can see the logs for Restore Save Cache from the GCS step in the Pipeline as it runs.

level=info name=drone-cache ts=2021-08-16T14:57:12.820832878Z caller=restorer.go:94 component=plugin component=restorer msg="cache restored" took=217.971354ms

See Also


Please Provide Feedback