fabiojose
11/14/2018 - 4:30 PM

Observar status com oc


BUILD_VERSION=$(oc start-build $RD_OPTION_BUILD_NAME -n pvd-pre | grep -o '".*"' | tr -d \")

while :; do
  STATUS=$(oc describe bc $RD_OPTION_BUILD_NAME | grep "$BUILD_VERSION" | awk '{print $2}')
  echo $STATUS
  case $STATUS in
    running)
      sleep 5
      continue
    ;;
    pending)
      sleep 5
      continue
    ;;
    failed)
      echo "Falha no Build!"
      exit 1
    ;;
    complete)
      echo "Build executado com sucesso!"
      echo "Deploy sendo iniciado..."
      oc deploy pvd-backend --latest -n pvd-pre
      exit 0
    ;;
    *)
      echo "status pendente... $STATUS"
      continue
    ;;
  esac
done