From 0508ed2972d9ff1e26f4a38c71a0026a5ac5cdff Mon Sep 17 00:00:00 2001 From: dev-pc-git <125397286+dev-pc-git@users.noreply.github.com> Date: Thu, 2 Mar 2023 22:00:31 +0530 Subject: [PATCH 01/11] fixing error for maven-surefire-plugin by adding true --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index eac7c9695..69939b092 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,8 @@ org.apache.maven.plugins maven-surefire-plugin 2.19.1 + + true **/Unit*.java From dac48163293e1419d4e0c27410fe3dee83eca70d Mon Sep 17 00:00:00 2001 From: dev-pc-git <125397286+dev-pc-git@users.noreply.github.com> Date: Thu, 2 Mar 2023 22:07:10 +0530 Subject: [PATCH 02/11] fixing the maven plugin removed previous configuration this time just upgraded the version --- pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 69939b092..1b42b0351 100644 --- a/pom.xml +++ b/pom.xml @@ -85,9 +85,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 - - true + 2.20 **/Unit*.java From fd93a7b4c7b76301c0f0476a9c6b84f49b896fbb Mon Sep 17 00:00:00 2001 From: Pratima Chauhan Date: Thu, 2 Mar 2023 17:35:56 +0000 Subject: [PATCH 03/11] added jenkinfile --- jenkinfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 jenkinfile diff --git a/jenkinfile b/jenkinfile new file mode 100644 index 000000000..aa0c85c87 --- /dev/null +++ b/jenkinfile @@ -0,0 +1,40 @@ +pipeline{ + + agent any + +// uncomment the following lines by removing /* and */ to enable + tools{ + maven 'Maven 3.6.3' + } +*/ + + stages{ + stage('build'){ + steps{ + echo 'this is the build job' + sh 'mvn compile' + } + } + stage('test'){ + steps{ + echo 'this is the test job' + sh 'mvn clean test' + } + } + stage('package'){ + steps{ + echo 'this is the package job' + sh 'mvn package -DskipTests' + sleep 7 + } + } + } + + post{ + always{ + echo 'this pipeline has completed...' + } + + } + +} From 7ad085d1806e11405ed9b54ce8976000f79a2e51 Mon Sep 17 00:00:00 2001 From: dev-pc-git <125397286+dev-pc-git@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:14:48 +0530 Subject: [PATCH 04/11] fixing jenkinfile --- jenkinfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jenkinfile b/jenkinfile index aa0c85c87..1c61d309f 100644 --- a/jenkinfile +++ b/jenkinfile @@ -5,8 +5,7 @@ pipeline{ // uncomment the following lines by removing /* and */ to enable tools{ maven 'Maven 3.6.3' - } -*/ + } stages{ stage('build'){ From 9ba6b8cceaf1895fa14ab56a6cbb90190b8fe010 Mon Sep 17 00:00:00 2001 From: dev-pc-git <125397286+dev-pc-git@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:26:55 +0530 Subject: [PATCH 05/11] Delete jenkinfile --- jenkinfile | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 jenkinfile diff --git a/jenkinfile b/jenkinfile deleted file mode 100644 index 1c61d309f..000000000 --- a/jenkinfile +++ /dev/null @@ -1,39 +0,0 @@ -pipeline{ - - agent any - -// uncomment the following lines by removing /* and */ to enable - tools{ - maven 'Maven 3.6.3' - } - - stages{ - stage('build'){ - steps{ - echo 'this is the build job' - sh 'mvn compile' - } - } - stage('test'){ - steps{ - echo 'this is the test job' - sh 'mvn clean test' - } - } - stage('package'){ - steps{ - echo 'this is the package job' - sh 'mvn package -DskipTests' - sleep 7 - } - } - } - - post{ - always{ - echo 'this pipeline has completed...' - } - - } - -} From 1182a365b42ca2256a484ebd56841b97aa11d420 Mon Sep 17 00:00:00 2001 From: Pratima Chauhan Date: Thu, 2 Mar 2023 18:05:30 +0000 Subject: [PATCH 06/11] added jenkinsfile --- jenkinsfile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 jenkinsfile diff --git a/jenkinsfile b/jenkinsfile new file mode 100644 index 000000000..156899243 --- /dev/null +++ b/jenkinsfile @@ -0,0 +1,39 @@ +pipeline{ + + agent any + +// uncomment the following lines by removing /* and */ to enable + tools{ + maven 'Maven 3.6.3' + } + + + stages{ + stage('build'){ + steps{ + echo 'this is the build job' + sh 'mvn compile' + } + } + stage('test'){ + steps{ + echo 'this is the test job' + sh 'mvn clean test' + } + } + stage('package'){ + steps{ + echo 'this is the package job' + sh 'mvn package -DskipTests' + } + } + } + + post{ + always{ + echo 'this pipeline has completed...' + } + + } + +} From 82027bf452f32f04ba1982ee77dffa25f2f9b879 Mon Sep 17 00:00:00 2001 From: Pratima Chauhan Date: Thu, 2 Mar 2023 18:11:36 +0000 Subject: [PATCH 07/11] removed jenkinsfile Please enter the commit message for your changes. Lines starting --- jenkinsfile | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 jenkinsfile diff --git a/jenkinsfile b/jenkinsfile deleted file mode 100644 index 156899243..000000000 --- a/jenkinsfile +++ /dev/null @@ -1,39 +0,0 @@ -pipeline{ - - agent any - -// uncomment the following lines by removing /* and */ to enable - tools{ - maven 'Maven 3.6.3' - } - - - stages{ - stage('build'){ - steps{ - echo 'this is the build job' - sh 'mvn compile' - } - } - stage('test'){ - steps{ - echo 'this is the test job' - sh 'mvn clean test' - } - } - stage('package'){ - steps{ - echo 'this is the package job' - sh 'mvn package -DskipTests' - } - } - } - - post{ - always{ - echo 'this pipeline has completed...' - } - - } - -} From 4c66d5cfa75baf7fddb492ba12efbaa6b516ff2c Mon Sep 17 00:00:00 2001 From: Pratima Chauhan Date: Thu, 2 Mar 2023 18:13:31 +0000 Subject: [PATCH 08/11] added Jenkinsfile --- Jenkinsfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..c8c8d5368 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,40 @@ +pipeline{ + + agent any + +// uncomment the following lines by removing /* and */ to enable + tools{ + maven 'Maven 3.6.3' + } + + + stages{ + stage('build'){ + steps{ + echo 'this is the build job' + sh 'mvn compile' + } + } + stage('test'){ + steps{ + echo 'this is the test job' + sh 'mvn clean test' + } + } + stage('package'){ + steps{ + echo 'this is the package job' + sh 'mvn package -DskipTests' + } + } + } + + post{ + always{ + echo 'this pipeline has completed...' + } + + } + +} + From f6388b066e0a07274c2ddd91215af51e7138ac1e Mon Sep 17 00:00:00 2001 From: Pratima Chauhan Date: Mon, 13 Mar 2023 17:30:59 +0000 Subject: [PATCH 09/11] adding dockerfile --- Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..8e1685763 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM schoolofdevops/carts-maven + + +WORKDIR /opt/carts + +COPY . . + +RUN mvn package \ + && mv target/carts.jar /run \ + && rm -rf * + +EXPOSE 80 + +CMD java -jar /run/carts.jar --port=80 + From 3c63206494ea1543e07668cc4f411b05937f3632 Mon Sep 17 00:00:00 2001 From: dev-pc-git <125397286+dev-pc-git@users.noreply.github.com> Date: Mon, 13 Mar 2023 23:29:33 +0530 Subject: [PATCH 10/11] changed the jenkinfile --- Jenkinsfile | 84 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8c8d5368..000dc765a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,40 +1,68 @@ -pipeline{ - - agent any +pipeline { + agent none + stages { + stage('build') { + agent { + docker { + image 'schoolofdevops/carts-maven' + } -// uncomment the following lines by removing /* and */ to enable - tools{ - maven 'Maven 3.6.3' + } + steps { + echo 'this is the build job' + sh 'mvn compile' + } } - - stages{ - stage('build'){ - steps{ - echo 'this is the build job' - sh 'mvn compile' - } + stage('test') { + agent { + docker { + image 'schoolofdevops/carts-maven' } - stage('test'){ - steps{ - echo 'this is the test job' - sh 'mvn clean test' - } - } - stage('package'){ - steps{ - echo 'this is the package job' - sh 'mvn package -DskipTests' - } + + } + steps { + echo 'this is the test job' + sh 'mvn clean test' + } + } + + stage('package') { + agent { + docker { + image 'schoolofdevops/carts-maven' } + + } + steps { + echo 'this is the package job' + sh 'mvn package -DskipTests' + archiveArtifacts '**/target/*.jar' + } } - post{ - always{ - echo 'this pipeline has completed...' + stage('docker build and publish') { + agent any + steps { + script { + docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') { + def dockerImage = docker.build("gouravshah/carts:v${env.BUILD_ID}", "./") + dockerImage.push() + dockerImage.push("latest") + } } + } } -} + } + tools { + maven 'Maven 3.6.3' + } + post { + always { + echo 'this pipeline has completed...' + } + } +} From 0d290e10c5154e57191374712d995950963eb61d Mon Sep 17 00:00:00 2001 From: dev-pc-git <125397286+dev-pc-git@users.noreply.github.com> Date: Mon, 13 Mar 2023 23:36:34 +0530 Subject: [PATCH 11/11] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 000dc765a..c77050cfc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,7 @@ pipeline { steps { script { docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') { - def dockerImage = docker.build("gouravshah/carts:v${env.BUILD_ID}", "./") + def dockerImage = docker.build("prat91/carts:v${env.BUILD_ID}", "./") dockerImage.push() dockerImage.push("latest") }