Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions snc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ YQ=${YQ:-yq}
OPENSHIFT_INSTALL=${OPENSHIFT_INSTALL:-./openshift-install}
CRC_VM_NAME=${CRC_VM_NAME:-crc}
BASE_DOMAIN=${CRC_BASE_DOMAIN:-testing}
QUAY_REGISTRY=${QUAY_REGISTRY:-quay.io/openshift-release-dev/ocp-release}
MIRROR=${MIRROR:-https://mirror.openshift.com/pub/openshift-v4/clients/ocp}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wking So is this correct assumption that mirror.openshift.com is source of truth when it comes to OCP releases? Recently when 4.3 rc bits happened those were not appeared on mirror.openshift.com atleast for a day or two. If you says this is way forward and every bits should be present here then we can merge it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recently when 4.3 rc bits happened those were not appeared on mirror.openshift.com at least for a day or two...

They're supposed to get pushed up around when the release is tagged into the candidate channel, with latest* symlinks bumped around when a release is tagged into fast/stable. If that's not what's happening, talk to ART.

CRC_PV_DIR="/mnt/pv-data"
SSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i id_rsa_crc"

# If user defined the OPENSHIFT_VERSION environment variable then use it.
# Otherwise use the tagged version if available
function get_openshift_version {
if [ "${OPENSHIFT_VERSION}" != "" ]; then
OPENSHIFT_RELEASE_VERSION=$OPENSHIFT_VERSION
if test -n "${OPENSHIFT_VERSION}"; then
OPENSHIFT_RELEASE_VERSION=$OPENSHIFT_VERSION
echo "Using release ${OPENSHIFT_RELEASE_VERSION} from OPENSHIFT_VERSION"
else
OPENSHIFT_RELEASE_VERSION=$(git describe --exact-match --tags HEAD 2>/dev/null)
if test -n "${OPENSHIFT_RELEASE_VERSION}"; then
echo "Using release ${OPENSHIFT_RELEASE_VERSION} from local Git tags"
else
OPENSHIFT_RELEASE_VERSION=$(git describe --exact-match --tags HEAD 2>/dev/null)
OPENSHIFT_RELEASE_VERSION="$(curl -L "${MIRROR}/latest/release.txt | sed -n 's/^ *Version: //p')"
if test -n "${OPENSHIFT_RELEASE_VERSION}"; then
echo "Using release ${OPENSHIFT_RELEASE_VERSION} from the latest mirror"
else
echo "Unable to determine an OpenShift release version. You may want to set the OPENSHIFT_VERSION environment variable explicitly.
exit 1
fi
fi
}
fi


function create_json_description {
openshiftInstallerVersion=$(${OPENSHIFT_INSTALL} version)
Expand All @@ -32,7 +43,7 @@ function create_json_description {
| ${JQ} ".buildInfo.buildTime = \"$(date -u --iso-8601=seconds)\"" \
| ${JQ} ".buildInfo.openshiftInstallerVersion = \"${openshiftInstallerVersion}\"" \
| ${JQ} ".buildInfo.sncVersion = \"git${sncGitHash}\"" \
| ${JQ} ".clusterInfo.openshiftVersion = \"${OPENSHIFT_RELEASE_VERSION:-git}\"" \
| ${JQ} ".clusterInfo.openshiftVersion = \"${OPENSHIFT_RELEASE_VERSION}\"" \
| ${JQ} ".clusterInfo.clusterName = \"${CRC_VM_NAME}\"" \
| ${JQ} ".clusterInfo.baseDomain = \"${BASE_DOMAIN}\"" \
| ${JQ} ".clusterInfo.appsDomain = \"apps-${CRC_VM_NAME}.${BASE_DOMAIN}\"" >${INSTALL_DIR}/crc-bundle-info.json
Expand Down Expand Up @@ -96,11 +107,7 @@ get_openshift_version
# Download the oc binary if not present in current directory
if ! which $OC; then
if [[ ! -e oc ]] ; then
if [ "${OPENSHIFT_RELEASE_VERSION}" != "" ]; then
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OPENSHIFT_RELEASE_VERSION}/openshift-client-linux-${OPENSHIFT_RELEASE_VERSION}.tar.gz | tar zx oc
else
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz | tar zx oc
fi
curl -L "${MIRROR}/${OPENSHIFT_RELEASE_VERSION}/openshift-client-linux-${OPENSHIFT_RELEASE_VERSION}.tar.gz" | tar zx oc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

fi
OC=./oc
fi
Expand All @@ -126,12 +133,9 @@ if [ "${OPENSHIFT_PULL_SECRET}" = "" ]; then
exit 1
fi

# Use the release payload for the latest known openshift release as indicated by git tags
if [ "${OPENSHIFT_RELEASE_VERSION}" != "" ]; then
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE=${QUAY_REGISTRY}:${OPENSHIFT_RELEASE_VERSION}
export OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE
echo "Setting OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE to ${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE}"
fi
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE="$(curl -l "${MIRROR}/${OPENSHIFT_RELEASE_VERSION}/release.txt" | sed -n 's/^Pull From: //p')"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

export OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE
echo "Setting OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE to ${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE}"

# Generate a new ssh keypair for this cluster
rm id_rsa_crc* || true
Expand Down