Update the osbuild/images to the version which introduces "dot notation" for distro release versions. - Replace all uses of distroregistry by distrofactory. - Delete local version of reporegistry and use the one from the osbuild/images. - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single `createTestWeldrAPI()` function`. - store/fixture: rework fixtures to allow overriding the host distro name and host architecture name. A cleanup function to restore the host distro and arch names is always part of the fixture struct. - Delete `distro_mock` package, since it is no longer used. - Bump the required version of osbuild to 98, because the OSCAP customization is using the 'compress_results' stage option, which is not available in older versions of osbuild. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
75 lines
2.6 KiB
Makefile
75 lines
2.6 KiB
Makefile
# BEGIN: lint-install -makefile lint.mk .
|
|
# http://github.com/tinkerbell/lint-install
|
|
|
|
.PHONY: lint
|
|
lint: _lint
|
|
|
|
LINT_ARCH := $(shell uname -m)
|
|
LINT_OS := $(shell uname)
|
|
LINT_OS_LOWER := $(shell echo $(LINT_OS) | tr '[:upper:]' '[:lower:]')
|
|
LINT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
|
|
# shellcheck and hadolint lack arm64 native binaries: rely on x86-64 emulation
|
|
ifeq ($(LINT_OS),Darwin)
|
|
ifeq ($(LINT_ARCH),arm64)
|
|
LINT_ARCH=x86_64
|
|
endif
|
|
endif
|
|
|
|
LINTERS :=
|
|
FIXERS :=
|
|
|
|
SHELLCHECK_VERSION ?= v0.8.0
|
|
SHELLCHECK_BIN := out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)
|
|
$(SHELLCHECK_BIN):
|
|
mkdir -p out/linters
|
|
rm -rf out/linters/shellcheck-*
|
|
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_OS_LOWER).$(LINT_ARCH).tar.xz | tar -C out/linters -xJf -
|
|
mv out/linters/shellcheck-$(SHELLCHECK_VERSION)/shellcheck $@
|
|
rm -rf out/linters/shellcheck-$(SHELLCHECK_VERSION)/shellcheck
|
|
|
|
LINTERS += shellcheck-lint
|
|
shellcheck-lint: $(SHELLCHECK_BIN)
|
|
$(SHELLCHECK_BIN) $(shell find . -name "*.sh")
|
|
|
|
FIXERS += shellcheck-fix
|
|
shellcheck-fix: $(SHELLCHECK_BIN)
|
|
$(SHELLCHECK_BIN) $(shell find . -name "*.sh") -f diff | { read -t 1 line || exit 0; { echo "$$line" && cat; } | git apply -p2; }
|
|
|
|
GOLANGCI_LINT_CONFIG := $(LINT_ROOT)/.golangci.yml
|
|
GOLANGCI_LINT_VERSION ?= v1.43.0
|
|
GOLANGCI_LINT_BIN := out/linters/golangci-lint-$(GOLANGCI_LINT_VERSION)-$(LINT_ARCH)
|
|
$(GOLANGCI_LINT_BIN):
|
|
mkdir -p out/linters
|
|
rm -rf out/linters/golangci-lint-*
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b out/linters $(GOLANGCI_LINT_VERSION)
|
|
mv out/linters/golangci-lint $@
|
|
|
|
LINTERS += golangci-lint-lint
|
|
golangci-lint-lint: $(GOLANGCI_LINT_BIN)
|
|
find . -name go.mod -execdir "$(GOLANGCI_LINT_BIN)" run -c "$(GOLINT_CONFIG)" \;
|
|
|
|
FIXERS += golangci-lint-fix
|
|
golangci-lint-fix: $(GOLANGCI_LINT_BIN)
|
|
find . -name go.mod -execdir "$(GOLANGCI_LINT_BIN)" run -c "$(GOLINT_CONFIG)" --fix \;
|
|
|
|
YAMLLINT_VERSION ?= 1.26.3
|
|
YAMLLINT_ROOT := out/linters/yamllint-$(YAMLLINT_VERSION)
|
|
YAMLLINT_BIN := $(YAMLLINT_ROOT)/dist/bin/yamllint
|
|
$(YAMLLINT_BIN):
|
|
mkdir -p out/linters
|
|
rm -rf out/linters/yamllint-*
|
|
curl -sSfL https://github.com/adrienverge/yamllint/archive/refs/tags/v$(YAMLLINT_VERSION).tar.gz | tar -C out/linters -zxf -
|
|
cd $(YAMLLINT_ROOT) && pip3 install --target dist .
|
|
|
|
LINTERS += yamllint-lint
|
|
yamllint-lint: $(YAMLLINT_BIN)
|
|
PYTHONPATH=$(YAMLLINT_ROOT)/dist $(YAMLLINT_ROOT)/dist/bin/yamllint .
|
|
|
|
.PHONY: _lint $(LINTERS)
|
|
_lint: $(LINTERS)
|
|
|
|
.PHONY: fix $(FIXERS)
|
|
fix: $(FIXERS)
|
|
|
|
# END: lint-install -makefile lint.mk .
|