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

ci: Improve OPM build for e2e testing #24

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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IMG ?= ghcr.io/controlplaneio-fluxcd/flux-operator:latest

# FLUX_OPERATOR_VERSION refers to the version of the operator to be tested
# under ./config/operatorhub/flux-operator/<version> directory.
FLUX_OPERATOR_VERSION ?= v0.1.0
FLUX_OPERATOR_VERSION ?= $(shell gh release view --json tagName -q '.tagName')
# OLM_VERSION refers to the version of the Operator Lifecycle Manager to be used.
OLM_VERSION ?= 0.28.0

Expand Down
5 changes: 2 additions & 3 deletions config/operatorhub/flux-operator/scripts/opm-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ docker build -t ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-catalog:bu
-f "${DIR}/bundle.Dockerfile" "${DIR}/${VERSION}"
docker push ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-catalog:bundle-"${VERSION}"

docker build -t opm --build-arg ARCH=$ARCH -f "${DIR}/Dockerfile.opm" .
docker build -t opm --build-arg ARCH=$ARCH -f "${DIR}/opm.Dockerfile" .

docker run --rm -it \
--privileged \
docker run --rm --privileged \
-v /var/lib/docker:/var/lib/docker \
-v /var/run/docker.sock:/var/run/docker.sock \
opm:latest index add \
Expand Down
11 changes: 10 additions & 1 deletion test/olm/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"strings"
"time"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
)

const (
Expand Down Expand Up @@ -97,4 +98,12 @@ var _ = AfterSuite(func() {
cmd := exec.Command("make", "undeploy-olm-data")
_, err := utils.Run(cmd, "/test/olm")
Expect(err).NotTo(HaveOccurred())

operatorsdkBin = os.Getenv("OPERATOR_SDK_BIN")
if operatorsdkBin == "" {
operatorsdkBin = defaultOperatorsdkBin
}
cmd = exec.Command(operatorsdkBin, "olm", "uninstall")
_, err = utils.Run(cmd, "/test/olm")
Expect(err).NotTo(HaveOccurred())
})
5 changes: 3 additions & 2 deletions test/olm/scorecard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package e2eolm
import (
"os/exec"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
)

var _ = Describe("Scorecard", Ordered, func() {
Expand All @@ -14,7 +15,7 @@ var _ = Describe("Scorecard", Ordered, func() {
By("run scorecard tests")
cmd := exec.Command(operatorsdkBin, "scorecard",
img, "-c", "config/operatorhub/flux-operator/"+version+"/tests/scorecard/config.yaml",
"-w", "60s", "-o", "json")
"-w", "5m", "-o", "json")
_, err := utils.Run(cmd, "/test/olm")
ExpectWithOffset(2, err).NotTo(HaveOccurred())
})
Expand Down