diff --git a/Jenkinsfile_Shirisha b/Jenkinsfile_Shirisha new file mode 100644 index 00000000..780c892f --- /dev/null +++ b/Jenkinsfile_Shirisha @@ -0,0 +1,41 @@ +node('nodes') +{ +echo 'Jenkins Node Name:-' +echo "${env.NODE_NAME}" + +properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '', numToKeepStr: '2'))]) + +def MAVEN_HOME = tool name: "Maven - 3.9.1" + +stage('get code from github') +{ +git branch: 'dev', credentialsId: '47285e52-f8e7-47a4-9570-d36eef4acbee', url: 'https://github.com/ShirishaMitti/maven-web-application.git' +} + +//${Environment_name} is choice parameter & ${Executed_by} is string parameter. +//echo "Gihub branch name is ${Environment_name}. Executing Build with parameters by Shirisha." +//echo ${Executed_by} + +stage('Build') +{ +sh "${MAVEN_HOME}/bin/mvn clean package" +} + +stage('Deploying war to Tomcat server') +{ +deploy adapters: [tomcat9(credentialsId: '68d86d50-002c-4342-827e-e473bd0a94c7', path: '', url: 'http://54.167.112.121:1332/')], contextPath: '/mavenSpringWeb_app', war: '**/maven-web-application.war' +} + +stage('Send Email to user after application deployment') +{ +emailext body: '''Hi Shirisha, + +Congrats. Build $BUILD_NUMBER is $BUILD_STATUS. Please check below for more details. + +$BUILD_URL + +Thanks, +Jenkins''', subject: '$PROJECT_NAME ---> Build $BUILD_NUMBER is $BUILD_STATUS', to: 'shirisha.mitti32@gmail.com,raghamitti2@gmail.com' +} + +}