Skip to content

Commit

Permalink
Merge pull request containers#5066 from cevich/fix_gate_wrong_commit
Browse files Browse the repository at this point in the history
Cirrus: Fix gate task + make lint|validate
  • Loading branch information
openshift-merge-robot authored Feb 4, 2020
2 parents 234e838 + dbb9d09 commit c4f6d56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ gating_task:
CIRRUS_WORKING_DIR: "/usr/src/libpod"
GOPATH: "/go"
GOSRC: "/go/src/github.com/containers/libpod"
EPOCH_TEST_COMMIT: "${CIRRUS_BASE_SHA}"

# Runs within Cirrus's "community cluster"
container:
Expand All @@ -103,6 +102,16 @@ gating_task:

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
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'

Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c4f6d56

Please sign in to comment.