Kaniko: How to cache folders from Gatsby build in Kubernetes using Tekton? Kaniko: How to cache folders from Gatsby build in Kubernetes using Tekton? kubernetes kubernetes

Kaniko: How to cache folders from Gatsby build in Kubernetes using Tekton?


how can I cache the .cache / public folders created by Gatsby build? These folders are not present in the repo.

If Persistent Volumes is available on your cluster and these volumes is available from all nodes, you can use a PVC-backed workspace for cache.

A more generic solution that also works in a regional cluster (e.g. cloud) is to upload the cached folder to something, e.g. a Bucket (Minio?) or potentially Redis? Then also need a Task that download this folder - potentially in parallel with git clone when starting a new PipelineRun. GitHub Actions has a similar solution with the cache action.

Example of a Task with two workspaces that copy a file from one workspace to the other:

apiVersion: tekton.dev/v1beta1  kind: Task  metadata:     name: copy-between-workspaces spec:     workspaces:       - name: ws-a        - name: ws-b      steps:        - name: copy      image: ubuntu       script: cp $(workspaces.ws-a.path)/myfile $(workspaces.ws-b.path)/myfile