ci: Cache pre-commit installations on Jenkins Agent
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m0s
Pre-commit hooks / Pre-commit (push) Successful in 1m31s
Build / Build Components (push) Successful in 1m54s
Tests and linters / gopls check (push) Successful in 3m36s
Tests and linters / Staticcheck (push) Successful in 3m52s
Tests and linters / Run gofumpt (push) Successful in 3m57s
Tests and linters / Tests with -race (push) Successful in 4m2s
Tests and linters / Lint (push) Successful in 4m7s
Tests and linters / Tests (push) Successful in 4m8s
OCI image / Build container images (push) Successful in 4m58s

This change introduces a custom helper from our shared library [0]
that defines ad-hoc container environment to execute CI steps in.

Pre-commit installation will now be cached on Jenkins Agent: builds will
tolerate network hiccups better and we will also save some run time
(although on non-critical path of a parallel process).

[0]: TrueCloudLab/jenkins#8

Change-Id: I93b01f169c457aa35f4d8bc5b90f31b31e2bd8b2
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
Vitaliy Potyarkin 2025-03-24 17:04:24 +03:00
parent 0c664fa804
commit 163e2e9f83

14
.ci/Jenkinsfile vendored
View file

@ -68,12 +68,14 @@ async {
}
task('pre-commit') {
sh '''
apt update
apt install -y --no-install-recommends pre-commit
''' // TODO: Make an OCI image for pre-commit + golang? Unpack golang tarball with a library function?
withEnv(['SKIP=make-lint,go-staticcheck-repo-mod,go-unit-tests,gofumpt']) {
sh 'pre-commit run --color=always --hook-stage=manual --all-files'
dockerfile("""
FROM ${golangDefault}
RUN apt update && \
apt install -y --no-install-recommends pre-commit
""") {
withEnv(['SKIP=make-lint,go-staticcheck-repo-mod,go-unit-tests,gofumpt']) {
sh 'pre-commit run --color=always --hook-stage=manual --all-files'
}
}
}
}