From 22e8ccf11f61b8f42908bd3a65388d4721a7f3e1 Mon Sep 17 00:00:00 2001 From: culture Date: Tue, 28 Mar 2023 16:03:25 -0600 Subject: [PATCH 1/2] Removing unwanted files --- Dockerfile | 11 - Jenkinsfile | 112 -------- JenkinsfileFilter | 23 -- JenkinsfileSharedLibrary | 26 -- Jenkinsfile_demo | 96 ------- 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 healthcheck.sh | 10 - kube.yaml | 81 ------ kubernetes/myapp/.helmignore | 23 -- kubernetes/myapp/Chart.yaml | 24 -- kubernetes/myapp/templates/_helpers.tpl | 62 ----- kubernetes/myapp/templates/deployment.yaml | 54 ---- kubernetes/myapp/templates/service.yaml | 15 -- kubernetes/myapp/values.yaml | 16 -- sonar-project.properties | 3 - 20 files changed, 244 insertions(+), 556 deletions(-) delete mode 100644 Dockerfile delete mode 100644 Jenkinsfile delete mode 100644 JenkinsfileFilter delete mode 100644 JenkinsfileSharedLibrary delete mode 100644 Jenkinsfile_demo 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 delete mode 100644 healthcheck.sh delete mode 100644 kube.yaml delete mode 100644 kubernetes/myapp/.helmignore delete mode 100644 kubernetes/myapp/Chart.yaml delete mode 100644 kubernetes/myapp/templates/_helpers.tpl delete mode 100644 kubernetes/myapp/templates/deployment.yaml delete mode 100644 kubernetes/myapp/templates/service.yaml delete mode 100644 kubernetes/myapp/values.yaml delete mode 100644 sonar-project.properties diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f9c20863..00000000 --- a/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# this is multi stage -FROM openjdk:11 as base -WORKDIR /app -COPY . . -RUN chmod +x gradlew -RUN ./gradlew build - -FROM tomcat:9 -WORKDIR webapps -COPY --from=base /app/build/libs/sampleWeb-0.0.1-SNAPSHOT.war . -RUN rm -rf ROOT && mv sampleWeb-0.0.1-SNAPSHOT.war ROOT.war diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index a2df42b1..00000000 --- a/Jenkinsfile +++ /dev/null @@ -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"; - } - } -} diff --git a/JenkinsfileFilter b/JenkinsfileFilter deleted file mode 100644 index 1c68c70e..00000000 --- a/JenkinsfileFilter +++ /dev/null @@ -1,23 +0,0 @@ -pipeline { - agent { - docker { - image 'openjdk:11' - } - } - - stages { - stage('Building') { - steps { - sh 'chmod +x gradlew' - sh "./gradlew build | tee output.log" - } - } - stage('Monitoring the logs') { - steps { - script { - sh '! grep "Task" output.log' - } - } - } - } -} diff --git a/JenkinsfileSharedLibrary b/JenkinsfileSharedLibrary deleted file mode 100644 index ebccd0ae..00000000 --- a/JenkinsfileSharedLibrary +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env groovy - -@Library('shared-library@master') _ //master or whatever branch - - -pipeline { - agent { - docker { - image 'openjdk:11' - } - } - - stages { - stage('Building') { - steps { - sh 'chmod +x gradlew' - sh "./gradlew build " - } - } - stage ('Check logs') { - steps { - filterLogs ('Task', 3) - } - } - } -} diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo deleted file mode 100644 index 3db03236..00000000 --- a/Jenkinsfile_demo +++ /dev/null @@ -1,96 +0,0 @@ -pipeline{ - agent any - environment{ - VERSION = "${env.BUILD_ID}" - } - stages{ - stage("sonar qube analysis"){ - agent{ - docker { - image 'openjdk:11' - } - } - steps{ - script{ - withSonarQubeEnv(credentialsId: 'sonar-token') { - sh ''' - chmod +x gradlew - ./gradlew sonarqube - ''' - } - - timeout(5) { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } - } - } - } - - stage("building docker image and pushing it to nexus"){ - steps{ - script{ - - withCredentials([string(credentialsId: 'nexus_pass', variable: 'docker_pass')]) { - sh ''' - - docker build -t 35.188.44.251:8083/springapp:${VERSION} . - docker login -u admin -p $docker_pass 35.188.44.251:8083 - docker push 35.188.44.251:8083/springapp:${VERSION} - docker rmi 35.188.44.251:8083/springapp:${VERSION} - docker image prune -f - ''' - } - } - } - } - - - 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: "issamraz1993@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="35.188.44.251:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' - } - } - } - } - } - - - stage('verifying app deployment'){ - steps{ - script{ - withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { - sh ''' - - chmod +x healthcheck.sh - ./healthcheck.sh - ''' - - } - } - } - } - - - } - -} 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/healthcheck.sh b/healthcheck.sh deleted file mode 100644 index c0244ee6..00000000 --- a/healthcheck.sh +++ /dev/null @@ -1,10 +0,0 @@ -echo "executing health check it might take a while" -sleep 120 -kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080 - -if [ $? -eq 0 ] -then - echo "The Deployment is success...Application Health is Good" -else - helm rollback myjavaapp -fi diff --git a/kube.yaml b/kube.yaml deleted file mode 100644 index d0058111..00000000 --- a/kube.yaml +++ /dev/null @@ -1,81 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: myapp - labels: - helm.sh/chart: myapp-0.2.0 - app.kubernetes.io/name: myapp - app.kubernetes.io/instance: myapp - app.kubernetes.io/version: "1.16.0" - app.kubernetes.io/managed-by: Helm -spec: - type: NodePort - ports: - - port: 8080 - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: myapp - app.kubernetes.io/instance: myapp ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: myapp - labels: - helm.sh/chart: myapp-0.2.0 - app.kubernetes.io/name: myapp - app.kubernetes.io/instance: myapp - app.kubernetes.io/version: "1.16.0" - app.kubernetes.io/managed-by: Helm -spec: - replicas: 2 - selector: - matchLabels: - app.kubernetes.io/name: myapp - app.kubernetes.io/instance: myapp - template: - metadata: - labels: - app.kubernetes.io/name: myapp - app.kubernetes.io/instance: myapp - spec: - imagePullSecrets: - - name: registry-secret - containers: - - name: myapp - image: imagename - command: ["/bin/sh"] - args: ["-c","sh /usr/local/tomcat/bin/startup.sh;while true; do echo hello; sleep 10;done"] - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - initialDelaySeconds: 60 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 3 - timeoutSeconds: 10 - readinessProbe: - httpGet: - path: / - port: http - initialDelaySeconds: 60 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 3 - timeoutSeconds: 10 - resources: - requests: - memory: 0.25Gi - cpu: 0.5 - limits: - memory: 0.25Gi - cpu: 0.5 diff --git a/kubernetes/myapp/.helmignore b/kubernetes/myapp/.helmignore deleted file mode 100644 index 0e8a0eb3..00000000 --- a/kubernetes/myapp/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/kubernetes/myapp/Chart.yaml b/kubernetes/myapp/Chart.yaml deleted file mode 100644 index 3dd48d0b..00000000 --- a/kubernetes/myapp/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: myapp -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/kubernetes/myapp/templates/_helpers.tpl b/kubernetes/myapp/templates/_helpers.tpl deleted file mode 100644 index 73b52b22..00000000 --- a/kubernetes/myapp/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "myapp.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "myapp.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "myapp.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "myapp.labels" -}} -helm.sh/chart: {{ include "myapp.chart" . }} -{{ include "myapp.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "myapp.selectorLabels" -}} -app.kubernetes.io/name: {{ include "myapp.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "myapp.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "myapp.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/kubernetes/myapp/templates/deployment.yaml b/kubernetes/myapp/templates/deployment.yaml deleted file mode 100644 index 2713adae..00000000 --- a/kubernetes/myapp/templates/deployment.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "myapp.fullname" . }} - labels: - {{- include "myapp.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "myapp.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "myapp.selectorLabels" . | nindent 8 }} - spec: - imagePullSecrets: - - name: registry-secret - containers: - - name: {{ .Chart.Name }} - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} - command: ["/bin/sh"] - args: ["-c","sh /usr/local/tomcat/bin/startup.sh;while true; do echo hello; sleep 10;done"] - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - initialDelaySeconds: 60 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 3 - timeoutSeconds: 10 - readinessProbe: - httpGet: - path: / - port: http - initialDelaySeconds: 60 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 3 - timeoutSeconds: 10 - resources: - requests: - memory: 0.25Gi - cpu: 0.5 - limits: - memory: 0.25Gi - cpu: 0.5 - diff --git a/kubernetes/myapp/templates/service.yaml b/kubernetes/myapp/templates/service.yaml deleted file mode 100644 index 61b409d5..00000000 --- a/kubernetes/myapp/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "myapp.fullname" . }} - labels: - {{- include "myapp.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "myapp.selectorLabels" . | nindent 4 }} diff --git a/kubernetes/myapp/values.yaml b/kubernetes/myapp/values.yaml deleted file mode 100644 index a0e99a3a..00000000 --- a/kubernetes/myapp/values.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Default values for myapp. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 2 - -image: - repository: IMAGE_NAME - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: IMAGE_TAG - -service: - type: NodePort - port: 8080 - diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 3f7e5334..00000000 --- a/sonar-project.properties +++ /dev/null @@ -1,3 +0,0 @@ -sonar.projectKey=CICD_Java_gradle_application -sonar.java.binaries=. -sonar.exclusions=build/** From 7576f9baa0b62da53bd3173bdae23c5411534e20 Mon Sep 17 00:00:00 2001 From: culture Date: Tue, 28 Mar 2023 16:33:46 -0600 Subject: [PATCH 2/2] take out files --- .github/workflows/ci.yml | 44 ---- .github/workflows/cicd.yml | 84 ------ bin/main/application.properties | 1 - .../example/controller/HomeController.class | Bin 583 -> 0 bytes .../example/demo/SampleWebApplication.class | Bin 718 -> 0 bytes .../com/example/demo/ServletInitializer.class | Bin 890 -> 0 bytes bin/main/templates/index.html | 243 ------------------ .../demo/SampleWebApplicationTests.class | Bin 546 -> 0 bytes 8 files changed, 372 deletions(-) delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/cicd.yml delete mode 100644 bin/main/application.properties delete mode 100644 bin/main/com/example/controller/HomeController.class delete mode 100644 bin/main/com/example/demo/SampleWebApplication.class delete mode 100644 bin/main/com/example/demo/ServletInitializer.class delete mode 100644 bin/main/templates/index.html delete mode 100644 bin/test/com/example/demo/SampleWebApplicationTests.class diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f02131ce..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Java CI with Gradle - -on: - pull_request: - branches: [ main ] - -env: - DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - name: SonarQube Quality Gate check - uses: sonarsource/sonarqube-quality-gate-action@master - # Force to fail step after specific time - timeout-minutes: 5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Install Datree - run: curl https://get.datree.io | /bin/bash - - - name: Run Datree's policy check - run: datree test kube.yaml - - diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml deleted file mode 100644 index d6773d69..00000000 --- a/.github/workflows/cicd.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Java CICD with Gradle - -on: - push: - branches: [ main ] - -env: - DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} - KUBECONFIG: /home/alerts_deekshith/kubeconfig/config_now - -jobs: - build: - - runs-on: self-hosted - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - name: SonarQube Quality Gate check - uses: sonarsource/sonarqube-quality-gate-action@master - # Force to fail step after specific time - timeout-minutes: 5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Install Datree - run: curl https://get.datree.io | /bin/bash - - - name: Run Datree's policy check - run: datree test kube.yaml - - - name: Login to Nexus registy - uses: docker/login-action@v1 - with: - registry: 34.125.31.157:8083 - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: docker build & docker push - run: | - docker build -t 34.125.31.157:8083/javaapp:${{ github.run_number }} . - docker push 34.125.31.157:8083/javaapp:${{ github.run_number }} - docker rmi 34.125.31.157:8083/javaapp:${{ github.run_number }} - - - name: deploying manifest file on k8s cluster - run: | - sed -i "s;imagename;34.125.31.157:8083/javaapp:${{ github.run_number }};g" kube.yaml - kubectl apply -f kube.yaml - sleep 30 - kubectl get po - - - name: verification - run: | - sleep 60 - kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myapp:8080 - - - name: Send email - if: always() - uses: dawidd6/action-send-mail@v2 - with: - server_address: smtp.gmail.com - server_port: 465 - username: ${{ secrets.EMAIL_USERNAME }} - password: ${{ secrets.EMAIL_PASSWORD }} - subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }} - # email body as text - body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }} - # comma-separated string, send email to - to: deekshith.snsep@gmail.com - # from email name - from: deekshith.snsep@gmail.com diff --git a/bin/main/application.properties b/bin/main/application.properties deleted file mode 100644 index 8b137891..00000000 --- a/bin/main/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bin/main/com/example/controller/HomeController.class b/bin/main/com/example/controller/HomeController.class deleted file mode 100644 index f89b6354f5da208d64c0661de6eb8136e9866a67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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 diff --git a/bin/main/com/example/demo/SampleWebApplication.class b/bin/main/com/example/demo/SampleWebApplication.class deleted file mode 100644 index ae4f25be88815cef3f40bcca6eadea655e618d3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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@ diff --git a/bin/main/com/example/demo/ServletInitializer.class b/bin/main/com/example/demo/ServletInitializer.class deleted file mode 100644 index 4699b6aee4e04cd4ca33b81e23682f2bbde148da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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 diff --git a/bin/main/templates/index.html b/bin/main/templates/index.html deleted file mode 100644 index 414eacf6..00000000 --- a/bin/main/templates/index.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - 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 deleted file mode 100644 index 9ff8277d9bbc752f26178705cd7e58b9be398b2d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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