Skip to content

Commit

Permalink
Setup ginkgo cli build properly to avoid double dep (#3378)
Browse files Browse the repository at this point in the history
* Setup ginkgo cli build properly to avoid double dep

Today we have the ginkgo CLI brought into the builder and
also to the project itself. This results in
```
 Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
  Ginkgo CLI Version:
    2.12.0
  Mismatched package versions found:
    2.17.1 used by tests
```
This commit provides the necessary build adaptations to get rid of the
builder ginkgo CLI dependency.

Signed-off-by: Alex Kalenyuk <[email protected]>

* update builder to latest

#3379

Signed-off-by: Alex Kalenyuk <[email protected]>

---------

Signed-off-by: Alex Kalenyuk <[email protected]>
  • Loading branch information
akalenyu authored Aug 16, 2024
1 parent f357368 commit 2d9c82e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ genrule(
cmd = "/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --comment --purpose server-auth $@",
)

genrule(
name = "build-ginkgo",
srcs = [
"//vendor/github.com/onsi/ginkgo/v2/ginkgo",
],
outs = ["ginkgo-copier"],
cmd = "echo '#!/bin/sh\n\ncp -f $(SRCS) $$1' > \"$@\"",
executable = 1,
)

pkg_tar(
name = "ca_anchors_tar",
srcs = [":ca_anchors"],
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ rpm-deps: ## Update RPM dependencies

##@ Testing
build-functest: ## Build the functional tests (content of tests/ subdirectory)
${DO_BAZ} ./hack/build/build-ginkgo.sh
${DO_BAZ} ./hack/build/build-functest.sh

test: test-unit test-functional test-lint ## execute all tests (_NOTE:_ 'WHAT' is expected to match the go cli pattern for paths e.g. './pkg/...'. This differs slightly from rest of the 'make' targets)
Expand Down
3 changes: 1 addition & 2 deletions hack/build/build-functest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ mkdir -p ${TESTS_OUT_DIR}/
# use vendor
export GO111MODULE=${GO111MODULE:-off}

ginkgo build ${CDI_DIR}/tests/
${TESTS_OUT_DIR}/ginkgo build ${CDI_DIR}/tests/
mv ${CDI_DIR}/tests/tests.test ${TESTS_OUT_DIR}/
cp -f /go/bin/ginkgo ${TESTS_OUT_DIR}/
18 changes: 18 additions & 0 deletions hack/build/build-ginkgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -ex

source hack/build/common.sh
source hack/build/config.sh

rm -rf "${TESTS_OUT_DIR}/ginkgo"

bazel build \
--verbose_failures \
--config=${ARCHITECTURE} \
//vendor/github.com/onsi/ginkgo/v2/ginkgo:ginkgo

bazel run \
--verbose_failures \
--config=${ARCHITECTURE} \
:build-ginkgo -- ${TESTS_OUT_DIR}/ginkgo
2 changes: 1 addition & 1 deletion hack/build/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FUNC_TEST_PROXY="cdi-func-test-proxy"
FUNC_TEST_POPULATOR="cdi-func-test-sample-populator"

# update this whenever new builder tag is created
BUILDER_IMAGE=${BUILDER_IMAGE:-quay.io/kubevirt/kubevirt-cdi-bazel-builder:2405081150-60b5fa4fc}
BUILDER_IMAGE=${BUILDER_IMAGE:-quay.io/kubevirt/kubevirt-cdi-bazel-builder:2408131802-67ef11da7}

BINARIES="cmd/${OPERATOR} cmd/${CONTROLLER} cmd/${IMPORTER} cmd/${CLONER} cmd/${APISERVER} cmd/${UPLOADPROXY} cmd/${UPLOADSERVER} cmd/${OPERATOR} tools/${FUNC_TEST_INIT} tools/${FUNC_TEST_REGISTRY_INIT} tools/${FUNC_TEST_BAD_WEBSERVER} tools/${FUNC_TEST_PROXY} tools/${FUNC_TEST_POPULATOR}"
CDI_PKGS="cmd/ pkg/ test/"
Expand Down
2 changes: 1 addition & 1 deletion hack/ci/build-functest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ source "${script_dir}"/../build/common.sh
mkdir -p ${TESTS_OUT_DIR}/
# use vendor
export GO111MODULE=on
/go/bin/ginkgo build ${CDI_DIR}/tests/
${TESTS_OUT_DIR}/ginkgo build ${CDI_DIR}/tests/
mv ${CDI_DIR}/tests/tests.test ${TESTS_OUT_DIR}/

0 comments on commit 2d9c82e

Please sign in to comment.