-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
59 lines (57 loc) · 2.13 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
#!groovy
@Library('jenkinsLib') _
currentBuild.displayName = "#${env.BUILD_NUMBER}-${branch_name}"
pipeline {
agent { node { label 'build-slave' } }
environment {
channel = "#college-adaptor"
service = "college-adaptor-client"
}
stages {
stage('build') {
steps {
script {
build_action = "Build"
ceEnv.setSSMCreds("qa")
adaptor_client_secret = ceEnv.getSSMParameter("gateway-client-tester-secret")
ceEnv.unsetSSMCreds()
ceBuild.mvnBuild("mvn -Dmaven.test.failure.ignore-true -Dadaptor.clientSecret=${adaptor_client_secret} clean install")
//publish coverage report
jacoco classPattern: '**/target/classes', execPattern: '**/target/jacoco.exec'
}
}
}
stage('publish') {
steps {
script {
pom = readMavenPom file: 'pom.xml'
artifact_version = pom.version
echo "DEBUG: artifact_version: $artifact_version"
if (env.BRANCH_NAME == "master" && !(artifact_version =~ /SNAPSHOT/)) { //publish to releases repo if we're on master, and we're not using a snapshot version
ceBuild.mvnBuild("mvn -Dadaptor.clientSecret=${adaptor_client_secret} deploy")
}
}
}
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
failure {
script {
ceDeploy.slackNotify(env.channel, "danger", build_action + " failed", env.service, "N/A", "N/A", artifact_version)
}
}
success {
script {
ceDeploy.slackNotify(env.channel, "good", build_action + " success", env.service, "N/A", "N/A", artifact_version)
}
}
unstable {
script {
ceDeploy.slackNotify(env.channel, "warning", build_action + " had test failures", env.service, "N/A", "N/A", artifact_version)
}
}
}
}