From 23b7800f1f53ea97a3b64c0a0ccd380547771a1c Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 14:45:42 +0200 Subject: [PATCH 01/72] added jenkinsfile --- Jenkinsfile | 112 ---------------------------------------------------- 1 file changed, 112 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a2df42b1..e69de29b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,112 +0,0 @@ -pipeline{ - agent any - environment{ - VERSION = "${env.BUILD_ID}" - } - stages{ - stage("sonar quality check"){ - agent { - docker { - image 'openjdk:11' - } - } - steps{ - script{ - withSonarQubeEnv(credentialsId: 'sonar-token') { - sh 'chmod +x gradlew' - sh './gradlew sonarqube' - } - - timeout(time: 1, unit: 'HOURS') { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } - - } - } - } - stage("docker build & docker push"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - sh ''' - docker build -t 34.125.214.226:8083/springapp:${VERSION} . - docker login -u admin -p $docker_password 34.125.214.226:8083 - docker push 34.125.214.226:8083/springapp:${VERSION} - docker rmi 34.125.214.226:8083/springapp:${VERSION} - ''' - } - } - } - } - stage('indentifying misconfigs using datree in helm charts'){ - steps{ - script{ - - dir('kubernetes/') { - withEnv(['DATREE_TOKEN=GJdx2cP2TCDyUY3EhQKgTc']) { - sh 'helm datree test myapp/' - } - } - } - } - } - stage("pushing the helm charts to nexus"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - dir('kubernetes/') { - sh ''' - helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') - tar -czvf myapp-${helmversion}.tgz myapp/ - curl -u admin:$docker_password http://34.125.214.226:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v - ''' - } - } - } - } - } - - stage('manual approval'){ - steps{ - script{ - timeout(10) { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "deekshith.snsep@gmail.com"; - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') - } - } - } - } - - stage('Deploying application on k8s cluster') { - steps { - script{ - withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { - dir('kubernetes/') { - sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' - } - } - } - } - } - - stage('verifying app deployment'){ - steps{ - script{ - withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { - sh 'kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080' - - } - } - } - } - } - - post { - always { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "deekshith.snsep@gmail.com"; - } - } -} From de4a3608dfccccce2c6c779836df81d129b38d18 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 15:26:57 +0200 Subject: [PATCH 02/72] added jenkinsfile --- Jenkinsfile | 22 ++ Jenkinsfile1 | 112 ++++++++ bin/main/application.properties | 1 + .../example/controller/HomeController.class | Bin 0 -> 583 bytes .../example/demo/SampleWebApplication.class | Bin 0 -> 718 bytes .../com/example/demo/ServletInitializer.class | Bin 0 -> 890 bytes bin/main/templates/index.html | 243 ++++++++++++++++++ .../demo/SampleWebApplicationTests.class | Bin 0 -> 546 bytes ernest.code-workspace | 10 + 9 files changed, 388 insertions(+) create mode 100644 Jenkinsfile1 create mode 100644 bin/main/application.properties create mode 100644 bin/main/com/example/controller/HomeController.class create mode 100644 bin/main/com/example/demo/SampleWebApplication.class create mode 100644 bin/main/com/example/demo/ServletInitializer.class create mode 100644 bin/main/templates/index.html create mode 100644 bin/test/com/example/demo/SampleWebApplicationTests.class create mode 100644 ernest.code-workspace diff --git a/Jenkinsfile b/Jenkinsfile index e69de29b..578b3f3b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -0,0 +1,22 @@ +pipeline{ + agent any + stages{ + agent{ + docker{ + image 'openjdk:11' + } + } + stage("sonar quality check"){ + steps{ + script{ + withSonarQubeEnv(credentialsId: 'sonar-token') { + sh 'chmod +x gradlew' + sh './gradlew sonarqube' + } + } + + } + } + } + +} \ No newline at end of file diff --git a/Jenkinsfile1 b/Jenkinsfile1 new file mode 100644 index 00000000..a2df42b1 --- /dev/null +++ b/Jenkinsfile1 @@ -0,0 +1,112 @@ +pipeline{ + agent any + environment{ + VERSION = "${env.BUILD_ID}" + } + stages{ + stage("sonar quality check"){ + agent { + docker { + image 'openjdk:11' + } + } + steps{ + script{ + withSonarQubeEnv(credentialsId: 'sonar-token') { + sh 'chmod +x gradlew' + sh './gradlew sonarqube' + } + + timeout(time: 1, unit: 'HOURS') { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } + + } + } + } + stage("docker build & docker push"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + sh ''' + docker build -t 34.125.214.226:8083/springapp:${VERSION} . + docker login -u admin -p $docker_password 34.125.214.226:8083 + docker push 34.125.214.226:8083/springapp:${VERSION} + docker rmi 34.125.214.226:8083/springapp:${VERSION} + ''' + } + } + } + } + stage('indentifying misconfigs using datree in helm charts'){ + steps{ + script{ + + dir('kubernetes/') { + withEnv(['DATREE_TOKEN=GJdx2cP2TCDyUY3EhQKgTc']) { + sh 'helm datree test myapp/' + } + } + } + } + } + stage("pushing the helm charts to nexus"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + dir('kubernetes/') { + sh ''' + helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') + tar -czvf myapp-${helmversion}.tgz myapp/ + curl -u admin:$docker_password http://34.125.214.226:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v + ''' + } + } + } + } + } + + stage('manual approval'){ + steps{ + script{ + timeout(10) { + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "deekshith.snsep@gmail.com"; + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + } + } + } + } + + stage('Deploying application on k8s cluster') { + steps { + script{ + withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { + dir('kubernetes/') { + sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + } + } + } + } + } + + stage('verifying app deployment'){ + steps{ + script{ + withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { + sh 'kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080' + + } + } + } + } + } + + post { + always { + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "deekshith.snsep@gmail.com"; + } + } +} diff --git a/bin/main/application.properties b/bin/main/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/bin/main/application.properties @@ -0,0 +1 @@ + diff --git a/bin/main/com/example/controller/HomeController.class b/bin/main/com/example/controller/HomeController.class new file mode 100644 index 0000000000000000000000000000000000000000..f89b6354f5da208d64c0661de6eb8136e9866a67 GIT binary patch literal 583 zcma)3%Ps^#6g@Q$GX`Uf_tHYVLTxN0L?RNgXe7vNtg72JitegbUG4E#tRxmbz(h1mI6~H=XYA6ZJM>dgkuaYz-8Cm0vlOakq|Mk?+o zrwjabS@D-T6IclT)y$?qRhx6V7noRF3i@50c&AO5)3e99@j9W7&NNrqF~)l3wKZI1 zBe1S3v$UXIIF-3B#W~L)WF1X`#)-{cM0>iJ zYy9`Z){3qKR{kuOd2(d^LrSv0;!Vtf_sCxZlsMx3v8^$Z>;?Pk@-ymBy>x?Zkp>fn z*baXZ*pDz0XkwH_S{yeSjqz!pL1Y;339d3O-j>@FkL*h5%Qb$;mA~XlnC!8pdV)pS GY2X9TzKLT1 literal 0 HcmV?d00001 diff --git a/bin/main/com/example/demo/SampleWebApplication.class b/bin/main/com/example/demo/SampleWebApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..ae4f25be88815cef3f40bcca6eadea655e618d3e GIT binary patch literal 718 zcma)4O-~y!5Pc4Tge815P`)o55Fv;9f_e!;f=E5BT8UKQ(35vDi^HxRdA-2j;?$}K zen5Xz#n?qk4twZj#`DI0GjGO!{{DUiaE8Mc8Vtv&DY$$V#Wa`vRu+bj!udufm(yvk zQsI=*Ei@T6CgM@>T7I^Mp(dd2a8x@SdW#KU#lXK z_Pa=O$D`kKb8Q$R}eTcw&s>qX5oH>|hHYNr=53-Zm@gUC+}+=0B>)GyXF7@ literal 0 HcmV?d00001 diff --git a/bin/main/com/example/demo/ServletInitializer.class b/bin/main/com/example/demo/ServletInitializer.class new file mode 100644 index 0000000000000000000000000000000000000000..4699b6aee4e04cd4ca33b81e23682f2bbde148da GIT binary patch literal 890 zcmbtSU279T6g`t{yLJ;Bjkd9VL6JgYq4VO4L<&tnC@k$mq#{1eZYFW+?9MW~n-+gn z`=U^&KcGLV^zJ5*Vi3f<+&lN{aL=7{b9?n0z&pHlQDJx!nuyDD5hYskp^OY4NITIo zJB(GPgjPSKb>T1^8aw7`VpTjISrN%IW54sjn2evvfTzC&-l^N;~6lkR)1#B2y;rO$*)560W06JqE1zX>ZwC(>Xt~&Ac>mu7>Uf4N1~)ai4JBRhxc$}tW2L1?GStNUYz*Bc z4#waO$~`}-LI|xzJ?#~%V;dwV5;jnw7s-gMOA#l}$gjNpg$I{q*&|z&3tJ;wpEi(x zNRfkeG$>OH_Xwy$etp-u#-lIQW^?cpPcJA_!5qaaQ8uTYGZdP^bG#rNhL>gkt2?&A B0dN2S literal 0 HcmV?d00001 diff --git a/bin/main/templates/index.html b/bin/main/templates/index.html new file mode 100644 index 00000000..414eacf6 --- /dev/null +++ b/bin/main/templates/index.html @@ -0,0 +1,243 @@ + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + + + + + web app + + +

