diff --git a/JenkinsfileMT b/JenkinsfileMT new file mode 100644 index 0000000..fe18bac --- /dev/null +++ b/JenkinsfileMT @@ -0,0 +1,61 @@ +node +{ + properties([ + buildDiscarder(logRotator(numToKeepStr: '3')), + pipelineTriggers([ + pollSCM('* * * * *') + ]) + ]) + + echo "GitHub BranhName ${env.BRANCH_NAME}" + echo "Jenkins Job Number ${env.BUILD_NUMBER}" + echo "Jenkins Node Name ${env.NODE_NAME}" + + echo "Jenkins Home ${env.JENKINS_HOME}" + echo "Jenkins URL ${env.JENKINS_URL}" + echo "JOB Name ${env.JOB_NAME}" + + def mvnHome=tool name: "maven3.6.3" + stage('CheckoutCode') + { + git branch: 'development', credentialsId: '235e277e-7cf7-495e-b970-a22c2478d48c', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' + } + + + stage('Build') + { + sh "${mvnHome}/bin/mvn clean package" + } + + /* + stage('SonarQubeReport') + { + sh "${mvnHome}/bin/mvn sonar:sonar" + } + + stage('UploadArtifactintoNexus') + { + sh "${mvnHome}/bin/mvn deploy" + } + + stage('DeployToTomcat') + { + sshagent(['bac46180-c907-4a95-b8a9-417aff7d4f5c']) + { + sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@13.233.253.59:/opt/apache-tomcat-9.0.30/webapps/maven-web-application.war" + } + } + + stage('SendEmailNotification') + { + emailext body: '''Build is over, + Please check the logs, + + Regards, + Mithun Technologies, + 9980923226.''', subject: 'Build is Over', to: 'devopstrainingblr@gmail.com,mahichowdary522@gmail.com' + + } + */ + +}