From 79e71ec49a938141807ae6c28cc14d2540b0badc Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Thu, 16 May 2024 21:34:41 -0500 Subject: [PATCH 01/17] Edited README.md file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc93c30f..93fa0b61 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Prerequisites -##### +## - JDK 11 - Maven 3 - MySQL 8 From 76bdbec5544913b785b458471c4b8ab2c8c5e7ca Mon Sep 17 00:00:00 2001 From: Samuel Taiwo <67716007+shaanu22@users.noreply.github.com> Date: Thu, 16 May 2024 23:49:56 -0500 Subject: [PATCH 02/17] Create main.yml --- .github/workflows/main.yml | 9 +++++++++ 1 file changed, 9 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..454a7598 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,9 @@ +name: Hprofile Actions +on: workflow_dispatch +jobs: + Testing: + runs-on: ubuntu-latest + steps: + - name: testing workflow + run: echo "Workflow works!" + From 0ad12347f59034e728730ca13b2bd013575d0b60 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Sun, 19 May 2024 17:33:05 -0500 Subject: [PATCH 03/17] update main.yml file --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 454a7598..9f875016 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,4 +6,4 @@ jobs: steps: - name: testing workflow run: echo "Workflow works!" - + \ No newline at end of file From cbcaf24b6477d5c97e748b30f6164b448b069f0d Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Sun, 19 May 2024 17:48:14 -0500 Subject: [PATCH 04/17] update main.yml file --- .github/workflows/main.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f875016..83559671 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,12 @@ jobs: Testing: runs-on: ubuntu-latest steps: - - name: testing workflow - run: echo "Workflow works!" + - name: Code Checkout + uses: actions/checkout@v4 + + - name: Maven test + run: mvn test + + - name: Checkstyle + run: mvn checkstyle:checkstyle \ No newline at end of file From 0faf4a2eba4713d086d5452e01ded8061c6e3b19 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 15:32:51 -0500 Subject: [PATCH 05/17] Added java and sonar-scanner steps --- .github/workflows/main.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 83559671..03c3a8b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,4 +12,28 @@ jobs: - name: Checkstyle run: mvn checkstyle:checkstyle - \ No newline at end of file + + # Setup java 11 to be default (sonar-scanner requirement as of 5.x) + - name: Set Java 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '21' + + # 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/ + \ No newline at end of file From 44f06eb7025dc4525e12c2e890b3ee6b4b591bb1 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 15:54:54 -0500 Subject: [PATCH 06/17] Edited sonar-scanner setup --- .github/workflows/main.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03c3a8b1..2104c9af 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,11 @@ jobs: # Setup sonar-scanner - name: Setup SonarQube - uses: warchant/setup-sonar-scanner@v7 + run: | + wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip + unzip sonar-scanner-cli-4.8.0.2856-linux.zip + mv sonar-scanner-4.8.0.2856-linux sonar-scanner + export PATH="${PATH}:${PWD}/sonar-scanner/bin" # Run sonar-scanner - name: SonarQube Scan @@ -36,4 +40,3 @@ jobs: -Dsonar.jacoco.reportsPath=target/jacoco.exec -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ - \ No newline at end of file From c39e7e66b20ab699be34617e1b4cbe6a9d526c58 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 16:07:30 -0500 Subject: [PATCH 07/17] modified: .github/workflows/main.yml --- .github/workflows/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2104c9af..be45c86f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,12 @@ jobs: wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip unzip sonar-scanner-cli-4.8.0.2856-linux.zip mv sonar-scanner-4.8.0.2856-linux sonar-scanner - export PATH="${PATH}:${PWD}/sonar-scanner/bin" + shell: bash + + # Add SonarQube Scanner to PATH + - name: Add SonarQube Scanner to PATH + run: echo "$(pwd)/sonar-scanner/bin" >> $GITHUB_PATH + shell: bash # Run sonar-scanner - name: SonarQube Scan From a71efe968170caf842c54d6d11715a2a9d92ebe0 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 16:13:17 -0500 Subject: [PATCH 08/17] Added debugging to sonar-scanner --- .github/workflows/main.yml | 39 +++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be45c86f..732a7af8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,15 +33,32 @@ jobs: run: echo "$(pwd)/sonar-scanner/bin" >> $GITHUB_PATH shell: bash - # Run sonar-scanner + # # 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/ + + + # Run SonarQube Scanner with debug logging - 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/ + run: | + sonar-scanner -X \ + -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/ + shell: bash + From 1eb991b60edc579feb60f78aa7443e00e9851d7a Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 16:18:16 -0500 Subject: [PATCH 09/17] Updated java version --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 732a7af8..fb367723 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,11 +14,11 @@ jobs: run: mvn checkstyle:checkstyle # Setup java 11 to be default (sonar-scanner requirement as of 5.x) - - name: Set Java 21 + - name: Set Java 17 uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options - java-version: '21' + java-version: '17' # Setup sonar-scanner - name: Setup SonarQube @@ -61,4 +61,4 @@ jobs: -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml \ -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ shell: bash - + From edf4a6f940f6e30de5bc89c25822d8e67d95777d Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 16:24:01 -0500 Subject: [PATCH 10/17] Updated java version --- .github/workflows/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb367723..9ac4f0aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,11 +14,11 @@ jobs: run: mvn checkstyle:checkstyle # Setup java 11 to be default (sonar-scanner requirement as of 5.x) - - name: Set Java 17 + - name: Set Java 21 uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options - java-version: '17' + java-version: '21' # Setup sonar-scanner - name: Setup SonarQube @@ -46,6 +46,13 @@ jobs: # -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml # -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ + # Switch to Java 17 for SonarQube Scan + - name: Set Java 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + # Run SonarQube Scanner with debug logging - name: SonarQube Scan From 72109f427feb51697d7bb1c51f04912cc074d546 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 16:32:33 -0500 Subject: [PATCH 11/17] Updated main.yml file --- .github/workflows/main.yml | 83 +++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ac4f0aa..aec0308a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,59 +13,50 @@ jobs: - name: Checkstyle run: mvn checkstyle:checkstyle - # Setup java 11 to be default (sonar-scanner requirement as of 5.x) - - name: Set Java 21 - uses: actions/setup-java@v4 + # Setup java 17 to be default (sonar-scanner requirement as of 5.x) + - name: Set Java 17 + uses: actions/setup-java@v3 with: distribution: 'temurin' # See 'Supported distributions' for available options - java-version: '21' + java-version: '17' # Setup sonar-scanner - name: Setup SonarQube - run: | - wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip - unzip sonar-scanner-cli-4.8.0.2856-linux.zip - mv sonar-scanner-4.8.0.2856-linux sonar-scanner - shell: bash - - # Add SonarQube Scanner to PATH - - name: Add SonarQube Scanner to PATH - run: echo "$(pwd)/sonar-scanner/bin" >> $GITHUB_PATH - shell: bash + 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/ + # 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/ - # Switch to Java 17 for SonarQube Scan - - name: Set Java 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' + # # Switch to Java 17 for SonarQube Scan + # - name: Set Java 17 + # uses: actions/setup-java@v4 + # with: + # distribution: 'temurin' + # java-version: '17' - # Run SonarQube Scanner with debug logging - - name: SonarQube Scan - run: | - sonar-scanner -X \ - -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/ - shell: bash + # # Run SonarQube Scanner with debug logging + # - name: SonarQube Scan + # run: | + # sonar-scanner -X \ + # -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/ + # shell: bash From fbc36f8ee468d2aa3d8a1a4ded8ede4904ad0bbb Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Mon, 20 May 2024 16:36:14 -0500 Subject: [PATCH 12/17] Updated main.yml file --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aec0308a..1177d712 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: # Setup java 17 to be default (sonar-scanner requirement as of 5.x) - name: Set Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '17' From aa9ecaed78250057861f4dea73f93ec3b68af0bc Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Thu, 23 May 2024 16:32:21 -0500 Subject: [PATCH 13/17] Added quality gate check --- .github/workflows/main.yml | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1177d712..ace3293e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,27 +36,14 @@ jobs: -Dsonar.jacoco.reportsPath=target/jacoco.exec -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ - - # # Switch to Java 17 for SonarQube Scan - # - name: Set Java 17 - # uses: actions/setup-java@v4 - # with: - # distribution: 'temurin' - # java-version: '17' - - - # # Run SonarQube Scanner with debug logging - # - name: SonarQube Scan - # run: | - # sonar-scanner -X \ - # -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/ - # shell: bash - + + # 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 38df30a85f392f719f2110af0dd9b84d3c81efc4 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Thu, 23 May 2024 16:38:00 -0500 Subject: [PATCH 14/17] Added quality gate check --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ace3293e..8b159bab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,5 +45,5 @@ jobs: timeout-minutes: 5 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #OPTIONAL + SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #This is OPTIONAL \ No newline at end of file From 962c670ef1c13b0e509c6eafcce15d55ed000f77 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Tue, 28 May 2024 02:33:16 -0500 Subject: [PATCH 15/17] Added Build and Publish to main.yml file --- .github/workflows/main.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8b159bab..7cc00a38 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,7 @@ name: Hprofile Actions on: workflow_dispatch +env: + AWS_REGION: us-east-1 jobs: Testing: runs-on: ubuntu-latest @@ -46,4 +48,29 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #This is OPTIONAL - \ No newline at end of file + + BUILD_AND_PUBLISH: + needs: Testing + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + + - name: Update application.properties file + run: | + sed -i "s/^jdbc.username.*$/jdbc.username\=${{ secrets.RDS_USER }}/" src/main/resources/application.properties + sed -i "s/^jdbc.password.*$/jdbc.password\=${{ secrets.RDS_PASS }}/" src/main/resources/application.properties + sed -i "s/db01/${{ secrets.RDS_ENDPOINT }}/" src/main/resources/application.properties + + - 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: actapp + region: ${{ env.AWS_REGION }} + tags: latest,${{ github.run_number }} + daemon_off: false + dockerfile: ./Dockerfile + context: ./ From 563ca3945612f89e0da40beea51a767ca7a6f82c Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Thu, 30 May 2024 16:59:22 -0500 Subject: [PATCH 16/17] Deploy job included in workflow --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++ aws-files/taskdeffile.json | 52 +++++++++++++++++++++++++++++++++----- 2 files changed, 80 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7cc00a38..171d8807 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,6 +2,11 @@ name: Hprofile Actions on: workflow_dispatch env: AWS_REGION: us-east-1 + ECR_REPOSITORY: actapp + ECS_SERVICE: vproapp-act-svc + ECS_CLUSTER: vproapp-act + ECS_TASK_DEFINITION: aws-files/taskdeffile.json + CONTAINER_NAME: vproapp jobs: Testing: runs-on: ubuntu-latest @@ -74,3 +79,33 @@ jobs: daemon_off: false dockerfile: ./Dockerfile context: ./ + + Deploy: + needs: BUILD_AND_PUBLISH + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@v1 + with: + task-definition: ${{ env.ECS_TASK_DEFINITION }} + container-name: ${{ env.CONTAINER_NAME }} + image: ${{ secrets.REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ github.run_number }} + + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: ${{ env.ECS_SERVICE }} + cluster: ${{ env.ECS_CLUSTER }} + wait-for-service-stability: true diff --git a/aws-files/taskdeffile.json b/aws-files/taskdeffile.json index a0fcaedd..3479ede0 100644 --- a/aws-files/taskdeffile.json +++ b/aws-files/taskdeffile.json @@ -1,9 +1,9 @@ { - "family": "vproappstagetask", + "taskDefinitionArn": "arn:aws:ecs:us-east-1:895792017190:task-definition/vproapp-act-tdef:1", "containerDefinitions": [ { "name": "vproapp", - "image": "716657688884.dkr.ecr.us-east-2.amazonaws.com/actapp:latest", + "image": "895792017190.dkr.ecr.us-east-1.amazonaws.com/actapp", "cpu": 0, "portMappings": [ { @@ -24,16 +24,52 @@ "logDriver": "awslogs", "options": { "awslogs-create-group": "true", - "awslogs-group": "/ecs/vproappstagetask", - "awslogs-region": "us-east-2", + "awslogs-group": "/ecs/vproapp-act-tdef", + "awslogs-region": "us-east-1", "awslogs-stream-prefix": "ecs" }, "secretOptions": [] - } + }, + "systemControls": [] } ], - "executionRoleArn": "arn:aws:iam::716657688884:role/ecsTaskExecutionRole", + "family": "vproapp-act-tdef", + "executionRoleArn": "arn:aws:iam::895792017190:role/ecsTaskExecutionRole", "networkMode": "awsvpc", + "revision": 1, + "volumes": [], + "status": "ACTIVE", + "requiresAttributes": [ + { + "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" + }, + { + "name": "ecs.capability.execution-role-awslogs" + }, + { + "name": "com.amazonaws.ecs.capability.ecr-auth" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" + }, + { + "name": "ecs.capability.execution-role-ecr-pull" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" + }, + { + "name": "ecs.capability.task-eni" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" + } + ], + "placementConstraints": [], + "compatibilities": [ + "EC2", + "FARGATE" + ], "requiresCompatibilities": [ "FARGATE" ], @@ -43,10 +79,12 @@ "cpuArchitecture": "X86_64", "operatingSystemFamily": "LINUX" }, + "registeredAt": "2024-05-29T21:45:22.017Z", + "registeredBy": "arn:aws:iam::895792017190:user/iamadmin", "tags": [ { "key": "Name", - "value": "vprofileappstagtaskdef" + "value": "vproapp-act-tdef" } ] } \ No newline at end of file From 8be68527781fe225c29c88527801d092f7a71e63 Mon Sep 17 00:00:00 2001 From: shaanu22 Date: Thu, 30 May 2024 17:10:33 -0500 Subject: [PATCH 17/17] Testing push event --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 171d8807..82a8a360 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ name: Hprofile Actions -on: workflow_dispatch +on: [push, workflow_dispatch] env: AWS_REGION: us-east-1 ECR_REPOSITORY: actapp