From 0a0b140bca1b6ca07b9a6d1a2a6c927a12346568 Mon Sep 17 00:00:00 2001 From: LandmarkTechnology <70292434+legah2045@users.noreply.github.com> Date: Fri, 24 Sep 2021 19:17:51 -0400 Subject: [PATCH] Add files via upload --- JenkinsfileDeclarative | 83 +++++++++++++++++++++++++++++++++ JenkinsfileJuly2021 | 51 ++++++++++++++++++++ JenkinsfiledeclarativeJuneBathc | 77 ++++++++++++++++++++++++++++++ docker-compose.yml | 11 +++++ 4 files changed, 222 insertions(+) create mode 100644 JenkinsfileDeclarative create mode 100644 JenkinsfileJuly2021 create mode 100644 JenkinsfiledeclarativeJuneBathc create mode 100644 docker-compose.yml diff --git a/JenkinsfileDeclarative b/JenkinsfileDeclarative new file mode 100644 index 0000000000..da4fee7347 --- /dev/null +++ b/JenkinsfileDeclarative @@ -0,0 +1,83 @@ +pipeline{ + +agent any + +tools +{ + maven 'maven3.6.3' + +} + +triggers{ + pollSCM('* * * * *') +} + +options{ + timestamps() + buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '', numToKeepStr: '2')) +} + + stages{ + + stage('CheckoutCode') + { + steps{ + git branch: 'development', credentialsId: '8e348aa2-9531-4dbe-863d-1adb64897470', url: 'https://github.com/LandmakTechnology/maven-web-application.git' + } + } + + stage('Build') + { + steps{ + sh "mvn clean package" + } + } + + stage('ExecuteSonarQubeReport') + { + steps{ + sh "mvn sonar:sonar" + } + } + + stage('UploadArtifactintoNexus') + { + steps{ + sh "mvn deploy" + } + } + + stage('DeployAppIntoTomcat') + { + steps{ + sshagent(['2b7b0c6a-5eff-4f4a-82c3-3630f91c70b5']) { + sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@3.1.222.74:/opt/apache-tomcat-9.0.41/webapps/" + } + } + } + + + + } + + post{ + + + success{ + mail bcc: 'mylandmarktech@gmail.com', body: '''BuildOver!.... + + Regards, + Landmark Technologies, + 9980923226''', cc: 'mylandmarktech@gmail.com', from: '', replyTo: '', subject: 'BuildOver!!', to: 'mylandmarktech@gmail.com' + } + + failure{ + mail bcc: 'devopstrainingblr@gmail.com', body: '''BuildOver!.... + + Regards, + Landmark Technologies, + +1 437 215 2483,''', cc: 'mylandmarktech@gmail.com', from: '', replyTo: '', subject: 'BuildOver!!', to: 'mylandmarktech@gmail.com' + } + + } +} diff --git a/JenkinsfileJuly2021 b/JenkinsfileJuly2021 new file mode 100644 index 0000000000..aa3cf4f010 --- /dev/null +++ b/JenkinsfileJuly2021 @@ -0,0 +1,51 @@ +node('wallmart-node'){ + + def mavenHome = tool name: "maven3.8.2" + + 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}" + + stage('CheckOutCode') + { + git branch: 'development', credentialsId: '12993250-1ff3-40a0-9978-794e74dcf712', url: 'https://github.com/LandmakTechnology/maven-web-application.git' + } + + stage('Build') + { + sh "${mavenHome}/bin/mvn clean package" + } + +/* + stage('SonarQubeReport'){ + sh "${mavenHome}/bin/mvn clean sonar:sonar" + } + + + stage('UploadArtifactIntoNexus'){ + sh "${mavenHome}/bin/mvn clean deploy" + } + + stage('DeployAppIntoTomcatServer') + { + sshagent(['c7a7b3d8-55f0-4f83-9e81-d56c154cc647']) { + sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@15.206.90.6:/opt/apache-tomcat-9.0.52/webapps/" + } + } + + */ + + stage('SendEmailNotification'){ + emailext body: '''Build is over !! + + Regards, + Landmark Technologies, + 9980923226''', subject: 'Build Over... !!', to: 'mylandmarktech@gmail.com' + } + + +} diff --git a/JenkinsfiledeclarativeJuneBathc b/JenkinsfiledeclarativeJuneBathc new file mode 100644 index 0000000000..a45c9ccafc --- /dev/null +++ b/JenkinsfiledeclarativeJuneBathc @@ -0,0 +1,77 @@ +pipeline{ + +agent{ +label 'slaves' +} + +tools{ +maven 'maven3.6.3' + +} + +triggers{ +pollSCM('* * * * *') +} + +options{ +timestamps() +buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')) +} + +stages{ + + stage('CheckOutCode'){ + steps{ + git branch: 'development', credentialsId: '957b543e-6f77-4cef-9aec-82e9b0230975', url: 'https://github.com/LandmakTechnology/maven-web-application-1.git' + + } + } + + stage('Build'){ + steps{ + sh "mvn clean package" + } + } +/* + stage('ExecuteSonarQubeReport'){ + steps{ + sh "mvn clean sonar:sonar" + } + } + + stage('UploadArtifactsIntoNexus'){ + steps{ + sh "mvn clean deploy" + } + } + + stage('DeployAppIntoTomcat'){ + steps{ + sshagent(['bfe1b3c1-c29b-4a4d-b97a-c068b7748cd0']) { + sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@35.154.190.162:/opt/apache-tomcat-9.0.50/webapps/" + } + } + } + */ +}//Stages Closing + +post{ + + success{ + emailext to: 'mylandmarktech@gmail.com,mylandmarktech@yahoo.com', + subject: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", + body: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", + replyTo: 'mylandmarktech@gmail.com' + } + + failure{ + emailext to: 'mylandmarktech@gmail.com,mylandmarktech@yahoo.com', + subject: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", + body: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", + replyTo: 'mylandmarktech@gmail.com' + } + +} + + +}//Pipeline closing diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..0fc4c94d29 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.1' +services: + springboot: + image: mylandmarktech/maven-web-app:VERSION + restart: always + ports: + - 9090:8080 + networks: + - mavenappbridge +networks: + mavenappbridge: