From 65af288ea44db58c440d66e51fa6d06ee3f56fe2 Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki Date: Thu, 11 May 2023 08:30:17 +0900 Subject: [PATCH] aqua-installer's caching --- docs/products/aqua-installer.md | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/docs/products/aqua-installer.md b/docs/products/aqua-installer.md index d171c47d7..80514b886 100644 --- a/docs/products/aqua-installer.md +++ b/docs/products/aqua-installer.md @@ -95,3 +95,51 @@ policy_allow | `""` | aqua >= `v2.3.0`. If this is `"true"`, `aqua policy allow` Please see [action.yaml](https://github.com/aquaproj/aqua-installer/blob/main/action.yaml) too. Nothing. + +### :bulb: Caching + +[#428](https://github.com/aquaproj/aqua-installer/issues/428) + +aqua-installer doesn't support caching, but you can cache packages and registries using `actions/cache`. + +e.g. + +```yaml +- uses: actions/cache@v3.3.1 + with: + path: ~/.local/share/aquaproj-aqua + key: v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('aqua.yaml')}} + restore-keys: | + v1-aqua-installer-${{runner.os}}-${{runner.arch}}- +- uses: aquaproj/aqua-installer@v2.1.1 + with: + aqua_version: v2.6.0 +``` + +Please fix `actions/cache`'s parameters properly. +If you [split `aqua.yaml` using import](/docs/guides/split-config) or use local Registries, you may have to add hashes of them to key and restore-keys. + +e.g. + +```yaml +- uses: actions/cache@v3.3.1 + with: + path: ~/.local/share/aquaproj-aqua + key: v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('.aqua/*.yaml')}} # Change key + restore-keys: | + v1-aqua-installer-${{runner.os}}-${{runner.arch}}- +``` + +aqua-installer runs aqua with [-l](https://aquaproj.github.io/docs/tutorial/install-only-link) option by default, so packages that aren't run in the workflow aren't cached. +If you want to cache all packages, please set `aqua_opts` to unset `-l` option. + +```yaml +- uses: aquaproj/aqua-installer@v2.1.1 + with: + aqua_version: v2.6.0 + aqua_opts: "" # Unset `-l` option +``` + +But if `-l` is unset, aqua installs packages that aren't run in the workflow uselessly. + +So it is up to you that whether and how you cache packages.