-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathcommon.mk
More file actions
72 lines (58 loc) · 2.12 KB
/
common.mk
File metadata and controls
72 lines (58 loc) · 2.12 KB
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
69
70
71
72
VPP_DATAPLANE_DIR = $(shell git rev-parse --show-toplevel)
VPP_CI_ARTIFACTS_BUCKET = calico-vpp-ci-artefacts
export GOOS ?= linux
# Docker option
# push dependency
PUSH_DEP := image
REGISTRIES := docker.io/
# Compute hash to detect any changes and rebuild/push the image
CI_BUILDER_IMAGE_HASH = $(shell echo \
"DOCKERFILE:$(shell md5sum \
$(VPP_DATAPLANE_DIR)/Dockerfile.depend \
$(VPP_DATAPLANE_DIR)/go.mod \
$(VPP_DATAPLANE_DIR)/go.sum \
| cut -f1 -d' ' \
)" | md5sum | cut -f1 -d' ')
CI_BUILDER_IMAGE = calicovpp/ci-builder:${CI_BUILDER_IMAGE_HASH}
# CI specific variables
ifdef CODEBUILD_BUILD_NUMBER
# Define variable when building for CI
CI_BUILD = 1
endif
ifdef COVER
COVER_OPTS = -cover -covermode=atomic
else
COVER_OPTS :=
endif
ifdef CI_BUILD
export CI_BUILD
GOFLAGS := -buildvcs=false
# We make binaries static executable so that they are portable if they run outside of the calico container
# where we have less control on the env and glibc version.
# this is especially import for felix-api-proxy
DOCKER_OPTS = -e CI_BUILD=1 -e GOFLAGS=${GOFLAGS}
DOCKER_OPTS += -e CGO_ENABLED=0
DOCKER_OPTS += --user $$(id -u):$$(id -g)
DOCKER_OPTS += -w /vpp-dataplane/$(shell git rev-parse --show-prefix)
DOCKER_OPTS += -v $(VPP_DATAPLANE_DIR):/vpp-dataplane
DOCKER_RUN = docker run -t --rm --name build_temp ${DOCKER_OPTS} ${CI_BUILDER_IMAGE}
PUSH_DEP :=
# REGISTRY_PRIV may be defined in the CI environment
REGISTRIES += ${REGISTRY_PRIV}
else
DOCKER_RUN = CGO_ENABLED=0 GOFLAGS=${GOFLAGS}
endif
TAG = $(shell git describe --always --abbrev=40 --dirty)
ifeq (${CODEBUILD_WEBHOOK_TRIGGER},branch/master)
ALSO_LATEST := y
endif
CLUSTER_NAME ?= kind-$(shell whoami)-$(shell git rev-parse --short=4 HEAD)
DOCKER_BUILD_ARGS = --network=host
DOCKER_BUILD_ARGS += --build-arg http_proxy=${DOCKER_BUILD_PROXY}
DOCKER_BUILD_ARGS += --build-arg https_proxy=${DOCKER_BUILD_PROXY}
DOCKER_BUILD_ARGS += --build-arg GIT_COMMIT="$(shell git describe --always --abbrev=40 --dirty)"
ifeq (${NO_CACHE},true)
DOCKER_BUILD_ARGS += --no-cache
endif
KIND_VERSION ?= v0.30.0
KIND ?= go run sigs.k8s.io/kind@$(KIND_VERSION)