Merge pull request #5066 from cevich/fix_gate_wrong_commit

Cirrus: Fix gate task + make lint|validate
This commit is contained in:
OpenShift Merge Robot
2020-02-03 16:05:34 -08:00
committed by GitHub
2 changed files with 16 additions and 2 deletions

View File

@ -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'

View File

@ -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