-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
67 lines (48 loc) · 2.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# If DEIS_REGISTRY is not set, try to populate it from legacy DEV_REGISTRY
DEIS_REGISTRY ?= $(DEV_REGISTRY)
IMAGE_PREFIX ?= hephy
COMPONENT ?= controller
SHORT_NAME ?= $(COMPONENT)
include versioning.mk
SHELLCHECK_PREFIX := docker run -v ${CURDIR}:/workdir -w /workdir hephy/shell-dev shellcheck
SHELL_SCRIPTS = $(wildcard rootfs/bin/*) $(shell find "rootfs" -name '*.sh') $(wildcard _scripts/*.sh)
# Test processes used in quick unit testing
TEST_PROCS ?= 4
check-kubectl:
@if [ -z $$(which kubectl) ]; then \
echo "kubectl binary could not be located"; \
exit 2; \
fi
check-docker:
@if [ -z $$(which docker) ]; then \
echo "Missing \`docker\` client which is required for development"; \
exit 2; \
fi
build: docker-build
docker-build: check-docker
DOCKER_BUILDKIT=1 docker build ${DOCKER_BUILD_FLAGS} -t ${IMAGE} rootfs
docker tag ${IMAGE} ${MUTABLE_IMAGE}
docker-build-test: check-docker
DOCKER_BUILDKIT=1 docker build ${DOCKER_BUILD_FLAGS} -t ${IMAGE}.test -f rootfs/Dockerfile.test rootfs
deploy: check-kubectl docker-build docker-push
kubectl --namespace=deis patch deployment deis-$(COMPONENT) --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"$(IMAGE)"}]'
clean: check-docker
docker rmi $(IMAGE)
commit-hook:
cp _scripts/util/commit-msg .git/hooks/commit-msg
full-clean: check-docker
docker images -q $(IMAGE_PREFIX)$(COMPONENT) | xargs docker rmi -f
test: test-style test-unit test-functional
test-style: docker-build-test
docker run -v ${CURDIR}:/test -w /test/rootfs ${IMAGE}.test /test/rootfs/bin/test-style
${SHELLCHECK_PREFIX} $(SHELL_SCRIPTS)
test-unit: docker-build-test
docker run -v ${CURDIR}:/test -w /test/rootfs ${IMAGE}.test /test/rootfs/bin/test-unit
test-functional:
@echo "Implement functional tests in _tests directory"
test-integration:
@echo "Check https://github.com/deisthree/workflow-e2e for the complete integration test suite"
upload-coverage:
$(eval CI_ENV := $(shell curl -s https://codecov.io/env | bash))
docker run ${CI_ENV} -v ${CURDIR}:/test -w /test/rootfs ${IMAGE}.test codecov --required
.PHONY: check-kubectl check-docker build docker-build docker-build-test deploy clean commit-hook full-clean test test-style test-unit test-functional test-integration upload-coverage