File tree Expand file tree Collapse file tree 3 files changed +26
-7
lines changed
Expand file tree Collapse file tree 3 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 1+ # Target architecture and OS for image builds
2+ # Defaults to amd64/linux for OpenShift clusters, but can be overridden for local development
3+ TARGET_ARCH ?= amd64
4+ TARGET_OS ?= linux
5+
16# Useful for local development
27dev :
38 ./hack/dev.sh
49
510# General purpose targets
611images :
7- ./hack/images.sh $(DOCKER_REPO_OVERRIDE )
12+ TARGET_ARCH= $( TARGET_ARCH ) TARGET_OS= $( TARGET_OS ) ./hack/images.sh $(DOCKER_REPO_OVERRIDE )
813
914install : install-tools
1015 ./hack/install.sh
@@ -18,7 +23,7 @@ install-all: install-tools
1823 SCALE_UP=4 INSTALL_KAFKA=" true" ENABLE_TRACING=true ./hack/install.sh
1924
2025install-release-next : install-tools generated-files-release-next
21- ON_CLUSTER_BUILDS=true ./hack/images.sh image-registry.openshift-image-registry.svc:5000/openshift-marketplace
26+ ON_CLUSTER_BUILDS=true TARGET_ARCH= $( TARGET_ARCH ) TARGET_OS= $( TARGET_OS ) ./hack/images.sh image-registry.openshift-image-registry.svc:5000/openshift-marketplace
2227 USE_RELEASE_NEXT=true DOCKER_REPO_OVERRIDE=image-registry.openshift-image-registry.svc:5000/openshift-marketplace ./hack/install.sh
2328
2429install-tracing :
Original file line number Diff line number Diff line change 1717
1818repo=$1
1919
20+ # Set default target architecture and OS if not provided
21+ TARGET_ARCH=${TARGET_ARCH:- amd64}
22+ TARGET_OS=${TARGET_OS:- linux}
23+
2024on_cluster_builds=${ON_CLUSTER_BUILDS:- false}
2125echo " On cluster builds: ${on_cluster_builds} "
26+ echo " Target platform: ${TARGET_OS} /${TARGET_ARCH} "
2227
2328if [[ $on_cluster_builds = true ]]; then
2429 # image-registry.openshift-image-registry.svc:5000/openshift-marketplace/openshift-knative-operator:latest
@@ -32,14 +37,14 @@ if [[ $on_cluster_builds = true ]]; then
3237
3338else
3439 tmp_dockerfile=$( replace_images openshift-knative-operator/Dockerfile)
35- podman build -t " $repo /serverless-openshift-knative-operator" -f " ${tmp_dockerfile} " .
40+ podman build --platform= " ${TARGET_OS} / ${TARGET_ARCH} " - t " $repo /serverless-openshift-knative-operator" -f " ${tmp_dockerfile} " .
3641 podman push " $repo /serverless-openshift-knative-operator"
3742
3843 tmp_dockerfile=$( replace_images knative-operator/Dockerfile)
39- podman build -t " $repo /serverless-knative-operator" -f " ${tmp_dockerfile} " .
44+ podman build --platform= " ${TARGET_OS} / ${TARGET_ARCH} " - t " $repo /serverless-knative-operator" -f " ${tmp_dockerfile} " .
4045 podman push " $repo /serverless-knative-operator"
4146
4247 tmp_dockerfile=$( replace_images serving/ingress/Dockerfile)
43- podman build -t " $repo /serverless-ingress" -f " ${tmp_dockerfile} " .
48+ podman build --platform= " ${TARGET_OS} / ${TARGET_ARCH} " - t " $repo /serverless-ingress" -f " ${tmp_dockerfile} " .
4449 podman push " $repo /serverless-ingress"
4550fi
Original file line number Diff line number Diff line change @@ -407,8 +407,12 @@ function image_with_sha {
407407 image=${1:? " Provide image" }
408408 return_input_on_empty=${2:- " false" }
409409
410+ # Use TARGET_OS and TARGET_ARCH if set, otherwise default to linux/amd64
411+ target_os=${TARGET_OS:- linux}
412+ target_arch=${TARGET_ARCH:- amd64}
413+
410414 # shellcheck disable=SC2086
411- digest=$( skopeo inspect --retry-times=10 --no-tags=true ${SKOPEO_EXTRA_FLAGS} " docker://${image} " | jq -r ' .Digest' || echo " " )
415+ digest=$( skopeo inspect --retry-times=10 --override-os " ${target_os} " --override-arch " ${target_arch} " -- no-tags=true ${SKOPEO_EXTRA_FLAGS} " docker://${image} " | jq -r ' .Digest' || echo " " )
412416 if [ " ${digest} " = " " ]; then
413417 if [ " ${return_input_on_empty} " = " true" ]; then
414418 echo " ${image} "
@@ -425,7 +429,12 @@ function image_with_sha {
425429
426430function bundle_image_version {
427431 image=${1:? " Provide image" }
428- version=$( skopeo inspect --no-tags=true " docker://${image} " | jq -r ' .Labels.version' )
432+
433+ # Use TARGET_OS and TARGET_ARCH if set, otherwise default to linux/amd64
434+ target_os=${TARGET_OS:- linux}
435+ target_arch=${TARGET_ARCH:- amd64}
436+
437+ version=$( skopeo inspect --no-tags=true --override-os " ${target_os} " --override-arch " ${target_arch} " " docker://${image} " | jq -r ' .Labels.version' )
429438 echo " ${version} "
430439}
431440
You can’t perform that action at this time.
0 commit comments