Sample Web application has been deployed with Github action

+ + + + + diff --git a/bin/test/com/example/demo/SampleWebApplicationTests.class b/bin/test/com/example/demo/SampleWebApplicationTests.class new file mode 100644 index 0000000000000000000000000000000000000000..9ff8277d9bbc752f26178705cd7e58b9be398b2d GIT binary patch literal 546 zcma)2%Sr<=6g`>NR@-W8bt8zl)GB6E+$cg7Tn!4g)OBVWYwAogWHQ>{awWL%1NB$VW2o%yj~S{LW+EG?V5Nm6)EL^K((N+d%! zG_gp=!YW@cnpJnNa)!h3{}-Jwv|^*3oV(D732krP6xyj&j#aLRdZ4v&1gNPi$8BYmi@Q^qMW-|4+z`MDf7$onw}&?Mjb0#IC~3Rt6QfHq|w f)uHH#4#@lt`%TjPK|;EfBmve58ld}4vjKbpO)-KQ literal 0 HcmV?d00001 diff --git a/ernest.code-workspace b/ernest.code-workspace new file mode 100644 index 00000000..24774970 --- /dev/null +++ b/ernest.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "../.." + }, + { + "path": "." + } + ] +} \ No newline at end of file From 2ec36d86aa4a65159c3eaa1055acbc9ba86b0c87 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 15:35:57 +0200 Subject: [PATCH 03/72] added jenkinsfile --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 578b3f3b..abb8bb6d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,12 @@ pipeline{ agent any stages{ - agent{ - docker{ - image 'openjdk:11' - } - } stage("sonar quality check"){ + agent { + docker{ + image 'openjdk:11' + } + } steps{ script{ withSonarQubeEnv(credentialsId: 'sonar-token') { From 59e626159229fab15c2b89ef369e3178be60a7a1 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 20:18:52 +0200 Subject: [PATCH 04/72] added timeout to jenkinsfile --- Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index abb8bb6d..219820d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,13 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } + timeout(time: 1, unit: 'HOURS'){ + def qg = waitForQualityGate() + if(qg.status != 'OK'){ + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } + } } From 9040447d19551dd889a504fc3d5a190f85c605e5 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 20:27:31 +0200 Subject: [PATCH 05/72] added timeout to jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 219820d2..38705001 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(time: 1, unit: 'HOURS'){ + timeout(time: 1, unit: 'HOURS') { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" From d21ee79a1f5be4f94bb56d0ae639a28de405846f Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 20:30:14 +0200 Subject: [PATCH 06/72] added timeout to jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 38705001..99c9a2a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(time: 1, unit: 'HOURS') { + timeout(time: 3, unit: 'HOURS') { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" From 8d990bb31635bef8ca1e84f85a956f5820057c0c Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 20:33:32 +0200 Subject: [PATCH 07/72] added timeout to jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 99c9a2a9..bf5825f8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline{ } timeout(time: 3, unit: 'HOURS') { def qg = waitForQualityGate() - if(qg.status != 'OK'){ + if(qg.status == 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" } } From 99001ed7f833baf349a512d61e9e7c700fd27fa6 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 20:36:49 +0200 Subject: [PATCH 08/72] added timeout to jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf5825f8..4b7b0609 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,10 +14,10 @@ pipeline{ sh './gradlew sonarqube' } timeout(time: 3, unit: 'HOURS') { - def qg = waitForQualityGate() + /*def qg = waitForQualityGate() if(qg.status == 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" - } + }*/ } } From 82cf0ec7ffbc2d079cf8a335a6d91954499fa356 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 9 Oct 2022 20:43:27 +0200 Subject: [PATCH 09/72] added timeout to jenkinsfile --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b7b0609..33a9699a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,11 +13,11 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(time: 3, unit: 'HOURS') { - /*def qg = waitForQualityGate() - if(qg.status == 'OK'){ + timeout(5) { + def qg = waitForQualityGate() + if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" - }*/ + } } } From 7ea6de9f50130d8e8b977db4f9c64dd2d3aabc95 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 10 Oct 2022 15:29:20 +0200 Subject: [PATCH 10/72] added Dockerfile --- Jenkinsfile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 33a9699a..2b6e919f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,15 @@ pipeline{ agent any + environment { + VERSION = "${env.BUILD_ID}" + } stages{ stage("sonar quality check"){ agent { docker{ image 'openjdk:11' } - } + } steps{ script{ withSonarQubeEnv(credentialsId: 'sonar-token') { @@ -24,6 +27,21 @@ pipeline{ } } + stage("docker build & docker push"){ + steps { + script { + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + sh ''' + docker build -t 34.125.93.147:8083/springapp:${VERSION} . + docker login -u admin -p $docker_password 34.125.93.147:8083 + docker push 34.125.93.147:8083/springapp:${VERSION} + docker rmi 34.125.93.147:8083/springapp:${VERSION} + ''' + } + + } + } + } } +} -} \ No newline at end of file From b768f4de8cf5c0504e3535291482881a3c6cce4c Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 10 Oct 2022 15:47:24 +0200 Subject: [PATCH 11/72] added Dockerfile --- Jenkinsfile | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b6e919f..1224281b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,21 +27,6 @@ pipeline{ } } - stage("docker build & docker push"){ - steps { - script { - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - sh ''' - docker build -t 34.125.93.147:8083/springapp:${VERSION} . - docker login -u admin -p $docker_password 34.125.93.147:8083 - docker push 34.125.93.147:8083/springapp:${VERSION} - docker rmi 34.125.93.147:8083/springapp:${VERSION} - ''' - } - - } - } - } } } From c197c9ebd04bd0a6872254591c9a3c3127ac3ac8 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 10 Oct 2022 15:53:33 +0200 Subject: [PATCH 12/72] added Dockerfile --- Jenkinsfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1224281b..14bd41e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,6 +27,20 @@ pipeline{ } } + stage("docker build & docker push"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + sh ''' + docker build -t 34.125.93.147:8083/springapp:${VERSION} . + docker login -u admin -p $docker_password 34.125.93.147:8083 + docker push 34.125.93.147:8083/springapp:${VERSION} + docker rmi 34.125.93.147:8083/springapp:${VERSION} + ''' + } + } + } + } } } From 24700eccf927d309ad162e4b1b409df49403b0b8 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 02:07:39 +0200 Subject: [PATCH 13/72] added Dockerfile --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 14bd41e0..aad3e949 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,5 +42,10 @@ pipeline{ } } } + post { + always { + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; + } + } } From 7d46b77a41421910c8fde0afea82f533f2746b52 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 02:15:33 +0200 Subject: [PATCH 14/72] added Dockerfile --- Jenkinsfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aad3e949..14bd41e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,10 +42,5 @@ pipeline{ } } } - post { - always { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; - } - } } From b2850d770cb83822139ec899f06f102c6b62d58d Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 02:19:48 +0200 Subject: [PATCH 15/72] added Dockerfile --- Jenkinsfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 14bd41e0..ca1fb085 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(5) { + timeout(6) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" @@ -42,5 +42,10 @@ pipeline{ } } } + post { + always { + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; + } + } } From 807c84af0d3b05d6cd102d8816167778386fbc2d Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 05:54:52 +0200 Subject: [PATCH 16/72] added Dockerfile --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ca1fb085..9ea26e38 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,6 +41,16 @@ pipeline{ } } } + + stage("identifying misconfigs using datree in helm charts"){ + steps{ + script{ + dir('kubernetes/'){ + sh 'helm datree test myapp/' + } + } + } + } } post { always { From 138c224896902a1f0994b9bbb650cded09765ba2 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 06:17:06 +0200 Subject: [PATCH 17/72] added Dockerfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ea26e38..0e26a8b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(6) { + timeout(7) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" From 769b1760dac456c4f90899b6a54aa743a65b7333 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 06:20:30 +0200 Subject: [PATCH 18/72] added Dockerfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e26a8b5..98465166 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(7) { + timeout(9) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" From 1b4e08e1c0506ed8b125e2b6b1005c4ff93b3dfe Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 06:23:13 +0200 Subject: [PATCH 19/72] added Dockerfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 98465166..640e06cb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,10 +42,10 @@ pipeline{ } } - stage("identifying misconfigs using datree in helm charts"){ + stage("identifying misconfigs using datree in helm charts") { steps{ - script{ - dir('kubernetes/'){ + script { + dir('kubernetes/') { sh 'helm datree test myapp/' } } From 918018580be3f7ebc39908c7e7122888de2bfbca Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:04:15 +0200 Subject: [PATCH 20/72] added Dockerfile --- Jenkinsfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 640e06cb..fcd615c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(9) { + timeout(5) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" @@ -41,21 +41,23 @@ pipeline{ } } } - - stage("identifying misconfigs using datree in helm charts") { + stage('indentifying misconfigs using datree in helm charts'){ steps{ - script { + script{ + dir('kubernetes/') { + sh 'helm datree test myapp/' + } } } } - } - post { + + } + post { always { mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; } - } } From d01d5163ca2d857348cc333a804c911cf40348f4 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:10:57 +0200 Subject: [PATCH 21/72] added Dockerfile --- Jenkinsfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fcd615c4..ed954280 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,10 +45,8 @@ pipeline{ steps{ script{ - dir('kubernetes/') { - - sh 'helm datree test myapp/' - + dir('kubernetes/') { + sh 'helm datree test myapp/' } } } From f453cca89461ed5fd1908d0b3af3c199fc7e96ef Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:11:57 +0200 Subject: [PATCH 22/72] added Dockerfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed954280..56c86f1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(5) { + timeout(7) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" @@ -49,7 +49,7 @@ pipeline{ sh 'helm datree test myapp/' } } - } + }s } } From 08e6e7df3fe8aa780c11eceaaca59c6cb618ced6 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:14:22 +0200 Subject: [PATCH 23/72] added Dockerfile --- Jenkinsfile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 56c86f1d..10d8f334 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,17 +41,6 @@ pipeline{ } } } - stage('indentifying misconfigs using datree in helm charts'){ - steps{ - script{ - - dir('kubernetes/') { - sh 'helm datree test myapp/' - } - } - }s - } - } post { always { From e321eb0574f054615b5026294b089786c6c5c19d Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:17:51 +0200 Subject: [PATCH 24/72] added Dockerfile --- Jenkinsfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 10d8f334..c83bbeb1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,11 +40,24 @@ pipeline{ } } } + } + stage('indentifying misconfigs using datree in helm charts'){ + steps{ + script{ + + dir('kubernetes/') { + withEnv(['DATREE_TOKEN=GJdx2cP2TCDyUY3EhQKgTc']) { + sh 'helm datree test myapp/' + } + } + } + } } } post { always { mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; } + } } From 48a274bf492977871811dd931ade444e34263219 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:37:57 +0200 Subject: [PATCH 25/72] added Dockerfile --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c83bbeb1..3c1e8380 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,9 +46,7 @@ pipeline{ script{ dir('kubernetes/') { - withEnv(['DATREE_TOKEN=GJdx2cP2TCDyUY3EhQKgTc']) { sh 'helm datree test myapp/' - } } } } From 9f6b7dfa8b802d06afeb6bcd31887c1cffc1cc91 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:43:37 +0200 Subject: [PATCH 26/72] added Dockerfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c1e8380..1438e34c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,10 +41,9 @@ pipeline{ } } } - stage('indentifying misconfigs using datree in helm charts'){ + stage("indentifying misconfigs using datree in helm charts"){ steps{ script{ - dir('kubernetes/') { sh 'helm datree test myapp/' } From d598661b3749191f0e7f076b54cd4d22b2b34b8d Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:50:24 +0200 Subject: [PATCH 27/72] added Dockerfile --- Jenkinsfile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1438e34c..bedad653 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,15 +41,7 @@ pipeline{ } } } - stage("indentifying misconfigs using datree in helm charts"){ - steps{ - script{ - dir('kubernetes/') { - sh 'helm datree test myapp/' - } - } - } - } + } post { always { From 2f8d16fb6dcee85f30c80887a48a4d27687d1edc Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:54:22 +0200 Subject: [PATCH 28/72] added Dockerfile --- Jenkinsfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bedad653..ef2240d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(7) { + timeout(8) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" @@ -41,7 +41,15 @@ pipeline{ } } } - + stage("indentifying misconfigs using datree in helm charts"){ + steps{ + script{ + dir('kubernetes/') { + sh 'helm datree test myapp/' + } + } + } + } } post { always { From 71fcd0f6e7a9c378a4c86251647553b50f94a08b Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 11:57:35 +0200 Subject: [PATCH 29/72] added Dockerfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ef2240d3..a643bb82 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(8) { + timeout(4) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" From 8faed98608535e8f37b35129f18b9f36d1cac832 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 12:09:59 +0200 Subject: [PATCH 30/72] added Dockerfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a643bb82..2adc7eb4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,13 +16,12 @@ pipeline{ sh 'chmod +x gradlew' sh './gradlew sonarqube' } - timeout(4) { + timeout(7) { def qg = waitForQualityGate() if(qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" } } - } } From 6cf1a2675e2238d6f0122714a9c040e46cdd020e Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 12:41:03 +0200 Subject: [PATCH 31/72] added Dockerfile --- gradle.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 gradle.properties diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..03b2e37a --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.warning.mode=all \ No newline at end of file From eb30737d46577fcf6ea2bf87a2ce49f5ccc6fe34 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 15:17:20 +0200 Subject: [PATCH 32/72] added Dockerfile --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2adc7eb4..deb158af 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,11 @@ pipeline{ steps{ script{ dir('kubernetes/') { - sh 'helm datree test myapp/' + + sh ''' + helm plugin install https://github.com/datreeio/helm-datree + helm datree test myapp/ + ''' } } } From 6dbc48a34839e28de509c6cb2ea6ca4e65f5ca36 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 15:43:41 +0200 Subject: [PATCH 33/72] added Dockerfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index deb158af..d9f78813 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,6 @@ pipeline{ dir('kubernetes/') { sh ''' - helm plugin install https://github.com/datreeio/helm-datree helm datree test myapp/ ''' } From 2cad0335133af70a4100b6f6b3016975fbf62c04 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 15:53:17 +0200 Subject: [PATCH 34/72] added Dockerfile --- Jenkinsfile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9f78813..e9e3ef15 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,18 +40,7 @@ pipeline{ } } } - stage("indentifying misconfigs using datree in helm charts"){ - steps{ - script{ - dir('kubernetes/') { - - sh ''' - helm datree test myapp/ - ''' - } - } - } - } + } post { always { From 9f4d5e111c60893a87659ea4afee244adfa830bd Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 15:56:19 +0200 Subject: [PATCH 35/72] added Dockerfile --- Jenkinsfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e9e3ef15..2adc7eb4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,15 @@ pipeline{ } } } - + stage("indentifying misconfigs using datree in helm charts"){ + steps{ + script{ + dir('kubernetes/') { + sh 'helm datree test myapp/' + } + } + } + } } post { always { From 5d7ee183d26ad8c6b0a018d306b18225a4f1c6bb Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 16:35:04 +0200 Subject: [PATCH 36/72] added Dockerfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2adc7eb4..9fa2a86a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,8 +43,10 @@ pipeline{ stage("indentifying misconfigs using datree in helm charts"){ steps{ script{ - dir('kubernetes/') { + dir('kubernetes/') { + withEnv(['DATREE_TOKEN=abd14242-b27a-4b93-b288-628a22413751']) { sh 'helm datree test myapp/' + } } } } From f869450901ce863df0202667b267ebe8b5b58903 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Tue, 11 Oct 2022 17:03:00 +0200 Subject: [PATCH 37/72] added Dockerfile --- kubernetes/myapp/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index a0e99a3a..7da09d77 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -11,6 +11,6 @@ image: tag: IMAGE_TAG service: - type: NodePort + type: LoadBalancer port: 8080 From 32dd425ce10dc17591f9315fef838b39ebaae736 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 14 Oct 2022 20:58:56 +0200 Subject: [PATCH 38/72] added helm push stage --- build.gradle | 5 +++-- gradlew | 0 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index 2b60d6a0..396d9379 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,8 @@ test { sonarqube { properties { - property 'sonar.host.url', 'http://34.125.201.58:9000' - property 'sonar.login', '******' + property 'sonar.host.url', 'http://34.125.1.203:9000' + property 'sonar.login', 'admin' + property 'sonar.password', 'admin' } } diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 0b23c975b70278218a28050b07139b347f4bebf7 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 14 Oct 2022 21:01:59 +0200 Subject: [PATCH 39/72] added helm push stage --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9fa2a86a..652efa85 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,6 +51,21 @@ pipeline{ } } } + stage("pushing the helm charts to nexus"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + dir('kubernetes/') { + sh ''' + helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') + tar -czvf myapp-${helmversion}.tgz myapp/ + curl -u admin:$docker_password http://34.125.93.147/:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v + ''' + } + } + } + } + } } post { always { From 6fe55bce5f099407f7eaba7006bd66351d3b8782 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 14 Oct 2022 21:17:02 +0200 Subject: [PATCH 40/72] added helm push stage --- Jenkinsfile | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 652efa85..9fa2a86a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,21 +51,6 @@ pipeline{ } } } - stage("pushing the helm charts to nexus"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - dir('kubernetes/') { - sh ''' - helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') - tar -czvf myapp-${helmversion}.tgz myapp/ - curl -u admin:$docker_password http://34.125.93.147/:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v - ''' - } - } - } - } - } } post { always { From 66e8e815c25f3f532a39ca88e9ba28bac9d0af1f Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 14 Oct 2022 21:19:41 +0200 Subject: [PATCH 41/72] added helm push stage --- Jenkinsfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9fa2a86a..6dce3e64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,6 +51,22 @@ pipeline{ } } } + + stage("pushing the helm charts to nexus"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + dir('kubernetes/') { + sh ''' + helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') + tar -czvf myapp-${helmversion}.tgz myapp/ + curl -u admin:$docker_password http://34.125.93.147:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v + ''' + } + } + } + } + } } post { always { From 027005aa74bf299c092884182ed233cea2eabaea Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 14 Oct 2022 21:31:14 +0200 Subject: [PATCH 42/72] added helm push stage --- Jenkinsfile | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6dce3e64..9fa2a86a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,22 +51,6 @@ pipeline{ } } } - - stage("pushing the helm charts to nexus"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - dir('kubernetes/') { - sh ''' - helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') - tar -czvf myapp-${helmversion}.tgz myapp/ - curl -u admin:$docker_password http://34.125.93.147:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v - ''' - } - } - } - } - } } post { always { From 3462bdee0ba2f8038f61496c347ca0f29ceb9a23 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 14 Oct 2022 21:34:26 +0200 Subject: [PATCH 43/72] added helm push stage --- Jenkinsfile | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9fa2a86a..c8787a4a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,31 +26,7 @@ pipeline{ } } - stage("docker build & docker push"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - sh ''' - docker build -t 34.125.93.147:8083/springapp:${VERSION} . - docker login -u admin -p $docker_password 34.125.93.147:8083 - docker push 34.125.93.147:8083/springapp:${VERSION} - docker rmi 34.125.93.147:8083/springapp:${VERSION} - ''' - } - } - } - } - stage("indentifying misconfigs using datree in helm charts"){ - steps{ - script{ - dir('kubernetes/') { - withEnv(['DATREE_TOKEN=abd14242-b27a-4b93-b288-628a22413751']) { - sh 'helm datree test myapp/' - } - } - } - } - } + } post { always { From 6348cb7a072f75643b9e2bbb066f9e6ad1a3549b Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 15 Oct 2022 00:00:12 +0200 Subject: [PATCH 44/72] added helm push stage --- Jenkinsfile | 42 +++++++++++++++++++++++++++++++++++++++++- build.gradle | 3 +-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8787a4a..6dce3e64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,7 +26,47 @@ pipeline{ } } - + stage("docker build & docker push"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + sh ''' + docker build -t 34.125.93.147:8083/springapp:${VERSION} . + docker login -u admin -p $docker_password 34.125.93.147:8083 + docker push 34.125.93.147:8083/springapp:${VERSION} + docker rmi 34.125.93.147:8083/springapp:${VERSION} + ''' + } + } + } + } + stage("indentifying misconfigs using datree in helm charts"){ + steps{ + script{ + dir('kubernetes/') { + withEnv(['DATREE_TOKEN=abd14242-b27a-4b93-b288-628a22413751']) { + sh 'helm datree test myapp/' + } + } + } + } + } + + stage("pushing the helm charts to nexus"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + dir('kubernetes/') { + sh ''' + helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') + tar -czvf myapp-${helmversion}.tgz myapp/ + curl -u admin:$docker_password http://34.125.93.147:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v + ''' + } + } + } + } + } } post { always { diff --git a/build.gradle b/build.gradle index 396d9379..99e43ad2 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,6 @@ test { sonarqube { properties { property 'sonar.host.url', 'http://34.125.1.203:9000' - property 'sonar.login', 'admin' - property 'sonar.password', 'admin' + property 'sonar.login', '73c3148c47cc350be96afd217f7a5dde56563563' } } From 314b243339c2d38224fe8a6d2436e4322e3efcec Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 16 Oct 2022 19:56:28 +0200 Subject: [PATCH 45/72] added deploy step --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index a2df42b1..30480d89 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -85,7 +85,7 @@ pipeline{ script{ withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { dir('kubernetes/') { - sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + sh 'helm upgrade --install --set image.repository="34.125.93.147:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' } } } From b83701bbe4dc9483de61b511e44e002b26eb51e2 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 16 Oct 2022 21:09:58 +0200 Subject: [PATCH 46/72] added deploy step --- Jenkinsfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 6dce3e64..be7bc442 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,7 +67,21 @@ pipeline{ } } } + + stage('Deploying application on k8s cluster') { + steps { + script{ + withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { + dir('kubernetes/') { + sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + } + } + } + } + } } + + post { always { mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; From 3f127f6174ec63c51e267a35bb5a6544a3ea0ac8 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sun, 16 Oct 2022 23:02:14 +0200 Subject: [PATCH 47/72] added deploy step --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index be7bc442..e0cc8972 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,11 +67,11 @@ pipeline{ } } } - + stage('Deploying application on k8s cluster') { steps { script{ - withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { + withCredentials([kubeconfigContent(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG_CONTENT')]) { dir('kubernetes/') { sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' } From 8e7ada471f2d00dadbe257868f2931146aa6c184 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 17 Oct 2022 00:28:18 +0200 Subject: [PATCH 48/72] added deploy step --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e0cc8972..22b3228e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,15 +73,13 @@ pipeline{ script{ withCredentials([kubeconfigContent(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG_CONTENT')]) { dir('kubernetes/') { - sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + sh 'helm upgrade --install --set image.repository="34.125.93.147:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' } } } } } } - - post { always { mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2021@gmail.com"; From 9d63f5c89891c8a20b44abe018fbfc51dc75f7c9 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 17 Oct 2022 01:18:13 +0200 Subject: [PATCH 49/72] added deploy step --- kubernetes/myapp/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index 7da09d77..a0e99a3a 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -11,6 +11,6 @@ image: tag: IMAGE_TAG service: - type: LoadBalancer + type: NodePort port: 8080 From 009147ab53ad1d80e95fdddb961a4494b2ff4397 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 17 Oct 2022 01:25:28 +0200 Subject: [PATCH 50/72] added deploy step --- kubernetes/myapp/values.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index a0e99a3a..faf98f6e 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -11,6 +11,5 @@ image: tag: IMAGE_TAG service: - type: NodePort - port: 8080 - + type: LoadBalancer + port: 8080 \ No newline at end of file From ae09ac63cb63762aa9a4436e0bbe316c9239fab3 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 17 Oct 2022 01:45:28 +0200 Subject: [PATCH 51/72] added deploy step --- kubernetes/myapp/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index faf98f6e..bda81673 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 2 +replicaCount: 1 image: repository: IMAGE_NAME From 067b84f032946a94270a063e14de4a1400508af3 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 17 Oct 2022 01:53:20 +0200 Subject: [PATCH 52/72] added deploy step --- kubernetes/myapp/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index bda81673..faf98f6e 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 1 +replicaCount: 2 image: repository: IMAGE_NAME From 6f3701e2e702314d8e3cf02aec9e281a41769ee4 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Thu, 20 Oct 2022 21:27:57 +0200 Subject: [PATCH 53/72] adding credential to sonarqube --- tamagni2002 | 39 +++++++++++++++++++++++++++++++++++++++ tamagni2002.pub | 1 + 2 files changed, 40 insertions(+) create mode 100644 tamagni2002 create mode 100644 tamagni2002.pub diff --git a/tamagni2002 b/tamagni2002 new file mode 100644 index 00000000..2573d30c --- /dev/null +++ b/tamagni2002 @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBrElct7u +8zoL9aH2c9WtTiAAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQCpu9Xxg12T +XFLHmp0wnoWODV9xhgQVZR1AfEZtxoPM1aRBR+aO0U8GyXcDKGRGy2SFhlkuDtxDkVnscu +Ihr0pipTSPuCZbnMbdzAjWE9ZlrGLXEQlm+ZOpi2ELYxxc0ZACLPMCeIRPIvfWM3HaVKQA +vj1X7YYYvz5s2Q2Xp9wV/uKlED47eWVZAzZilcPxRSjBoxWdbaTGsLXdB6EAxvoU4JVb06 +1aat5pok9LbOJrL6lATFfSviT11rrWruNPdPr2MVl56++VVtXFTmfTgXfBvK0N/1M1x0kD +Gheg8ugxFLpSIvldCWwi2A9e+13h2hbjZuztnYg71XsJEPIQZIzr+MNqGyxXZ51PSs08t1 +/AbCGavdppVjMeTLqO22flT+X5bIgGY+e6IOG7RrOLv7W2by2RycRoTRjRvS3CgLd3yGpf +e3wVxmhg9h+kEESn6YItmBnp6YSyF7qSlZcGTs3rwKceJyaYbK6Y361FOOOP6CWz96uRAZ +fd/sTEeL74lmEAAAWQOnXiu+1txINCOq0L0D0S+uEHAkX1b3xtv1PzMXGMH4OX4svVKQMC +/RxadlN0+SDXDhcPfc1NNLl9S+8fP8zCLLINSJ1Qe2S5AW7PEWFiVviolrkiZGHrMxrlJn +YYYCA7czJGKF5GKRemJ2LcEbNczrMNjc87YNVCN3HRGPWsEVe7C/pRsl4ztJfJbDDiO9ox +dZOaGGOJTXF7sAwjR0Zk55EEI3ic2I7ewCK4XujK0sI+o1M8rMY7YzyEa9FU5hWE03MQ4/ +LAwUA5qc6u3njVFTOT8AA+aLB2bQd2XBhXWICJRaLY8+p3O5d08dRyeJkxvw/aiPt7Y0Ml +g/wTMraj7/kwqPgE4//PXtk8Z8WLtaVGmvfviyj/sEWSyTugAj/hyC4Y8o0lylEg2QBBDR +E7nub9U5XGriYYcGjXF88yf7PC5avzSAAU+YPjIP6xb5dV7ccGmF3hh+a3c59ZmSNTSSMF +Tz6XFL02MnTuH5xUaM5BwrrfDA+cBVYD8KuisnetHQ3lcangpGNL9JsZU3xn3X8qbOGAA+ +6SXSjWRSpiOo/djKns1ndoTFRWKjq/VpiraZlPQ3BYjKAe4rCD2rvxnr4Lv5F9clI5D6sC +49TnupNJdNrPyBJooF0edL3ecqyTHmkE2vDRuedSgXYv2GRcqXv9Zqx/CtfBKKS5P3dO5f +wV8nXq2x4Uf28KJdCMAO+mPOWMItuwiiqbl2qkR/uNlV1OhOnqiMf6PquHmcMRE+6Pwg4x +cCrKhw5kWRrQJmDhqzIppCZYpcXBfK6annoUvafeve1UpQW3l0ngdfo4pXvEveYboJNJFA +7JKAc2KnwR1mXBn0wF5JA4Q/rmFr5yfh3IYOQdLQYfILZx1x6OV+alTkZKzLoviO0DdJao +nZPMY2EErV7btRa4Nvv7m+rBqE7INPHWwjtHT7JlcNL5BMna8kmGPW7bUssKiBS327me41 +zq5jLRLL5zH/0pfgp9OE22MCndYdcxCtdxnJv2KcMEuPvOdz1QdmIOqQr4arLqO9KkkOKQ +EiwWePAcrQiIbPBvfvK7PV7xrouP1clfGH3H9CWsSHW6rQq2/UZvj+7q8N6Jt2ifDmL73n +ujADquC5JTnt6hKuYz3dwtebaNHjM1q3lNKKQN7X0bjepZr9Lcj1maL3lqArhT4UWzOPvb +oCnpTG+vbHza20UvTWfjl5Hb2pw0TBpOw9mEBPmlNb/AhuzSLZT0k4Q/hsxXfKCADB+Fqa +LJO5G3I80gYxaexNH17nru8AC0YspilnBGx+lW/rYkk2+JWX0BWJmNMizxue+KMNraP1o8 +PS+wKxJnI0bVx2qyUVN4oRssbp9UxrRoSsvRDIipIgr9ZH69JwBoYWTSjKGRtGu7o3IAf8 +1+X7Tfn5qGN1vUuUaZ+pJJX/H2uLN/guERpaOC+05D0tq2rZeeMGy7sh3OVE8OIrvSAsw5 +X2riXukjgKpKsgIHLNQDaJG4lY7Ml8LsO+KoTLAAEjtls4TBHVdCpQb7JipZEpLOSQxpNc +eEwQsUoQeKzUO6xXUtlCyVwt0x2muJsKe8/R943U3CEfktUWOWyOpJe28O/4S++FY87GWC +JSv0lhFxBttZWcEoCmdPd//i/+PVHUbw30ELjAby2CzvXd+OOpiS2DxAvAo/vv7NKn5Zbw +x+r443nHUKJSuClGm18nKv9I/uKWgDxJ+W9l4280uWO5X2a7M4Si78xb/fFTC4WDn6azIJ +0BS7eRDjBn9Xv0BFz5Kr+HWryDA7F2/J7EqN8NpHs3nLXnCxsfqWforPKjdBqc0bABDs9R +qvGUFhjxLej5fdgFjgOBEwS3/aM+mCUGyRRobp8ZXxh4S0rsPbEQerNHPeDWbHPE59rob9 +SW/krR1wNa7Tye9dDq56RXXmHGw= +-----END OPENSSH PRIVATE KEY----- diff --git a/tamagni2002.pub b/tamagni2002.pub new file mode 100644 index 00000000..7d283a9f --- /dev/null +++ b/tamagni2002.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCpu9Xxg12TXFLHmp0wnoWODV9xhgQVZR1AfEZtxoPM1aRBR+aO0U8GyXcDKGRGy2SFhlkuDtxDkVnscuIhr0pipTSPuCZbnMbdzAjWE9ZlrGLXEQlm+ZOpi2ELYxxc0ZACLPMCeIRPIvfWM3HaVKQAvj1X7YYYvz5s2Q2Xp9wV/uKlED47eWVZAzZilcPxRSjBoxWdbaTGsLXdB6EAxvoU4JVb061aat5pok9LbOJrL6lATFfSviT11rrWruNPdPr2MVl56++VVtXFTmfTgXfBvK0N/1M1x0kDGheg8ugxFLpSIvldCWwi2A9e+13h2hbjZuztnYg71XsJEPIQZIzr+MNqGyxXZ51PSs08t1/AbCGavdppVjMeTLqO22flT+X5bIgGY+e6IOG7RrOLv7W2by2RycRoTRjRvS3CgLd3yGpfe3wVxmhg9h+kEESn6YItmBnp6YSyF7qSlZcGTs3rwKceJyaYbK6Y361FOOOP6CWz96uRAZfd/sTEeL74lmE= root@ernest From a79d73b29fa5c4b7f706dbfee6441ce894280d2e Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Thu, 20 Oct 2022 21:59:52 +0200 Subject: [PATCH 54/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 22b3228e..d1e7584e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline{ script{ withSonarQubeEnv(credentialsId: 'sonar-token') { sh 'chmod +x gradlew' - sh './gradlew sonarqube' + sh './gradlew sonarqube --warning-mode fail --stacktrace' } timeout(7) { def qg = waitForQualityGate() From 9949ccdc5e88dde4f232d95568302f5e5a5f56f7 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Thu, 20 Oct 2022 22:21:33 +0200 Subject: [PATCH 55/72] Test --- Jenkinsfile | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d1e7584e..0314e240 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,18 +67,6 @@ pipeline{ } } } - - stage('Deploying application on k8s cluster') { - steps { - script{ - withCredentials([kubeconfigContent(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG_CONTENT')]) { - dir('kubernetes/') { - sh 'helm upgrade --install --set image.repository="34.125.93.147:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' - } - } - } - } - } } post { always { From 2852aa019293eae37dda727a4ceff09054434a12 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Thu, 20 Oct 2022 22:23:50 +0200 Subject: [PATCH 56/72] Test --- Jenkinsfile | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0314e240..1c401453 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,47 +26,7 @@ pipeline{ } } - stage("docker build & docker push"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - sh ''' - docker build -t 34.125.93.147:8083/springapp:${VERSION} . - docker login -u admin -p $docker_password 34.125.93.147:8083 - docker push 34.125.93.147:8083/springapp:${VERSION} - docker rmi 34.125.93.147:8083/springapp:${VERSION} - ''' - } - } - } - } - stage("indentifying misconfigs using datree in helm charts"){ - steps{ - script{ - dir('kubernetes/') { - withEnv(['DATREE_TOKEN=abd14242-b27a-4b93-b288-628a22413751']) { - sh 'helm datree test myapp/' - } - } - } - } - } - - stage("pushing the helm charts to nexus"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - dir('kubernetes/') { - sh ''' - helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') - tar -czvf myapp-${helmversion}.tgz myapp/ - curl -u admin:$docker_password http://34.125.93.147:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v - ''' - } - } - } - } - } + } post { always { From 17ae9da4422c2c63eda4d7f53e71bb6ae5318392 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 21 Oct 2022 00:11:21 +0200 Subject: [PATCH 57/72] Test --- Jenkinsfile | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1c401453..d1e7584e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,7 +26,59 @@ pipeline{ } } - + stage("docker build & docker push"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + sh ''' + docker build -t 34.125.93.147:8083/springapp:${VERSION} . + docker login -u admin -p $docker_password 34.125.93.147:8083 + docker push 34.125.93.147:8083/springapp:${VERSION} + docker rmi 34.125.93.147:8083/springapp:${VERSION} + ''' + } + } + } + } + stage("indentifying misconfigs using datree in helm charts"){ + steps{ + script{ + dir('kubernetes/') { + withEnv(['DATREE_TOKEN=abd14242-b27a-4b93-b288-628a22413751']) { + sh 'helm datree test myapp/' + } + } + } + } + } + + stage("pushing the helm charts to nexus"){ + steps{ + script{ + withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { + dir('kubernetes/') { + sh ''' + helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') + tar -czvf myapp-${helmversion}.tgz myapp/ + curl -u admin:$docker_password http://34.125.93.147:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v + ''' + } + } + } + } + } + + stage('Deploying application on k8s cluster') { + steps { + script{ + withCredentials([kubeconfigContent(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG_CONTENT')]) { + dir('kubernetes/') { + sh 'helm upgrade --install --set image.repository="34.125.93.147:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + } + } + } + } + } } post { always { From 7005ee8517cf187d1991930229fac9bb03cc8b10 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 21 Oct 2022 00:40:29 +0200 Subject: [PATCH 58/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d1e7584e..22b3228e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline{ script{ withSonarQubeEnv(credentialsId: 'sonar-token') { sh 'chmod +x gradlew' - sh './gradlew sonarqube --warning-mode fail --stacktrace' + sh './gradlew sonarqube' } timeout(7) { def qg = waitForQualityGate() From 4158ad405aeb594c39dca7a5cc78d976727631b4 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 21 Oct 2022 15:29:36 +0200 Subject: [PATCH 59/72] Test --- kubernetes/myapp/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index faf98f6e..893a6d0f 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -11,5 +11,5 @@ image: tag: IMAGE_TAG service: - type: LoadBalancer + type: NodePort port: 8080 \ No newline at end of file From 55bd6d29f68c4230c31c744f93902ca4c41750a4 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Fri, 21 Oct 2022 22:06:08 +0200 Subject: [PATCH 60/72] Test --- kubernetes/myapp/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml index 893a6d0f..faf98f6e 100644 --- a/kubernetes/myapp/values.yaml +++ b/kubernetes/myapp/values.yaml @@ -11,5 +11,5 @@ image: tag: IMAGE_TAG service: - type: NodePort + type: LoadBalancer port: 8080 \ No newline at end of file From 1703fc5bf40e8b7ab3ec420d6c017104b89ef785 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 02:51:26 +0200 Subject: [PATCH 61/72] Test --- Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 22b3228e..a61a69db 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,6 +68,17 @@ pipeline{ } } + stage('manual approval'){ + steps{ + script{ + timeout(10) { + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + } + } + } + } + stage('Deploying application on k8s cluster') { steps { script{ @@ -79,6 +90,17 @@ pipeline{ } } } + + stage('verifying app deployment'){ + steps{ + script{ + withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { + sh 'kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080' + + } + } + } + } } post { always { From cd07d5973c484f1913a87bd07af35f5cefcb736b Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 02:56:00 +0200 Subject: [PATCH 62/72] Test --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a61a69db..a5129451 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -90,8 +90,8 @@ pipeline{ } } } - - stage('verifying app deployment'){ + + stage('verifying app deployment'){ steps{ script{ withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { From 4be87a14419992deca2424fa8114c92a4fb4c38f Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 15:13:45 +0200 Subject: [PATCH 63/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a5129451..d38a7bee 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline{ steps{ script{ timeout(10) { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr" input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') } } From 492394994bb6b1b4b7e9982dbc9fa1ef036deacd Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 15:38:09 +0200 Subject: [PATCH 64/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d38a7bee..68158230 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,7 +73,7 @@ pipeline{ script{ timeout(10) { mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr" - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + //input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') } } } From fe5656576437e16f9d647731aeaf627725939167 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 16:02:22 +0200 Subject: [PATCH 65/72] Test --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 68158230..3c875ae5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,8 +72,9 @@ pipeline{ steps{ script{ timeout(10) { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr" - //input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; + } } } From 4c0618b8e92f1581656a740d8607798908cfa682 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 16:10:32 +0200 Subject: [PATCH 66/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c875ae5..9a6b571c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,7 +73,7 @@ pipeline{ script{ timeout(10) { input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; + //mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; } } From 74325cfe6f6b3aa9bad16dab3969f389f276fa97 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 16:20:50 +0200 Subject: [PATCH 67/72] Test --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9a6b571c..f09a0e9f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,8 +73,6 @@ pipeline{ script{ timeout(10) { input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') - //mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; - } } } From cd1ba9e80e1efedacbdc348e5295833fb200356b Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 16:27:57 +0200 Subject: [PATCH 68/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f09a0e9f..89922c45 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline{ steps{ script{ timeout(10) { - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy'); } } } From 3c0d7298840e4e1148d1dcfa084971be184e6d35 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 16:38:45 +0200 Subject: [PATCH 69/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 89922c45..e94b111a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline{ steps{ script{ timeout(10) { - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy'); + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: "Deploy"); } } } From db299f3e38f27a1c2d2572da64e2148fe39cd3bd Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 16:51:02 +0200 Subject: [PATCH 70/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e94b111a..bcbe8167 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline{ steps{ script{ timeout(10) { - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: "Deploy"); + input(message: "Deploy ${params.project_name}?", ok: "Deploy") } } } From aa0cbdceee29eab18c3bcc43cc07419093b3433d Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Sat, 22 Oct 2022 17:07:00 +0200 Subject: [PATCH 71/72] Test --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index bcbe8167..6567c07a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,8 @@ pipeline{ steps{ script{ timeout(10) { - input(message: "Deploy ${params.project_name}?", ok: "Deploy") + mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "tamagni2002@yahoo.fr"; + input(message: "Deploy ${params.project_name}?", ok: "Deploy") } } } From 6283da4b31b233c30d1f69327c50b18f06e0c1a0 Mon Sep 17 00:00:00 2001 From: Ernest Tamagni Date: Mon, 24 Oct 2022 04:03:23 +0200 Subject: [PATCH 72/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6567c07a..eb728f42 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -79,7 +79,7 @@ pipeline{ } } - stage('Deploying application on k8s cluster') { + stage('Deploying application xxx on k8s cluster') { steps { script{ withCredentials([kubeconfigContent(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG_CONTENT')]) {