Skip to content
Open
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
7 changes: 7 additions & 0 deletions tests-extension/pkg/bindata/qe/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion tests-extension/test/qe/specs/olmv0_custom_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package specs
import (
"context"
"os"
"runtime"
"time"

g "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -53,7 +54,10 @@ var _ = g.Describe("[sig-operator][Jira:OLM][OCPFeatureGate:OLMLifecycleAndCompa
fbcContent, err := os.ReadFile(exutil.FixturePath("testdata", "custom-schema", "index.json"))
o.Expect(err).NotTo(o.HaveOccurred())

imageRef := olmv0util.BuildCustomCatalogImage(oc, namespace, catalogName, baseImage, fbcContent)
testArch := runtime.GOARCH
e2e.Logf("test running on architecture: %s", testArch)

imageRef := olmv0util.BuildCustomCatalogImage(oc, namespace, catalogName, baseImage, testArch, fbcContent)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
e2e.Logf("built catalog image: %s", imageRef)

// Register build resources for cleanup
Expand All @@ -67,6 +71,7 @@ var _ = g.Describe("[sig-operator][Jira:OLM][OCPFeatureGate:OLMLifecycleAndCompa
SourceType: "grpc",
Address: imageRef,
Template: exutil.FixturePath("testdata", "olm", "catalogsource-image.yaml"),
Arch: testArch,
}
catsrc.CreateWithCheck(oc, itName, dr)

Expand Down
4 changes: 4 additions & 0 deletions tests-extension/test/qe/testdata/olm/catalogsource-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ objects:
name: "${NAME}"
namespace: "${NAMESPACE}"
spec:
grpcPodConfig:
nodeSelector:
kubernetes.io/arch: "${ARCH}"
image: "${ADDRESS}"
secrets:
- "${SECRET}"
Expand All @@ -31,3 +34,4 @@ parameters:
- name: SECRET
- name: INTERVAL
value: "10m0s"
- name: ARCH
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ objects:
name: "${NAME}"
namespace: "${NAMESPACE}"
spec:
nodeSelector:
kubernetes.io/arch: "${ARCH}"
output:
to:
kind: ImageStreamTag
Expand All @@ -25,3 +27,4 @@ parameters:
- name: NAME
- name: NAMESPACE
- name: BASE_IMAGE
- name: ARCH
8 changes: 7 additions & 1 deletion tests-extension/test/qe/util/olmv0util/catalog_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package olmv0util
import (
"context"
"fmt"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -33,6 +34,7 @@ type CatalogSourceDescription struct {
Interval string // Update interval for the catalog source
ImageTemplate string // Image template for catalog updates
ClusterType string // Target cluster type (e.g., "microshift")
Arch string // Architecture for node selector
}

// Create creates a CatalogSource resource using the provided template and parameters
Expand All @@ -49,6 +51,10 @@ func (catsrc *CatalogSourceDescription) Create(oc *exutil.CLI, itName string, dr
catsrc.Interval = "10m0s"
e2e.Logf("set interval to be 10m0s")
}
if catsrc.Arch == "" {
catsrc.Arch = runtime.GOARCH
e2e.Logf("set catalogsource node selector arch to %s", catsrc.Arch)
}
// Choose appropriate template application function based on cluster type
applyFn := ApplyResourceFromTemplate
if strings.Compare(catsrc.ClusterType, "microshift") == 0 {
Expand All @@ -63,7 +69,7 @@ func (catsrc *CatalogSourceDescription) Create(oc *exutil.CLI, itName string, dr
err := applyFn(oc, "--ignore-unknown-parameters=true", "-f", catsrc.Template,
"-p", "NAME="+catsrc.Name, "NAMESPACE="+catsrc.Namespace, "ADDRESS="+catsrc.Address, "SECRET="+catsrc.Secret,
"DISPLAYNAME="+"\""+catsrc.DisplayName+"\"", "PUBLISHER="+"\""+catsrc.Publisher+"\"", "SOURCETYPE="+catsrc.SourceType,
"INTERVAL="+catsrc.Interval, "IMAGETEMPLATE="+imageTemplate)
"INTERVAL="+catsrc.Interval, "IMAGETEMPLATE="+imageTemplate, "ARCH="+catsrc.Arch)
o.Expect(err).NotTo(o.HaveOccurred())
// Configure security context constraints for non-microshift clusters
if strings.Compare(catsrc.ClusterType, "microshift") != 0 {
Expand Down
10 changes: 7 additions & 3 deletions tests-extension/test/qe/util/olmv0util/custom_schema_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -123,7 +124,7 @@ func GetOPMBaseImage(oc *exutil.CLI) string {
// BuildConfig. It creates an ImageStream and BuildConfig, starts a binary build
// from the provided FBC content, and waits for completion.
// Returns the internal registry image reference.
func BuildCustomCatalogImage(oc *exutil.CLI, namespace, name, baseImage string, fbcContent []byte) string {
func BuildCustomCatalogImage(oc *exutil.CLI, namespace, name, baseImage, arch string, fbcContent []byte) string {
// Create ImageStream
isTemplate := exutil.FixturePath("testdata", "olm", "custom-schema-imagestream.yaml")
err := ApplyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", isTemplate,
Expand All @@ -132,11 +133,14 @@ func BuildCustomCatalogImage(oc *exutil.CLI, namespace, name, baseImage string,
e2e.Logf("created ImageStream %s/%s", namespace, name)

// Create BuildConfig
if arch == "" {
arch = runtime.GOARCH
}
bcTemplate := exutil.FixturePath("testdata", "olm", "custom-schema-buildconfig.yaml")
err = ApplyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", bcTemplate,
"-p", "NAME="+name, "NAMESPACE="+namespace, "BASE_IMAGE="+baseImage)
"-p", "NAME="+name, "NAMESPACE="+namespace, "BASE_IMAGE="+baseImage, "ARCH="+arch)
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("created BuildConfig %s/%s with base image %s", namespace, name, baseImage)
e2e.Logf("created BuildConfig %s/%s with base image %s for arch %s", namespace, name, baseImage, arch)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// Prepare build directory
buildDir, err := os.MkdirTemp("", "custom-schema-build-")
Expand Down