forked from mohancggrl/My-Documantaion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsonarube-pipeline
25 lines (25 loc) · 1.05 KB
/
sonarube-pipeline
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
node{
stage("Clone Repo"){
git credentialsId: 'Project_K_Cred', url: 'https://github.com/srivardan05/maven-web-app1.git'
}
stage("Maven Clean Build"){
def mavenHome = tool name:"maven-3.6.1", type:"maven"
def mavenCMD = "${mavenHome}/bin/mvn "
sh "${mavenCMD} clean package"
}
stage("Code Review"){
withSonarQubeEnv("sonar-5.0"){
def mavenHome = tool name: "maven-3.6.1", type: "maven"
def mavenCMD = "${mavenHome}/bin/mvn "
sh "${mavenCMD} sonar:sonar"
}
}
stage("Upload Build Artifact"){
nexusArtifactUploader artifacts: [[artifactId: '01-maven-web-app', classifier: '', file: 'target/01-maven-web-app.war', type: 'war']], credentialsId: 'ProjectK2-Nexus', groupId: 'in.projectk2', nexusUrl: '3.83.145.100:8081', nexusVersion: 'nexus3', protocol: 'http', repository: 'devops-snapshot-repository', version: '2.0-SNAPSHOT'
}
stage("Deploy"){
sshagent(['ProjectK2']) {
sh "scp -o StrictHostKeyChecking=no target/01-maven-web-app.war /opt/tomcat/webapps"
}
}
}