From 62bff1bf5b3a120cda8a34d44ec6e8454c4b761c Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:15:50 +0530 Subject: [PATCH 01/55] added ci workflow --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2d2c1d43 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + pull_request: + branches: [ main ] + +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 From c56fbcb5a0cfa0d9e65ef683f7d89708e2048776 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:16:50 +0530 Subject: [PATCH 02/55] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e6c19db0..a7e563e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# this is multi stage dockerfiles FROM openjdk:11 as base WORKDIR /app COPY . . @@ -7,4 +8,4 @@ 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 \ No newline at end of file +RUN rm -rf ROOT && mv sampleWeb-0.0.1-SNAPSHOT.war ROOT.war From 73e2d3ca698067ed32618374048377e5e95d8454 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:22:19 +0530 Subject: [PATCH 03/55] Update ci.yml --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d2c1d43..54c5f149 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,3 +24,14 @@ jobs: 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 }} From 1b107536ae0028fab6d670b0a33b56ed2d100ec1 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:26:23 +0530 Subject: [PATCH 04/55] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a7e563e8..f9c20863 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# this is multi stage dockerfiles +# this is multi stage FROM openjdk:11 as base WORKDIR /app COPY . . From f3c1472516c993272bc7c75f28ea139067e717f1 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:28:57 +0530 Subject: [PATCH 05/55] Create sonar-project.properties --- sonar-project.properties | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..3f7e5334 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,3 @@ +sonar.projectKey=CICD_Java_gradle_application +sonar.java.binaries=. +sonar.exclusions=build/** From 59dd6e22d2a02d565194a450e433606602d2d91f Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:31:12 +0530 Subject: [PATCH 06/55] Create kube.yaml --- kube.yaml | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 kube.yaml diff --git a/kube.yaml b/kube.yaml new file mode 100644 index 00000000..ff04a61e --- /dev/null +++ b/kube.yaml @@ -0,0 +1,83 @@ +--- +# Source: myapp/templates/service.yaml +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 +--- +# Source: myapp/templates/deployment.yaml +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 From c2a0753763179f811cec22ec34538b875904e1c2 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:32:29 +0530 Subject: [PATCH 07/55] Update ci.yml --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54c5f149..aff5ec04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,3 +35,8 @@ jobs: 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 ~/.datree/k8s-demo.yaml From 71774b111f2873fda89e60c14a1fac4eb5857f4f Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:33:23 +0530 Subject: [PATCH 08/55] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aff5ec04..55bfcbab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,4 +39,4 @@ jobs: run: curl https://get.datree.io | /bin/bash - name: Run Datree's policy check - run: datree test ~/.datree/k8s-demo.yaml + run: datree test kube.yaml From 8437a1f5279aeee3763c2120684a20908d81f6c0 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:33:42 +0530 Subject: [PATCH 09/55] Update kube.yaml --- kube.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/kube.yaml b/kube.yaml index ff04a61e..25a98905 100644 --- a/kube.yaml +++ b/kube.yaml @@ -1,5 +1,4 @@ --- -# Source: myapp/templates/service.yaml apiVersion: v1 kind: Service metadata: From a88a0039d936ed4d41cbe1237037c235c0c2d34e Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:41:06 +0530 Subject: [PATCH 10/55] Update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55bfcbab..3dbd6848 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,9 @@ on: pull_request: branches: [ main ] +env: + DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} + jobs: build: From e865b4d7be1024679a6db21a4aa492c7674d2b53 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 07:41:32 +0530 Subject: [PATCH 11/55] Update kube.yaml --- kube.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/kube.yaml b/kube.yaml index 25a98905..d0058111 100644 --- a/kube.yaml +++ b/kube.yaml @@ -20,7 +20,6 @@ spec: app.kubernetes.io/name: myapp app.kubernetes.io/instance: myapp --- -# Source: myapp/templates/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: From 70f1cabc77d208253ba9afe7f4832a6efa5be9c1 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 08:54:15 +0530 Subject: [PATCH 12/55] Delete ci.yml --- .github/workflows/ci.yml | 45 ---------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 3dbd6848..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -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 From 797b13f6fc0b6a010b70d4f15b104a6d27ff64ad Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 10:06:40 +0530 Subject: [PATCH 13/55] Create ci.yml --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2d2c1d43 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + pull_request: + branches: [ main ] + +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 From ed03cba9d58aec3ada0d2cb7d5e8a76bf3c497b5 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 5 Nov 2021 10:08:19 +0530 Subject: [PATCH 14/55] Delete .github/workflows directory --- .github/workflows/ci.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 2d2c1d43..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - pull_request: - branches: [ main ] - -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 From 1899f139e15264c136097efb91fa270c2ebad9cf Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 10 Nov 2021 18:01:11 +0530 Subject: [PATCH 15/55] Create ci.yml --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..9235cdb8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: Java CI with Gradle + +on: + pull_request: + branches: [ main ] + +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 From a347937684737791cc0f8dc05df6e974a90d18f6 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 10 Nov 2021 18:12:47 +0530 Subject: [PATCH 16/55] Update ci.yml --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9235cdb8..5e99a7ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,14 @@ jobs: 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 }} From 8ee5a1c2ba5d120a3af629027ef31b17b55b0d30 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 10 Nov 2021 18:17:24 +0530 Subject: [PATCH 17/55] Update ci.yml --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e99a7ea..718f6fed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,3 +32,8 @@ jobs: 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 From c00b73e7812d8e11d2c195f05aa752d01f84b885 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 10 Nov 2021 18:25:10 +0530 Subject: [PATCH 18/55] Update ci.yml --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 718f6fed..f02131ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,9 @@ name: Java CI with Gradle on: pull_request: branches: [ main ] + +env: + DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} jobs: build: @@ -37,3 +40,5 @@ jobs: - name: Run Datree's policy check run: datree test kube.yaml + + From b4918f2fdaa81645f07c47f677ed2b4906006095 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 08:28:35 +0530 Subject: [PATCH 19/55] Create cicd.yaml --- .github/workflows/cicd.yaml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/cicd.yaml diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/.github/workflows/cicd.yaml @@ -0,0 +1 @@ + From 47a7623b10d6ce865ba89a36895f4fa3e0a0e9f2 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 08:35:17 +0530 Subject: [PATCH 20/55] Delete cicd.yaml --- .github/workflows/cicd.yaml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/workflows/cicd.yaml diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml deleted file mode 100644 index 8b137891..00000000 --- a/.github/workflows/cicd.yaml +++ /dev/null @@ -1 +0,0 @@ - From bb61be587741fef785c54772b85c982b3caca726 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 08:40:21 +0530 Subject: [PATCH 21/55] Create cicd.yml --- .github/workflows/cicd.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/cicd.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1 @@ + From d8a7eb8001e432725a59a123e7b8a4f7b50a8cf1 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 08:48:44 +0530 Subject: [PATCH 22/55] Update cicd.yml --- .github/workflows/cicd.yml | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 8b137891..0e8318e9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -1 +1,42 @@ +name: Java CICD with Gradle +on: + push: + branches: [ main ] + +env: + DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} + +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 From f538b9e2ab7cbd4267b2754aea3fd7ee2aee169b Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 09:01:38 +0530 Subject: [PATCH 23/55] Update cicd.yml --- .github/workflows/cicd.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 0e8318e9..e48226dc 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -40,3 +40,10 @@ jobs: - name: Run Datree's policy check run: datree test kube.yaml + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + registry: 34.125.31.157:8083 + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} From f82bb4cfa8426b6f839762685d52c887e303fac1 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 09:12:12 +0530 Subject: [PATCH 24/55] Update cicd.yml --- .github/workflows/cicd.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index e48226dc..0b0a6054 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -41,9 +41,16 @@ jobs: - name: Run Datree's policy check run: datree test kube.yaml - - name: Login to Docker Hub + - 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 + 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 }} + From 5e96dd14c91321f517b1f55e3647fbbdff2d16ed Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 09:23:31 +0530 Subject: [PATCH 25/55] Update cicd.yml --- .github/workflows/cicd.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 0b0a6054..f805fd50 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -6,7 +6,8 @@ on: env: DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} - + KUBECONFIG: /home/alerts_deekshith/kubeconfig/config_now + jobs: build: @@ -48,9 +49,15 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: docker build & docker + - 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 From f3a0b91c985f3b22646225cb284a82bd41c756e9 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 09:44:02 +0530 Subject: [PATCH 26/55] Update cicd.yml --- .github/workflows/cicd.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index f805fd50..d6773d69 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -61,3 +61,24 @@ jobs: 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 From 80811c3eb1e0c595c6a6fc38d3de653d712eb3bb Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Thu, 11 Nov 2021 09:55:46 +0530 Subject: [PATCH 27/55] Update index.html --- src/main/resources/templates/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 017ca718..4d30e162 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -4,7 +4,7 @@ web app -

