-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
68 lines (49 loc) · 2.34 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
68
# If DRYCC_REGISTRY is not set, try to populate it from legacy DEV_REGISTRY
DRYCC_REGISTRY ?= $(DEV_REGISTRY)
IMAGE_PREFIX ?= drycc
COMPONENT ?= controller
SHORT_NAME ?= $(COMPONENT)
PLATFORM ?= linux/amd64,linux/arm64
include versioning.mk
SHELLCHECK_PREFIX := podman run -v ${CURDIR}:/workdir -w /workdir ${DEV_REGISTRY}/drycc/go-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-podman:
@if [ -z $$(which podman) ]; then \
echo "Missing \`podman\` client which is required for development"; \
exit 2; \
fi
build: podman-build
podman-build: check-podman
podman build --build-arg CODENAME=${CODENAME} -t ${IMAGE} rootfs
podman tag ${IMAGE} ${MUTABLE_IMAGE}
podman-build-test: check-podman
podman build --build-arg CODENAME=${CODENAME} -t ${IMAGE}.test -f rootfs/Dockerfile.test rootfs
deploy: check-kubectl podman-build podman-push
kubectl --namespace=drycc patch deployment drycc-$(COMPONENT) --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"$(IMAGE)"}]'
clean: check-podman
podman rmi $(IMAGE)
commit-hook:
cp _scripts/util/commit-msg .git/hooks/commit-msg
full-clean: check-podman
podman images -q $(IMAGE_PREFIX)/$(COMPONENT) | xargs podman rmi -f
test: test-style test-unit test-functional
test-style: podman-build-test
podman run -v ${CURDIR}:/test -w /test/rootfs ${IMAGE}.test /test/rootfs/bin/test-style
${SHELLCHECK_PREFIX} $(SHELL_SCRIPTS)
test-unit: podman-build-test
podman 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/drycc/workflow-e2e for the complete integration test suite"
upload-coverage:
$(eval CI_ENV := $(shell curl -s https://codecov.io/env | bash))
podman run --rm ${CI_ENV} -v ${CURDIR}:/test -w /test/rootfs -e CODECOV_TOKEN=${CODECOV_TOKEN} ${IMAGE}.test /test/rootfs/bin/upload-coverage
.PHONY: check-kubectl check-podman build podman-build podman-build-test deploy clean commit-hook full-clean test test-style test-unit test-functional test-integration upload-coverage