From e777881f23ff5500c8e4dd8572d3e789314c83de Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Thu, 18 Dec 2025 01:36:52 +0000 Subject: [PATCH] fixup! fixup! fixup! More fixes, moving from python to golang worker. --- .github/workflows/ci.yaml | 2 +- .github/workflows/release.yaml | 2 +- internal/controller/raczylo.com/suite_test.go | 18 ++++++++++-------- workflow-prepare.sh | 13 +++++++++++++ 4 files changed, 25 insertions(+), 10 deletions(-) create mode 100755 workflow-prepare.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8a163f9..2e582ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,5 +18,5 @@ jobs: pr-checks: uses: lukaszraczylo/shared-actions/.github/workflows/go-pr.yaml@main with: - go-version: "1.22" + go-version: "1.25" secrets: inherit diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 269664a..ed6890f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: release: uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main with: - go-version: "1.22" + go-version: "1.25" docker-enabled: true secrets: inherit diff --git a/internal/controller/raczylo.com/suite_test.go b/internal/controller/raczylo.com/suite_test.go index 3b4946a..3bb194f 100644 --- a/internal/controller/raczylo.com/suite_test.go +++ b/internal/controller/raczylo.com/suite_test.go @@ -19,6 +19,7 @@ package raczylocom import ( "context" "fmt" + "os" "path/filepath" "runtime" "testing" @@ -58,17 +59,18 @@ var _ = BeforeSuite(func() { ctx, cancel = context.WithCancel(context.TODO()) By("bootstrapping test environment") + + // Use KUBEBUILDER_ASSETS if set (CI), otherwise fall back to local path + binaryAssetsDir := os.Getenv("KUBEBUILDER_ASSETS") + if binaryAssetsDir == "" { + binaryAssetsDir = filepath.Join("..", "..", "..", "bin", "k8s", + fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)) + } + testEnv = &envtest.Environment{ CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, ErrorIfCRDPathMissing: true, - - // The BinaryAssetsDirectory is only required if you want to run the tests directly - // without call the makefile target test. If not informed it will look for the - // default path defined in controller-runtime which is /usr/local/kubebuilder/. - // Note that you must have the required binaries setup under the bin directory to perform - // the tests directly. When we run make test it will be setup and used automatically. - BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s", - fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)), + BinaryAssetsDirectory: binaryAssetsDir, } var err error diff --git a/workflow-prepare.sh b/workflow-prepare.sh new file mode 100755 index 0000000..f1bef69 --- /dev/null +++ b/workflow-prepare.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +echo "Setting up envtest binaries..." + +# Install setup-envtest +go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest + +# Download and setup envtest binaries +ENVTEST_ASSETS=$(setup-envtest use 1.31.0 --bin-dir /tmp/envtest -p path) +echo "KUBEBUILDER_ASSETS=${ENVTEST_ASSETS}" >> $GITHUB_ENV + +echo "Envtest binaries installed at: ${ENVTEST_ASSETS}"