From ad929660f9f6834276c0e3a6dcc62bad5f0d938b Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 4 Jan 2024 10:45:27 +0000 Subject: [PATCH 01/19] jenkins file added --- Jenkinsfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ac530d3 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +pipeline { + agent any + + tools { + jdk "java-8" + maven "maven-3" + } + stages { + stage ('clone'){ + steps { + git "https://github.com/komalkhiratkar/VProfile.git" + } + } + stage ('test'){ + steps { + echo " running test cases" + } + } + stage ('build') { + steps { + sh 'mvn package' + } + } + + } +} From d414a3599a31ece6b7ab60ba8f3bb69a089bdefe Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 5 Jan 2024 15:04:26 +0000 Subject: [PATCH 02/19] nexus configuration --- Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ac530d3..c9dc4ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,6 +21,28 @@ pipeline { sh 'mvn package' } } + stage('Nexus artifact'){ + steps { + + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: '15.206.211.121:8081', + groupId: 'DEV', + version: 'V1', + repository: 'Vprofile-repos', + credentialsId: 'nexus-creds', + artifacts: [ + [artifactId: vprofile, + classifier: '', + file: 'target/vprofile-v1.war', + type: 'war'] + ] + ) + + } + } } } + From c6f8e9b54c0baf0ac57f99a5df47df52bdcd92f2 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 8 Jan 2024 08:21:58 +0000 Subject: [PATCH 03/19] nexus configuration --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c9dc4ae..77f75c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,10 +27,10 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: '15.206.211.121:8081', + nexusUrl: '172.31.8.147:8081', groupId: 'DEV', version: 'V1', - repository: 'Vprofile-repos', + repository: 'Vprofile-repo', credentialsId: 'nexus-creds', artifacts: [ [artifactId: vprofile, From b53cec96d0c7537c95507921697f36af966ee1b9 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 05:32:18 +0000 Subject: [PATCH 04/19] modified Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 77f75c4..323a61e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pipeline { repository: 'Vprofile-repo', credentialsId: 'nexus-creds', artifacts: [ - [artifactId: vprofile, + [artifactId: 'vprofile', classifier: '', file: 'target/vprofile-v1.war', type: 'war'] From 9a36170eaa0d0db91699ebe111dfc76aa1260ab8 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 09:41:23 +0000 Subject: [PATCH 05/19] version added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 323a61e..0af8eb9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { protocol: 'http', nexusUrl: '172.31.8.147:8081', groupId: 'DEV', - version: 'V1', + version: 'V2', repository: 'Vprofile-repo', credentialsId: 'nexus-creds', artifacts: [ From d453ba5a84802aef54339d8279455d78dcf183c7 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 09:45:02 +0000 Subject: [PATCH 06/19] artifact version added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0af8eb9..f52bb5e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { protocol: 'http', nexusUrl: '172.31.8.147:8081', groupId: 'DEV', - version: 'V2', + version: $'BUILD_NUMBER', repository: 'Vprofile-repo', credentialsId: 'nexus-creds', artifacts: [ From ab68c6015043fdb4910debfef98ac569e9a0a27b Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 09:47:08 +0000 Subject: [PATCH 07/19] artifact version added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f52bb5e..ea2a784 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { protocol: 'http', nexusUrl: '172.31.8.147:8081', groupId: 'DEV', - version: $'BUILD_NUMBER', + version: '$BUILD_NUMBER', repository: 'Vprofile-repo', credentialsId: 'nexus-creds', artifacts: [ From 89354bf52f77fab3c2eabaa630d0ae08e1ce0f95 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 10:22:44 +0000 Subject: [PATCH 08/19] quality gate added --- Jenkinsfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ea2a784..b830fb0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,6 +21,33 @@ pipeline { sh 'mvn package' } } + stage('CODE ANALYSIS with SONARQUBE') { + + environment { + scannerHome = tool 'sonarqube-4' + } + + steps { + withSonarQubeEnv('sonarqube') { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile-repo \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.login=admin \ + -Dsonar.password=admin1234 \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + } + + //timeout(time: 1, unit: 'MINUTES') { + // waitForQualityGate abortPipeline: false + // } + } + } + + stage('Nexus artifact'){ steps { From 499892bc7f82f9ee3967c0369d04c8ab9d9ce10f Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 11:12:52 +0000 Subject: [PATCH 09/19] tomcat deployed --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index b830fb0..d85da42 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,6 +70,11 @@ pipeline { } } + stage('deploy to tomcat'){ + steps{ + deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'https://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' +} +} } } From 037d98716cc9c113b5d3b3c9b4c20da4c6e68768 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 9 Jan 2024 11:31:57 +0000 Subject: [PATCH 10/19] tomcat deployed --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d85da42..9f91b99 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,8 +73,8 @@ pipeline { stage('deploy to tomcat'){ steps{ deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'https://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' -} -} + } + } } } From 61aa38f72fdef6bc9dc019ba7fa87999490a1154 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 11 Jan 2024 04:54:50 +0000 Subject: [PATCH 11/19] fixed tomcat url --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f91b99..78b3fa5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { stage('deploy to tomcat'){ steps{ - deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'https://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' + deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'http://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' } } } From 49ff1e3e9f232bacd0316eabf64a1fee74f25018 Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Wed, 10 Jan 2024 23:57:32 -0500 Subject: [PATCH 12/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f91b99..78b3fa5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { stage('deploy to tomcat'){ steps{ - deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'https://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' + deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'http://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' } } } From 1355740ec6997133a682052991623033b05c293d Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Thu, 11 Jan 2024 00:09:01 -0500 Subject: [PATCH 13/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 78b3fa5..07060ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { stage('deploy to tomcat'){ steps{ - deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'http://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war' +deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'http://13.234.76.183:8080')], contextPath: null, war: 'target/vprofile-v1.war' } } } From 186c6c499f1a519826e27f29649decb2873c1a23 Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Thu, 11 Jan 2024 00:14:59 -0500 Subject: [PATCH 14/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07060ef..ebea307 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { stage('deploy to tomcat'){ steps{ -deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'http://13.234.76.183:8080')], contextPath: null, war: 'target/vprofile-v1.war' +deploy adapters: [tomcat8(credentialsId: 'tomcatcreds', path: '', url: 'http://13.234.76.183:8080')], contextPath: null, war: 'target/vprofile-v1.war' } } } From 30ed7b32be360b2c61b0b8fd1d9454972b2d1982 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 29 Jan 2024 13:37:08 +0000 Subject: [PATCH 15/19] run playbook --- sample-playbook.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 sample-playbook.yml diff --git a/sample-playbook.yml b/sample-playbook.yml new file mode 100644 index 0000000..ef7d8d9 --- /dev/null +++ b/sample-playbook.yml @@ -0,0 +1,8 @@ +--- + - hosts: ubuntu + become: yes + tasks: + - name: install tree package + apt: + name: tree + state: present From cc4ed00cfb8bd58799faf3e3529425aa2dbe84c0 Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Tue, 13 Feb 2024 06:01:30 -0500 Subject: [PATCH 16/19] Create Jenkinsfile-3 --- Jenkinsfile-3 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Jenkinsfile-3 diff --git a/Jenkinsfile-3 b/Jenkinsfile-3 new file mode 100644 index 0000000..cb13fcf --- /dev/null +++ b/Jenkinsfile-3 @@ -0,0 +1,61 @@ +pipeline { + environment { + registry = "komal921/docker-test" + registryCredential = 'docc-credentials' + dockerImage = '' + } + agent any + tools { + jdk "java-8" + maven "maven-3" + } + stages { + stage('Cloning Git') { + steps { + git branch: 'develop', changelog: false, poll: false, url: 'https://github.com/komalkhiratkar/VProfile.git' + } + } + + stage ('Build maven') { + steps { + sh 'mvn package' + } + } + + stage('Building image') { + steps{ + script { + dockerImage = docker.build registry + ":$BUILD_NUMBER" + } + } + } + + stage('Deploy Image') { + steps{ + script { + docker.withRegistry( '', registryCredential ) { + dockerImage.push() + } + } + } + } + stage('Remove Unused docker image') { + steps{ + sh "docker rmi $registry:$BUILD_NUMBER" + } + } + stage ('install docker and pull image') { + steps{ + script { + withDockerRegistry(credentialsId: 'docc-credentials') { + sh "sudo apt install docker.io -y" + sh "docker pull komal921/docker-test ." + sh "docker run -itd komal921/docker-test" + } + } + } + } + } + } + + From a44fb183feda18bcacad24615aae1f9faca607ce Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Tue, 13 Feb 2024 06:27:18 -0500 Subject: [PATCH 17/19] Update Jenkinsfile-3 --- Jenkinsfile-3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-3 b/Jenkinsfile-3 index cb13fcf..cb546bb 100644 --- a/Jenkinsfile-3 +++ b/Jenkinsfile-3 @@ -48,7 +48,7 @@ pipeline { steps{ script { withDockerRegistry(credentialsId: 'docc-credentials') { - sh "sudo apt install docker.io -y" + sh "sudo -A apt install docker.io -y" sh "docker pull komal921/docker-test ." sh "docker run -itd komal921/docker-test" } From 99f9a313d719fe1729871701669c51222ef6500a Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Tue, 13 Feb 2024 06:29:25 -0500 Subject: [PATCH 18/19] Update Jenkinsfile-3 --- Jenkinsfile-3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-3 b/Jenkinsfile-3 index cb546bb..26b9550 100644 --- a/Jenkinsfile-3 +++ b/Jenkinsfile-3 @@ -12,7 +12,7 @@ pipeline { stages { stage('Cloning Git') { steps { - git branch: 'develop', changelog: false, poll: false, url: 'https://github.com/komalkhiratkar/VProfile.git' + git branch: 'komal', changelog: false, credentialsId: 'docc-credentials', poll: false, url: 'https://github.com/komalkhiratkar/VProfile.git' } } From 34842ceacd4de16ddeae7d54a5d59df2bab70d5f Mon Sep 17 00:00:00 2001 From: komalkhiratkar <152837472+komalkhiratkar@users.noreply.github.com> Date: Tue, 13 Feb 2024 06:32:48 -0500 Subject: [PATCH 19/19] Update Jenkinsfile-3 --- Jenkinsfile-3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-3 b/Jenkinsfile-3 index 26b9550..073d052 100644 --- a/Jenkinsfile-3 +++ b/Jenkinsfile-3 @@ -48,7 +48,7 @@ pipeline { steps{ script { withDockerRegistry(credentialsId: 'docc-credentials') { - sh "sudo -A apt install docker.io -y" + sh "sudo -S apt install docker.io -y" sh "docker pull komal921/docker-test ." sh "docker run -itd komal921/docker-test" }