Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Created February 14, 2024 14:35
Show Gist options
  • Save hexfusion/a0cb0182e6d58215b3b0dfb5d791cdc5 to your computer and use it in GitHub Desktop.
Save hexfusion/a0cb0182e6d58215b3b0dfb5d791cdc5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#set -x
IMAGE_NAME="$1"
RELEASE="$2"
TAG="$3"
if [ "$IMAGE_NAME" == "" ]; then
echo "IMAGE_NAME is required. example cluster-etcd-operator"
exit 1
fi
if [ "$RELEASE" == "" ]; then
echo "RELEASE is required. example 4.8"
exit 1
fi
if [ "$TAG" == "" ]; then
TAG=$RELEASE
fi
BUILD=$(curl -s -L https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestream/${RELEASE}.0-0.nightly/latest | jq -r '.pullSpec')
echo "build $BUILD"
echo "auth oc"
oc registry login --to=$REGISTRY_AUTH_FILE
echo "auth podman"
podman login -u="sbatsche+dev" -p="$QUAY_TOKEN" quay.io:443
# ensure cloud is populated
function pco() {
jq -s '.[0] * .[1]' $REGISTRY_AUTH_FILE /home/sbatsche/.PULL_SECRET_CLOUD
}
OUT=$(pco)
echo "$OUT" &> $REGISTRY_AUTH_FILE
SKIP_MULTI_ARCH_PAYLOAD=1 oc -a "${REGISTRY_AUTH_FILE}" adm release new \
--from-release "${BUILD}" \
--to-image quay.io:443/sbatsche/origin-release:"${TAG}" \
${IMAGE_NAME}=quay.io:443/sbatsche/"${IMAGE_NAME}":latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment