Skip to content

Commit

Permalink
MGDAPI-5078 - feat: support container image platform
Browse files Browse the repository at this point in the history
  • Loading branch information
KevFan committed Jan 19, 2023
1 parent 0294038 commit a8747f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ IMAGE_REG ?= quay.io
IMAGE_ORG ?= integreatly
IMAGE_NAME ?= cloud-resource-operator
OPERATOR_IMG = $(IMAGE_REG)/$(IMAGE_ORG)/$(IMAGE_NAME):v$(VERSION)
CONTAINER_PLATFORM ?= linux/amd64
MANIFEST_NAME ?= cloud-resources
NAMESPACE=cloud-resource-operator
PREV_VERSION=0.41.0
Expand Down Expand Up @@ -141,7 +142,7 @@ test/unit:
.PHONY: image/build
image/build: build
echo "build image ${OPERATOR_IMG}"
docker build -t ${OPERATOR_IMG} .
docker build --platform=$(CONTAINER_PLATFORM) -t ${OPERATOR_IMG} .

.PHONY: image/push
image/push: image/build
Expand Down Expand Up @@ -238,7 +239,7 @@ release/prepare: gen/csv image/push create/olm/bundle
.PHONY: image/build/pipelines
image/build/pipelines: build
echo "build image ${OPERATOR_IMG}"
sudo podman build --ulimit nofile=65535:65535 . -t ${OPERATOR_IMG}
sudo podman build --platform=$(CONTAINER_PLATFORM) --ulimit nofile=65535:65535 . -t ${OPERATOR_IMG}
sudo podman save ${OPERATOR_IMG} | sudo -u jenkins podman load

.PHONY: image/push/pipelines
Expand Down
4 changes: 3 additions & 1 deletion scripts/create-olm-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LATEST_VERSION=$(grep cloud-resource-operator bundles/cloud-resource-operator.pa
ORG="${IMAGE_ORG:-integreatly}"
REG="${IMAGE_REG:-quay.io}"
BUILD_TOOL="${BUILD_TOOL:-docker}"
CONTAINER_PLATFORM="${CONTAINER_PLATFORM:-linux/amd64}"
UPGRADE_CRO="${UPGRADE:-true}"
VERSIONS="${BUNDLE_VERSIONS:-$LATEST_VERSION}"
ROOT=$(pwd)
Expand Down Expand Up @@ -63,6 +64,7 @@ generate_bundles() {
do
image="$REG/$ORG/cloud-resource-operator:bundle-v$VERSION"
$BUILD_TOOL build -f ./bundles/bundle.Dockerfile -t $image \
--platform="$CONTAINER_PLATFORM" \
--build-arg manifest_path=./bundles/temp/$VERSION/manifests \
--build-arg metadata_path=./bundles/temp/$VERSION/metadata \
--build-arg version=$VERSION .
Expand All @@ -88,7 +90,7 @@ generate_index() {
INDEX_IMAGE=$REG/$ORG/cloud-resource-operator:index-v$LATEST_VERSION

printf "Building index image:$INDEX_IMAGE\n"
${BUILD_TOOL} build . -f index.Dockerfile -t $INDEX_IMAGE
${BUILD_TOOL} build . -f index.Dockerfile -t $INDEX_IMAGE --platform="$CONTAINER_PLATFORM"

printf "Pushing index image:'$INDEX_IMAGE\n"
${BUILD_TOOL} push $INDEX_IMAGE
Expand Down

0 comments on commit a8747f3

Please sign in to comment.