Restore Cache from S3

Updated 2 months ago by Michael Cretzman

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

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

This topic covers restoring the saved cache from an S3 bucket.

In this topic:

Before You Begin

Save Cache in S3: the Save Cache in S3 step saves the cache that the Restore Cache in S3 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 S3

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

For step settings, see Restore Cache Step Settings.

In this step, you are configuring the S3 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 S3 step in the Pipeline as it runs.

level=info name=drone-cache ts=2021-06-26T13:59:36.274220492Z caller=restorer.go:94 component=plugin component=restorer msg="cache restored" took=362.80513ms

See Also


Please Provide Feedback