summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2020-02-03 11:58:38 -0500
committerChris Evich <cevich@redhat.com>2020-02-03 16:23:46 -0500
commitdbb9d098b5cb87f60debc4861dd15774257c9dbf (patch)
tree8d45150d0ef9d3dea6e4c865e870096f66aeadf2 /Makefile
parent23f795786224c27f737e9043e9d513f54fa35ba8 (diff)
downloadpodman-dbb9d098b5cb87f60debc4861dd15774257c9dbf.tar.gz
podman-dbb9d098b5cb87f60debc4861dd15774257c9dbf.tar.bz2
podman-dbb9d098b5cb87f60debc4861dd15774257c9dbf.zip
Cirrus: Fix gate task + make lint|validate
A recent Makefile change (4ec893a748) removed a side-effect necessary for 'make validation' to pass under automation. Making things worse, change 12bd7e927c was found upon investigation to always point at the latest upstream HEAD. However, this is rarely a fork-point for pull-requests. Further investigation showed the built-in Cirrus-CI, golang-based git does not obtain sufficient data for the Makefile command `git merge-base HEAD $${DEST_BRANCH:-master}` to function properly (in the context of the gate container). Fix this by customizing the clone operation and slightly adjust the Makefile command to function as intended in the gate container. Also add checks to the validate and lint targets which validate the variable EPOCH_TEST_COMMIT value is never an empty string or whitespace. Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index f71f7d2b1..6713b8bae 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ export GOPROXY=https://proxy.golang.org
GO ?= go
DESTDIR ?=
-EPOCH_TEST_COMMIT ?= $(shell git merge-base HEAD $${DEST_BRANCH:-master})
+EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-master} HEAD)
HEAD ?= HEAD
CHANGELOG_BASE ?= HEAD~
CHANGELOG_TARGET ?= HEAD
@@ -132,6 +132,9 @@ for cmd in sorted(cmds):
endef
export PRINT_HELP_PYSCRIPT
+# Dereference variable $(1), return value if non-empty, otherwise raise an error.
+err_if_empty = $(if $(strip $($(1))),$(strip $($(1))),$(error Required variable $(1) value is undefined, whitespace, or empty))
+
.PHONY: help
help:
@$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
@@ -146,6 +149,7 @@ endif
.PHONY: lint
lint: golangci-lint
+ @echo "Linting vs commit '$(call err_if_empty,EPOCH_TEST_COMMIT)'"
ifeq ($(PRE_COMMIT),)
@echo "FATAL: pre-commit was not found, check https://pre-commit.com/ about installing it." >&2
@exit 2
@@ -531,6 +535,7 @@ uninstall:
.PHONY: .gitvalidation
.gitvalidation: .gopathok
+ @echo "Validating vs commit '$(call err_if_empty,EPOCH_TEST_COMMIT)'"
GIT_CHECK_EXCLUDE="./vendor:docs/make.bat" $(GOBIN)/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
.PHONY: install.tools