diff --git a/Dockerfile b/Dockerfile index d2eb418feb..473c23c760 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ -FROM tomcat:8.0.21-jre8 +FROM tomcat:9.0-jdk11 COPY target/maven-web-application.war /usr/local/tomcat/webapps/maven-web-application.war \ No newline at end of file diff --git a/JenkinsFileDocker b/JenkinsFileDocker new file mode 100644 index 0000000000..4240c770a0 --- /dev/null +++ b/JenkinsFileDocker @@ -0,0 +1,68 @@ +pipeline +{ + agent any + + tools + { + maven 'Maven_3.9.7' + } + + environment + { + buildNumber = "${BUILD_NUMBER}" + } + + stages + { + stage('Checkout code to Jenkins from GitHub') + { + steps() + { + git branch: 'master', url: 'https://github.com/itspranavdubey/maven-web-application.git' + } + } + stage('Build Artifact Using Maven') + { + steps() + { + sh 'mvn clean package' + } + } + stage("Build Docker Image") + { + steps() + { + sh 'docker build -t itspranavdubey/logindockerjenkins:${buildNumber} .' + } + } + stage("Authenticate and Push Docker Image To Docker Hub") + { + steps() + { + withCredentials([string(credentialsId: 'Dockerhubpassword', variable: 'Dockerhubpassword')]) + { + sh 'docker login -u itspranavdubey -p ${Dockerhubpassword}' + } + sh 'docker push itspranavdubey/logindockerjenkins:${buildNumber}' + } + } + stage('Remove Docker Images From Jenkins Locally') + { + steps() + { + sh 'docker rmi -f itspranavdubey/logindockerjenkins:${buildNumber}' + } + } + stage('Deploy App to Deployement Server') + { + steps() + { + sshagent(['DeploymentServer_SSH']) + { + sh "ssh -o StrictHostKeyChecking=no ubuntu@13.233.206.123 docker rm -f mavenwebapplication || true" + sh "ssh -o StrictHostKeyChecking=no ubuntu@13.233.206.123 docker run -d --name mavenwebapplication -p 8080:8080 itspranavdubey/logindockerjenkins:$Build_Number" + } + } + } + } +} \ No newline at end of file diff --git a/Jenkinsfile1 b/Jenkinsfile similarity index 100% rename from Jenkinsfile1 rename to Jenkinsfile diff --git a/Jenkinsfile7AMNovBatch2022 b/Jenkinsfile7AMNovBatch2022 deleted file mode 100644 index e40817d597..0000000000 --- a/Jenkinsfile7AMNovBatch2022 +++ /dev/null @@ -1,49 +0,0 @@ -node{ - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - -echo "The Job name is: ${env.JOB_NAME}" -echo "The Nod ename is: ${env.NODE_NAME}" -echo "The Build Number is: ${env.BUILD_NUMBER}" -echo "The Jenkins Home directory is: ${JENKINS_HOME}" - -def mavenHome = tool name: "maven3.8.6" - -try{ -sendSlackNotifications("STARTED") - -stage('CheckoutCode'){ -git branch: 'development', credentialsId: 'd3b6896a-ebbd-4396-8b5c-850f74d96a39', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} -/* -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn sonar:sonar" -} - -stage('UploadArtifactsIntoNexus'){ -sh "${mavenHome}/bin/mvn deploy" -} - -stage('DeployAppIntoTomcatServer'){ -sshagent(['48c992f5-c73e-40ba-b71b-9191b6f93285']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.10.36:/usr/local/apache-tomcat-9.0.70/webapps/" -} -} - -*/ -}//try closing -catch(e){ -currentBuild.result = "FAILURE" -} -finally{ -sendSlackNotifications(currentBuild.result) -} - -} - - - diff --git a/JenkinsfileApril6AMBatch b/JenkinsfileApril6AMBatch deleted file mode 100644 index 2a0e892ecd..0000000000 --- a/JenkinsfileApril6AMBatch +++ /dev/null @@ -1,36 +0,0 @@ -node{ - -def mavenHome = tool name: 'maven3.9.2' - -echo "Job name is: $JOB_NAME" -echo "Node name is: $NODE_NAME" -echo "Jenkins Home url is: $JENKINS_HOME" - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - -stage('CheckOutCode'){ -git branch: 'development', credentialsId: '7234a3b2-097a-4e4b-a14d-a9e98131fa2b', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} - -/* -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn clean sonar:sonar" -} - -stage('UploadArtifactsIntoNexus'){ -sh "${mavenHome}/bin/mvn clean deploy" -} - -stage('DeployAppIntoTomcatServer'){ -sshagent(['2d6c465d-3f2c-4356-83b4-6c4928ec54c6']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.26.193:/opt/apache-tomcat-9.0.75/webapps/" -} -} -*/ - - -} diff --git a/JenkinsfileAugBacth2022 b/JenkinsfileAugBacth2022 deleted file mode 100644 index 705a8bca1e..0000000000 --- a/JenkinsfileAugBacth2022 +++ /dev/null @@ -1,84 +0,0 @@ -@Library('sharedlibsmss') _ -node{ - -try{ - - sendSlackNotifications('STARTED') - def mavenHome = tool name: 'maven3.8.6' - - echo "The JobName is: ${env.JOB_NAME}" - echo "The node name is: ${env.NODE_NAME}" - echo "The build number is: ${env.BUILD_NUMBER}" - - properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - - - stage('CheckOutCode'){ - git branch: 'development', credentialsId: '1ed3c65b-4e6a-46ae-9e15-56aab257dac5', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' - } - - stage('Build'){ - sh "${mavenHome}/bin/mvn package" - } - - /* - stage('ExecuteSoanrQubeReport') - { - sh "${mavenHome}/bin/mvn clean sonar:sonar" - } - - stage('UploadArtifactsIntoNexus') - { - sh "${mavenHome}/bin/mvn clean deploy" - } - - stage('DeployAppIntoTomcatServer'){ - sshagent(['ed3c425a-5ed2-4384-99c1-12cc22911ec4']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.42.12:/opt/apache-tomcat-9.0.67/webapps/" - } - } - */ - }//try closing - catch(e){ - currentBuild.result="FAILURE" - throw e - }//catch closing - finally{ - sendSlackNotifications(currentBuild.result) - } -} //Node closing - -/* -//Code Snippet for sending slack notifications. - -def slackNotifications(String buildStatus = 'STARTED') { - // build status of null means successful - buildStatus = buildStatus ?: 'SUCCESS' - //buildStatus = buildStatus ? "SUCCESS":"FAILURE" - - // Default values - def colorName = 'RED' - def colorCode = '#FF0000' - def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" - def summary = "${subject} (${env.BUILD_URL})" - - // Override default values based on build status - if (buildStatus == 'STARTED') { - colorName = 'ORANGE' - colorCode = '#FFA500' - } else if (buildStatus == 'SUCCESS') { - colorName = 'GREEN' - colorCode = '#00FF00' - } else { - colorName = 'RED' - colorCode = '#FF0000' - } - - // Send notifications - slackSend (color: colorCode, message: summary, channel: "#walmart") -} - -*/ - - - diff --git a/JenkinsfileFeb7.30Batch b/JenkinsfileFeb7.30Batch deleted file mode 100644 index 8267a351ac..0000000000 --- a/JenkinsfileFeb7.30Batch +++ /dev/null @@ -1,35 +0,0 @@ -node{ - - echo "The Job name is: ${JOB_NAME}" -echo "The buils number is: ${BUILD_NUMBER}" -echo "The node name is : ${NODE_NAME}" - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - -def mavenHome = tool name: 'maven3.8.8' - -stage('CheckoutCode'){ -git branch: 'development', credentialsId: '4768a632-7cb1-4a54-96e5-816d16a40c7f', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} - -/* -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn clean sonar:sonar" -} - -stage('UploadArtifactsIntoNexus'){ -sh "${mavenHome}/bin/mvn clean deploy" -} - -stage('DeployAppintoTomcat'){ -sshagent(['a2296f55-cf3b-4b3f-a5b5-17b11d8b83f2']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.44.186:/opt/apache-tomcat-9.0.73/webapps/" -} -} -*/ - -} diff --git a/JenkinsfileJan2024 b/JenkinsfileJan2024 deleted file mode 100644 index cc8d7324d4..0000000000 --- a/JenkinsfileJan2024 +++ /dev/null @@ -1,87 +0,0 @@ -pipeline{ - -agent any - -tools{ -maven 'maven3.9.6' -} - -//Checkout code -stages{ - stage('CheckOuteCode'){ - steps{ - sendSlackNotifications("STARTED") - git branch: 'development', credentialsId: 'f4d44680-6f7c-4889-b836-5ce7015057f8', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' - } - } - //Build - stage('Build'){ - steps{ - sh "mvn clean package" - } - } - /* - //Execute SonarQube Report - stage('ExecuteSonarQubeReport'){ - steps{ - sh "mvn clean sonar:sonar" - } - } - - // Upload Artifcats into Nexus - stage('UploadArtifcatsIntoNexus'){ - steps{ - sh "mvn clean deploy" - } - } - -//Deploy App into Tomcat Server -stage('DeployAppIntoTomcat'){ - steps{ - sshagent(['ea56a0ef-94e7-43c1-99e3-d7e0947043a3']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.1.56:/opt/apache-tomcat-9.0.86/webapps/" -} -} - } -*/ -}//stages closing - -post { - success { - sendSlackNotifications(currentBuild.result) - } - failure { - sendSlackNotifications(currentBuild.result) - } -} -}//pipeline closing - - -def sendSlackNotifications(String buildStatus = 'STARTED') { - // build status of null means successful - buildStatus = buildStatus ?: 'SUCCESS' - - // Default values - def colorName = 'RED' - def colorCode = '#FF0000' - def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" - def summary = "${subject} (${env.BUILD_URL})" - - // Override default values based on build status - if (buildStatus == 'STARTED') { - colorName = 'YELLOW' - colorCode = '#FFFF00' - } else if (buildStatus == 'SUCCESS') { - colorName = 'GREEN' - colorCode = '#00FF00' - } else { - colorName = 'RED' - colorCode = '#FF0000' - } - - // Send notifications - slackSend (color: colorCode, message: summary, channel: "citibank-project") -} - - - diff --git a/JenkinsfileJune2023 b/JenkinsfileJune2023 deleted file mode 100644 index b8c25771aa..0000000000 --- a/JenkinsfileJune2023 +++ /dev/null @@ -1,37 +0,0 @@ -node{ - - -echo "Jenkins Home dir is: ${env.JENKINS_HOME}" -echo "Job name is: ${env.JOB_NAME}" -echo "Build number is: ${env.BUILD_NUMBER}" - -//properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - - -def mavenHome=tool name: 'maven3.9.3' - -stage('CheckOutCode'){ -git branch: 'development', credentialsId: 'c4900e7a-ccd3-4a5a-8604-b81f52bdc0f2', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} -/* -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn clean sonar:sonar" -} - -stage('UploadArtifactsInotNexus'){ -sh "${mavenHome}/bin/mvn clean deploy" -} - - -stage('DeploAppIntoTomcatServer'){ -sshagent(['331ae6af-906c-4d4f-8317-0379a46b437e']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.2.79:/opt/apache-tomcat-9.0.76/webapps/" -} -} -*/ - -} diff --git a/JenkinsfileMarch2023 b/JenkinsfileMarch2023 deleted file mode 100644 index 926390284e..0000000000 --- a/JenkinsfileMarch2023 +++ /dev/null @@ -1,39 +0,0 @@ -node{ - - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - -def mavenHome = tool name: 'maven3.9.1' - -echo "The Job name is: ${JOB_NAME} " -echo "The Node name is: ${NODE_NAME}" -echo "The Build Number is: ${BUILD_NUMBER}" -echo "Jenkins Home path is: ${JENKINS_HOME}" - - -stage('CheckoutCode'){ -git branch: 'development', credentialsId: 'aaa8e2c0-226a-40ba-85eb-259762d67c15', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build') -{ -sh "${mavenHome}/bin/mvn clean package" -} - - /* -stage('SonarQubeReport'){ -sh "${mavenHome}/bin/mvn clean sonar:sonar" -} - -stage('UploadArtifactsIntoNexus'){ -sh "${mavenHome}/bin/mvn clean deploy" -} - -stage('DeployAppIntoTomcat'){ -sshagent(['dd085870-ab36-4a86-9f5b-a915e179d45d']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.40.86:/opt/apache-tomcat-9.0.73/webapps/" -} -} -*/ - -}//node closing diff --git a/JenkinsfileMarchdp b/JenkinsfileMarchdp deleted file mode 100644 index 0918280faa..0000000000 --- a/JenkinsfileMarchdp +++ /dev/null @@ -1,103 +0,0 @@ -pipeline{ - -agent any - -parameters { - choice choices: ['master', 'development', 'stage', 'uat'], description: 'Select the Branch Name', name: 'BranchName' - string defaultValue: 'Mithun Software Solutions', name: 'PersonName' -} - - -tools{ -maven 'maven3.9.1' -} - -options { - buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5') - timestamps() -} - - -triggers { - pollSCM('* * * * * ') -} - - -stages{ - stage('CheckoutCode'){ - steps{ - sendSlackNotifications('STARTED') - git branch: "${params.BranchName}", credentialsId: 'aaa8e2c0-226a-40ba-85eb-259762d67c15', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' - } - } - -stage('Build'){ -steps{ -sh "mvn clean package" -} -} -/* -//Execute SonarQube Report -stage('ExecuteSonarQubeReport'){ -steps{ -sh "mvn clean sonar:sonar" -} -} - -//UploadArtifactsIntoNexus -stage('ArtifactsIntoNexus'){ -steps{ -sh "mvn clean deploy" -} -} - -//DeployApplication into TOmcat Server -stage('DeploApp'){ -steps{ -sshagent(['dd085870-ab36-4a86-9f5b-a915e179d45d']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.40.86:/opt/apache-tomcat-9.0.73/webapps/" -} -} -} -*/ - -}//stages closing -post { - success { - sendSlackNotifications(currentBuild.result) - } - failure { - sendSlackNotifications(currentBuild.result) - } -} - -}//pipeline closing - -//Function for slack notifications -def sendSlackNotifications(String buildStatus = 'STARTED') { - // build status of null means successful - buildStatus = buildStatus ?: 'SUCCESS' - - // Default values - def colorName = 'RED' - def colorCode = '#FF0000' - def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" - def summary = "${subject} (${env.BUILD_URL})" - - // Override default values based on build status - if (buildStatus == 'STARTED') { - color = 'YELLOW' - colorCode = '#FFFF00' - } else if (buildStatus == 'SUCCESS') { - colorName = 'GREEN' - colorCode = '#00FF00' - } else { - colorName = 'RED' - colorCode = '#FF0000' - } - - // Send notifications - slackSend (color: colorCode, message: summary, channel: '#citibank') -} - - diff --git a/JenkinsfileOctBatch2022 b/JenkinsfileOctBatch2022 deleted file mode 100644 index f48a667761..0000000000 --- a/JenkinsfileOctBatch2022 +++ /dev/null @@ -1,84 +0,0 @@ -node{ - -try{ - - def mavenHome = tool name: 'maven3.8.5' - - echo "The Job name is: ${env.JOB_NAME}" - echo "The Build numebr is: ${env.BUILD_NUMBER}" - echo "The node name is: ${env.NODE_NAME}" - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - - -//Checkout Code State -stage('CheckoutCode'){ -sendSlackNotifications("STARTED") -git branch: 'development', credentialsId: '7c0bd52e-8700-404b-a704-444a4f556b2f', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -//Build -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} - - /* -//Execute SonarQube Report -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn sonar:sonar" -} - -//UploadArtifcats Into Nexus -stage('UploadArtifcatsIntoNexus'){ -sh "${mavenHome}/bin/mvn deploy" -} - -//Deploy App into Tomcat Server -stage('DeployApp'){ -sshagent(['e83477fc-0cee-45ee-a412-92e2240a7256']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.40.1:/opt/apache-tomcat-9.0.68/webapps/" -} -} -*/ - -}//try closing -catch(e){ -currentBuild.result = "FAILURE" -} -finally{ -sendSlackNotifications(currentBuild.result) -} - -}//node closing - -//Function for slack notifications - -def sendSlackNotifications(String buildStatus = 'STARTED') { - // build status of null means successful - buildStatus = buildStatus ?: 'SUCCESS' - - // Default values - def colorName = 'RED' - def colorCode = '#FF0000' - def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" - def summary = "${subject} (${env.BUILD_URL})" - - // Override default values based on build status - if (buildStatus == 'STARTED') { - colorName = 'ORANGE' - colorCode = '#FFA500' - } else if (buildStatus == 'SUCCESS') { - colorName = 'GREEN' - colorCode = '#00FF00' - } else { - colorName = 'RED' - colorCode = '#FF0000' - } - - // Send notifications - slackSend (color: colorCode, message: summary) -} - - - - diff --git a/JenkinsfileSepBatch b/JenkinsfileSepBatch deleted file mode 100644 index 861f541301..0000000000 --- a/JenkinsfileSepBatch +++ /dev/null @@ -1,52 +0,0 @@ -node('wallmart-node'){ - - -//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 mavenHome = tool name: "maven3.8.3" - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - - - -stage('CheckOutCode'){ -git branch: 'development', credentialsId: '9aad10da-e742-413a-a2f6-ce6a8b007f70', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} -/* -stage('ExecuteSOnarQubeReport'){ -sh "mvn sonar:sonar" -} - -stage('UploadArtifactsIntoNexusRepo'){ -sh "mvn deploy" -} - -stage('DeployAppintoTomcatServer'){ -sshagent(['dd147e39-1f55-4554-9700-b10dc494211f']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@13.233.201.155:/opt/apache-tomcat-9.0.54/webapps/" -} -} - -stage('SendEmailNotification'){ - -mail bcc: '', body: '''Build Over.. - -Regards, -Mithun Software Solutions, -9980923226''', cc: 'devopstrainingblr@gmail.com', from: '', replyTo: '', subject: 'Build over!...', to: 'devopstrainingblr@gmail.com' -} - -*/ - -} diff --git a/JenkinsfileSepBatch2022 b/JenkinsfileSepBatch2022 deleted file mode 100644 index 40fffe89a3..0000000000 --- a/JenkinsfileSepBatch2022 +++ /dev/null @@ -1,75 +0,0 @@ -node{ - -def mavenHome = tool name: "maven3.8.5" - -echo "Build number: ${env.BUILD_NUMBER}" -//echo "Job name is: ${env.JOB_NAME}" -echo "Node name is: ${env.NODE_NAME}" - - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - -try{ -sendslacknotifications("STARTED") -stage('CheckoutCode'){ -git branch: 'development', credentialsId: 'd282f55b-fad5-4318-87d4-7ae8a1bf92b2', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} - - /* -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn sonar:sonar" -} - -stage('UploadArtifactintoNexus') -{ -sh "${mavenHome}/bin/mvn deploy" -} - -stage('DeployAppIntoTomcatServer'){ -sshagent(['edb68cd9-21f4-4bb5-a6ae-2bd936f65b53']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.16.144:/opt/apache-tomcat-9.0.68/webapps/" -} -} -*/ -}//try closing -catch(e){ -currentBuild.result = "FAILURE" -}//catch block closing -finally{ -sendslacknotifications(currentBuild.result) -}//finally closing - -}//node closing - - -def sendslacknotifications(String buildStatus = 'STARTED') { - // build status of null means successful - buildStatus = buildStatus ?: 'SUCCESSFUL' - - // Default values - def colorName = 'RED' - def colorCode = '#FF0000' - def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" - def summary = "${subject} (${env.BUILD_URL})" - - // Override default values based on build status - if (buildStatus == 'STARTED') { - colorName = 'YELLOW' - colorCode = '#FFFF00' - } else if (buildStatus == 'SUCCESSFUL') { - colorName = 'GREEN' - colorCode = '#00FF00' - } else { - colorName = 'RED' - colorCode = '#FF0000' - } - - // Send notifications - slackSend (color: colorCode, message: summary, channel: "#walmart") -} - - diff --git a/Jenkinsparalleljob b/Jenkinsparalleljob deleted file mode 100644 index 9277f18e6f..0000000000 --- a/Jenkinsparalleljob +++ /dev/null @@ -1,39 +0,0 @@ -pipeline{ - - agent any - - tools{ - maven 'maven3.8.5' - } - -stages{ -//Get the code from GitHub - stage('CheckoutCode'){ - steps{ - - git branch: 'master', credentialsId: '4368c281-f352-4495-89c1-730c9742fca9', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' - } - } - - //Run Junt Test cases & Do the Build - - stage('RunUnitTestcases&Build'){ - steps{ - parallel( - RunUnitTestCases: { - sh "mvn test" - }, - - Build: { - sh "mvn clean package" - } - - ) - } - } - - - -}// Stages Closing - -}// Pipelien CLosing diff --git a/Jenkinspipeline b/Jenkinspipeline deleted file mode 100644 index 80cb19bba0..0000000000 --- a/Jenkinspipeline +++ /dev/null @@ -1,38 +0,0 @@ -node{ - -def mavenHome = tool name: "maven3.8.6" - -echo "Jenkins url is: ${env.JENKINS_URL}" -echo "Node Name is: ${env.NODE_NAME}" -echo "Job Name is: ${env.JOB_NAME}" - - - - -properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'JobLocalConfiguration', changeReasonComment: ''], pipelineTriggers([pollSCM('* * * * *')])]) - - - -stage('CheckOutCode'){ -git branch: 'development', credentialsId: '166c70a2-1df5-4993-a566-0a795862da8c', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' -} - -stage('Build'){ -sh "${mavenHome}/bin/mvn clean package" -} - -stage('ExecuteSonarQubeReport'){ -sh "${mavenHome}/bin/mvn clean sonar:sonar" -} - -stage('UploadArtifcatsIntoArtifactoryRepo'){ -sh "${mavenHome}/bin/mvn clean deploy" -} - -stage('DeployAppIntoTomcatServer'){ -sshagent(['dc292b7a-3b39-4630-9fc3-1b806b54412c']) { - sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@172.31.7.80:/opt/apache-tomcat-9.0.65/webapps/" -} -} - -} diff --git a/JenkinswithAnsible b/JenkinswithAnsible deleted file mode 100644 index 0161f77d76..0000000000 --- a/JenkinswithAnsible +++ /dev/null @@ -1,49 +0,0 @@ -pipeline{ - -agent { -label 'ansible' -} - -environment { - AWS_EC2_PRIVATE_KEY=credentials('ec2-private-key') - } - -tools{ -maven 'maven3.8.2' - -} - - -options{ -timestamps() -buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')) -} - -stages{ - - stage('CheckOutCode'){ - steps{ - git branch: 'master', credentialsId: '957b543e-6f77-4cef-9aec-82e9b0230975', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git' - - } - } - - stage('Build'){ - steps{ - sh "mvn clean package" - } - } - -stage('DeployApp'){ - steps{ - //List the dymaic inventory just for verification - sh "ansible-inventory --graph -i aws_ec2.yaml" - //Run playbook using dynamic inventory & limit exuection only fo tomcatservers. - sh "ansible-playbook -i aws_ec2.yaml appdeploy.yaml -u ec2-user --private-key=$AWS_EC2_PRIVATE_KEY --limit tomcatservers --ssh-common-args='-o StrictHostKeyChecking=no'" - } -} - - -}//Stages Closing - -} diff --git a/MavenWebApplication.yaml b/MavenWebApplication.yaml new file mode 100644 index 0000000000..39ad0366fb --- /dev/null +++ b/MavenWebApplication.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: webpage-deployment + namespace: production +spec: + replicas: 2 + revisionHistoryLimit: 5 + selector: + matchLabels: + application: webpage + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 1 + minReadySeconds: 30 + template: + metadata: + name: webpage-pod + labels: + application: webpage + spec: + containers: + - name: webpage-container + image: mithuntechnologies/maven-web-application:1 + imagePullPolicy: Always + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: webpage-service + namespace: production +spec: + type: NodePort + selector: + application: webpage + ports: + - port: 80 + targetPort: 8080 \ No newline at end of file diff --git a/appdeploy.yaml b/appdeploy.yaml index e8e3a42f8b..ae4e3253df 100644 --- a/appdeploy.yaml +++ b/appdeploy.yaml @@ -29,4 +29,4 @@ uri: url: "http://{{ ansible_host }}:8080/maven-web-application/" status_code: 200 -... +... \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6c5aa3ef90..d58b32aab8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,4 @@ services: networks: - mavenappbridge networks: - mavenappbridge: + mavenappbridge: \ No newline at end of file diff --git a/mavenwebappdeployment.yaml b/mavenwebappdeployment.yaml deleted file mode 100644 index 8574e3267d..0000000000 --- a/mavenwebappdeployment.yaml +++ /dev/null @@ -1,42 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: mavenwebappdeployment -spec: - revisionHistoryLimit: 10 - replicas: 2 - strategy: - type: Recreate - selector: - matchLabels: - app: mavenwebapp - template: - metadata: - name: mavenwebapppod - labels: - app: mavenwebapp - spec: - containers: - - name: mavenwebappcontainer - image: dockerhandson/maven-web-application:TAG - ports: - - containerPort: 8080 - resources: - requests: - cpu: 200m - memory: 256Mi - limits: - cpu: 500m - memory: 512Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: mavenwebappsvc -spec: - selector: - app: mavenwebapp - type: NodePort - ports: - - port: 80 - targetPort: 8080 diff --git a/pom.xml b/pom.xml index d832dea9c7..cfc5be39ad 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 5.1.2.RELEASE 4.11 1.2.17 - http://18.138.81.149:9000/ + http://172.31.33.143:9000/ admin passw0rd UTF-8 @@ -98,13 +98,13 @@ nexus Mithun Technologies Releases Nexus Repository - http://54.255.174.111:8081/repository/flipkart-release/ + http://172.31.42.154:9980/mithuntechnologies/repository/canarabank-snapshot/ nexus Mithun Technologies Snapshot Nexus Repository - http://54.255.174.111:8081/repository/flipkart-snapshot/ + http://172.31.42.154:9980/mithuntechnologies/repository/canarabank-release/ @@ -113,6 +113,11 @@ maven-web-application + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + org.apache.maven.plugins maven-compiler-plugin diff --git a/src/main/webapp/jsps/home.jsp b/src/main/webapp/jsps/home.jsp index 2d563be969..1a325de2d1 100644 --- a/src/main/webapp/jsps/home.jsp +++ b/src/main/webapp/jsps/home.jsp @@ -9,8 +9,12 @@ -

Welcome to Mithun Technologies Private Ltd. Ph No: +91-9980923226, +91-9980923216 ,+91-9900012028,Bengaluru,Karnataka,India

-

Mithun Technologies- Very Good Training center for DevOps with AWS,Python & AWS Solution Architect & Terraform in Bangalore India.Teaching Real Time scnerios

+

Welcome to Mithun Technologies - Hello

+

Phone Number: +91 9980923216

+

Mithun Technologies is a Very Good Training Center for DevOps, Cloud, Kubernetes and Terraform

+ +

Trainer Name: Bhaskar Reddy Lacchannagari

+

Server Side IP Address


@@ -22,12 +26,12 @@ ip = inetAddress.getHostAddress(); out.println("Server Host Name :: "+inetAddress.getHostName()); %>
-<%out.println("Server IP Address :: "+ip);%> +<%out.println("Server IP Address :: "+ip);%>

Client Side IP Address


-<%out.print( "Client IP Address :: " + request.getRemoteAddr() ); %>
-<%out.print( "Client Name Host :: "+ request.getRemoteHost() );%>
+<%out.print( "Client IP Address :: "+request.getRemoteAddr()); %>
+<%out.print( "Client Name Host :: "+request.getRemoteHost() );%>

@@ -35,20 +39,20 @@ out.println("Server Host Name :: "+inetAddress.getHostName()); Mithun Technologies, - Martha Halli, Above ICICI Bank, Beside Meghana Foods, - Bangalore, - +91-9980923226,+91-9900012028 - devopstrainingblr@gmail.com + Marathahalli, + Bengaluru, + +91 9980923216 and + Devopstrainingblr@Gmail.com
- Mail to Mithun Technologies + Mail to Mithun Technologies

Service : Get Employee Details



-

Mithun Technologies - Consultant, Training, Development Center.

-

Copyrights 2022 by Mithun Technologies,Bengaluru

+

Mithun Technologies - Consultant, Training and Development Center.

+

Copyrights 2025 by Mithun Technologies,Bengaluru

- + \ No newline at end of file diff --git a/target/classes/com/mt/services/EmployeeService.class b/target/classes/com/mt/services/EmployeeService.class deleted file mode 100644 index bd7b4db3ed..0000000000 Binary files a/target/classes/com/mt/services/EmployeeService.class and /dev/null differ