-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjenkinsfile
More file actions
98 lines (91 loc) · 2.89 KB
/
jenkinsfile
File metadata and controls
98 lines (91 loc) · 2.89 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
pipeline{
agent any;
tools{
maven 'maven'
jdk 'JDK11'
}
stages {
stage('Maven-Clean'){
steps{
sh 'mvn clean'
}
}
stage('Maven-Compile'){
steps{
sh 'mvn compile'
}
}
stage('Maven-Test'){
steps{
sh 'mvn test'
}
}
stage('Maven-Package'){
steps{
sh 'mvn package'
}
}
stage("build & SonarQube analysis") {
steps {
withSonarQubeEnv('sonar-server-local') {
sh 'mvn sonar:sonar'
}
}
}
// stage("Quality Gate") {
// steps {
// sleep(60)
// timeout(time: 1, unit: 'HOURS') {
// script{
// def qg = waitForQualityGate()
// if (qg.status != 'OK')
// {
// error "Pipeline aborted due to gate failure : ${qg.status}"
// waitForQualityGate abortPipeline: true
// }
// }
// }
// }
// }
}
post{
success{
rtUpload (
serverId: 'ARTIFACTORY-SERVER',
spec: '''{
"files": [
{
"pattern": "target/*.jar",
"target": "art-doc-dev-loc/mindsapp/"
}
]
}''',
)
rtDownload (
serverId: "ARTIFACTORY-SERVER",
spec:"""{
"files": [
{
"pattern": "art-doc-dev-loc/mindsapp/**",
"target": "artifacts/"
}
]
}"""
)
sshagent(['20c7b532-4b27-48e5-8d94-efc415f57aca']){
sh 'scp -r /var/jenkins_home/workspace/mindsapp-spring/artifacts/mindsapp/*.jar ubuntu@3.135.63.62:/home/ubuntu/artifacts/'
}
withAWS(region:'us-east-2',credentials:'70be04d1-2159-4bd2-bf81-ad29e92c201e') {
s3Upload(file:'artifacts/mindsapp/', bucket:'jenkinssujjadbucket', path:'artifacts/')
}
mail to: 'efskwgkkwhae@inilogic.com', from: 'commonteesta@gmail.com',
subject: "Example Build: ${env.JOB_NAME} - success",
body: "Job success - \"${env.JOB_NAME}\" build: ${env.BUILD_NUMBER}\n\nView the log at:\n ${env.BUILD_URL}"
}
failure {
mail to: 'efskwgkkwhae@inilogic.com', from: 'commonteesta@gmail.com',
subject: "Example Build: ${env.JOB_NAME} - failed",
body: "Job failed - \"${env.JOB_NAME}\" build: ${env.BUILD_NUMBER}\n\nView the log at:\n ${env.BUILD_URL}"
}
}
}