{"id":21822407,"url":"https://github.com/openshift-pipelines/tekton-caches","last_synced_at":"2026-03-03T07:04:29.727Z","repository":{"id":225181292,"uuid":"765265891","full_name":"openshift-pipelines/tekton-caches","owner":"openshift-pipelines","description":"Tools (and Task/StepAction) to manage cached content within Tekton","archived":false,"fork":false,"pushed_at":"2026-02-11T12:24:25.000Z","size":19643,"stargazers_count":12,"open_issues_count":17,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-11T20:32:25.218Z","etag":null,"topics":["cache","experiment","stepaction","tekton"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openshift-pipelines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-29T15:39:32.000Z","updated_at":"2025-12-15T07:57:37.000Z","dependencies_parsed_at":"2024-04-30T12:06:41.802Z","dependency_job_id":"b23b07d7-a8e7-4264-85d2-b9acfe9126b1","html_url":"https://github.com/openshift-pipelines/tekton-caches","commit_stats":null,"previous_names":["openshift-pipelines/tekton-caches"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/openshift-pipelines/tekton-caches","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-pipelines%2Ftekton-caches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-pipelines%2Ftekton-caches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-pipelines%2Ftekton-caches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-pipelines%2Ftekton-caches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openshift-pipelines","download_url":"https://codeload.github.com/openshift-pipelines/tekton-caches/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift-pipelines%2Ftekton-caches/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29776697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","experiment","stepaction","tekton"],"created_at":"2024-11-27T17:14:51.834Z","updated_at":"2026-02-24T08:38:56.572Z","avatar_url":"https://github.com/openshift-pipelines.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tekton-caches [![build-test-publish](https://github.com/openshift-pipelines/tekton-caches/actions/workflows/latest.yaml/badge.svg)](https://github.com/openshift-pipelines/tekton-caches/actions/workflows/latest.yaml)\n\nThis is a tool to cache resources like go cache/maven or others on TektonCD\npipelines.\n\nThis tool supports uploading the cache to an OCI registry and plans to support\nS3, GCS and other storage backends.\n\nIt uses the new [StepActions](https://tekton.dev/docs/pipelines/stepactions/)\nfeature of TektonCD Pipelines but can be as well used without it.\n\nSee the StepActions in the [tekton/](./tekton) directory.\n\n## Example\n\nThis is an example of a build pipeline for a go application caching and reusing\nthe go cache. If the `go.mod` and `go.sum` are changed the cache is invalidated and\nrebuilt.\n\n### Pre-requisites\n\n- You need a recent TektonCD pipelines installed with the StepActions feature-flags enabled.\n\n```shell\nkubectl patch configmap -n tekton-pipelines --type merge -p '{\"data\":{\"enable-step-actions\": \"true\"}}' feature-flags\n```\n\n- A registry to push the images to. Example: docker.io/loginname. Make sure you\n  have setup tekton to be able to push/fetch from that registry, see the\n  [TektonCD pipelines documentation](https://tekton.dev/docs/pipelines/auth/#configuring-authentication-for-docker)\n\n### Usage\n\nCreate the go pipeline example from the examples directory:\n\n```shell\nkubectl create -f pipeline-go.yaml\n```\n\nStart it with the tkn cli (change the value as needed):\n\n```shell\ntkn pipeline start pipeline-go --param repo_url=https://github.com/vdemeester/go-helloworld-app --param revision=main --param registry=docker.io/username -w name=source,emptyDir= --use-param-defaults\n```\n\nor with a PipelineRun yaml object:\n\n```yaml\nkind: PipelineRun\nmetadata:\n  name: build-go-application-with-caching-run\nspec:\n  pipelineRef:\n    name: pipeline-go\n  params:\n    - name: repo_url\n      value: https://github.com/vdemeester/go-helloworld-app\n    - name: revision\n      value: main\n    - name: registry\n      value: docker.io/username\n  workspaces:\n    - name: source\n      emptyDir: { }\n```\n\n- you can as well redefine the `buildCommand` which by default do a `go build\n  -v ./` with the `buildCommand` parameter, for example if you want instead to\n  run the tests on a repo with caching:\n\n```shell\ntkn pipeline start pipeline-go --param repo_url=https://github.com/chmouel/gosmee \\ \n  --param revision=main --param registry=docker.io/username \\\n  --param=buildCommand=\"make test\" -w name=source,emptyDir= --use-param-defaults --showlog\n```\n\n- You can as well force the upload of the cache with param `FORCE_CACHE_UPLOAD=true` (default: false)\n- You can provide your own image with the param `image` (default to the latest docker.io `golang` image)\n- You can provide your own patterns for the hash to computer with the `cachePatterns` array parameter (default to\n  `go.mod,go.sum`)\n\n## Using with Google Storage as a backend\n\nIn order to use the `StepAction` with GCS, the parameter `googleCredentialsPath` needs to be specified. It should point\nto the google service account json file — which usually comes from a secret.\n\nFor example, let's assume a secret name `gcs-secret` is populated with the content of the google service account, key\n`gcs-sa.json` (a json file, be it with or without support for Google Workload Identity). One could use a `workspace` or\na `volume` to mount that secret somewhere and set the path to the `StepAction`.\n\n```yaml\napiVersion: tekton.dev/v1\nkind: TaskRun\nmetadata:\n  generateName: my-taskrun-\nspec:\n  params:\n    - name: serviceAccountName\n      value: gcs-sa.json\n  taskSpec:\n    params:\n      - name: serviceAccountName\n        type: string\n        default: \"\"\n    workspaces:\n      - name: source\n      - name: google-credentials\n        optional: true\n      - name: bound-sa-token\n        mountPath: /var/run/secrets/openshift/serviceaccount\n        optional: true\n    steps:\n      - # […] git clone, …\n      - name: cache-fetch\n        ref:\n          name: cache-fetch\n          # or using http resolver with https://raw.githubusercontent.com/openshift-pipelines/tekton-caches/main/tekton/cache-fetch.yaml\n        params:\n          - name: PATTERNS\n            value: [ \"go.mod\", \"go.sum\" ]\n          - name: SOURCE\n            value: gs://my-bucket/some/folder\n          - name: CACHE_PATH\n            value: $(workspace.source.path)/cache\n          - name: WORKING_DIR\n            value: $(worksoaces.source.path)/repo\n          - name: GOOGLE_APPLICATION_CREDENTIALS\n            value: $(workspace.google-credentials.path)/$(params.serviceAccountName)\n      - # […] something else like go build\n      - # […] and then same thing with cache-upload\n  workspaces:\n    - name: source\n      emptyDir: { }\n    - name: google-credentials\n      secret:\n        secretName: gcs-secret\n    - name: bound-sa-token\n      projected:\n        sources:\n          - serviceAccountToken:\n              audience: openshift\n              expirationSeconds: 3600\n              path: token\n        defaultMode: 420\n```\n\n`bound-sa-token` workspace isn't required if Workload Identity federation isn't setup. Here we assumed an OIDC is\nconfigured in OpenShift.\n\n## Param Names\n\nHere is the list of params being used in cache step actions.\n\n### common\n\nThese parameters are supported in both `cache-fetch` and `cache-upload` step-action\n\n| Name                             | Type     | Optional | Description                                                                                                                                                                                                                   | Default Value |\n|----------------------------------|----------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| `PATTERNS`                       | `array`  | NO       | Regular expression to select files to include to compute the hash. For example, in the case of a Go project, you can use `go.mod` for this, so the value would be \"**/go.sum\" (to work with possible sub go modules as well). | None          |\n| `CACHE_PATH`                     | `string` | NO       | Path where to extract the cache content. \u003cbr\u003e It can refer any folder, backed by a workspace or a volume, or nothing.                                                                                                         | None          |\n| `WORKING_DIR`                    | `string` | NO       | The working dir from where the files patterns needs to be taken                                                                                                                                                               | None          |\n| `INSECURE`                       | `string` | YES      | Whether to use insecure mode for fetching the cache                                                                                                                                                                           | `false`       |\n| `GOOGLE_APPLICATION_CREDENTIALS` | `string` | YES      | The path where to find the google credentials. If left empty, it is ignored.                                                                                                                                                  | `\"\"`          |\n| `AWS_CONFIG_FILE`                | `string` | YES      | The path to the aws config file. If left empty, it is ignored.                                                                                                                                                                | `\"\"`          |\n| `AWS_SHARED_CREDENTIALS_FILE`    | `string` | YES      | The path to find the aws credentials file. If left empty, it is ignored.                                                                                                                                                      | `\"\"`          |\n| `BLOB_QUERY_PARAMS`              | `string` | YES      | Blob Query Params to support configure s3, gcs and azure. This is optional unless some additional features of storage providers are required like s3 acceleration, fips, pathstyle,etc                                        | `\"\"`          |\n\n### cache-fetch\n\n| Name     | Type     | Optional | Description                                                                                                                                                                                                                                                                                                                                                               | Default Value |\n|----------|----------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| `SOURCE` | `string` | NO       | The source from where the cache should be fetched. It's a URI with the scheme defining the \"provider\". In addition, one can add a {{hash}} variable to use the computed hash in the reference (oci image tags, path in s3, …)\u003cbr\u003e **Currently supported:** \u003cul\u003e \u003cli\u003e oci:// (e.g. oci://quay.io/vdemeester/go-cache:{{hash}}\u003cli\u003e s3:// (e.g. s3:// \u003cli\u003e gs:// (e.g. gs:// | None          |\n\n### cache-upload\n\n| Name     | Type     | Optional | Description                                                                                                                                                                                                                                                                                                                                                               | Default Value |\n|----------|----------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| `TARGET` | `string` | NO       | The target from where the cache should be uploaded. It's a URI with the scheme defining the \"provider\". In addition, one can add a {{hash}} variable to use the computed hash in the reference (oci image tags, path in s3, …)\u003cbr\u003e **Currently supported:** \u003cul\u003e \u003cli\u003e oci:// (e.g. oci://quay.io/vdemeester/go-cache:{{hash}}\u003cli\u003e s3:// (e.g. s3://\u003cli\u003e gs:// (e.g. gs:// | None          |\n\n## License\n\n[Apache License 2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift-pipelines%2Ftekton-caches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenshift-pipelines%2Ftekton-caches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift-pipelines%2Ftekton-caches/lists"}