open-nomad/.circleci/Makefile
Kris Hicks c4ae5aab9a
circleci: Allow expanding Makefile in enterpise (#9587)
OSS no longer needs the multi-file config Makefile content, so it was
removed. However, enterprise does benefit from having that around. We
can allow enterprise to expand on OSS' CircleCI Makefile by adding an
include directive in OSS. This will allow the Makefile to be the same on
both OSS and Enterprise, so merge conflicts cannot occur.
2020-12-09 09:53:26 -08:00

38 lines
1.2 KiB
Makefile

# Set SHELL to 'strict mode' without using .SHELLFLAGS for max compatibility.
# See https://fieldnotes.tech/how-to-shell-for-compatible-makefiles/
SHELL := /usr/bin/env bash -euo pipefail -c
CIRCLECI := circleci --skip-update-check
# Set up some documentation/help message variables.
# We do not attempt to install the CircleCI CLI from this Makefile.
CCI_INSTALL_LINK := https://circleci.com/docs/2.0/local-cli/\#installation
CCI_INSTALL_MSG := Please install CircleCI CLI. See $(CCI_INSTALL_LINK)
CCI_VERSION := $(shell $(CIRCLECI) version 2> /dev/null)
ifeq ($(CCI_VERSION),)
# Attempting to use the CLI fails with installation instructions.
CIRCLECI := echo '$(CCI_INSTALL_MSG)'; exit 1; \#
endif
default: help
help:
@echo "Usage:"
@echo " make ci-verify: validate that config.yml for correctness"
@echo
@echo "Diagnostics:"
@[ -z "$(CCI_VERSION)" ] || echo " circleci-cli version $(CCI_VERSION)"
@[ -n "$(CCI_VERSION)" ] || echo " $(CCI_INSTALL_MSG)"
.PHONY: ci-verify
ci-verify:
@$(CIRCLECI) config validate config.yml
MKFILE_PATH := $(lastword $(filter %Makefile,$(MAKEFILE_LIST)))
CURRENT_DIR := $(dir $(realpath $(MKFILE_PATH)))
CURRENT_DIR := $(CURRENT_DIR:/=)
ifneq ($(wildcard $(CURRENT_DIR)/*.mk),)
include $(CURRENT_DIR)/*.mk
endif