File Jenkinsfile changed (mode: 100644) (index aff5a81..60c012d) |
1 |
|
pipeline{
|
|
2 |
|
agent {
|
|
3 |
|
label 'iib-sca-build'
|
|
4 |
|
}
|
|
5 |
|
environment {
|
|
6 |
|
codecIV = credentials('deployment_audit_api_iv_nonprod')
|
|
7 |
|
codecKey = credentials('deployment_audit_api_key_nonprod')
|
|
8 |
|
codecIV_prod = credentials('deployment_audit_api_iv_prod')
|
|
9 |
|
codecKey_prod = credentials('deployment_audit_api_key_prod')
|
|
10 |
|
srv_gitlab = credentials('srv-gitlab')
|
|
11 |
|
}
|
|
12 |
|
stages
|
|
13 |
|
{
|
|
14 |
|
stage("Compile") {
|
|
15 |
|
steps {
|
|
16 |
|
sh "sh ./gradlew compileJava --stacktrace"
|
|
17 |
|
}
|
|
18 |
|
}
|
|
19 |
|
|
|
20 |
|
stage("Unit test") {
|
|
21 |
|
steps {
|
|
22 |
|
sh "sh ./gradlew test --tests com.kingfisher.deployment.audit.test.unit.suite.* --stacktrace"
|
|
23 |
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/tests/test', reportFiles: 'index.html', reportName: 'Unit Test Report', reportTitles: 'Unit tests by Junit'])
|
|
24 |
|
}
|
|
25 |
|
}
|
|
26 |
|
|
|
27 |
|
stage('Setup dev DB instance') {
|
|
28 |
|
steps{
|
|
29 |
|
sh "sh ./gradlew update -PrunList=dev --stacktrace"
|
|
30 |
|
}
|
|
31 |
|
}
|
|
32 |
|
|
|
33 |
|
stage("Integration test with dev DB") {
|
|
34 |
|
steps {
|
|
35 |
|
sh "sh ./gradlew test --tests com.kingfisher.deployment.audit.test.integration.suite.* --stacktrace"
|
|
36 |
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/tests/test', reportFiles: 'index.html', reportName: 'Integration Test Report', reportTitles: 'Unit tests by Junit'])
|
|
37 |
|
}
|
|
38 |
|
}
|
|
39 |
|
|
|
40 |
|
stage('Test Coverage') {
|
|
41 |
|
steps{
|
|
42 |
|
// sh "sh ./gradlew check"
|
|
43 |
|
sh "sh ./gradlew jacocoTestReport --stacktrace"
|
|
44 |
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/jacoco/test/html', reportFiles: 'index.html', reportName: 'Code Coverage Report', reportTitles: 'Code coverage by JaCoCo'])
|
|
45 |
|
}
|
|
46 |
|
}
|
|
47 |
|
|
|
48 |
|
stage("Package") {
|
|
49 |
|
steps {
|
|
50 |
|
// sh "sh ./gradlew -Dskip.tests build "
|
|
51 |
|
sh "sh ./gradlew build -x test "
|
|
52 |
|
}
|
|
53 |
|
}
|
|
54 |
|
|
|
55 |
|
stage("Docker build") {
|
|
56 |
|
steps {
|
|
57 |
|
sh "docker build -t registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:latest --build-arg arg_port=9090 --build-arg arg_profile=dev --build-arg arg_codecKey=$codecKey --build-arg arg_codecIV=$codecIV --build-arg arg_git_commit=$GIT_COMMIT ."
|
|
58 |
|
sh "docker build -t registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:${BUILD_NUMBER} --build-arg arg_port=9090 --build-arg arg_profile=dev --build-arg arg_codecKey=$codecKey --build-arg arg_codecIV=$codecIV ."
|
|
59 |
|
}
|
|
60 |
|
}
|
|
61 |
|
|
|
62 |
|
stage("Docker publish to registry") {
|
|
63 |
|
steps {
|
|
64 |
|
withDockerRegistry([ credentialsId: "srv_gitlab", url: "https://registry.gitlab.kfplc.com" ]) {
|
|
65 |
|
sh "docker push registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:latest"
|
|
66 |
|
sh "docker push registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:${BUILD_NUMBER}"
|
|
67 |
|
}
|
|
68 |
|
}
|
|
69 |
|
}
|
|
70 |
|
|
|
71 |
|
stage("Deploy in dev") {
|
|
72 |
|
steps {
|
|
73 |
|
|
|
74 |
|
sshPublisher(publishers: [sshPublisherDesc(configName: 'INTAPPS_NONPROD', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker ps -aq|xargs -I {} docker stop {}; docker ps -aq|xargs -I {} docker rm {}; docker login registry.gitlab.kfplc.com -u $srv_gitlab_USR -p $srv_gitlab_PSW; docker pull registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api; docker run -d -p 9090:9090 registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api', execTimeout: 1200000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/home/cloud-user', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
|
75 |
|
|
|
76 |
|
}
|
|
77 |
|
}
|
|
78 |
|
|
|
79 |
|
/*stage("Sanity test in dev") {
|
|
80 |
|
steps {
|
|
81 |
|
script
|
|
82 |
|
{
|
|
83 |
|
sleep (2*60) // Sleep for 2 mins, waiting the application to be booted up in dev
|
|
84 |
|
currentGitCommit = sh(script: 'curl http://int-hos-intapps-nonprod-01.iaas.gha.kfplc.com:9090/v1/currentGitCommit', returnStdout: true)
|
|
85 |
|
if ( currentGitCommit != GIT_COMMIT ){
|
|
86 |
|
sh "exit 1"
|
|
87 |
|
}
|
|
88 |
|
}
|
|
89 |
|
}
|
|
90 |
|
}*/
|
|
91 |
|
|
|
92 |
|
stage('Setup prod DB instance') {
|
|
93 |
|
steps{
|
|
94 |
|
sh "sh ./gradlew update -PrunList=prod"
|
|
95 |
|
}
|
|
96 |
|
}
|
|
97 |
|
|
|
98 |
|
stage("Deploy in prod") {
|
|
99 |
|
steps {
|
|
100 |
|
|
|
101 |
|
sshPublisher(publishers: [sshPublisherDesc(configName: 'INTAPPS_PROD', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker ps -aq|xargs -I {} docker stop {}; docker ps -aq|xargs -I {} docker rm {}; docker login registry.gitlab.kfplc.com -u $srv_gitlab_USR -p $srv_gitlab_PSW; docker pull registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api; docker run -d -p 9090:9090 registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api', execTimeout: 1200000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/home/cloud-user', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
|
102 |
|
|
|
103 |
|
}
|
|
104 |
|
}
|
|
105 |
|
}
|
|
|
1 |
|
pipeline{ |
|
2 |
|
agent { |
|
3 |
|
label 'iib-sca-build' |
|
4 |
|
} |
|
5 |
|
environment { |
|
6 |
|
codecIV = credentials('deployment_audit_api_iv_nonprod') |
|
7 |
|
codecKey = credentials('deployment_audit_api_key_nonprod') |
|
8 |
|
codecIV_prod = credentials('deployment_audit_api_iv_prod') |
|
9 |
|
codecKey_prod = credentials('deployment_audit_api_key_prod') |
|
10 |
|
srv_gitlab = credentials('srv-gitlab') |
|
11 |
|
} |
|
12 |
|
stages |
|
13 |
|
{ |
|
14 |
|
stage("Compile") { |
|
15 |
|
steps { |
|
16 |
|
sh "sh ./gradlew compileJava --stacktrace" |
|
17 |
|
} |
|
18 |
|
} |
|
19 |
|
|
|
20 |
|
stage("Unit test") { |
|
21 |
|
steps { |
|
22 |
|
sh "sh ./gradlew test --tests com.kingfisher.deployment.audit.test.unit.suite.* --stacktrace" |
|
23 |
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/tests/test', reportFiles: 'index.html', reportName: 'Unit Test Report', reportTitles: 'Unit tests by Junit']) |
|
24 |
|
} |
|
25 |
|
} |
|
26 |
|
|
|
27 |
|
stage('Setup dev DB instance') { |
|
28 |
|
steps{ |
|
29 |
|
sh "sh ./gradlew update -PrunList=dev --stacktrace" |
|
30 |
|
} |
|
31 |
|
} |
|
32 |
|
|
|
33 |
|
stage("Integration test with dev DB") { |
|
34 |
|
steps { |
|
35 |
|
sh "sh ./gradlew test --tests com.kingfisher.deployment.audit.test.integration.suite.* --stacktrace" |
|
36 |
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/tests/test', reportFiles: 'index.html', reportName: 'Integration Test Report', reportTitles: 'Unit tests by Junit']) |
|
37 |
|
} |
|
38 |
|
} |
|
39 |
|
|
|
40 |
|
stage('Test Coverage') { |
|
41 |
|
steps{ |
|
42 |
|
// sh "sh ./gradlew check" |
|
43 |
|
sh "sh ./gradlew jacocoTestReport --stacktrace" |
|
44 |
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/reports/jacoco/test/html', reportFiles: 'index.html', reportName: 'Code Coverage Report', reportTitles: 'Code coverage by JaCoCo']) |
|
45 |
|
} |
|
46 |
|
} |
|
47 |
|
|
|
48 |
|
stage("Package") { |
|
49 |
|
steps { |
|
50 |
|
// sh "sh ./gradlew -Dskip.tests build " |
|
51 |
|
sh "sh ./gradlew build -x test " |
|
52 |
|
} |
|
53 |
|
} |
|
54 |
|
|
|
55 |
|
stage("Docker build") { |
|
56 |
|
steps { |
|
57 |
|
sh "docker build -t registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:latest --build-arg arg_port=9090 --build-arg arg_profile=dev --build-arg arg_codecKey=$codecKey --build-arg arg_codecIV=$codecIV --build-arg arg_git_commit=$GIT_COMMIT ." |
|
58 |
|
sh "docker build -t registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:${BUILD_NUMBER} --build-arg arg_port=9090 --build-arg arg_profile=dev --build-arg arg_codecKey=$codecKey --build-arg arg_codecIV=$codecIV ." |
|
59 |
|
} |
|
60 |
|
} |
|
61 |
|
|
|
62 |
|
stage("Docker publish to registry") { |
|
63 |
|
steps { |
|
64 |
|
withDockerRegistry([ credentialsId: "srv-gitlab", url: "https://registry.gitlab.kfplc.com" ]) { |
|
65 |
|
sh "docker push registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:latest" |
|
66 |
|
sh "docker push registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api:${BUILD_NUMBER}" |
|
67 |
|
} |
|
68 |
|
} |
|
69 |
|
} |
|
70 |
|
|
|
71 |
|
stage("Deploy in dev") { |
|
72 |
|
steps { |
|
73 |
|
|
|
74 |
|
sshPublisher(publishers: [sshPublisherDesc(configName: 'INTAPPS_NONPROD', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker ps -aq|xargs -I {} docker stop {}; docker ps -aq|xargs -I {} docker rm {}; docker login registry.gitlab.kfplc.com -u $srv_gitlab_USR -p $srv_gitlab_PSW; docker pull registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api; docker run -d -p 9090:9090 registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api', execTimeout: 1200000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/home/cloud-user', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) |
|
75 |
|
|
|
76 |
|
} |
|
77 |
|
} |
|
78 |
|
|
|
79 |
|
/*stage("Sanity test in dev") { |
|
80 |
|
steps { |
|
81 |
|
script |
|
82 |
|
{ |
|
83 |
|
sleep (2*60) // Sleep for 2 mins, waiting the application to be booted up in dev |
|
84 |
|
currentGitCommit = sh(script: 'curl http://int-hos-intapps-nonprod-01.iaas.gha.kfplc.com:9090/v1/currentGitCommit', returnStdout: true) |
|
85 |
|
if ( currentGitCommit != GIT_COMMIT ){ |
|
86 |
|
sh "exit 1" |
|
87 |
|
} |
|
88 |
|
} |
|
89 |
|
} |
|
90 |
|
}*/ |
|
91 |
|
|
|
92 |
|
stage('Setup prod DB instance') { |
|
93 |
|
steps{ |
|
94 |
|
sh "sh ./gradlew update -PrunList=prod" |
|
95 |
|
} |
|
96 |
|
} |
|
97 |
|
|
|
98 |
|
stage("Deploy in prod") { |
|
99 |
|
steps { |
|
100 |
|
|
|
101 |
|
sshPublisher(publishers: [sshPublisherDesc(configName: 'INTAPPS_PROD', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker ps -aq|xargs -I {} docker stop {}; docker ps -aq|xargs -I {} docker rm {}; docker login registry.gitlab.kfplc.com -u $srv_gitlab_USR -p $srv_gitlab_PSW; docker pull registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api; docker run -d -p 9090:9090 registry.gitlab.kfplc.com/integration_automation/int-deployment-audit-api', execTimeout: 1200000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/home/cloud-user', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) |
|
102 |
|
|
|
103 |
|
} |
|
104 |
|
} |
|
105 |
|
} |
106 |
106 |
} |
} |