From 7201839c0fa7f37c3e1839a7b6e8b7ea64bfdd3c Mon Sep 17 00:00:00 2001 From: Tomas Srnka Date: Wed, 29 Jul 2026 16:31:03 +0200 Subject: [PATCH] test(integration): run the Alpine distro build with a musl-capable envd --- packages/envd/Makefile | 7 ++++++- .../internal/tests/api/templates/distro_build_test.go | 11 ----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/envd/Makefile b/packages/envd/Makefile index f708ab24c4..ae6b3c1f53 100644 --- a/packages/envd/Makefile +++ b/packages/envd/Makefile @@ -7,6 +7,7 @@ ENV := $(shell cat ../../.last_used_env || echo "not-set") BUILD := $(shell git rev-parse HEAD | cut -c1-7) LDFLAGS=-ldflags "-X=main.commitSHA=$(BUILD)" PROD_LDFLAGS=-ldflags "-X=main.commitSHA=$(BUILD) -s -w -buildid=" +DEBUG_LDFLAGS=-ldflags "-X=main.commitSHA=$(BUILD) -linkmode external -extldflags=-static" AWS_BUCKET_PREFIX ?= $(PREFIX)$(AWS_ACCOUNT_ID)- GCP_BUCKET_PREFIX ?= $(GCP_PROJECT_ID)- @@ -71,8 +72,12 @@ endif build: CGO_ENABLED=0 GOOS=linux GOARCH=$(BUILD_ARCH) go build -trimpath -buildvcs=false -a -o bin/envd ${PROD_LDFLAGS} +# This binary is injected into every sandbox guest, including musl ones, so it +# must not need a dynamic loader; -race requires cgo, hence the static external +# link. osusergo/netgo keep user and DNS lookups pure Go, as in the CGO_ENABLED=0 +# build above, so only the race instrumentation differs from what ships. build-debug: - CGO_ENABLED=1 go build -race -gcflags=all="-N -l" -o bin/debug/envd ${LDFLAGS} + CGO_ENABLED=1 go build -race -tags osusergo,netgo -gcflags=all="-N -l" -o bin/debug/envd ${DEBUG_LDFLAGS} start-docker: make build diff --git a/tests/integration/internal/tests/api/templates/distro_build_test.go b/tests/integration/internal/tests/api/templates/distro_build_test.go index 3b164e9f66..f6077443ce 100644 --- a/tests/integration/internal/tests/api/templates/distro_build_test.go +++ b/tests/integration/internal/tests/api/templates/distro_build_test.go @@ -22,7 +22,6 @@ func TestTemplateBuildDistroFamilies(t *testing.T) { name string templateName string fromImage string - skipReason string }{ { name: "Debian family", @@ -43,12 +42,6 @@ func TestTemplateBuildDistroFamilies(t *testing.T) { name: "Alpine on OpenRC", templateName: "test-distro-alpine", fromImage: "alpine:3.24", - // The integration host installs the envd from `make build-debug`, and - // -race requires cgo, so that binary is glibc-linked and cannot exec - // on musl: envd never answers and the base layer times out. Released - // envd is built with CGO_ENABLED=0 and runs on Alpine. Drop this once - // the host installs a static envd. - skipReason: "host envd is glibc-linked; a musl guest cannot exec it", }, } @@ -56,10 +49,6 @@ func TestTemplateBuildDistroFamilies(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() - if tc.skipReason != "" { - t.Skip(tc.skipReason) - } - var logMessages []string logHandler := func(alias string, entry api.BuildLogEntry) { logMessages = append(logMessages, entry.Message)