forked from BetterCloud/scim2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
73 lines (71 loc) · 2.02 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
64
65
66
67
68
69
70
71
72
73
pipeline {
agent any
environment {
NEXUS_URL = 'https://nexus.onedatascan.io/nexus/content/repositories/thirdparty/'
NEXUS_CREDS = credentials('jenkins-maven')
}
parameters{
string(defaultValue: '#product_dev', description: 'The space delimited list of channels to publish slack notifications.', name: 'SLACK_CHANNELS')
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('setup') {
steps {
script {
currentBuild.displayName = "bettercloud-scim2-library"
currentBuild.description = "Pipeline Build of bettercloud-scim2-library"
publishAllTheSlacks("STARTED - ${currentBuild.description}", params.SLACK_CHANNELS)
}
}
}
stage('gradle') {
agent {
docker {
image 'gradle:8.10.2-jdk21'
reuseNode true
}
}
stages {
stage('build') {
steps {
sh "gradle clean build -x test"
}
}
stage('deploy') {
steps {
sh "gradle publish"
}
}
}
}
}
post {
always {
script {
deleteDir()
}
}
success {
script {
publishAllTheSlacks("SUCCESS - ${currentBuild.description}", params.SLACK_CHANNELS)
}
}
failure {
script {
currentBuild.result = "FAILED"
publishAllTheSlacks("FAILED: Job '${env.JOB_NAME} Build ${env.BUILD_NUMBER}'", params.SLACK_CHANNELS)
}
}
}
}
@NonCPS
def publishAllTheSlacks(msg, channels) {
slackSend (
channel: channels,
message: msg,
teamDomain: 'onedatascan'
)
}