Skip to content

Commit e4097f7

Browse files
author
Steven Hardy
authored
Merge pull request openshift-metal3#863 from stbenjam/oc-version
Don't rely on build date for `oc`
2 parents 22e464b + ab964cb commit e4097f7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

01_install_requirements.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ fi
4040
oc_version=4.4
4141
oc_tools_dir=$HOME/oc-${oc_version}
4242
oc_tools_local_file=openshift-client-${oc_version}.tar.gz
43-
oc_date=0
4443
if which oc 2>&1 >/dev/null ; then
45-
oc_date=$(date -d $(oc version -o json | jq -r '.clientVersion.buildDate') +%s)
44+
oc_git_version=$(oc version -o json | jq -r '.clientVersion.gitVersion')
45+
oc_actual_version=${oc_git_version#v*}
46+
oc_major_minor="${oc_actual_version%\.[0-9]*}"
4647
fi
47-
if [ ! -f ${oc_tools_dir}/${oc_tools_local_file} ] || [ $oc_date -lt 1566755586 ]; then
48+
if [ ! -f ${oc_tools_dir}/${oc_tools_local_file} ] || [ "$oc_major_minor" != "$oc_version" ]; then
4849
mkdir -p ${oc_tools_dir}
4950
cd ${oc_tools_dir}
5051
wget https://mirror.openshift.com/pub/openshift-v4/clients/oc/${oc_version}/linux/oc.tar.gz -O ${oc_tools_local_file}

0 commit comments

Comments
 (0)