From 7498c77912b6d742de407478c1ad8d3dc306ed32 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Wed, 19 Oct 2022 19:15:40 +0530 Subject: [PATCH 1/3] Add more details to version section in readme --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index abe42b0..11fcb8b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in > See [Skipping steps based on cache-hit](#Skipping-steps-based-on-cache-hit) for info on using this output ### Cache scopes -The cache is scoped to the key and branch. The default branch cache is available to other branches. +The cache is scoped to the key, [version](#cache-version) and branch. The default branch cache is available to other branches. See [Matching a cache key](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) for more info. @@ -174,9 +174,13 @@ steps: ## Cache Version -Cache version is unique for a combination of compression tool used for compression of cache (Gzip, Zstd, etc based on runner OS) and the path of directories being cached. If two caches have different versions, they are identified as unique cache entries. This also means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different. +Cache version is a hash [generated](https://github.com/actions/toolkit/blob/500d0b42fee2552ae9eeb5933091fe2fbf14e72d/packages/cache/src/internal/cacheHttpClient.ts#L73-L90) for a combination of compression tool used (Gzip, Zstd etc based on runner OS) and the `path` of directories being cached. If two caches have different versions, they are identified as unique caches while matching. This for example, means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different. -Example: Below example will create 3 unique caches with same keys. Ubuntu and windows runners will use different compression technique and hence create two different caches. And `build-linux` will create two different caches as the `paths` are different. +> Pro tip: [List caches](https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository) API can be used to get the version of a cache. This can be helpful to troubleshoot cache miss due to version. + +
+ Example +The workflow will create 3 unique caches with same keys. Ubuntu and windows runners will use different compression technique and hence create two different caches. And `build-linux` will create two different caches as the `paths` are different. ```yaml jobs: @@ -223,6 +227,7 @@ jobs: if: steps.cache-primes.outputs.cache-hit != 'true' run: ./generate-primes -d prime-numbers ``` +
## Known practices and workarounds Following are some of the known practices/workarounds which community has used to fulfill specific requirements. You may choose to use them if suits your use case. Note these are not necessarily the only or the recommended solution. From f38dc63de942db2c1548464998c4d5b010000339 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Fri, 4 Nov 2022 11:08:32 +0530 Subject: [PATCH 2/3] Update README.md Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11fcb8b..e880de3 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ steps: ## Cache Version -Cache version is a hash [generated](https://github.com/actions/toolkit/blob/500d0b42fee2552ae9eeb5933091fe2fbf14e72d/packages/cache/src/internal/cacheHttpClient.ts#L73-L90) for a combination of compression tool used (Gzip, Zstd etc based on runner OS) and the `path` of directories being cached. If two caches have different versions, they are identified as unique caches while matching. This for example, means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different. +Cache version is a hash [generated](https://github.com/actions/toolkit/blob/500d0b42fee2552ae9eeb5933091fe2fbf14e72d/packages/cache/src/internal/cacheHttpClient.ts#L73-L90) for a combination of compression tool used (Gzip, Zstd, etc. based on the runner OS) and the `path` of directories being cached. If two caches have different versions, they are identified as unique caches while matching. This for example, means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different. > Pro tip: [List caches](https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository) API can be used to get the version of a cache. This can be helpful to troubleshoot cache miss due to version. From 91db8faf67e712e69bb81eae15d5fcc471ee3d64 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Mon, 7 Nov 2022 10:29:43 +0530 Subject: [PATCH 3/3] Use ubuntu/squid instead of datadog/squid --- .github/workflows/workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 320fd46..60410a6 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -99,7 +99,7 @@ jobs: options: --dns 127.0.0.1 services: squid-proxy: - image: datadog/squid:latest + image: ubuntu/squid:latest ports: - 3128:3128 env: @@ -122,7 +122,7 @@ jobs: options: --dns 127.0.0.1 services: squid-proxy: - image: datadog/squid:latest + image: ubuntu/squid:latest ports: - 3128:3128 env: