forked from LandmakTechnology/maven-web-application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_declarative042023
69 lines (60 loc) · 1.68 KB
/
Jenkinsfile_declarative042023
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
pipeline{
agent {
label 'master'
}
tools {
maven 'maven3.9.1'
}
//options{}
//triggers{}
stages {
stage('1Clone'){
steps{
sh "echo 'cloning the latest application version' "
git "https://github.com/LandmakTechnology/maven-web-application"
sh "echo 'latest application version available for testing and build' "
}
}
stage('2TestBuild'){
steps{
sh "echo 'running JUnit-test-cases' "
sh "echo 'testing must passed to create artifacts ' "
sh "mvn clean package"
}
}
stage('3CodeQualityAnalysis') {
steps{
sh "echo setup sonarQube authentication"
sh "echo 'Perfoming CodeQualityAnalysis' "
sh "mvn sonar:sonar"
}
}
stage('4UploadArtifacts') {
steps{
sh "echo configure nexus authentication"
//sh "mvn deploy"
sh "echo artifacts uploaded"
}
}
stage('5deploy') {
steps{
deploy adapters: [tomcat9(credentialsId: 'tomcat-credentials', path: '', url: 'http://100.26.217.86:8080/')], contextPath: null, war: 'target/*war'
}
}
//stage('5deploy') {}
}
post{
always{
emailext body: '''Great job team.
LandmarkTech ''', recipientProviders: [buildUser(), developers()], subject: 'Build Success', to: '[email protected]'
}
success{
emailext body: '''Great job team.
LandmarkTech ''', recipientProviders: [buildUser(), developers()], subject: 'Build Success', to: '[email protected]'
}
failure{
emailext body: '''Please review this job.
LandmarkTech ''', recipientProviders: [buildUser(), developers()], subject: 'Build failed', to: '[email protected]'
}
}
}