Skip to content

Commit

Permalink
Create jenkins-pipeline-9am-sep-2018
Browse files Browse the repository at this point in the history
  • Loading branch information
javahometech authored Sep 7, 2018
1 parent db609fa commit 6d093a1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions jenkins-pipeline-9am-sep-2018
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
try{
node{
stage('Git Checkout'){
git credentialsId: 'github',
url: 'https://github.com/javahometech/my-app',
branch: "${params.gitBranch}"
}

stage('Maven Build'){
sh 'mvn clean package'
}
stage('Deploy to Dev'){
sh 'mv target/*.war target/myweb.war'
sshagent(['tomcat-dev']) {
sh 'ssh [email protected] rm -rf /opt/tomcat8/webapps/myweb*'
sh 'scp target/myweb.war [email protected]:/opt/tomcat8/webapps/'
sh 'ssh [email protected] sudo service tomcat restart'
}
slackSend channel: '#devops-2',
color: 'good',
message: "Job - ${env.JOB_NAME}, Completed successfully Build URL is ${env.BUILD_URL}"


}
}

}catch(error){
slackSend channel: '#devops-2',
color: 'danger',
message: "Job - ${env.JOB_NAME}, Failed, Build URL is ${env.BUILD_URL}"
error 'Something wrong'
}

0 comments on commit 6d093a1

Please sign in to comment.