forked from Cloud-Gen-DevOps-Projects/Rigstration-Form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile1
78 lines (75 loc) · 1.47 KB
/
Jenkinsfile1
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
pipeline
{
agent any
tools
{
maven "maven"
}
stages{
stage('Code Checkout'){
steps{
git branch: 'main', url: 'https://github.com/Devops9AM/Rigstration-Form.git'
}
}
stage('Cleaning The Old Artifact'){
steps{
sh 'mvn clean'
}
}
stage('Installing Plugins'){
steps{
sh 'mvn install'
}
}
stage('Code Validtating'){
steps{
sh 'mvn validate'
}
}
stage('Code Test'){
steps{
sh 'mvn test'
}
}
stage('Code Compiling'){
steps{
sh 'mvn compile'
}
}
stage("SonarQube Code analysis") {
steps {
withSonarQubeEnv('SonarQube') {
sh 'mvn sonar:sonar'
}
}
}
stage('Artifacting the Packge'){
steps{
sh 'mvn package'
}
}
stage('War Deploy into Nexus'){
steps{
sh 'mvn deploy'
}
}
stage('Ownership') {
steps {
sh "chmod +x -R ${env.WORKSPACE}"
}
}
stage('Deploy War into Tomcat'){
steps{
sshagent(['Tomcat-Web-Server']) {
sh 'scp /root/.jenkins/workspace/Registration-Form-1/webapp/target/*.war root@192.168.10.165:/opt/tomcat/webapps'
}
}
}
stage('mailing the status on this job'){
steps{
mail bcc: '', body: '''Hi We are from Project Build Team. Pls have a look on this project output.
''', cc: '', from: '', replyTo: '', subject: 'Jenkins Pipeline Job Execution', to: 'cloudgen0323@gmail.com'
}
}
}
}