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
63 lines (54 loc) · 2.21 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
53
54
55
56
57
58
59
60
61
62
63
node('maven') {
parameters {
booleanParam(defaultValue: true, description: '', name: 'quickPush')
}
stage('checkout') {
echo "checking out source"
checkout scm
echo "Build: ${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', showBuildLogs: 'true'
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: '$BUILD_ID', srcStream: 'qsystem', srcTag: 'latest'
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: 'dev', srcStream: 'qsystem', srcTag: 'latest'
}
stage('verify') {
if (!params.quickPush) {
openshiftVerifyDeployment depCfg: 'qsystem', namespace: 'servicebc-customer-flow-dev', verbose: 'true'
}
}
}
stage('deploy-test') {
if (!params.quickPush) {
input "Deploy to test?"
node('master'){
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: 'test', srcStream: 'qsystem', srcTag: '$BUILD_ID'
}
}
}
stage('deploy-prod') {
if (!params.quickPush) {
input "Deploy to prod?"
node('master'){
openshiftTag destStream: 'qsystem', verbose: 'true', destTag: 'prod', srcStream: 'qsystem', srcTag: '$BUILD_ID'
}
}
}