From 4f07893b8277ccbd30e6a6cb2a7557aab97e919d Mon Sep 17 00:00:00 2001 From: Itxaka Date: Thu, 11 Jul 2024 17:10:45 +0200 Subject: [PATCH] Several fixes for building - use go1.22 in teh test image - move controller image build out of the docker stanza so its fast - bump controller-gen version to 0.14.0 Signed-off-by: Itxaka --- .earthlyignore | 1 + .gitignore | 1 + Earthfile | 10 +++++++--- Makefile | 2 +- scripts/e2e-tests.sh | 6 ++---- 5 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 .earthlyignore diff --git a/.earthlyignore b/.earthlyignore new file mode 100644 index 0000000..6dd29b7 --- /dev/null +++ b/.earthlyignore @@ -0,0 +1 @@ +bin/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 938e380..a21d5ba 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ testbin/* *~ /helm-chart +build/ diff --git a/Earthfile b/Earthfile index 55d3ca9..a429e94 100644 --- a/Earthfile +++ b/Earthfile @@ -76,7 +76,7 @@ luet: e2e-tests-image: FROM opensuse/tumbleweed - RUN zypper in -y go git qemu-x86 qemu-arm qemu-tools swtpm docker jq docker-compose make glibc libopenssl-devel curl gettext-runtime + RUN zypper in -y go1.22 git qemu-x86 qemu-arm qemu-tools swtpm docker jq docker-compose make glibc libopenssl-devel curl gettext-runtime awk envsubst ENV GOPATH="/go" COPY . /test @@ -94,11 +94,15 @@ e2e-tests-image: RUN luet repo add -y kairos --url quay.io/kairos/packages --type docker RUN LUET_NOLOCK=true luet install -y container/kubectl utils/k3d +controller-latest: + FROM DOCKERFILE . + SAVE IMAGE controller:latest + e2e-tests: FROM +e2e-tests-image ARG LABEL - - WITH DOCKER --allow-privileged + RUN make test # This also generates the latest controllers automatically, we do that before building the docker image with them + WITH DOCKER --allow-privileged --load controller:latest=+controller-latest RUN ./scripts/e2e-tests.sh END diff --git a/Makefile b/Makefile index 3757e44..f1191ce 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 -CONTROLLER_TOOLS_VERSION ?= v0.9.2 +CONTROLLER_TOOLS_VERSION ?= v0.14.0 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize diff --git a/scripts/e2e-tests.sh b/scripts/e2e-tests.sh index cc6cdf9..387f120 100755 --- a/scripts/e2e-tests.sh +++ b/scripts/e2e-tests.sh @@ -34,10 +34,8 @@ trap cleanup EXIT k3d cluster create "$CLUSTER_NAME" --k3s-arg "--cluster-cidr=10.49.0.1/16@server:0" --k3s-arg "--service-cidr=10.48.0.1/16@server:0" -p '80:80@server:0' -p '443:443@server:0' --image "$K3S_IMAGE" k3d kubeconfig get "$CLUSTER_NAME" > "$KUBECONFIG" -# Build the docker image -IMG=controller:latest make docker-build - -# Import the image to the cluster +# Import the controller image that we built at the start into to the cluster +# this image has to exists and be available in the local docker k3d image import -c "$CLUSTER_NAME" controller:latest # Install cert manager