From 32e01c9a4c3e606a095a0360f1818a3cdfeca448 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Tue, 30 Jan 2024 11:10:42 -0800 Subject: [PATCH] Add special handling for installing linter in CI Don't download the linter unless a special CI env setting is set. Also use a different cache to avoid permissions issues with the rootfs in CI. Signed-off-by: William Douglas --- Makefile | 2 +- entrypoint.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9a92155fb..39f6d65ca 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ checkcoverage: .PHONY: lint lint: - @if ! $(gopath)/bin/golangci-lint --version &>/dev/null; then \ + @if [ ! -z "${CI_ONLY}" ]; then \ echo "Installing linters..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(gopath)/bin v1.55.2; \ fi diff --git a/entrypoint.sh b/entrypoint.sh index 04c467f71..8bfea3754 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,8 @@ cd /home/clr/mixer-tools run_precheck() { make && sudo -E make install + export CI_ONLY=1 + export GOLANGCI_LINT_CACHE=/tmp/.golangci-lint make lint && make check }