2016-09-19 06:28:34 +00:00
|
|
|
EPOCH_TEST_COMMIT ?= 7fc874e05e74faa81e7c423b6514fc5c474c6b34
|
2016-09-20 10:23:34 +00:00
|
|
|
PROJECT := github.com/kubernetes-incubator/ocid
|
|
|
|
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
|
|
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
|
|
|
|
OCID_IMAGE := ocid_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN))
|
|
|
|
OCID_LINK := ${CURDIR}/vendor/src/github.com/kubernetes-incubator/ocid
|
|
|
|
OCID_LINK_DIR := ${CURDIR}/vendor/src/github.com/kubernetes-incubator
|
|
|
|
OCID_INSTANCE := ocid_dev
|
2016-09-21 09:41:23 +00:00
|
|
|
SYSTEM_GOPATH := ${GOPATH}
|
2016-09-20 10:23:34 +00:00
|
|
|
export GOPATH := ${CURDIR}/vendor
|
2016-07-15 17:52:13 +00:00
|
|
|
|
2016-09-19 06:28:34 +00:00
|
|
|
default: help
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Usage: make <target>"
|
|
|
|
@echo
|
2016-09-19 18:36:57 +00:00
|
|
|
@echo " * 'binaries' - Build ocid, conmon and ocic"
|
2016-09-20 10:23:34 +00:00
|
|
|
@echo " * 'integration' - Execute integration tests"
|
2016-09-19 06:28:34 +00:00
|
|
|
@echo " * 'clean' - Clean artifacts"
|
|
|
|
@echo " * 'lint' - Execute the source code linter"
|
|
|
|
|
2016-09-21 10:04:13 +00:00
|
|
|
lint: ${OCID_LINK}
|
2016-09-19 06:28:34 +00:00
|
|
|
@echo "checking lint"
|
|
|
|
@./.tool/lint
|
2016-09-17 09:37:45 +00:00
|
|
|
|
2016-09-20 10:23:34 +00:00
|
|
|
${OCID_LINK}:
|
|
|
|
mkdir -p ${OCID_LINK_DIR}
|
|
|
|
ln -sfn ${CURDIR} ${OCID_LINK}
|
|
|
|
|
2016-09-17 09:37:45 +00:00
|
|
|
conmon:
|
|
|
|
make -C $@
|
2016-07-15 17:52:13 +00:00
|
|
|
|
2016-09-20 10:23:34 +00:00
|
|
|
ocid: ${OCID_LINK}
|
2016-09-23 07:50:05 +00:00
|
|
|
go build -o ocid ./cmd/server/
|
2016-07-15 17:52:13 +00:00
|
|
|
|
2016-09-20 10:23:34 +00:00
|
|
|
ocic: ${OCID_LINK}
|
2016-09-23 07:50:05 +00:00
|
|
|
go build -o ocic ./cmd/client/
|
2016-07-15 17:52:13 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ocic ocid
|
2016-09-20 10:23:34 +00:00
|
|
|
rm -f ${OCID_LINK}
|
2016-09-19 06:28:34 +00:00
|
|
|
rm -f conmon/conmon.o conmon/conmon
|
2016-09-17 13:50:35 +00:00
|
|
|
|
2016-09-20 10:23:34 +00:00
|
|
|
ocidimage:
|
|
|
|
docker build -t ${OCID_IMAGE} .
|
|
|
|
|
|
|
|
dbuild: ocidimage
|
|
|
|
docker run --name=${OCID_INSTANCE} --privileged ${OCID_IMAGE} make binaries
|
|
|
|
docker cp ${OCID_INSTANCE}:/go/src/github.com/kubernetes-incubator/ocid/ocid .
|
|
|
|
docker cp ${OCID_INSTANCE}:/go/src/github.com/kubernetes-incubator/ocid/ocic .
|
|
|
|
docker cp ${OCID_INSTANCE}:/go/src/github.com/kubernetes-incubator/ocid/conmon/conmon ./conmon/conmon
|
|
|
|
docker rm ${OCID_INSTANCE}
|
|
|
|
|
|
|
|
integration: ocidimage
|
|
|
|
docker run -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${OCID_IMAGE} make localintegration
|
|
|
|
|
|
|
|
localintegration: binaries
|
|
|
|
./test/test_runner.sh
|
|
|
|
|
|
|
|
binaries: ${OCID_LINK} ocid ocic conmon
|
2016-09-19 06:28:34 +00:00
|
|
|
|
|
|
|
.PHONY: .gitvalidation
|
|
|
|
# When this is running in travis, it will only check the travis commit range
|
|
|
|
.gitvalidation:
|
|
|
|
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
|
|
|
|
ifeq ($(TRAVIS),true)
|
2016-09-20 08:24:28 +00:00
|
|
|
git-validation -q -run DCO,short-subject
|
2016-09-19 06:28:34 +00:00
|
|
|
else
|
2016-09-20 08:24:28 +00:00
|
|
|
git-validation -v -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD
|
2016-09-19 06:28:34 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: install.tools
|
|
|
|
|
2016-09-21 09:41:23 +00:00
|
|
|
install.tools: .install.gitvalidation .install.gometalinter
|
2016-09-19 06:28:34 +00:00
|
|
|
|
|
|
|
.install.gitvalidation:
|
2016-09-21 09:41:23 +00:00
|
|
|
GOPATH=${SYSTEM_GOPATH} go get github.com/vbatts/git-validation
|
2016-09-19 06:28:34 +00:00
|
|
|
|
|
|
|
.install.gometalinter:
|
2016-09-21 09:41:23 +00:00
|
|
|
GOPATH=${SYSTEM_GOPATH} go get github.com/alecthomas/gometalinter
|
|
|
|
GOPATH=${SYSTEM_GOPATH} gometalinter --install
|
2016-09-19 06:28:34 +00:00
|
|
|
|
|
|
|
.PHONY: \
|
|
|
|
binaries \
|
2016-09-19 07:21:14 +00:00
|
|
|
conmon \
|
|
|
|
ocid \
|
|
|
|
ocic \
|
2016-09-19 06:28:34 +00:00
|
|
|
clean \
|
|
|
|
lint
|