forked from sanchitraj5/maven-web-application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinspipeline
38 lines (24 loc) · 1.02 KB
/
Jenkinspipeline
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
node{
def mavenHome = tool name: "maven3.8.6"
echo "Jenkins url is: ${env.JENKINS_URL}"
echo "Node Name is: ${env.NODE_NAME}"
echo "Job name is: ${env.JOB_NAME}"
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])])
stage('CheckOutCode'){
git branch: 'development', credentialsId: '166c70a2-1df5-4993-a566-0a795862da8c', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git'
}
stage('Build'){
sh "${mavenHome}/bin/mvn clean package"
}
stage('ExecuteSonarQubeReport'){
sh "${mavenHome}/bin/mvn clean sonar:sonar"
}
stage('UploadArtifcatsIntoArtifactoryRepo'){
sh "${mavenHome}/bin/mvn clean deploy"
}
stage('DeployAppIntoTomcatServer'){
sshagent(['dc292b7a-3b39-4630-9fc3-1b806b54412c']) {
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.7.80:/opt/apache-tomcat-9.0.65/webapps/"
}
}
}