-
Notifications
You must be signed in to change notification settings - Fork 2
/
init-openshift.ps1
executable file
·36 lines (29 loc) · 1.27 KB
/
init-openshift.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
. .\init-properties.ps1
if ((Get-Command "oc" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Output "The oc client tools need to be installed to connect to OpenShift."
Write-Output "Download it from https://www.openshift.org/download.html and confirm that ""oc version"" runs.`n"
exit
}
Function Write-Host-Header($echo) {
Write-Output ""
Write-Output "########################################################################"
Write-Output "$echo"
Write-Output "########################################################################"
}
$PRJ_DEMO="complaints-mgmnt"
$PRJ_DEMO_NAME=((./support/openshift/provision.ps1 info $PRJ_DEMO 2>&1 | Select-String -Pattern "Project name") -split "\s+")[2]
# Check if the project exists
#oc get project $PRJ_DEMO_NAME > $null 2>&1
oc get project $PRJ_DEMO_NAME > $null 2>&1
$PRJ_EXISTS=$?
if ($PRJ_EXISTS) {
Write-Output "$PRJ_DEMO_NAME already exists. Deleting project."
./support/openshift/provision.ps1 -command delete -demo $PRJ_DEMO
# Wait until the project has been removed.
Write-Output "Waiting for OpenShift to clean deleted project."
Start-Sleep -s 30
}
Write-Output "Provisioning $PRODUCT $DEMO."
./support/openshift/provision.ps1 -command setup -demo $PRJ_DEMO -with-imagestreams
Write-Output "Setup completed."