Sample Web application

+

Sample Web application has been deployed with Github action

- \ No newline at end of file + From 0abfbd8a857f30ef9fbdcb157e936f740242958c Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 19:28:46 +0530 Subject: [PATCH 28/55] Create JenkinsfileFilter --- JenkinsfileFilter | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 JenkinsfileFilter diff --git a/JenkinsfileFilter b/JenkinsfileFilter new file mode 100644 index 00000000..04576bd3 --- /dev/null +++ b/JenkinsfileFilter @@ -0,0 +1,23 @@ +pipeline { + agent { + docker { + image 'maven' + args '-v $HOME/.m2:/root/.m2' + } + } + + stages { + stage('Building') { + steps { + sh "mvn clean install | tee output.log" + } + } + stage('Monitoring the logs') { + steps { + script { + sh '! grep "WARNING" output.log' + } + } + } + } +} From b90adda0c8c0092dc492669a16200f65ad768e2b Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 19:31:09 +0530 Subject: [PATCH 29/55] Update JenkinsfileFilter --- JenkinsfileFilter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JenkinsfileFilter b/JenkinsfileFilter index 04576bd3..ebe34b49 100644 --- a/JenkinsfileFilter +++ b/JenkinsfileFilter @@ -9,7 +9,7 @@ pipeline { stages { stage('Building') { steps { - sh "mvn clean install | tee output.log" + sh "./gradlew build | tee output.log" } } stage('Monitoring the logs') { From 1116da7a4c5e6ba527b4f772ffb2d6eeb80690a6 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 19:31:50 +0530 Subject: [PATCH 30/55] Update JenkinsfileFilter --- JenkinsfileFilter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JenkinsfileFilter b/JenkinsfileFilter index ebe34b49..b66c8d2d 100644 --- a/JenkinsfileFilter +++ b/JenkinsfileFilter @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'maven' + image 'gradle' args '-v $HOME/.m2:/root/.m2' } } From 54b2dacd608d24ff421f7ba80fde870a14021464 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 19:37:05 +0530 Subject: [PATCH 31/55] Update JenkinsfileFilter --- JenkinsfileFilter | 1 + 1 file changed, 1 insertion(+) diff --git a/JenkinsfileFilter b/JenkinsfileFilter index b66c8d2d..769418c0 100644 --- a/JenkinsfileFilter +++ b/JenkinsfileFilter @@ -9,6 +9,7 @@ pipeline { stages { stage('Building') { steps { + sh 'chmod +x gradlew' sh "./gradlew build | tee output.log" } } From 90b584d15f1367e3cd599e513031f5ff94846e97 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 19:38:08 +0530 Subject: [PATCH 32/55] Update JenkinsfileFilter --- JenkinsfileFilter | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/JenkinsfileFilter b/JenkinsfileFilter index 769418c0..f46aadea 100644 --- a/JenkinsfileFilter +++ b/JenkinsfileFilter @@ -1,8 +1,7 @@ pipeline { agent { docker { - image 'gradle' - args '-v $HOME/.m2:/root/.m2' + image 'openjdk:11' } } From fbc21021469aa3b77331a8c15300cb7d0e442f73 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 19:58:03 +0530 Subject: [PATCH 33/55] Create JenkinsfileSharedLibrary --- JenkinsfileSharedLibrary | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 JenkinsfileSharedLibrary diff --git a/JenkinsfileSharedLibrary b/JenkinsfileSharedLibrary new file mode 100644 index 00000000..011ecdc4 --- /dev/null +++ b/JenkinsfileSharedLibrary @@ -0,0 +1,26 @@ +#!/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 | tee output.log" + } + } + stage ('Check logs') { + steps { + filterLogs ('WARNING', 10) + } + } + } +} From 790abff6e113be501605ea755ec5f67e90b1362d Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 20:00:17 +0530 Subject: [PATCH 34/55] Update JenkinsfileSharedLibrary --- JenkinsfileSharedLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JenkinsfileSharedLibrary b/JenkinsfileSharedLibrary index 011ecdc4..a7b07532 100644 --- a/JenkinsfileSharedLibrary +++ b/JenkinsfileSharedLibrary @@ -14,7 +14,7 @@ pipeline { stage('Building') { steps { sh 'chmod +x gradlew' - sh "./gradlew build | tee output.log" + sh "./gradlew build " } } stage ('Check logs') { From 24540ab906baeea081683edd6c7ceed307abeec2 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 20:01:08 +0530 Subject: [PATCH 35/55] Update JenkinsfileSharedLibrary --- JenkinsfileSharedLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JenkinsfileSharedLibrary b/JenkinsfileSharedLibrary index a7b07532..f0b7be03 100644 --- a/JenkinsfileSharedLibrary +++ b/JenkinsfileSharedLibrary @@ -19,7 +19,7 @@ pipeline { } stage ('Check logs') { steps { - filterLogs ('WARNING', 10) + filterLogs ('Task', 2) } } } From 182c34b0ccb029124920d161ce909def45a7e896 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 20:45:16 +0530 Subject: [PATCH 36/55] Update JenkinsfileFilter --- JenkinsfileFilter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JenkinsfileFilter b/JenkinsfileFilter index f46aadea..1c68c70e 100644 --- a/JenkinsfileFilter +++ b/JenkinsfileFilter @@ -15,7 +15,7 @@ pipeline { stage('Monitoring the logs') { steps { script { - sh '! grep "WARNING" output.log' + sh '! grep "Task" output.log' } } } From 7e06c4fecc099407e7dff856b3912787a1bd1c95 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Sun, 9 Jan 2022 21:12:43 +0530 Subject: [PATCH 37/55] Update JenkinsfileSharedLibrary --- JenkinsfileSharedLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JenkinsfileSharedLibrary b/JenkinsfileSharedLibrary index f0b7be03..0a04c9fb 100644 --- a/JenkinsfileSharedLibrary +++ b/JenkinsfileSharedLibrary @@ -19,7 +19,7 @@ pipeline { } stage ('Check logs') { steps { - filterLogs ('Task', 2) + filterLogs ('Task', 15) } } } From c23240b924eab755bb984a93b793b124a2af6eb7 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Mon, 21 Feb 2022 08:25:22 +0530 Subject: [PATCH 38/55] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1e8ba502..2b60d6a0 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ test { sonarqube { properties { - property 'sonar.host.url', 'http://34.125.75.197:9000' + property 'sonar.host.url', 'http://34.125.201.58:9000' property 'sonar.login', '******' } } From a73124d6acb814db815b914c96bd08492916cb3d Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Mon, 21 Feb 2022 08:31:09 +0530 Subject: [PATCH 39/55] Create Jenkinsfile_demo --- Jenkinsfile_demo | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Jenkinsfile_demo diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo new file mode 100644 index 00000000..2f4b3329 --- /dev/null +++ b/Jenkinsfile_demo @@ -0,0 +1,24 @@ +pipeline{ + agent any + stages{ + stage("sonar qube analysis"){ + agent{ + docker { + image 'openjdk:11' + } + } + steps{ + script{ + withSonarQubeEnv(credentialsId: 'sonar-token-test') { + sh ''' + chmod +x gradlew + ./gradlew sonarqube + ''' + } + + } + } + } + } + +} From 0e48b55fb2e20aa5f476ee209ca4d598bbebf28e Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Mon, 21 Feb 2022 08:33:40 +0530 Subject: [PATCH 40/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index 2f4b3329..39990679 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -1,12 +1,13 @@ pipeline{ - agent any - stages{ - stage("sonar qube analysis"){ - agent{ - docker { + agent{ + docker { image 'openjdk:11' } } + + stages{ + stage("sonar qube analysis"){ + steps{ script{ withSonarQubeEnv(credentialsId: 'sonar-token-test') { From e1384999887c2a506bb3d22055c4d77addc3eb36 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Mon, 21 Feb 2022 08:41:41 +0530 Subject: [PATCH 41/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index 39990679..dfcd6499 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -1,13 +1,12 @@ pipeline{ - agent{ - docker { + agent any + stages{ + stage("sonar qube analysis"){ + agent{ + docker { image 'openjdk:11' } } - - stages{ - stage("sonar qube analysis"){ - steps{ script{ withSonarQubeEnv(credentialsId: 'sonar-token-test') { @@ -17,6 +16,13 @@ pipeline{ ''' } + timeout(5) { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } + } } } From b1ed91716bb067c046b3d63ec173353e81e09e32 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Mon, 21 Feb 2022 08:54:43 +0530 Subject: [PATCH 42/55] Update index.html --- src/main/resources/templates/index.html | 233 ++++++++++++++++++++++++ 1 file changed, 233 insertions(+) diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 4d30e162..414eacf6 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -8,3 +8,236 @@

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

+ + + + + From 603a877b392178029d4ead3c443c54f4ed10ccc1 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Tue, 22 Feb 2022 08:00:40 +0530 Subject: [PATCH 43/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index dfcd6499..f3e858d3 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -1,5 +1,8 @@ pipeline{ agent any + environment{ + VERSION = "${env.BUILD_ID}" + } stages{ stage("sonar qube analysis"){ agent{ @@ -22,10 +25,29 @@ pipeline{ error "Pipeline aborted due to quality gate failure: ${qg.status}" } } - } } } + + stage("building docker image and pushing it to nexus"){ + steps{ + script{ + + withCredentials([string(credentialsId: 'nexs-password', variable: 'docker-passwd')]) { + sh ''' + + docker build -t 34.125.203.155:8083/springapp:${VERSION} . + docker login -u admin -p $docker-passwd 34.125.203.155:8083 + docker push 34.125.203.155:8083/springapp:${VERSION} + docker rmi 34.125.203.155:8083/springapp:${VERSION} + ''' + } + } + } + } + + + } } From 8c617f8e97ff61d4c308f3e0d772d3d702e37b49 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Tue, 22 Feb 2022 08:05:52 +0530 Subject: [PATCH 44/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index f3e858d3..d211eb0a 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -33,11 +33,11 @@ pipeline{ steps{ script{ - withCredentials([string(credentialsId: 'nexs-password', variable: 'docker-passwd')]) { + withCredentials([string(credentialsId: 'nexus_pass', variable: 'docker_pass')]) { sh ''' docker build -t 34.125.203.155:8083/springapp:${VERSION} . - docker login -u admin -p $docker-passwd 34.125.203.155:8083 + docker login -u admin -p $docker_pass 34.125.203.155:8083 docker push 34.125.203.155:8083/springapp:${VERSION} docker rmi 34.125.203.155:8083/springapp:${VERSION} ''' From f584c8ffe831b9a8fa9324199b18520bdf185c7e Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Tue, 22 Feb 2022 08:29:03 +0530 Subject: [PATCH 45/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index d211eb0a..a360dfae 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -39,14 +39,26 @@ pipeline{ docker build -t 34.125.203.155:8083/springapp:${VERSION} . docker login -u admin -p $docker_pass 34.125.203.155:8083 docker push 34.125.203.155:8083/springapp:${VERSION} - docker rmi 34.125.203.155:8083/springapp:${VERSION} + docker rmi 34.125.203.155: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: "deekshith.snsep@gmail.com"; + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + } + } + } + } + } From 07ffff3c5292cb2932069abce4ebd0d23901f75c Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Tue, 22 Feb 2022 08:51:45 +0530 Subject: [PATCH 46/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index a360dfae..3f537fc7 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -53,13 +53,27 @@ 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: "deekshith.snsep@gmail.com"; - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') + // 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.203.155:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + } + } + } + } + } + } } From fc5eea6b2e9d652ee0419f669c84d404857ff160 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 23 Feb 2022 07:56:47 +0530 Subject: [PATCH 47/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index 3f537fc7..dccb0064 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -73,6 +73,19 @@ 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' + + } + } + } + } + } } From 1c901c60df2776a2c8883a410e5835dccb9d8883 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 23 Feb 2022 07:58:25 +0530 Subject: [PATCH 48/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index dccb0064..e37a34f1 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -85,7 +85,7 @@ pipeline{ } } } - } + } From 393651fd05c198ba466fce2e76f80ca70732a739 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 23 Feb 2022 08:03:42 +0530 Subject: [PATCH 49/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index e37a34f1..d849e466 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -79,7 +79,11 @@ pipeline{ steps{ script{ withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { - sh 'kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080' + sh ''' + echo "executing health check it might take a while" + sleep 60 + kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080 + ''' } } From aeb8d97af6773c8ac0e4ed317c6e8ce0894c881b Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 23 Feb 2022 08:04:16 +0530 Subject: [PATCH 50/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index d849e466..840a8004 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -81,7 +81,7 @@ pipeline{ withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { sh ''' echo "executing health check it might take a while" - sleep 60 + sleep 120 kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080 ''' From f0527aadf1c303d144040ab6084b4ccae64cb344 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 23 Feb 2022 08:21:27 +0530 Subject: [PATCH 51/55] Create healthcheck.sh --- healthcheck.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 healthcheck.sh diff --git a/healthcheck.sh b/healthcheck.sh new file mode 100644 index 00000000..c0244ee6 --- /dev/null +++ b/healthcheck.sh @@ -0,0 +1,10 @@ +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 From ba8bdbf2f4bc487544ec007caede3b234a8055ba Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Wed, 23 Feb 2022 08:22:25 +0530 Subject: [PATCH 52/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index 840a8004..8fb707fa 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -80,9 +80,9 @@ pipeline{ script{ withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { sh ''' - 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 + + chmod +x healthcheck.sh + ./healthcheck.sh ''' } From 51960f2e94f639a29638c5f8949633701d769f1a Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 20 May 2022 15:51:24 +0530 Subject: [PATCH 53/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index 8fb707fa..f989c653 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -12,7 +12,7 @@ pipeline{ } steps{ script{ - withSonarQubeEnv(credentialsId: 'sonar-token-test') { + withSonarQubeEnv(credentialsId: 'sonar-token') { sh ''' chmod +x gradlew ./gradlew sonarqube @@ -36,10 +36,10 @@ pipeline{ withCredentials([string(credentialsId: 'nexus_pass', variable: 'docker_pass')]) { sh ''' - docker build -t 34.125.203.155:8083/springapp:${VERSION} . - docker login -u admin -p $docker_pass 34.125.203.155:8083 - docker push 34.125.203.155:8083/springapp:${VERSION} - docker rmi 34.125.203.155:8083/springapp:${VERSION} + 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 ''' } From 5f98c0a034b4b169e2f7c5fb5d75bfd1033c8d06 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 20 May 2022 17:35:21 +0530 Subject: [PATCH 54/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index f989c653..5d297f48 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -52,8 +52,8 @@ 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: "deekshith.snsep@gmail.com"; - // 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: "issamraz1993@gmail.com"; + input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') } } } From fccc7e8ba578e20b262589e25ea29beb6826a349 Mon Sep 17 00:00:00 2001 From: Deekshith SN Date: Fri, 20 May 2022 19:00:49 +0530 Subject: [PATCH 55/55] Update Jenkinsfile_demo --- Jenkinsfile_demo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_demo b/Jenkinsfile_demo index 5d297f48..3db03236 100644 --- a/Jenkinsfile_demo +++ b/Jenkinsfile_demo @@ -67,7 +67,7 @@ pipeline{ withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { dir('kubernetes/') { - sh 'helm upgrade --install --set image.repository="34.125.203.155:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' + sh 'helm upgrade --install --set image.repository="35.188.44.251:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' } } }