forked from himanshusahu0001/hello-world-http-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.oc.amd64
49 lines (45 loc) · 1.79 KB
/
Jenkinsfile.oc.amd64
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
37
38
39
40
41
42
43
44
45
46
47
48
49
pipeline {
agent {
label 'x86'
}
environment {
git = 'https://github.com/OpenShift-Z/hello-world-http-java.git' // Replace with your fork of the hello-world code
oc_token = credentials('octoken-x86') // Replace with OpenShift Token from GUI
pullSecret = credentials('pull-secret')
ocp_server = 'https://c101-e.us-east.containers.cloud.ibm.com:32149'
app = 'java-hello-world'
}
stages {
stage('Create Project') {
steps {
sh 'oc login --token=$oc_token --insecure-skip-tls-verify --server=$ocp_server'
//sh 'oc delete namespace $app --wait=true || true'
//sh 'oc new-project $app'
//sh 'oc project $app'
//sh 'kubectl create -f $pullSecret'
//sh 'oc secrets link builder 13358228-test19918811112-pull-secret'
//sh 'oc secrets link default 13358228-test19918811112-pull-secret'
}
}
stage('Build and deploy') {
steps {
sh 'oc project $app'
sh 'oc delete bc hello-world-http-java || true'
sh 'oc delete deployment hello-world-http-java || true'
sh 'oc delete service hello-world-http-java || true'
sh 'oc delete route hello-world-http-java || true'
sh 'oc new-app $git'
sh 'sleep 15'
sh 'oc logs -f bc/hello-world-http-java '
sh 'sleep 15'
}
}
stage('Expose Route') {
steps {
sh 'oc project $app'
sh 'oc expose svc/hello-world-http-java'
sh 'oc get routes -o json | jq -r \'.items[0].spec.host\''
}
}
}
}