This repository has been archived by the owner on Oct 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
JenkinsFile_MT
79 lines (67 loc) · 3.09 KB
/
JenkinsFile_MT
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
node('maven') {
parameters {
booleanParam(defaultValue: true, description: '', name: 'quickPush')
}
stage('checkout') {
echo "checking out source"
checkout scm
echo "Build: MT.${BUILD_ID}"
}
stage('code quality check') {
if (!params.quickPush) {
SONARQUBE_PWD = sh (
script: 'oc env dc/sonarqube --list | awk -F "=" \'/SONARQUBE_ADMINPW/{print $2}\'',
returnStdout: true
).trim()
echo "SONARQUBE_PWD: ${SONARQUBE_PWD}"
SONARQUBE_URL = sh (
script: 'oc get routes -o wide --no-headers | awk \'/sonarqube/{ print match($0,/edge/) ? "https://"$2 : "http://"$2 }\'',
returnStdout: true
).trim()
echo "SONARQUBE_URL: ${SONARQUBE_URL}"
dir('sonar-runner') {
sh "./gradlew sonarqube -Dsonar.host.url=\"${SONARQUBE_URL}\" -Dsonar.verbose=true --stacktrace -Dsonar.java.binaries=.. -Dsonar.sources=.. -Dsun.jnu.encoding=UTF-8"
}
}
}
stage('build') {
echo "Building..."
openshiftBuild bldCfg: 'qsystem-mt', showBuildLogs: 'true'
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: 'MT.$BUILD_ID', srcStream: 'qsystem', srcTag: 'latest'
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: 'dev-mt', srcStream: 'qsystem', srcTag: 'latest'
}
stage('verify') {
if (!params.quickPush) {
openshiftVerifyDeployment depCfg: 'multitenant', namespace: 'servicebc-customer-flow-dev', verbose: 'true'
}
}
stage('validation') {
if (!params.quickPush) {
dir('functional-tests'){
try {
TEST_USERNAME = sh (
script: 'oc env bc/qsystem-mt --list | awk -F "=" \'/TEST_USERNAME/{print $2}\'',
returnStdout: true
).trim()
TEST_PASSWORD = sh (
script: 'oc env bc/qsystem-mt --list | awk -F "=" \'/TEST_PASSWORD/{print $2}\'',
returnStdout: true
).trim()
echo "TEST_USERNAME: ${TEST_USERNAME}"
echo "TEST_PASSWORD: ${TEST_PASSWORD}"
sh "export TEST_USERNAME=${TEST_USERNAME}\nexport TEST_PASSWORD=${TEST_PASSWORD}\n./gradlew --debug --stacktrace phantomJsTest"
} finally {
archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/**/*'
}
}
}
}
}
stage('deploy-test') {
if (!params.quickPush) {
input "Deploy to test?"
node('master'){
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: 'test-mt', srcStream: 'qsystem', srcTag: 'MT.$BUILD_ID'
}
}
}