This repository was archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
83 lines (71 loc) · 2.36 KB
/
Jenkinsfile
File metadata and controls
83 lines (71 loc) · 2.36 KB
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
80
81
82
/**
Logspace
Copyright (c) 2018 Indoqa Software Design und Beratung GmbH. All rights reserved.
This program and the accompanying materials are made available under the terms of
the Eclipse Public License Version 1.0, which accompanies this distribution and
is available at http://www.eclipse.org/legal/epl-v10.html.
**/
pipeline {
agent any
parameters {
booleanParam(name: 'DEPLOY_ARTIFACTS', defaultValue: false, description: 'Deploy artifacts to nexus')
booleanParam(name: 'RUN_SONAR', defaultValue: false, description: 'Run sonar analysis')
}
environment {
MAVEN_BUILD_PROPERTIES=''
DEPLOY_BRANCH='master'
}
triggers {
snapshotDependencies()
parameterizedCron '15 23 * * * % DEPLOY_ARTIFACTS=true;RUN_SONAR=true;CRON=true'
}
tools {
maven 'Maven 3.5.x'
nodejs '8.1.2'
jdk 'J2SDK 14 (AdoptOpenJdk)'
}
stages {
stage('Build') {
options {
timeout(time: 5, unit: 'MINUTES')
}
steps {
sh 'mvn clean install -Ptest-coverage,indoqa-release ${MAVEN_BUILD_PROPERTIES}'
}
}
stage('SonarQube analysis') {
when {
environment name: 'RUN_SONAR', value: 'true'
}
steps {
withSonarQubeEnv('sonar') {
sh 'mvn -Ptest-coverage,indoqa-release sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.password= '
}
}
}
stage('Deploy to nexus') {
when {
allOf {
branch "${DEPLOY_BRANCH}"
environment name: 'DEPLOY_ARTIFACTS', value: 'true'
}
}
steps {
sh 'mvn deploy ${DEPLOY_SETTINGS} ${MAVEN_BUILD_PROPERTIES}'
}
}
}
post {
changed {
echo "Changed to ${currentBuild.result}"
script {
if(currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
slackSend channel: '#ci_oss', color: '#008000', tokenCredentialId: 'Slack_IntegrationToken', message: "${env.JOB_NAME} has recovered at ${env.BUILD_NUMBER} status: ${currentBuild.currentResult} (<${env.BUILD_URL}|Open>)"
}
if(currentBuild.resultIsWorseOrEqualTo('UNSTABLE')) {
slackSend channel: '#ci_oss', color: '#800000', tokenCredentialId: 'Slack_IntegrationToken', message: "${env.JOB_NAME} has failed at ${env.BUILD_NUMBER} status: ${currentBuild.currentResult} (<${env.BUILD_URL}|Open>)"
}
}
}
}
}