forked from MaheshBangaru/maven-web-application
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5591d35
commit ac07462
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!groovy | ||
|
||
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '2'))]) | ||
|
||
|
||
node { | ||
|
||
cleanWs notFailBuild: true | ||
|
||
|
||
stage('Checkout the Code'){ | ||
git branch: 'development', credentialsId: 'dc9bee7b-a6ef-4ffd-a07b-7c97617a378a', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' | ||
} | ||
|
||
stage('Build'){ | ||
|
||
if(isUnix()){ | ||
sh 'mvn clean package' | ||
}else{ | ||
bat 'mvn clean package' | ||
} | ||
} | ||
stage('SonarQubeReport'){ | ||
|
||
if(isUnix()){ | ||
sh 'mvn sonar:sonar' | ||
}else{ | ||
bat 'mvn sonar:sonar' | ||
} | ||
} | ||
|
||
stage('Upload Artifacts into Nexus'){ | ||
|
||
if(isUnix()){ | ||
sh 'mvn deploy' | ||
}else{ | ||
bat 'mvn deploy' | ||
} | ||
} | ||
|
||
|
||
|
||
stage('Deploy the App into Tomcat Server') | ||
{ | ||
|
||
sh 'echo Deploy the app into tomcat server' | ||
sh 'cp $WORKSPACE/target/maven-web-application.war /Users/bhaskarreddyl/BhaskarReddyL/Softwares/Running/apache-tomcat-9.0.14/mithunapps/' | ||
sh 'echo app deployed successfully' | ||
} | ||
stage('Send Email Notification'){ | ||
|
||
mail bcc: '[email protected]', body: '''Build is done!! | ||
Regards, | ||
Mithun Technologies | ||
Martaha Halli | ||
Bangalore | ||
9980923226 | ||
''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build Done', to: '[email protected]' | ||
} | ||
|
||
|
||
stage ('Send Slack Notification') | ||
{ | ||
slackSend baseUrl: 'https://devops-team-bangalore.slack.com/services/hooks/jenkins-ci/', channel: 'build-notification', message: '"Build Done"', tokenCredentialId: '193d10e7-9280-4629-84e8-5ec4a30b87b5' } | ||
|
||
|
||
} | ||
|
||
|
||
|