Skip to content

Instantly share code, notes, and snippets.

@jcpowermac
Created April 7, 2017 21:26
Show Gist options
  • Select an option

  • Save jcpowermac/aa73a5e4734836da0a026dc41d867e1b to your computer and use it in GitHub Desktop.

Select an option

Save jcpowermac/aa73a5e4734836da0a026dc41d867e1b to your computer and use it in GitHub Desktop.
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m' # No Color
set -x
echo -e "\n${RED}>>> Build ansibleapp-base${NC}\n"
cd /home/jcallen/Development/ansibleapp-library/ansibleapp-base
docker build -t ansibleapp/ansibleapp-base .
echo -e "\n${RED}>>> Build ansibleapp/helloworld-ansibleapp${NC}\n"
cd /home/jcallen/Development/ansibleapp-library/helloworld-ansibleapp
docker build -t ansibleapp/helloworld-ansibleapp .
echo -e "\n${RED}>>> Tag and push to docker.io${NC}\n"
docker tag ansibleapp/helloworld-ansibleapp:latest docker.io/jcpowermac/helloworld-ansibleapp:latest
docker push docker.io/jcpowermac/helloworld-ansibleapp:latest
echo -e "\n${RED}>>> Run helloworld-ansibleapp using docker run${NC}\n"
docker run --rm -e "OPENSHIFT_TARGET=openshift.virtomation.com:8443" -e "OPENSHIFT_USER=admin" -e "OPENSHIFT_PASS=admin" ansibleapp/helloworld-ansibleapp provision -e message=helloworldocp
echo -e "\n${RED}>>> Make sure we are using the helloworld-ansibleapp project${NC}\n"
oc project helloworld-ansibleapp
rep=$(oc get dc/web --template='{{.status.availableReplicas}}')
while [ "$rep" != "1" ];do
sleep 10s
rep=$(oc get dc/web --template='{{.status.availableReplicas}}')
done
oc get all
host=`oc get route --template='{{(index .items 0).spec.host}}'`
echo -e "\n${RED}>>> curl the url${NC}\n"
curl http://${host}
echo -e "\n${RED}>>> delete the project${NC}\n"
oc delete project helloworld-ansibleapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment