Skip to content

Commit 97c5524

Browse files
authored
fix: Multiarch catalog and bundle builds (#1968)
* fix: Multiarch catalog and bundle builds Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Update dev resources Signed-off-by: Anatolii Bazko <abazko@redhat.com> --------- Signed-off-by: Anatolii Bazko <abazko@redhat.com>
1 parent 99e82fe commit 97c5524

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

.github/workflows/release-next-catalog-and-operator-image.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ jobs:
105105
${GITHUB_WORKSPACE}/build/scripts/olm/release-catalog.sh \
106106
--channel next \
107107
--image-tool docker \
108-
--platform linux/amd64,linux/arm64 \
109108
--catalog-image quay.io/eclipse/eclipse-che-olm-catalog:next
110109
111110
build-catalog-with-digest:
@@ -138,6 +137,5 @@ jobs:
138137
${GITHUB_WORKSPACE}/build/scripts/olm/release-catalog.sh \
139138
--channel next \
140139
--image-tool docker \
141-
--platform linux/amd64,linux/arm64 \
142140
--catalog-image quay.io/eclipse/eclipse-che-olm-catalog:next-digest \
143141
--bundle-image quay.io/eclipse/eclipse-che-olm-bundle:$(make bundle-version CHANNEL=next)-digest

Makefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -488,17 +488,22 @@ bundle-build: download-opm ## Build a bundle image
488488
[[ -z "$(BUNDLE_IMG)" ]] && { echo [ERROR] BUNDLE_IMG not defined; exit 1; }
489489

490490
BUNDLE_PATH=$$($(MAKE) bundle-path)
491-
if [[ -z "$(PLATFORMS)" ]]; then
492-
$(IMAGE_TOOL) build -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
493-
else
494-
$(IMAGE_TOOL) buildx build --platform $(PLATFORMS) -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
495-
fi
491+
$(IMAGE_TOOL) build -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
496492

497493
bundle-push: SHELL := /bin/bash
498494
bundle-push: ## Push a bundle image
499495
[[ -z "$(BUNDLE_IMG)" ]] && { echo [ERROR] BUNDLE_IMG not defined; exit 1; }
500496
$(IMAGE_TOOL) push $(BUNDLE_IMG)
501497

498+
bundle-build-and-push-multiarch: SHELL := /bin/bash
499+
bundle-build-and-push-multiarch: ## Build a bundle image
500+
[[ -z "$(CHANNEL)" ]] && { echo [ERROR] CHANNEL not defined; exit 1; }
501+
[[ -z "$(BUNDLE_IMG)" ]] && { echo [ERROR] BUNDLE_IMG not defined; exit 1; }
502+
[[ -z "$(ARCHS)" ]] && { echo [ERROR] ARCHS not defined; exit 1; }
503+
504+
BUNDLE_PATH=$$($(MAKE) bundle-path)
505+
$(IMAGE_TOOL) buildx build --push --platform $(ARCHS) -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
506+
502507
bundle-render: SHELL := /bin/bash
503508
bundle-render: download-opm ## Add bundle to a catalog
504509
[[ -z "$(CHANNEL)" ]] && { echo [ERROR] CHANNEL not defined; exit 1; }
@@ -517,17 +522,22 @@ catalog-build: download-opm ## Build a catalog image
517522
[[ -z "$(CATALOG_IMG)" ]] && { echo [ERROR] CATALOG_IMG not defined; exit 1; }
518523

519524
$(OPM) validate olm-catalog/$(CHANNEL)
520-
if [[ -z "$(PLATFORMS)" ]]; then
521-
$(IMAGE_TOOL) build -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
522-
else
523-
$(IMAGE_TOOL) buildx build --platform $(PLATFORMS) -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
524-
fi
525+
$(IMAGE_TOOL) build -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
525526

526527
catalog-push: SHELL := /bin/bash
527528
catalog-push: ## Push a catalog image
528529
[[ -z "$(CATALOG_IMG)" ]] && { echo [ERROR] CATALOG_IMG not defined; exit 1; }
529530
$(IMAGE_TOOL) push $(CATALOG_IMG)
530531

532+
catalog-build-and-push-multiarch: SHELL := /bin/bash
533+
catalog-build-and-push-multiarch: download-opm ## Build a catalog image
534+
[[ -z "$(CHANNEL)" ]] && { echo [ERROR] CHANNEL not defined; exit 1; }
535+
[[ -z "$(CATALOG_IMG)" ]] && { echo [ERROR] CATALOG_IMG not defined; exit 1; }
536+
[[ -z "$(ARCHS)" ]] && { echo [ERROR] ARCHS not defined; exit 1; }
537+
538+
$(OPM) validate olm-catalog/$(CHANNEL)
539+
$(IMAGE_TOOL) buildx build --push --platform $(ARCHS) -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
540+
531541
bundle-path: SHELL := /bin/bash
532542
bundle-path: ## Prints path to a bundle directory for a given channel
533543
[[ -z "$(CHANNEL)" ]] && { echo [ERROR] CHANNEL not defined; exit 1; }

build/scripts/olm/release-catalog.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ init() {
2222
unset CATALOG_IMAGE
2323
unset BUNDLE_IMAGE
2424
unset IMAGE_TOOL
25-
unset PLATFORM
2625

2726
while [[ "$#" -gt 0 ]]; do
2827
case $1 in
2928
'--channel'|'-c') CHANNEL="$2"; shift 1;;
3029
'--catalog-image'|'-i') CATALOG_IMAGE="$2"; shift 1;;
3130
'--bundle-image'|'-b') BUNDLE_IMAGE="$2"; shift 1;;
3231
'--image-tool'|'-t') IMAGE_TOOL="$2"; shift 1;;
33-
'--platform'|'-p') PLATFORM="$2"; shift 1;;
3432
'--force'|'-f') FORCE="true";;
3533
'--help'|'-h') usage; exit;;
3634
esac
@@ -60,7 +58,6 @@ usage () {
6058
echo "Options:"
6159
echo -e "\t-i,--catalog-image Catalog image to build"
6260
echo -e "\t-b,--bundle-image Bundle image to build"
63-
echo -e "\t-p,--platform Target platform for build"
6461
echo -e "\t-c,--channel=next|stable Olm channel to build bundle from"
6562
echo -e "\t-t,--image-tool [default: docker] Image tool"
6663
echo -e "\t-f,--force [default: false] Force to build catalog and bundle images even if bundle already exists in the catalog"
@@ -79,11 +76,11 @@ build () {
7976
exit 0
8077
else
8178
echo "[INFO] Build and push the new bundle image"
82-
make bundle-build bundle-push \
79+
make bundle-build-and-push-multiarch \
8380
CHANNEL="${CHANNEL}" \
8481
BUNDLE_IMG="${BUNDLE_IMAGE}" \
8582
IMAGE_TOOL="${IMAGE_TOOL}" \
86-
PLATFORM="${PLATFORM}"
83+
ARCHS="linux/arm64,linux/amd64"
8784

8885
echo "[INFO] Add bundle to the catalog"
8986

@@ -105,11 +102,11 @@ build () {
105102
fi
106103

107104
echo "[INFO] Build and push the catalog image"
108-
make catalog-build catalog-push \
105+
make catalog-build-and-push-multiarch \
109106
CHANNEL="${CHANNEL}" \
110107
CATALOG_IMG="${CATALOG_IMAGE}" \
111108
IMAGE_TOOL="${IMAGE_TOOL}" \
112-
PLATFORM="${PLATFORM}"
109+
ARCHS="linux/arm64,linux/amd64"
113110

114111
make download-addlicense
115112
make license $(make catalog-path CHANNEL="${CHANNEL}")

bundle/next/eclipse-che/manifests/che-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ metadata:
108108
operatorframework.io/arch.amd64: supported
109109
operatorframework.io/arch.arm64: supported
110110
operatorframework.io/os.linux: supported
111-
name: eclipse-che.v7.99.0-900.next
111+
name: eclipse-che.v7.99.0-901.next
112112
namespace: placeholder
113113
spec:
114114
apiservicedefinitions: {}
@@ -1077,7 +1077,7 @@ spec:
10771077
minKubeVersion: 1.19.0
10781078
provider:
10791079
name: Eclipse Foundation
1080-
version: 7.99.0-900.next
1080+
version: 7.99.0-901.next
10811081
webhookdefinitions:
10821082
- admissionReviewVersions:
10831083
- v1

0 commit comments

Comments
 (0)