From 5250ba2b6dd87e61abfea0d21bea208b591f5e08 Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:11:42 +0530 Subject: [PATCH 1/7] first vprofile action commit --- .github/workflows/main.yml | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..84263ac5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,55 @@ +name: vprofile actions +on: workflow_dispatch +env: + AWS_REGION: us-east-2 + ECR_REPOSITORY: vprofileapp + EKS_CLUSTER: vprofile-eks + +jobs: + Testing: + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + + - name: Maven test + run: mvn test + + - name: Checkstyle + run: mvn checkstyle:checkstyle + + # Setup java 11 to be default (sonar-scanner requirement as of 5.x) + - name: Set Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '11' + + # Setup sonar-scanner + - name: Setup SonarQube + uses: warchant/setup-sonar-scanner@v7 + + + # Run sonar-scanner + - name: SonarQube Scan + run: sonar-scanner + -Dsonar.host.url=${{ secrets.SONAR_URL }} + -Dsonar.login=${{ secrets.SONAR_TOKEN }} + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} + -Dsonar.sources=src/ + -Dsonar.junit.reportsPath=target/surefire-reports/ + -Dsonar.jacoco.reportsPath=target/jacoco.exec + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ + + # Check the Quality Gate status. + - name: SonarQube Quality Gate check + id: 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 }} + SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #OPTIONAL + \ No newline at end of file From 7be634099386db943e60bd86d27726a92d09a0c9 Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:32:48 +0530 Subject: [PATCH 2/7] new code changes --- .github/workflows/main.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 84263ac5..8d2bcbf4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,26 +30,5 @@ jobs: uses: warchant/setup-sonar-scanner@v7 - # Run sonar-scanner - - name: SonarQube Scan - run: sonar-scanner - -Dsonar.host.url=${{ secrets.SONAR_URL }} - -Dsonar.login=${{ secrets.SONAR_TOKEN }} - -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} - -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} - -Dsonar.sources=src/ - -Dsonar.junit.reportsPath=target/surefire-reports/ - -Dsonar.jacoco.reportsPath=target/jacoco.exec - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml - -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ - - # Check the Quality Gate status. - - name: SonarQube Quality Gate check - id: 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 }} - SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #OPTIONAL + \ No newline at end of file From 3dc14720fd27b4bc3913e0aa9d6233809399aa62 Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:45:14 +0530 Subject: [PATCH 3/7] build and publish to ecr --- .github/workflows/main.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d2bcbf4..0de700a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,9 +25,18 @@ jobs: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '11' - # Setup sonar-scanner - - name: Setup SonarQube - uses: warchant/setup-sonar-scanner@v7 + - name: Build & Upload image to ECR + uses: appleboy/docker-ecr-action@master + with: + access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} + secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + registry: ${{ secrets.REGISTRY }} + repo: ${{ env.ECR_REPOSITORY }} + region: ${{ env.AWS_REGION }} + tags: latest,${{ github.run_number }} + daemon_off: false + dockerfile: ./Dockerfile + context: ./ From 80a402a54f1ac2e07e901fa7407604a18fdb77c0 Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:48:55 +0530 Subject: [PATCH 4/7] final commit --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 267c0571..7b495a4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,3 +11,5 @@ COPY --from=BUILD_IMAGE vprofile-project/target/vprofile-v2.war /usr/local/tomca EXPOSE 8080 CMD ["catalina.sh", "run"] + +## From 2d3af75a609dd4ef71b974bbc645121764eccb73 Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:52:21 +0530 Subject: [PATCH 5/7] Empty Commit From 9b845bafbfc4c2e8f8fe209f36633291b1fdadff Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:53:23 +0530 Subject: [PATCH 6/7] one last --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7b495a4d..ca8b70b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,4 @@ COPY --from=BUILD_IMAGE vprofile-project/target/vprofile-v2.war /usr/local/tomca EXPOSE 8080 CMD ["catalina.sh", "run"] -## + From 123dd5c9cbcacde1083d7617a880dce3cb70c22c Mon Sep 17 00:00:00 2001 From: gundaprashanth Date: Sat, 1 Jun 2024 17:56:49 +0530 Subject: [PATCH 7/7] one for last --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0de700a9..3f6913bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,8 +7,8 @@ env: jobs: Testing: - runs-on: ubuntu-latest - steps: + runs-on: ubuntu-latest + steps: - name: Code checkout uses: actions/checkout@v4