mirror of
https://github.com/containers/podman.git
synced 2025-05-22 01:27:07 +08:00
ci: run golangci-lint on freebsd
This could have been done by simply running GOOS=freebsd ./bin/golangci-lint run [options] ./... on Linux, but some freebsd code is using cgo (i.e. is linked to C libraries), so real freebsd environment is required. This also fixes the issue of ignoring linter errors for Windows and Darwin (exit 0), introduced by commit c9b108d5b38. Fixes: c9b108d5b38 ("Bump golangci-lint to v2.0.2") Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@ -330,6 +330,8 @@ freebsd_alt_build_task:
|
|||||||
image_family: freebsd-13-4
|
image_family: freebsd-13-4
|
||||||
setup_script:
|
setup_script:
|
||||||
- pkg install -y gpgme bash go-md2man gmake gsed gnugrep go pkgconf zstd
|
- pkg install -y gpgme bash go-md2man gmake gsed gnugrep go pkgconf zstd
|
||||||
|
lint_script:
|
||||||
|
- gmake golangci-lint
|
||||||
build_amd64_script:
|
build_amd64_script:
|
||||||
- gmake podman-release
|
- gmake podman-release
|
||||||
# This task cannot make use of the shared repo.tar.zst artifact and must
|
# This task cannot make use of the shared repo.tar.zst artifact and must
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Run golangci-lint with different sets of build tags.
|
# Run golangci-lint with different sets of build tags.
|
||||||
set -e
|
set -e
|
||||||
@ -8,23 +8,29 @@ set -e
|
|||||||
# a very old version, where modern features (like `declare -A`) are
|
# a very old version, where modern features (like `declare -A`) are
|
||||||
# absent.
|
# absent.
|
||||||
|
|
||||||
echo "Linting for GOOS=$GOOS"
|
declare -a EXTRA_TAGS
|
||||||
# Special case: for Darwin and Windows only "remote" linting is possible and required.
|
|
||||||
if [[ "$GOOS" == "windows" || "$GOOS" == "darwin" ]]; then
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
./bin/golangci-lint run --build-tags="remote,containers_image_openpgp" "$@"
|
|
||||||
)
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Normal case (Linux): run linter for various sets of build tags.
|
echo "Linting for GOOS=$GOOS"
|
||||||
TAGS="apparmor,seccomp,selinux"
|
case "$GOOS" in
|
||||||
for EXTRA_TAGS in "" ",systemd" ",remote"; do
|
windows|darwin)
|
||||||
|
# For Darwin and Windows, only "remote" linting is possible and required.
|
||||||
|
TAGS="remote,containers_image_openpgp"
|
||||||
|
;;
|
||||||
|
freebsd)
|
||||||
|
TAGS="containers_image_openpgp"
|
||||||
|
EXTRA_TAGS=(",remote")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Assume Linux: run linter for various sets of build tags.
|
||||||
|
TAGS="apparmor,seccomp,selinux"
|
||||||
|
EXTRA_TAGS=(",systemd" ",remote")
|
||||||
|
esac
|
||||||
|
|
||||||
|
for EXTRA in "" "${EXTRA_TAGS[@]}"; do
|
||||||
|
# Use set -x in a subshell to make it easy for a developer to copy-paste
|
||||||
|
# the command-line to focus or debug a single, specific linting category.
|
||||||
(
|
(
|
||||||
# Make it really easy for a developer to copy-paste the command-line
|
|
||||||
# to focus or debug a single, specific linting category.
|
|
||||||
set -x
|
set -x
|
||||||
./bin/golangci-lint run --build-tags="${TAGS}${EXTRA_TAGS}" "$@"
|
./bin/golangci-lint run --build-tags="${TAGS}${EXTRA}" "$@"
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
7
pkg/machine/e2e/config_freebsd_test.go
Normal file
7
pkg/machine/e2e/config_freebsd_test.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package e2e_test
|
||||||
|
|
||||||
|
const podmanBinary = "../../../bin/podman-remote"
|
||||||
|
|
||||||
|
func getOtherProvider() string {
|
||||||
|
return ""
|
||||||
|
}
|
Reference in New Issue
Block a user