From d78402115d5c340fe06bf014d1d66ce3b88413a4 Mon Sep 17 00:00:00 2001 From: Gordon Chan Date: Fri, 15 May 2026 11:29:46 +1200 Subject: [PATCH 1/3] [TE-5842] Bump test-engine-client from v1.6.0 to v2.5.1 Move the `go tool test-engine-client` install from the v1 major to v2.x so the runtime test path can share a bktec version with the metadata side-channel landed in TE-5828. v1.6.0 (Jun 2025) predates the v2.0.0 subcommand split (Dec 2025), the `plan` subcommand, and the `--collect-git-metadata` flag added in v2.4.0. v2.5.1 also carries the corrected go.mod module path with the `/v2` suffix required for v2+ module fetches. `go mod tidy` adds `github.com/urfave/cli/v3 v3.8.0` as a new indirect (bktec's own CLI dependency) and prunes the v1.x-only transitives no longer pulled in (pact-go, cobra, pflag, afero, logutils, mousetrap). Subsequent commits migrate `tests.sh` to the v2 `run` subcommand shape and unify the metadata script onto the same `go tool` install. --- go.mod | 5 +++-- go.sum | 18 ++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 54474b2988..b6c0d271a2 100644 --- a/go.mod +++ b/go.mod @@ -123,7 +123,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bitfield/gotestdox v0.2.2 // indirect github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect - github.com/buildkite/test-engine-client v1.6.0 // indirect + github.com/buildkite/test-engine-client/v2 v2.5.1 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -190,6 +190,7 @@ require ( github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/trailofbits/go-mutexasserts v0.0.0-20250514102930-c1f3d2e37561 // indirect + github.com/urfave/cli/v3 v3.8.0 // indirect github.com/vektah/gqlparser/v2 v2.5.32 // indirect github.com/wolfeidau/quickzip v1.0.2 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect @@ -227,7 +228,7 @@ require ( tool ( drjosh.dev/assertzapper github.com/Khan/genqlient/generate - github.com/buildkite/test-engine-client + github.com/buildkite/test-engine-client/v2 gotest.tools/gotestsum mvdan.cc/gofumpt ) diff --git a/go.sum b/go.sum index 988e7dde15..9e3e95350e 100644 --- a/go.sum +++ b/go.sum @@ -164,8 +164,8 @@ github.com/buildkite/roko v1.4.0 h1:DxixoCdpNqxu4/1lXrXbfsKbJSd7r1qoxtef/TT2J80= github.com/buildkite/roko v1.4.0/go.mod h1:0vbODqUFEcVf4v2xVXRfZZRsqJVsCCHTG/TBRByGK4E= github.com/buildkite/shellwords v1.0.1 h1:88OjMbEBf+EliVB0tizXJynpAM2CKOvYwepg5n8O70M= github.com/buildkite/shellwords v1.0.1/go.mod h1:so0eQnTxgbo58CTYX+4BCx5UuMzvRha9dcKdCKl6NV4= -github.com/buildkite/test-engine-client v1.6.0 h1:yk/gdkFFU8B1+M16mxPNmxJgVoYffI/sx4XP1xmFesE= -github.com/buildkite/test-engine-client v1.6.0/go.mod h1:J6LrqenaJPfVCffiWW1/QxjICFb+OkqCvdCd7qAI0AE= +github.com/buildkite/test-engine-client/v2 v2.5.1 h1:2Bx+UxKxsbyVB4pixuUMeevvoATrfYO7DKUpg3iI3jc= +github.com/buildkite/test-engine-client/v2 v2.5.1/go.mod h1:JA61MSQxGU9GYx0CyED17ex83RSzcKI3LR3RVyuaH7M= github.com/buildkite/zstash v0.8.0 h1:z8hBGGKIaN/UX0MZh51P8s28mWaDBkgD3uMoOu6Q96g= github.com/buildkite/zstash v0.8.0/go.mod h1:60v4pl8PnsVA6b09MC47aTR8Z1QNJoeQqOGp2jkEww8= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -272,10 +272,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= @@ -337,8 +333,6 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/outcaste-io/ristretto v0.2.3 h1:AK4zt/fJ76kjlYObOeNwh4T3asEuaCmp26pOvUOL9w0= github.com/outcaste-io/ristretto v0.2.3/go.mod h1:W8HywhmtlopSB1jeMg3JtdIhf+DYkLAr0VN/s4+MHac= -github.com/pact-foundation/pact-go/v2 v2.4.1 h1:eaLC58qzeCTbwdlCY8UvWz1HmDW+qrjTFfH8Xoq0rWs= -github.com/pact-foundation/pact-go/v2 v2.4.1/go.mod h1:OwnXXRliPZvKDMJn/IsAwQ95tQprmp5gPTzPYz54mTg= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= @@ -396,12 +390,6 @@ github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUN github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= -github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= -github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= -github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= -github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= -github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -428,6 +416,8 @@ github.com/trailofbits/go-mutexasserts v0.0.0-20250514102930-c1f3d2e37561 h1:qqa github.com/trailofbits/go-mutexasserts v0.0.0-20250514102930-c1f3d2e37561/go.mod h1:GA3+Mq3kt3tYAfM0WZCu7ofy+GW9PuGysHfhr+6JX7s= github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ= github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo= +github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI= +github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/vektah/gqlparser/v2 v2.5.32 h1:k9QPJd4sEDTL+qB4ncPLflqTJ3MmjB9SrVzJrawpFSc= github.com/vektah/gqlparser/v2 v2.5.32/go.mod h1:c1I28gSOVNzlfc4WuDlqU7voQnsqI6OG2amkBAFmgts= github.com/vmihailenco/msgpack/v4 v4.3.13 h1:A2wsiTbvp63ilDaWmsk2wjx6xZdxQOvpiNlKBGKKXKI= From 100bb8b40fadc0f83ca9253d120b3debce717bf9 Mon Sep 17 00:00:00 2001 From: Gordon Chan Date: Fri, 15 May 2026 15:16:44 +1200 Subject: [PATCH 2/3] [TE-5842] Migrate tests.sh to bktec run subcommand bktec v2.0.0 split the single-command shape into `run`, `plan`, and `tools` subcommands. The bare `bktec` invocation is no longer supported -- the v2 CLI exits non-zero on an unrecognised command. The runtime test contract is unchanged: same suite slug, runner, result path, retry count, and test command. Only the entry point shape moves from v1 to v2. --- .buildkite/steps/tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/steps/tests.sh b/.buildkite/steps/tests.sh index eb949f116a..fb79b4bc02 100755 --- a/.buildkite/steps/tests.sh +++ b/.buildkite/steps/tests.sh @@ -23,4 +23,4 @@ else export BUILDKITE_TEST_ENGINE_TEST_CMD="go tool gotestsum --junitfile={{resultPath}} -- -count=1 -cover $* {{packages}} -test.gocoverdir=${COVERAGE_DIR}" fi -go tool test-engine-client +go tool test-engine-client run From 58f25e2098399d47df4cb2b110dede03926e72a8 Mon Sep 17 00:00:00 2001 From: Gordon Chan Date: Fri, 15 May 2026 15:16:48 +1200 Subject: [PATCH 3/3] [TE-5842] Unify metadata step on go tool test-engine-client install Drop the curl-and-run install bootstrap and call the bktec binary installed via `go tool` instead. Both call sites in this repo now share a single bktec version pinned in go.mod, removing the runtime dependency on the GitHub release endpoint and the ~5s download from the metadata step's wall clock. The metadata step already runs inside the `agent` compose service (see .buildkite/docker-compose.yml), which carries `go` on PATH for bktec's gotest runner -- `go tool` resolves and caches the bktec binary out of GOMODCACHE on the same code path the test step uses. No change to the plan request shape: same suite, same runner, same `--collect-git-metadata` preview flag, same discarded JSON output. Also drops the `BKTEC_VERSION` override env, the arch detection case, and the tempdir / chmod / PATH plumbing -- all of that is now handled by the Go module pin. --- .buildkite/steps/collect-commit-metadata.sh | 37 ++++----------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/.buildkite/steps/collect-commit-metadata.sh b/.buildkite/steps/collect-commit-metadata.sh index 4a623cfb18..896f6d0fcd 100755 --- a/.buildkite/steps/collect-commit-metadata.sh +++ b/.buildkite/steps/collect-commit-metadata.sh @@ -13,39 +13,16 @@ # # Runs inside the `agent` docker-compose service (see # .buildkite/docker-compose.yml), which is a linux/amd64+arm64 golang image. -# The service provides `go` on PATH for bktec's gotest runner (which shells -# out to `go list ./...` to discover packages) and forwards -# BUILDKITE_TEST_ENGINE_API_ACCESS_TOKEN into the container. +# The service provides `go` on PATH so we can install bktec via `go tool`, +# and forwards BUILDKITE_TEST_ENGINE_API_ACCESS_TOKEN into the container. # -# bktec is downloaded fresh each run from the test-engine-client GitHub -# release. The agent repo's go.mod pins test-engine-client v1.6.0 for use as -# a `go tool` on the runtime test path; that v1 shape predates the `plan` -# subcommand and is intentionally left untouched here. A future change should -# unify both call sites on a single bktec version. +# bktec is pinned via go.mod and installed as a `go tool`, sharing the install +# path with `.buildkite/steps/tests.sh`. See TE-5842 for the unification. set -euo pipefail -BKTEC_VERSION="${BKTEC_VERSION:-2.5.0}" - -echo "+++ :test_tube: Installing bktec v${BKTEC_VERSION}" - -case "$(uname -m)" in - x86_64) arch=amd64 ;; - aarch64|arm64) arch=arm64 ;; - *) - echo "Unsupported architecture: $(uname -m)" >&2 - exit 1 - ;; -esac - -bindir="$(mktemp -d)" -url="https://github.com/buildkite/test-engine-client/releases/download/v${BKTEC_VERSION}/bktec_${BKTEC_VERSION}_linux_${arch}" - -curl --fail --silent --show-error --location --output "${bindir}/bktec" "${url}" -chmod +x "${bindir}/bktec" -export PATH="${bindir}:${PATH}" - -bktec --version +echo "+++ :test_tube: bktec version" +go tool test-engine-client --version echo "+++ :test_tube: Collecting git commit metadata via bktec plan (discarded)" @@ -53,6 +30,6 @@ echo "+++ :test_tube: Collecting git commit metadata via bktec plan (discarded)" # --json output is redirected to /dev/null below so this file is never read. export BUILDKITE_TEST_ENGINE_RESULT_PATH=/tmp/bktec-plan-metadata.json -BKTEC_PREVIEW_SELECTION=1 bktec plan --json --collect-git-metadata > /dev/null +BKTEC_PREVIEW_SELECTION=1 go tool test-engine-client plan --json --collect-git-metadata > /dev/null echo "Plan request issued -- git commit metadata sent to Test Engine."