cirrus: fix golangci-lint cache leak

Do not use reupload_on_changes, this will make the cache grow unbound
and I have seen the cache become so large then restoring it and
uploading it took several minutes thus making the task time worse
compared to no cache. I manually cleaned the cache a few times to fix
this but it need to properly be fixed here.

To not have a stale cache for to long also use date +%U which will
create a new cache once a week. This is in line with the offical
golangci-lint github action which invalidates the cache every 7 days by
default[1].

[1] https://github.com/golangci/golangci-lint-action/blob/main/README.md#cache-invalidation-interval

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-09-10 14:23:51 +02:00
parent cf06546b7f
commit 710e216390

View File

@ -122,10 +122,10 @@ validate-source_task:
setup_script: &setup '$GOSRC/$SCRIPT_BASE/setup_environment.sh'
golangci-lint_cache:
folder: /root/.cache/golangci-lint
reupload_on_changes: true
fingerprint_script:
fingerprint_script: &golangci_cache_fingerprint
- go version
- grep GOLANGCI_LINT_VERSION Makefile | head -1
- date +%U
# Standard main execution stage call, used by nearly every task in CI.
main_script: &main '/usr/bin/time --verbose --output="$STATS_LOGFILE" $GOSRC/$SCRIPT_BASE/runner.sh'
@ -340,10 +340,7 @@ freebsd_alt_build_task:
- go version # Downloads a new go version based on go.mod's go directive.
golint_cache:
folder: ~/.cache/golangci-lint
reupload_on_changes: true
fingerprint_script:
- go version
- grep GOLANGCI_LINT_VERSION Makefile | head -1
fingerprint_script: *golangci_cache_fingerprint
lint_script:
- gmake golangci-lint
build_amd64_script: