forked from pkuma343/MySpringBootApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
36 lines (35 loc) · 1.15 KB
/
Jenkinsfile
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
node {
stage('Checkout SCM') {
checkout scm
}
stage('Maven Tests') {
try {
bat 'mvn clean test'; junit '**/surefire-reports/*Test.xml'
} catch(err) {
junit '**/surefire-reports/*Test.xml'//; if(currentBuild.result == 'UNSTABLE') { currentBuild.result = 'FAILURE' }; throw err
}
}
stage('Sonar Scan') {
bat 'mvn sonar:sonar -Dsonar.host.url=http://localhost:9000'
}
//stage('Junit step') {
//junit '**/surefire-reports/*Test.xml'
//}
if (!env.CHANGE_TARGET) {
stage('Maven Install') {
bat 'mvn clean install -Dmaven.test.skip=true'
}
stage('Docker build') {
bat 'docker build -t pkuma343/myimage:v1 -f Dockerfile .'
}
stage('Push Image') {
bat 'docker login -u "pkuma343" -p "Password"'
bat 'docker push pkuma343/myimage:v1'
}
stage('Openshift Deploy') {
bat '"C:\\Softwares\\openshift-origin-client-tools-v1.5.1-7b451fc-windows\\oc.exe" login --token=p-pw_rEzFszNt__4gKxJ5pjFmoiamnWj14OqUzb71g4 --server=https://api.us-west-1.starter.openshift-online.com:6443'
bat '"C:\\Softwares\\openshift-origin-client-tools-v1.5.1-7b451fc-windows\\oc.exe" project my-project-pankaj'
bat '"C:\\Softwares\\openshift-origin-client-tools-v1.5.1-7b451fc-windows\\oc.exe" create -f api.yaml'
}
}
}