From ca37839368b9b9901aa1d926bdc80ff74b0b60be Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Mon, 15 Apr 2024 12:51:06 +0530 Subject: [PATCH 1/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 38a78cde..add4d72c 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ This is a Sample Maven App. +This is a new training From 6f9751e6e5485f96eb282454874b29f1f754ee54 Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Tue, 16 Apr 2024 10:02:06 +0530 Subject: [PATCH 2/9] Create Jenkinsfile --- Jenkinsfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..fd87fa1b --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,32 @@ +pipeline { + agent any + tools { + maven 'Maven 3.6.3' + } + stages{ + stage("build"){ + steps{ + echo 'compiling the code' + sh 'mvn compile' + } + } + stage("test"){ + steps{ + echo 'running the unit test' + sh 'mvn clean test' + } + } + stage("package"){ + steps{ + echo 'generating artifacts' + sh 'mvn package -DskipTests' + } + } + } + + post{ + always{ + echo 'This pipeline is completed..' + } + } +} From 0fa39f07defe0c4ff20ecfeb4e5664217558466f Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:00:14 +0530 Subject: [PATCH 3/9] first commit from blue ocean --- Jenkinsfile | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fd87fa1b..273a6b0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,32 +1,36 @@ pipeline { agent any - tools { - maven 'Maven 3.6.3' - } - stages{ - stage("build"){ - steps{ - echo 'compiling the code' - sh 'mvn compile' - } + stages { + stage('build') { + steps { + echo 'compiling the code' + sh 'mvn compile' } - stage("test"){ - steps{ - echo 'running the unit test' - sh 'mvn clean test' - } + } + + stage('test') { + steps { + echo 'running the unit test' + sh 'mvn clean test' } - stage("package"){ - steps{ - echo 'generating artifacts' - sh 'mvn package -DskipTests' - } + } + + stage('package') { + steps { + echo 'generating artifacts' + sh 'mvn package -DskipTests' + archiveArtifacts 'target/*.war' } - } + } - post{ - always{ - echo 'This pipeline is completed..' + } + tools { + maven 'Maven 3.6.3' + } + post { + always { + echo 'This pipeline is completed..' } + } -} +} \ No newline at end of file From e07e3985939d740f41baacf2b9d79dd89078e4a3 Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:13:11 +0530 Subject: [PATCH 4/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index add4d72c..7b87da80 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ This is a Sample Maven App. This is a new training +This is a commit from new review brach for approval From 876cad160367e66eb2d0cf9b529af6a7d153c0eb Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:24:00 +0530 Subject: [PATCH 5/9] Changing to docker agent --- Jenkinsfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 273a6b0b..3b01265c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,10 @@ pipeline { - agent any + agent { + docker { + image 'maven:3.6.3-jdk-11-slim' + } + + } stages { stage('build') { steps { From 7591229e7c2b65cb48ed26d38f1f76014ffd844a Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:27:15 +0530 Subject: [PATCH 6/9] Update Jenkinsfile removing tool config from jenkins file --- Jenkinsfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3b01265c..6d30cbdc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,13 +29,10 @@ pipeline { } } - tools { - maven 'Maven 3.6.3' - } post { always { echo 'This pipeline is completed..' } } -} \ No newline at end of file +} From 9eebf27422780ad716c2f9d25ff195060231f2cf Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:43:14 +0530 Subject: [PATCH 7/9] Adding Dockerbuild --- Jenkinsfile | 55 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6d30cbdc..0fc3c769 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,13 @@ pipeline { - agent { - docker { - image 'maven:3.6.3-jdk-11-slim' - } - - } + agent none stages { stage('build') { + agent { + docker { + image 'maven:3.6.3-jdk-11-slim' + } + + } steps { echo 'compiling the code' sh 'mvn compile' @@ -14,6 +15,12 @@ pipeline { } stage('test') { + agent { + docker { + image 'maven:3.6.3-jdk-11-slim' + } + + } steps { echo 'running the unit test' sh 'mvn clean test' @@ -21,10 +28,36 @@ pipeline { } stage('package') { - steps { - echo 'generating artifacts' - sh 'mvn package -DskipTests' - archiveArtifacts 'target/*.war' + parallel { + stage('package') { + agent { + docker { + image 'maven:3.6.3-jdk-11-slim' + } + + } + steps { + echo 'generating artifacts' + sh 'mvn package -DskipTests' + archiveArtifacts 'target/*.war' + } + } + + stage('DockerBuildandpush') { + agent any + steps { + script { + docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') { + def dockerImage = docker.build("dockerbvk87/sysfoo:v${env.BUILD_ID}", "./") + dockerImage.push() + dockerImage.push("latest") + dockerImage.push("dev") + } + } + + } + } + } } @@ -35,4 +68,4 @@ pipeline { } } -} +} \ No newline at end of file From 438e8a5e01906e5011328d71f967959a71dac5a3 Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:54:19 +0530 Subject: [PATCH 8/9] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0fc3c769..c77e18fb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { } steps { - echo 'compiling the code' + echo 'compiling the new code' sh 'mvn compile' } } @@ -68,4 +68,4 @@ pipeline { } } -} \ No newline at end of file +} From c0d4f3a8a43044e5e07665d13228946c505261c4 Mon Sep 17 00:00:00 2001 From: bvkvamsi <147296451+bvkvamsi@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:01:44 +0530 Subject: [PATCH 9/9] Create Dockerfile --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ad262a19 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM maven:3.6.3-jdk-11-slim as build +WORKDIR /opt/demo +COPY . /opt/demo +RUN mvn package -DskipTests + +FROM tomcat:jre8-openjdk-slim-buster as run +WORKDIR /usr/local/tomcat +COPY --from=build /opt/demo/target/sysfoo.war webapps/ROOT.war