-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPCT-272: Create Sonobuoy mirror scripts to multi-arch images (#91)
Moving the script to mirror sonobuoy image to CLI repo, and adding support to multi-architectures. https://issues.redhat.com/browse/OPCT-272 --------- Co-authored-by: Richard Vanderpool <49568690+rvanderp3@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM ${SONOBUOY_REPO}:${SONOBUOY_VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Mirror sonobuoy image to OPCT repo. | ||
|
||
set -o pipefail | ||
set -o nounset | ||
set -o errexit | ||
|
||
export SONOBUOY_VERSION=${SONOBUOY_VERSION:-v0.56.10} | ||
export SONOBUOY_REPO=docker.io/sonobuoy/sonobuoy | ||
export MIRROR_REPO=${MIRROR_REPO:-quay.io/opct/sonobuoy} | ||
export PLATFORM_IMAGES="" | ||
|
||
declare -A BUILD_PLATFORMS=() | ||
BUILD_PLATFORMS+=( ["linux-amd64"]="linux/amd64" ) | ||
BUILD_PLATFORMS+=( ["linux-arm64"]="linux/arm64" ) | ||
BUILD_PLATFORMS+=( ["linux-ppc64le"]="linux/ppc64le" ) | ||
BUILD_PLATFORMS+=( ["linux-s390x"]="linux/s390x" ) | ||
|
||
mkdir -p build/ | ||
envsubst < "$(dirname "$0")"/Containerfile > build/sonobuoy.Containerfile | ||
|
||
for arch in ${!BUILD_PLATFORMS[*]} | ||
do | ||
img_name="${MIRROR_REPO}:${SONOBUOY_VERSION}-${arch}" | ||
podman build --platform "${BUILD_PLATFORMS[$arch]}" \ | ||
-f build/sonobuoy.Containerfile \ | ||
-t "${img_name}" . &&\ | ||
podman push "${img_name}" &&\ | ||
PLATFORM_IMAGES+=" ${img_name}" | ||
done | ||
|
||
podman manifest create ${MIRROR_REPO}:${SONOBUOY_VERSION} ${PLATFORM_IMAGES} | ||
podman manifest push ${MIRROR_REPO}:${SONOBUOY_VERSION} docker://${MIRROR_REPO}:${SONOBUOY_VERSION} | ||
|