mirror of https://github.com/containers/podman.git
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, change12bd7e927c
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>
This commit is contained in:
parent
23f7957862
commit
dbb9d098b5
11
.cirrus.yml
11
.cirrus.yml
|
@ -93,7 +93,6 @@ gating_task:
|
||||||
CIRRUS_WORKING_DIR: "/usr/src/libpod"
|
CIRRUS_WORKING_DIR: "/usr/src/libpod"
|
||||||
GOPATH: "/go"
|
GOPATH: "/go"
|
||||||
GOSRC: "/go/src/github.com/containers/libpod"
|
GOSRC: "/go/src/github.com/containers/libpod"
|
||||||
EPOCH_TEST_COMMIT: "${CIRRUS_BASE_SHA}"
|
|
||||||
|
|
||||||
# Runs within Cirrus's "community cluster"
|
# Runs within Cirrus's "community cluster"
|
||||||
container:
|
container:
|
||||||
|
@ -103,6 +102,16 @@ gating_task:
|
||||||
|
|
||||||
timeout_in: 20m
|
timeout_in: 20m
|
||||||
|
|
||||||
|
# Custom cloning is required to satisfy lint/validation needs
|
||||||
|
clone_script: |
|
||||||
|
git clone --recursive --branch=$DEST_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
|
||||||
|
git remote update origin
|
||||||
|
if [[ -n "$CIRRUS_PR" ]]; then # running for a PR
|
||||||
|
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
|
||||||
|
git checkout pull/$CIRRUS_PR
|
||||||
|
fi
|
||||||
|
git reset --hard $CIRRUS_CHANGE_IN_REPO
|
||||||
|
|
||||||
# Don't bother going further if something is down
|
# Don't bother going further if something is down
|
||||||
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
|
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
|
||||||
|
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -3,7 +3,7 @@ export GOPROXY=https://proxy.golang.org
|
||||||
|
|
||||||
GO ?= go
|
GO ?= go
|
||||||
DESTDIR ?=
|
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
|
HEAD ?= HEAD
|
||||||
CHANGELOG_BASE ?= HEAD~
|
CHANGELOG_BASE ?= HEAD~
|
||||||
CHANGELOG_TARGET ?= HEAD
|
CHANGELOG_TARGET ?= HEAD
|
||||||
|
@ -132,6 +132,9 @@ for cmd in sorted(cmds):
|
||||||
endef
|
endef
|
||||||
export PRINT_HELP_PYSCRIPT
|
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
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
@$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
||||||
|
@ -146,6 +149,7 @@ endif
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: golangci-lint
|
lint: golangci-lint
|
||||||
|
@echo "Linting vs commit '$(call err_if_empty,EPOCH_TEST_COMMIT)'"
|
||||||
ifeq ($(PRE_COMMIT),)
|
ifeq ($(PRE_COMMIT),)
|
||||||
@echo "FATAL: pre-commit was not found, check https://pre-commit.com/ about installing it." >&2
|
@echo "FATAL: pre-commit was not found, check https://pre-commit.com/ about installing it." >&2
|
||||||
@exit 2
|
@exit 2
|
||||||
|
@ -531,6 +535,7 @@ uninstall:
|
||||||
|
|
||||||
.PHONY: .gitvalidation
|
.PHONY: .gitvalidation
|
||||||
.gitvalidation: .gopathok
|
.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)
|
GIT_CHECK_EXCLUDE="./vendor:docs/make.bat" $(GOBIN)/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
|
||||||
|
|
||||||
.PHONY: install.tools
|
.PHONY: install.tools
|
||||||
|
|
Loading…
Reference in New Issue