-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.oc.amd64
48 lines (44 loc) · 1.77 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
pipeline {
agent {
label 'x86'
}
environment {
git = 'https://github.com/ftmiranda/java-hello-world' // Replace with your fork of the hello-world code
oc_token = credentials('fm-octoken-x86') // Replace with OpenShift Token from GUI
pullSecret = credentials('fm-pull-secret')
ocp_server = 'c115-e.us-south.containers.cloud.ibm.com:30341'
app = 'fm-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 java-hello-world'
//sh 'kubectl create -f $pullSecret -n=$app'
//sh 'oc secrets link builder 13358228-test19918811112-pull-secret -n=$app'
//sh 'oc secrets link default 13358228-test19918811112-pull-secret -n=$app'
}
}
stage('Build and deploy') {
steps {
sh 'oc project $app'
sh 'oc delete bc fm-java-hello-world || true'
sh 'oc delete deployment fm-java-hello-world || true'
sh 'oc delete service fm-java-hello-world || true'
sh 'oc delete route fm-java-hello-world || true'
sh 'oc new-app $git'
sh 'sleep 10'
sh 'oc logs -f bc/fm-java-hello-world'
sh 'sleep 15'
}
}
stage('Expose Route') {
steps {
sh 'oc project $app'
sh 'oc expose svc/fm-java-hello-world'
sh 'oc get routes -o json | jq -r \'.items[0].spec.host\''
}
}
}
}