forked from javahometech/my-app
-
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
3cab242
commit d2c4eae
Showing
1 changed file
with
15 additions
and
45 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 |
---|---|---|
@@ -1,52 +1,22 @@ | ||
|
||
node { | ||
// This is to demo github action | ||
def sonarUrl = 'sonar.host.url=http://172.31.30.136:9000' | ||
def mvn = tool (name: 'maven3', type: 'maven') + '/bin/mvn' | ||
// def sonarUrl = 'sonar.host.url=http://172.31.30.136:9000' | ||
//def mvn = tool (name: 'maven3', type: 'maven') + '/bin/mvn' | ||
stage('SCM Checkout'){ | ||
// Clone repo | ||
git branch: 'master', | ||
credentialsId: 'github', | ||
url: 'https://github.com/javahometech/myweb' | ||
|
||
} | ||
|
||
stage('Sonar Publish'){ | ||
withCredentials([string(credentialsId: 'sonarqube', variable: 'sonarToken')]) { | ||
def sonarToken = "sonar.login=${sonarToken}" | ||
sh "${mvn} sonar:sonar -D${sonarUrl} -D${sonarToken}" | ||
} | ||
|
||
git 'https://github.com/Naganagaraj/my-app' | ||
} | ||
|
||
|
||
stage('Mvn Package'){ | ||
// Build using maven | ||
|
||
sh "${mvn} clean package deploy" | ||
} | ||
|
||
stage('deploy-dev'){ | ||
def tomcatDevIp = '172.31.28.172' | ||
def tomcatHome = '/opt/tomcat8/' | ||
def webApps = tomcatHome+'webapps/' | ||
def tomcatStart = "${tomcatHome}bin/startup.sh" | ||
def tomcatStop = "${tomcatHome}bin/shutdown.sh" | ||
|
||
sshagent (credentials: ['tomcat-dev']) { | ||
sh "scp -o StrictHostKeyChecking=no target/myweb*.war ec2-user@${tomcatDevIp}:${webApps}myweb.war" | ||
sh "ssh ec2-user@${tomcatDevIp} ${tomcatStop}" | ||
sh "ssh ec2-user@${tomcatDevIp} ${tomcatStart}" | ||
} | ||
} | ||
stage('Email Notification'){ | ||
mail bcc: '', body: """Hi Team, You build successfully deployed | ||
Job URL : ${env.JOB_URL} | ||
Job Name: ${env.JOB_NAME} | ||
Thanks, | ||
DevOps Team""", cc: '', from: '', replyTo: '', subject: "${env.JOB_NAME} Success", to: '[email protected]' | ||
|
||
} | ||
stage('com,pile-Package'){ | ||
sh 'svn package' | ||
} | ||
|
||
} | ||
|
||
// Clone repo | ||
// git branch: 'master', | ||
// credentialsId: 'github', | ||
// url: 'https://github.com/Naganagaraj/my-app' | ||
// | ||
//} | ||
|
||
|