Skip to content

Commit 63e0131

Browse files
committed
Refactor build to push debug and release images
This patch refactors the build system and adds building debug and release images for vpp and vclsidecar. Important changes : - we remove the --squash option which was not used in CI anyway and that is deprecated in favor of staged builds. - we remove tarball compression as we do not gain much disk space but loose compression / decompression - we fix an issue in tarball creation that was missing .so.25.06 style dynamic libraries - we always package gdb with the images (removing WITH_GDB) - Add Debug/Release builds for memif - Add `make kind DEBUG=true` option for debug images Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
1 parent 7ca25b0 commit 63e0131

File tree

13 files changed

+247
-146
lines changed

13 files changed

+247
-146
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Binaries
22
calico-vpp-agent/bin
33
vpp-manager/images/*/vpp-manager
4+
vpp-manager/images/*/bin
5+
vpp-manager/images/*/artifacts
46
vpp-manager/images/*/vppdev.sh
57
vpp-manager/vpp_build/
68
*.deb
79
*.so*
810
multinet-monitor/watcher
911
*.tgz
12+
*.tar
1013

1114
test/k8s-e2e-tests/kubernetes-*
1215
test/vagrant/local-config.env

Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ image:
1818

1919
.PHONY: image-kind
2020
image-kind: image
21-
docker image tag calicovpp/vpp:$(TAG) localhost:5000/calicovpp/vpp:latest
22-
docker push localhost:5000/calicovpp/vpp:latest
23-
docker image tag calicovpp/agent:$(TAG) localhost:5000/calicovpp/agent:latest
24-
docker push localhost:5000/calicovpp/agent:latest
25-
docker image tag calicovpp/multinet-monitor:$(TAG) localhost:5000/calicovpp/multinet-monitor:latest
26-
docker push localhost:5000/calicovpp/multinet-monitor:latest
27-
21+
@for image in vpp:$(TAG) vpp:dbg-$(TAG) vclsidecar:$(TAG) vclsidecar:dbg-$(TAG) agent:$(TAG) multinet-monitor:$(TAG); do \
22+
docker image tag calicovpp/$$image localhost:5000/calicovpp/$$image ; \
23+
docker push localhost:5000/calicovpp/$$image ; \
24+
done
2825

2926
.PHONY: kind-new-cluster
3027
kind-new-cluster:
@@ -170,7 +167,17 @@ restart-calicovpp:
170167
.PHONY: goapi
171168
export VPP_DIR ?= $(shell pwd)/vpp-manager/vpp_build
172169
goapi:
173-
@go generate -v ./vpplink/generated/
170+
ifdef CI_BUILD
171+
docker run -t --rm --name build_temp \
172+
--user $$(id -u):$$(id -g) \
173+
-e VPP_DIR=/vpp-dataplane/vpp-manager/vpp_build \
174+
-v ${PROJECT_DIR}:/vpp-dataplane \
175+
-w /vpp-dataplane/ \
176+
calicovpp/ci-builder:latest \
177+
go generate -v ./vpplink/generated/
178+
else
179+
go generate -v ./vpplink/generated/
180+
endif
174181

175182
.PHONY: cherry-vpp
176183
cherry-vpp:

common.mk

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ WITH_GDB ?= yes
1212
export GOOS ?= linux
1313

1414
# Docker option
15-
SQUASH := --squash
1615
# push dependency
1716
PUSH_DEP := image
1817

19-
# We make binaries static executable so that they are portable if they run outside of the calico container
20-
# where we have less control on the env and glibc version.
21-
# this is especially import for felix-api-proxy
22-
CGO_ENABLED := 0
23-
2418
REGISTRIES := docker.io/
2519

2620
# CI specific variables
@@ -33,22 +27,25 @@ ifdef CI_BUILD
3327
export CI_BUILD
3428
GOFLAGS := -buildvcs=false
3529

30+
# We make binaries static executable so that they are portable if they run outside of the calico container
31+
# where we have less control on the env and glibc version.
32+
# this is especially import for felix-api-proxy
3633
DOCKER_OPTS = -e CI_BUILD=1 -e GOFLAGS=${GOFLAGS}
37-
DOCKER_OPTS += -e CGO_ENABLED=${CGO_ENABLED}
34+
DOCKER_OPTS += -e CGO_ENABLED=0
3835
DOCKER_OPTS += --user $$(id -u):$$(id -g)
3936
DOCKER_OPTS += -w /vpp-dataplane/${SUB_DIR}
4037
DOCKER_OPTS += -v ${PROJECT_DIR}:/vpp-dataplane
4138
DOCKER_RUN = docker run -t --rm --name build_temp ${DOCKER_OPTS} calicovpp/ci-builder:latest
42-
SQUASH :=
39+
4340
PUSH_DEP :=
4441

45-
# REGISTRY_PRIV may be defined in the CI environment
42+
# REGISTRY_PRIV may be defined in the CI environment
4643
REGISTRIES += ${REGISTRY_PRIV}
4744
else
48-
DOCKER_RUN = CGO_ENABLED=${CGO_ENABLED} GOFLAGS=${GOFLAGS}
45+
DOCKER_RUN = CGO_ENABLED=0 GOFLAGS=${GOFLAGS}
4946
endif
5047

51-
TAG = $(shell git rev-parse HEAD)
48+
TAG = $(shell git describe --always --abbrev=40 --dirty)
5249
ifeq (${CODEBUILD_WEBHOOK_TRIGGER},branch/master)
5350
ALSO_LATEST := y
5451
endif

test/kind/Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
include ../../common.mk
2+
13
TAG ?= latest # Tag images with :$(TAG)
24
N_KIND_WORKERS ?= 2
35
N_KIND_CONTROL_PLANES ?= 1
46
CPU_PINNING ?= false
57
KIND_CALICO_VERSION ?= master
8+
DEBUG ?= false
69

710
.PHONY: new-cluster
811
new-cluster:
@@ -13,7 +16,7 @@ new-cluster:
1316

1417
.PHONY: install-cni
1518
install-cni:
16-
@./install_calico_vpp.sh
19+
@TAG=${TAG} DEBUG=${DEBUG} ./install_calico_vpp.sh
1720

1821

1922
.PHONY: delete-cluster
@@ -22,12 +25,12 @@ delete-cluster:
2225

2326
.PHONY: dev
2427
dev:
25-
docker image tag calicovpp/vpp:$(TAG) localhost:5000/calicovpp/vpp:$(TAG)
26-
docker push localhost:5000/calicovpp/vpp:$(TAG)
27-
docker image tag calicovpp/agent:$(TAG) localhost:5000/calicovpp/agent:$(TAG)
28-
docker push localhost:5000/calicovpp/agent:$(TAG)
29-
docker image tag calicovpp/multinet-monitor:$(TAG) localhost:5000/calicovpp/multinet-monitor:$(TAG)
30-
docker push localhost:5000/calicovpp/multinet-monitor:$(TAG)
28+
docker image tag calicovpp/vpp:$(TAG) localhost:5000/calicovpp/vpp:master
29+
docker push localhost:5000/calicovpp/vpp:master
30+
docker image tag calicovpp/agent:$(TAG) localhost:5000/calicovpp/agent:master
31+
docker push localhost:5000/calicovpp/agent:master
32+
docker image tag calicovpp/multinet-monitor:$(TAG) localhost:5000/calicovpp/multinet-monitor:master
33+
docker push localhost:5000/calicovpp/multinet-monitor:master
3134

3235
# this is for a cluster using a mirror docker.io -> localhost:5000 to avoid pull rate limit
3336
.PHONY: load-mirror

test/kind/install_calico_vpp.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ while [[ "$(kubectl api-resources --api-group=operator.tigera.io | grep Installa
99
export TAG=${TAG:-latest}
1010

1111
export CALICO_AGENT_IMAGE=localhost:5000/calicovpp/agent:${TAG}
12-
export CALICO_VPP_IMAGE=localhost:5000/calicovpp/vpp:${TAG}
1312
export MULTINET_MONITOR_IMAGE=localhost:5000/calicovpp/multinet-monitor:${TAG}
13+
if [[ "${DEBUG}" = "true" ]]; then
14+
export CALICO_VPP_IMAGE=localhost:5000/calicovpp/vpp:dbg-${TAG}
15+
else
16+
export CALICO_VPP_IMAGE=localhost:5000/calicovpp/vpp:${TAG}
17+
fi
1418

1519
export IMAGE_PULL_POLICY=Always # Always Never IfNotPresent
1620
export CALICOVPP_ENABLE_MEMIF=true

test/yaml/sidecar-vcl/Dockerfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)