forked from Devops-organization-mohan/maven-web-application
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
64 lines (52 loc) · 1.79 KB
/
Jenkinsfile
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
pipeline{
agent any
tools{
maven '3.8.4'
}
triggers{
pollSCM('* * * * *')
}
options{
timestamps()
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5'))
}
stages{
stage('CheckOutCode'){
steps{
git credentialsId: 'Github-naga-user', url: 'https://github.com/MittaNagaraju/maven-web-application.git'
}
}
stage('Build'){
steps{
sh "mvn clean package"
}
}
stage('ExecuteSonarQubeReport'){
steps{
withSonarQubeEnv('sonarqube-8.9.10') {
sh "mvn sonar:sonar"
}
}
}
stage('UploadArtifactsIntoNexus'){
steps{
/*nexusPublisher nexusInstanceId: 'nexus3', nexusRepositoryId: 'sample', packages: [[$class: 'MavenPackage', mavenAssetList: [[classifier: '', extension: '', filePath: '/home/jenkins/jenkins-workspace/workspace/JavaMavenProj/target/maven-web-application.war']], mavenCoordinate: [artifactId: 'JavaMavenProj', groupId: 'org.jenkins-ci.main', packaging: 'war', version: '1.0.1']]]*/
nexusPublisher nexusInstanceId: 'nexus3', nexusRepositoryId: 'sample', packages: [[$class: 'MavenPackage', mavenAssetList: [[classifier: '', extension: '', filePath: '/home/jenkins/jenkins-workspace/workspace/JavaMavenProj/target/maven-web-application.war']], mavenCoordinate: [artifactId: 'Maven_project', groupId: 'com.jenkins-ci.main', packaging: 'war', version: '1.0.1']]]
}
}
/*
stage('DeployAppIntoTomcat'){
steps{
sshagent(['bfe1b3c1-c29b-4a4d-b97a-c068b7748cd0']) {
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@35.154.190.162:/opt/apache-tomcat-9.0.50/webapps/"
}
}
}
*/
}//Stages Closing
post{
always{
emailext body: 'check the build status ', subject: 'pipeline status ', to: ''
}
}
}//Pipeline closing