obsidian-toaster / platform

Generates the Obsidian archetypes from obsidian-toaster-quickstarts github org
Apache License 2.0
2 stars 9 forks source link

Obtain app endpoint from OpenShift route. #12

Closed RadekKoubsky closed 7 years ago

RadekKoubsky commented 7 years ago

The app endpoint ($APP) is created from hardcoded values, for instance $SUFFIX(openshiftapps), ".com" at the end of the endpoint. The hardcoded values do not work with our OpenShift instance which creates routes with different hostnames.

I believe that obtaining the app endpoint from OpenShift route provides generic solution to this problem. What do you think about it?

I have also added changes regarding the TMPDIR env var as the default value is not set in the script. Where does the value of TMPDIR come from if not defined in the script? That's why I changed the code to: Set TMPDIR=obsidian-toaster-quickstarts-tmp Create dir TMPDIR at the start of the script. Delete TMPDIR at the and of the script.

Can you please review my changes and discsuss the problems above. I will change the code if needed.

cmoulliard commented 7 years ago

@RadekKoubsky The TMPDIR is an Unix variable which is normally set by the OS. So this is not required to specify it.

As the script should continue to be used using one of the existing openshift machine (engint, devpreview, ...), I would prefer to keep or to improve it in order to support your machines ....

RadekKoubsky commented 7 years ago

@cmoulliard Thanks for your comments.

ad TMPDIR) When I ran the script on Fedora 24, the value of the env var was TMPDIR="", thus the current dir after the command rm -rf $TMPDIR/$name && cd $TMPDIR was my HOME dir, where the github repo was cloned by the following command git clone $GITHUB_ORG/$name.git. That's why I was confused.

ad host) To support our (any) machines, correct endpoint can be obtained from route using APP=$(oc get route $service -o json | jq '.spec.host' | tr -d \"\") instead of creating it from user-provided values. After all, one cannot determine the actual host of the route before the route is created in OpenShift.

I have removed the TMPDIR changes. The updated script with APP=$(oc get route $service -o json | jq '.spec.host' | tr -d \"\") works, I have tested it with our OCP instance and engint.openshift.com.