- make setup-cluster will use current VPP dir instead of CalicoVPP's dir
- VPP will be built only once
- changed build targets to build VPP as a non-root user (to avoid
permission issues when building CalicoVPP)
Type: improvement
Change-Id: Iba90219660c1259da6ad81fe002f99b6d43ea248
Signed-off-by: Adrian Villin <[email protected]>
endif
FORCE_BUILD?=true
+BUILD_AS:=$(strip $(shell echo $${SUDO_USER:-$${USER:-root}}))
.PHONY: help
help:
@go run github.com/onsi/ginkgo/v2/ginkgo --dry-run -v --no-color --seed=2 | head -n -1 | grep 'test.go' | \
sed 's/^/* /; s/\(Suite\) /\1\//g'
+.PHONY: build-msg
+build-msg:
+ @echo "Building VPP as '$(BUILD_AS)'"
+ @echo "****************************************************************"
+ @echo "If you wish to build VPP as root, use 'SUDO_USER=root make ...'"
+ @echo "****************************************************************"
+
.PHONY: build-vpp-release
-build-vpp-release:
- @$(MAKE) -C ../.. build-release
+build-vpp-release: build-msg
+ @sudo -u $(BUILD_AS) $(MAKE) -C ../.. build-release
.PHONY: build-vpp-debug
-build-vpp-debug:
- @$(MAKE) -C ../.. build
+build-vpp-debug: build-msg
+ @sudo -u $(BUILD_AS) $(MAKE) -C ../.. build
.PHONY: build-vpp-gcov
-build-vpp-gcov:
- @$(MAKE) -C ../.. build-gcov
+build-vpp-gcov: build-msg
+ @sudo -u $(BUILD_AS) $(MAKE) -C ../.. build-gcov
.build.ok: build
@touch .build.ok
.PHONY: build
build: .deps.ok build-vpp-release build-go
@rm -f .build.ok
- bash ./script/build_hst.sh release $(FORCE_BUILD)
+ bash ./script/build_hst.sh release $(FORCE_BUILD) $(BUILD_AS)
@touch .build.ok
.PHONY: build-cov
build-cov: .deps.ok build-vpp-gcov build-go
@rm -f .build.cov.ok
- bash ./script/build_hst.sh gcov $(FORCE_BUILD)
+ bash ./script/build_hst.sh gcov $(FORCE_BUILD) $(BUILD_AS)
@touch .build.cov.ok
.PHONY: build-debug
build-debug: .deps.ok build-vpp-debug build-go
@rm -f .build.ok
- bash ./script/build_hst.sh debug $(FORCE_BUILD)
+ bash ./script/build_hst.sh debug $(FORCE_BUILD) $(BUILD_AS)
@touch .build.ok
.deps.ok:
MASTER_OR_LATEST=${1-"latest"}
CALICOVPP_DIR="$HOME/vpp-dataplane"
+VPP_DIR=$(pwd)
+VPP_DIR=${VPP_DIR%extras*}
+STASH_SAVED=0
if [ $MASTER_OR_LATEST = "master" ]; then
if [ ! -d "$CALICOVPP_DIR" ]; then
fi
cd $CALICOVPP_DIR
git pull
+ cd $VPP_DIR
# ---------------- images ----------------
export CALICO_AGENT_IMAGE=localhost:5000/calicovpp/agent:latest
make -C $CALICOVPP_DIR kind-new-cluster N_KIND_WORKERS=2
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.3/manifests/tigera-operator.yaml
- make -C $CALICOVPP_DIR/vpp-manager vpp BASE=origin/master
+ make -C $CALICOVPP_DIR cherry-vpp FORCE=y BASE=origin/master VPP_DIR=$VPP_DIR
+ make build
make -C $CALICOVPP_DIR dev-kind
make -C $CALICOVPP_DIR load-kind
$CALICOVPP_DIR/yaml/overlays/dev/kustomize.sh up
+ if ! git diff-index --quiet HEAD --; then
+ echo "Saving stash"
+ git stash save "HST: temp stash"
+ git reset --hard origin/master
+ git stash pop
+ fi
else
echo "********"
echo "Performance tests only work on Ubuntu 22.04 for now."
echo "Sleeping for 10s, waiting for tigera operator to start up."
sleep 10
- kubectl create -f https://raw.githubusercontent.com/projectcalico/vpp-dataplane/master/yaml/calico/installation-default.yaml
+ kubectl create -f https://raw.githubusercontent.com/projectcalico/vpp-dataplane/master/yaml/calico/installation-default.yaml
kubectl create -f kubernetes/calico-config.yaml
echo "Done. Please wait for the cluster to come fully online before running tests."
#!/usr/bin/env bash
+BUILD_AS=$3
+
if [ "$(lsb_release -is)" != Ubuntu ]; then
echo "Host stack test framework is supported only on Ubuntu"
exit 1
rm -rf vpp-data/lib/* || true
declare -i res=0
-cp ${VPP_BUILD_ROOT}/bin/* ${bin}
+sudo -u $BUILD_AS cp ${VPP_BUILD_ROOT}/bin/* ${bin}
res+=$?
-cp -r ${VPP_BUILD_ROOT}/lib/"${OS_ARCH}"-linux-gnu/* ${lib}
+sudo -u $BUILD_AS cp -r ${VPP_BUILD_ROOT}/lib/"${OS_ARCH}"-linux-gnu/* ${lib}
res+=$?
if [ "$res" -ne 0 ]; then
echo "Failed to copy VPP files. Is VPP built? Try running 'make build' in VPP directory."