openshift_container_versions.sh 897 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # Here we don't really care if this is a master, api, controller or node image.
  3. # We just need to know the version of one of them.
  4. unit_file=$(ls /etc/systemd/system/${1}*.service | grep -v node-dep | head -n1)
  5. if [ ${1} == "origin" ]; then
  6. image_name="openshift/origin"
  7. elif grep aep $unit_file 2>&1 > /dev/null; then
  8. image_name="aep3/node"
  9. elif grep openshift3 $unit_file 2>&1 > /dev/null; then
  10. image_name="openshift3/node"
  11. fi
  12. installed=$(docker run --rm --entrypoint=/bin/openshift ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v')
  13. docker pull ${image_name} 2>&1 > /dev/null
  14. available=$(docker run --rm --entrypoint=/bin/openshift ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v')
  15. echo "---"
  16. echo "curr_version: ${installed}"
  17. echo "avail_version: ${available}"