Skip to content

Commit 03a93ef

Browse files
Create Jenkinsfile
1 parent fb83ce3 commit 03a93ef

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

Jenkinsfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
node('master')
2+
{
3+
4+
//http://localhost:8080/pipeline-syntax/globals#currentBuild
5+
//Getting the env global varibale values
6+
7+
echo "GitHub BranhName ${env.BRANCH_NAME}"
8+
echo "Jenkins Job Number ${env.BUILD_NUMBER}"
9+
echo "Jenkins Node Name ${env.NODE_NAME}"
10+
11+
echo "Jenkins Home ${env.JENKINS_HOME}"
12+
echo "Jenkins URL ${env.JENKINS_URL}"
13+
echo "JOB Name ${env.JOB_NAME}"
14+
15+
def MavenHome = tool name: 'Maven3.6.1', type:'maven'
16+
17+
properties([
18+
buildDiscarder(logRotator(numToKeepStr: '3')),
19+
pipelineTriggers([
20+
pollSCM('* * * * *')
21+
])
22+
])
23+
24+
25+
stage('CheckoutCode'){
26+
git branch: 'development', credentialsId: '2587140f-2970-4f0e-aac3-62624e3d9682', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git'
27+
}
28+
29+
/*
30+
stage('Build')
31+
{
32+
sh "${MavenHome}/bin/mvn clean package"
33+
}
34+
35+
stage('ExecuteSonarQubeReport'){
36+
sh "${MavenHome}/bin/mvn sonar:sonar"
37+
}
38+
39+
stage('UploadArtifact'){
40+
sh "${MavenHome}/bin/mvn deploy"
41+
}
42+
43+
stage('DeployApplication'){
44+
45+
sshagent(['e5a7a729-2e31-4d89-9b43-b3154cf128de']) {
46+
sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war [email protected]:/opt/apache-tomcat-9.0.22/webapps/maven-web-application.war"
47+
}
48+
}
49+
*/
50+
stage('EmailNotification'){
51+
emailext body: '''Build is over
52+
Please check the logs...
53+
54+
Regards,
55+
Mithun Software Solutions,
56+
Bangalore.
57+
''', subject: 'Build done', to: '[email protected]'
58+
59+
}
60+
61+
}

0 commit comments

Comments
 (0)