Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] operator-sdk binary installation #22

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ test-olm: operator-sdk opm-index
./config/operatorhub/flux-operator/testdata/003-catalog-source.yaml
export OLM_VERSION=${OLM_VERSION} && \
export FLUX_OPERATOR_VERSION=${FLUX_OPERATOR_VERSION} && \
export OPERATOR_SDK_BIN=$(OPERATOR_SDK) && \
go test ./test/olm/ -v -ginkgo.v

.PHONY: deploy-olm-data
Expand All @@ -186,7 +187,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk-$(OPERATOR_SDK_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.1
Expand Down
21 changes: 14 additions & 7 deletions test/olm/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ import (
)

const (
namespace = "flux-system"
defaultVersion = "v0.3.0"
defaultOLMVersion = "v0.28.0"
namespace = "flux-system"
defaultVersion = "v0.3.0"
defaultOLMVersion = "v0.28.0"
defaultOperatorsdkBin = "bin/operator-sdk"
)

var (
version string
img string
version string
img string
operatorsdkBin string
)

// Build the flux-operator image and deploy it to the Kind cluster.
Expand All @@ -34,6 +36,11 @@ var _ = BeforeSuite(func() {
olmVersion = defaultOLMVersion
}

operatorsdkBin = os.Getenv("OPERATOR_SDK_BIN")
if operatorsdkBin == "" {
operatorsdkBin = defaultOperatorsdkBin
}

img = fmt.Sprintf("ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-catalog:bundle-%s", version)
opm := fmt.Sprintf("ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-index:%s", version)

Expand All @@ -44,9 +51,9 @@ var _ = BeforeSuite(func() {
ExpectWithOffset(1, err).NotTo(HaveOccurred())

By("installing OLM")
cmd := exec.Command("bin/operator-sdk", "olm", "install", "--version", olmVersion)
cmd := exec.Command(operatorsdkBin, "olm", "install", "--version", olmVersion)
_, err = utils.Run(cmd, "/test/olm")
ExpectWithOffset(1, err).NotTo(HaveOccurred())
ExpectWithOffset(3, err).NotTo(HaveOccurred())

By("deploying flux-operator olm kubernetes resources")
cmd = exec.Command("make", "deploy-olm-data")
Expand Down
2 changes: 1 addition & 1 deletion test/olm/scorecard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _ = Describe("Scorecard", Ordered, func() {
Context("test", func() {
It("should run successfully", func() {
By("run scorecard tests")
cmd := exec.Command("bin/operator-sdk", "scorecard",
cmd := exec.Command(operatorsdkBin, "scorecard",
img, "-c", "config/operatorhub/flux-operator/"+version+"/tests/scorecard/config.yaml",
"-w", "60s", "-o", "json")
_, err := utils.Run(cmd, "/test/olm")
Expand Down