Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Created September 21, 2021 19:39
Show Gist options
  • Save hexfusion/76c75dfd8f07e3fe4778494bc80f5790 to your computer and use it in GitHub Desktop.
Save hexfusion/76c75dfd8f07e3fe4778494bc80f5790 to your computer and use it in GitHub Desktop.
#!/bin/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"
oc registry login --to=/home/remote/sbatsche/.PULL_SECRET_CI
# cat the pull secret
function pco() {
jq -s '.[0] * .[1] * .[2]' /home/remote/sbatsche/.PULL_SECRET_CI /home/remote/sbatsche/.PULL_SECRET_CLOUD /home/remote/sbatsche/.PULL_SECRET_DOCKER
}
OUT=$(pco)
echo "$OUT" &> ~/.PULL_SECRET_BUILD
docker login
/usr/local/bin/oc -a ~/.PULL_SECRET_BUILD adm release new -n ocp \
--server https://api.ci.openshift.org \
--from-release \
${BUILD} \
--to-image docker.io/hexfusion/origin-release:${TAG} \
${IMAGE_NAME}=quay.io/hexfusion/${IMAGE_NAME}:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment