Skip to content

Commit 6756e1d

Browse files
committed
fix: multi-arch
Signed-off-by: Paul Bastide <[email protected]>
1 parent 90ed49c commit 6756e1d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ test-unit:
5252

5353
test-integration:
5454
mkdir -p tests/results-integration
55-
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-additional.out -race -count=1 ./internal/pkg/... -run TestIntegrationAdditional
56-
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-release.out -race -count=1 ./internal/pkg/... -run TestIntegrationRelease
55+
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-additional.out -race -count=1 ./internal/pkg/... -run 'TestIntegrationAdditional$'
56+
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-release.out -race -count=1 ./internal/pkg/... -run 'TestIntegrationRelease$'
5757
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-additional.out -race -count=1 ./internal/pkg/... -run TestIntegrationAdditionalM2M
5858
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-release.out -race -count=1 ./internal/pkg/... -run TestIntegrationReleaseM2M
5959
make -C v1 test-integration

internal/e2e/templates/isc_templates/release_isc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ kind: ImageSetConfiguration
33
apiVersion: mirror.openshift.io/v2alpha1
44
mirror:
55
platform:
6+
architectures:
7+
- "multi"
8+
- "ppc64le"
9+
- "amd64"
610
channels:
711
- name: {{.}}
812
graph: true

internal/testutils/testutils.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"os"
1414
"path"
1515
"path/filepath"
16+
"runtime"
1617
"strings"
1718
"text/template"
1819

@@ -23,6 +24,7 @@ import (
2324
v1 "github.com/google/go-containerregistry/pkg/v1"
2425
"github.com/google/go-containerregistry/pkg/v1/empty"
2526
"github.com/google/go-containerregistry/pkg/v1/layout"
27+
"github.com/google/go-containerregistry/pkg/v1/mutate"
2628
"github.com/google/go-containerregistry/pkg/v1/remote"
2729
"github.com/openshift/oc-mirror/v2/internal/pkg/image"
2830
)
@@ -127,6 +129,17 @@ func buildAndPushFakeImage(content map[string][]byte, imgRef string, dir string)
127129
return "", err
128130
}
129131
i, _ := crane.Image(content)
132+
// Set the platform to match the local GOARCH
133+
cfg, err := i.ConfigFile()
134+
if err != nil {
135+
return "", err
136+
}
137+
cfg.OS = runtime.GOOS
138+
cfg.Architecture = runtime.GOARCH
139+
i, err = mutate.ConfigFile(i, cfg)
140+
if err != nil {
141+
return "", err
142+
}
130143
if err := crane.Push(i, tag.String()); err != nil {
131144
return "", err
132145
}

0 commit comments

Comments
 (0)