forked from Sunbird-RC/sunbird-rc-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
52 lines (44 loc) · 2.22 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
node {
try {
def branchname = 'main'
stage('Clone repository') {
git([url: 'https://github.com/Sunbird-RC/sunbird-rc-core', branch: "${branchname}"])
}
stage('Compile And Test'){
sh """sh configure-dependencies.sh"""
sh """make"""
step([$class: 'JacocoPublisher', exclusionPattern: '**/model/**,**/helpers/**,**/config/**,**/configs/**,**/controllers/**,**/models/**,**/exceptions/**,**/messaging/**,**/response/**,**/utils/**,**/migration/**,**/TestApplication.class,**/TestKafkaConfiguration.class,**/HealthCheck.class,**/TestSubmissionPipelineApplicationn.class,**/TestApplicationConfiguration.class,**/migration/**'])
}
stage('Build image') {
app = docker.build("ghcr.io/sunbird-rc/sunbird-rc-core","target")
claimApp = docker.build("ghcr.io/sunbird-rc/sunbird-rc-claim-ms","java/claim")
}
// stage('Test image') {
// app.withRun('-p 8010:8081') {c ->
// sh """#!/bin/bash
// env;
// i=0;
// while [[ \$i -lt 120 ]] ; do let i=i+1; sleep 1; status=`curl -I localhost:8010/health 2>/dev/null | grep 'HTTP/1.1 200' | wc -l`;if [ \$status -ge 1 ];then echo '\nTested Successfully';exit 0;else printf '.'; fi;done; exit 1;"""
// }
// }
stage('Push image') {
docker.withRegistry('', 'dockerhub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
docker.withRegistry('', 'dockerhub') {
claimApp.push("${env.BUILD_NUMBER}")
claimApp.push("latest")
}
}
// stage('Deploy image') {
// sh "ssh [email protected] 'kubectl get pods -n ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/registry registry=ghcr.io/sunbird-rc/sunbird-rc:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/claim-ms claim-ms=ghcr.io/sunbird-rc/sunbird-rc-claim-ms:${env.BUILD_NUMBER} --record --namespace=ndear'"
// }
}
catch (err) {
currentBuild.result = "FAILURE"
throw err
}
}