diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 88fe618..0000000 --- a/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM tomcat:8.0 - -ADD ./target/*.war /usr/local/tomcat/webapps/ - -EXPOSE 8080 - -WORKDIR /usr/local/tomcat/webapps/ - -CMD ["catalina.sh", "run"] - diff --git a/Jenkinsfile b/Jenkinsfile index f722447..ec3a66f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,33 +2,30 @@ pipeline { agent any tools { - maven 'local_maven' - } - parameters { - string(name: 'staging_server', defaultValue: '13.232.37.20', description: 'Remote Staging Server') + maven 'localMaven' + jdk 'localJava' } stages{ stage('Build'){ steps { - sh 'mvn clean package' + sh 'mvn clean install' } post { success { echo 'Archiving the artifacts' archiveArtifacts artifacts: '**/target/*.war' } - } - } - - stage ('Deployments'){ - parallel{ - stage ("Deploy to Staging"){ - steps { - sh "scp -v -o StrictHostKeyChecking=no **/*.war root@${params.staging_server}:/opt/tomcat/webapps/" - } + failure{ + emailext attachLog: true, body: 'Build failed', subject: 'Build Failed - ${BUILDNUMBER}', to: 'ranjitswain@gmail.com' } } } + stage ('Deploy to Staging'){ + steps { + //deploy adapters: [tomcat9(credentialsId: 'tomcat', path: '', url: 'http://13.127.187.179:8080/')], contextPath: null, war: '**/*.war' + echo "Demo Deploy" + } + } } } diff --git a/Jenkinsfile_1.0 b/Jenkinsfile_1.0 deleted file mode 100644 index d030fb6..0000000 --- a/Jenkinsfile_1.0 +++ /dev/null @@ -1,45 +0,0 @@ -pipeline { - agent any - - tools { - maven 'localMaven' - } - parameters { - string(name: 'tomcat_stag', defaultValue: '13.59.108.184', description: 'Node1-Remote Staging Server') - string(name: 'tomcat_prod', defaultValue: '18.219.228.98', description: 'Node2-Remote Production Server') - } - - triggers { - pollSCM('* * * * *') - } - -stages{ - stage('Build'){ - steps { - sh 'mvn clean package' - } - post { - success { - echo 'Archiving the artifacts' - archiveArtifacts artifacts: '**/target/*.war' - } - } - } - - stage ('Deployments'){ - parallel{ - stage ('Deploy to Staging'){ - steps { - sh "scp **/*.war jenkins@${params.tomcat_stag}:/usr/share/tomcat/webapps/" - } - } - - stage ("Deploy to Production"){ - steps { - sh "scp **/*.war jenkins@${params.tomcat_prod}:/usr/share/tomcat/webapps/" - } - } - } - } - } -} diff --git a/Jenkinsfile_Docker_Local b/Jenkinsfile_Docker_Local deleted file mode 100644 index 7f7c1cc..0000000 --- a/Jenkinsfile_Docker_Local +++ /dev/null @@ -1,14 +0,0 @@ -pipeline{ - agent any - tools { - maven 'localMaven' - } - stages{ - stage('Build'){ - steps{ - sh 'mvn clean package' - sh "docker build . -t tomcatwebapp:${env.BUILD_ID}" - } - } - } -} diff --git a/Jenkinsfile_Docker_Remote b/Jenkinsfile_Docker_Remote deleted file mode 100644 index cf138a7..0000000 --- a/Jenkinsfile_Docker_Remote +++ /dev/null @@ -1,15 +0,0 @@ -pipeline{ - agent any - tools { - maven 'localMaven' - } - stages{ - stage('Build'){ - steps{ - sh 'mvn clean package' - sh 'scp Dockerfile centos@3.17.61.170' - sh 'ssh centos@3.17.61.170 "docker build . -t tomcatwebapp:${env.BUILD_ID}"' - } - } - } -} diff --git a/Jenkinsfile_SharedLib b/Jenkinsfile_SharedLib new file mode 100644 index 0000000..00c4a13 --- /dev/null +++ b/Jenkinsfile_SharedLib @@ -0,0 +1,37 @@ +@Library ('demoSharedLib@feature/demo')_ + +pipeline { + agent any + + tools { + maven 'localMaven' + jdk 'localJava' + } + +stages{ + stage('Build'){ + steps { + script{ + build.java() + } + } + post { + success { + echo 'Archiving the artifacts' + archiveArtifacts artifacts: '**/target/*.war' + } + failure{ + emailext attachLog: true, body: 'Build failed', subject: 'Build Failed - ${BUILDNUMBER}', to: 'ranjitswain@gmail.com' + } + } + } + stage ('Deploy to Staging'){ + steps { + //deploy adapters: [tomcat9(credentialsId: 'tomcat', path: '', url: 'http://13.127.187.179:8080/')], contextPath: null, war: '**/*.war' + script{ + deploy() + } + } + } + } +} diff --git a/src/main/webapp/template.xhtml b/src/main/webapp/template.xhtml index 8151566..ea383ad 100644 --- a/src/main/webapp/template.xhtml +++ b/src/main/webapp/template.xhtml @@ -10,8 +10,8 @@ -

DevOps class - Ranjit Swain - Version: 2.7.2 - Batch7

-

Just an example! - Webhook

+

DevOps class - Ranjit Swain - Version: 2.8.5 - Batch13

+

Just an example! - Webhook- devopsB13