From d9ad7cbc949d7e59506292c79735cd10eedfb36b Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Thu, 25 Jan 2024 15:51:14 -0500 Subject: [PATCH 1/2] Run lint for mac builds There are darwin-specific code paths which were not being linted prior to this commit. Fix this with a new, darwin-specific section of the lint runner script. Signed-off-by: Chris Evich --- .cirrus.yml | 2 ++ hack/golangci-lint.sh | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index e9f28662ce..0254546728 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -466,6 +466,8 @@ osx_alt_build_task: # This host is/was shared with potentially many other CI tasks. # The previous task may have been canceled or aborted. prep_script: &mac_cleanup "contrib/cirrus/mac_cleanup.sh" + lint_script: + - make lint basic_build_script: - make .install.ginkgo - make podman-remote diff --git a/hack/golangci-lint.sh b/hack/golangci-lint.sh index 7c8237e2eb..9d34a9c927 100755 --- a/hack/golangci-lint.sh +++ b/hack/golangci-lint.sh @@ -3,6 +3,28 @@ # Need to run linter twice to cover all the build tags code paths set -e +# Dedicated block for Darwin: OS doesn't support the rest of this +# script, only needs to check 'remote', and its golangci-lint needs +# specialized arguments. +if [[ $(uname -s) == "Darwin" ]] || [[ "$GOOS" == "darwin" ]]; then + declare -a DARWIN_SKIP_DIRS + DARWIN_SKIP_DIRS=( + libpod/events + pkg/api + pkg/domain/infra/abi + pkg/machine/qemu + pkg/trust + test + ) + echo "" + echo Running golangci-lint for "remote" + echo Build Tags "remote": remote + echo Skipped directories "remote": ${DARWIN_SKIP_DIRS[*]} + ./bin/golangci-lint run --build-tags="remote" \ + --skip-dirs=$(tr ' ' ',' <<<"${DARWIN_SKIP_DIRS[@]}") + exit 0 # All done, don't execute anything below, it will break on Darwin +fi + declare -A BUILD_TAGS BUILD_TAGS[default]="apparmor,seccomp,selinux" BUILD_TAGS[abi]="${BUILD_TAGS[default]},systemd" From 3f3d1e4de70d29f7aa26ec3e6a9c5e858f786258 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Fri, 26 Jan 2024 10:39:54 -0500 Subject: [PATCH 2/2] Temporarily ignore mac-linting failures As of this commit, there are several pages worth of lint findings for the mac. Once they're all addressed, this commit may be reverted to enable continuous checking. Signed-off-by: Chris Evich --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 0254546728..696c7e7385 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -467,7 +467,7 @@ osx_alt_build_task: # The previous task may have been canceled or aborted. prep_script: &mac_cleanup "contrib/cirrus/mac_cleanup.sh" lint_script: - - make lint + - make lint || true # TODO: Enable when code passes check basic_build_script: - make .install.ginkgo - make podman-remote