Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign OPENSHIFT_VERSION early if not manually defined #1652

Closed
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions 01_install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ if sudo systemctl is-active docker-distribution.service; then
sudo systemctl disable --now docker-distribution.service
fi

retry_with_timeout 5 60 "curl $OPENSHIFT_CLIENT_TOOLS_URL | sudo tar -U -C /usr/local/bin -xzf -"
sudo chmod +x /usr/local/bin/oc
oc version --client -o json
if [[ ! -f /usr/local/bin/oc ]]; then
retry_with_timeout 5 60 "curl $OPENSHIFT_CLIENT_TOOLS_URL | sudo tar -U -C /usr/local/bin -xzf -"
sudo chmod +x /usr/local/bin/oc
oc version --client -o json
fi
17 changes: 14 additions & 3 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export REGISTRY_BACKEND=${REGISTRY_BACKEND:-"podman"}
export KNI_INSTALL_FROM_GIT=${KNI_INSTALL_FROM_GIT:-}

export OPENSHIFT_CLIENT_TOOLS_URL=https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz
export PERSONAL_PULL_SECRET=${PERSONAL_PULL_SECRET:-$SCRIPTDIR/pull_secret.json}

# Note: when changing defaults for OPENSHIFT_RELEASE_STREAM, make sure to update
# doc in config_example.sh
Expand Down Expand Up @@ -165,9 +166,22 @@ export OPENSHIFT_INSTALL_PATH="${OPENSHIFT_INSTALL_PATH:-$GOPATH/src/github.com/
# Override the image to use for installing hive
export HIVE_DEPLOY_IMAGE="${HIVE_DEPLOY_IMAGE:-registry.ci.openshift.org/openshift/hive-v4.0:hive}"

export PULL_SECRET_FILE=${PULL_SECRET_FILE:-$WORKING_DIR/pull_secret.json}

# CI images don't have version numbers
export OPENSHIFT_CI=${OPENSHIFT_CI:-""}
export OPENSHIFT_VERSION=${OPENSHIFT_VERSION:-""}
if [[ -z "$OPENSHIFT_VERSION" ]]; then
source utils.sh
retry_with_timeout 5 60 "curl $OPENSHIFT_CLIENT_TOOLS_URL | sudo tar -U -C /usr/local/bin -xzf -"
sudo chmod +x /usr/local/bin/oc
oc version --client -o json
source release_info.sh
mkdir -p ${OCP_DIR}
save_release_info ${OPENSHIFT_RELEASE_IMAGE} ${OCP_DIR}
OPENSHIFT_VERSION=$(openshift_version)
export OPENSHIFT_VERSION
fi
if [[ -z "$OPENSHIFT_CI" ]]; then
export OPENSHIFT_VERSION=${OPENSHIFT_VERSION:-$(echo $OPENSHIFT_RELEASE_IMAGE | sed "s/.*:\([[:digit:]]\.[[:digit:]]*\).*/\1/")}
zaneb marked this conversation as resolved.
Show resolved Hide resolved
fi
Expand Down Expand Up @@ -309,15 +323,12 @@ export SSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o C
# Connect to system libvirt
export LIBVIRT_DEFAULT_URI=qemu:///system

export PULL_SECRET_FILE=${PULL_SECRET_FILE:-$WORKING_DIR/pull_secret.json}

# Ensure a few variables are set, even if empty, to avoid undefined
# variable errors in the next 2 checks.
set +x
export CI_TOKEN=${CI_TOKEN:-}
set -x
export CI_SERVER=${CI_SERVER:-api.ci.l2s4.p1.openshiftapps.com}
export PERSONAL_PULL_SECRET=${PERSONAL_PULL_SECRET:-$SCRIPTDIR/pull_secret.json}

# Ensure working dir is always different than script dir. If not, some
# files may get overriden during deployment process.
Expand Down
8 changes: 7 additions & 1 deletion release_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ function save_release_info() {
release_image="$1"
outdir="$2"

oc adm release info --registry-config "$PULL_SECRET_FILE" "$release_image" -o json > ${outdir}/release_info.json
if [[ -f "$PULL_SECRET_FILE" ]]; then
PULL_SECRET="${PULL_SECRET_FILE}"
else
PULL_SECRET="${PERSONAL_PULL_SECRET}"
fi

oc adm release info --registry-config "$PULL_SECRET" "$release_image" -o json > ${outdir}/release_info.json
}

# Gives us e.g 4.7 because although OPENSHIFT_VERSION is set by users,
Expand Down
2 changes: 1 addition & 1 deletion sanitychecks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euxo pipefail
MIN_SPACE_REQUIRED=${MIN_SPACE_REQUIRED:=80}

function verifyClean {
if [ -d "ocp/${CLUSTER_NAME}" ]; then
if [ -d "ocp/${CLUSTER_NAME}/auth" ]; then
echo "A cluster named '${CLUSTER_NAME}' already exists on this host. Run 'make clean' to remove it before doing another deployment."
exit 1
fi
Expand Down