From 0b695a076336a89fc67a01520d5dcdca861dd40b Mon Sep 17 00:00:00 2001 From: Santanu Sinha Date: Mon, 24 Jun 2024 10:23:00 +0530 Subject: [PATCH 1/5] Trying artifacts --- .github/workflows/release.yml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39f45f85..41c97deb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ on: - '*' # Push events to every tag not containing / jobs: - build: + deploy-java: runs-on: ubuntu-latest steps: - name: Checkout Code @@ -26,6 +26,24 @@ jobs: - name: Build with Maven run: mvn -B package -DskipTests +# - name: Deploy with Maven +# run: mvn -B deploy -DskipTests +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Save Executor jar for next job + uses: actions/upload-artifact@v4 + with: + name: drove-executor + path: drove-executor/target/drove-executor-${{ github.ref_name }}.jar + retention-days: 1 + overwrite: true + - name: Save Controller jar for next job + uses: actions/upload-artifact@v4 + with: + name: drove-controller + path: drove-controller/target/drove-controller-${{ github.ref_name }}.jar + retention-days: 1 + overwrite: true deploy: needs: build @@ -45,11 +63,17 @@ jobs: packages: write steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Create directories + run: mkdir -p ${{ matrix.context }}/target - # - name: Deploy with Maven - # run: mvn -B deploy -DskipTests - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Download artifacts from build step + uses: actions/download-artifact@v4 + with: + name: ${{ matrix.context }} + path: ${{ matrix.context }}/target - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 From 95254984a701cde8e0ab439a02b9c6979e1d52e1 Mon Sep 17 00:00:00 2001 From: Santanu Sinha Date: Mon, 24 Jun 2024 10:25:15 +0530 Subject: [PATCH 2/5] syntax fix --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41c97deb..4f67c4f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,9 +71,9 @@ jobs: - name: Download artifacts from build step uses: actions/download-artifact@v4 - with: - name: ${{ matrix.context }} - path: ${{ matrix.context }}/target + with: + name: ${{ matrix.context }} + path: ${{ matrix.context }}/target - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 From ed5427af9d358eb563a9eabc069f7243f9246f14 Mon Sep 17 00:00:00 2001 From: Santanu Sinha Date: Mon, 24 Jun 2024 10:26:24 +0530 Subject: [PATCH 3/5] Fixed names --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f67c4f0..464b1580 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,8 +45,8 @@ jobs: retention-days: 1 overwrite: true - deploy: - needs: build + deploy-containers: + needs: deploy-java runs-on: ubuntu-latest strategy: From 34ccc3508d8898b8a09e8085d05d56c8eaebfcb6 Mon Sep 17 00:00:00 2001 From: Santanu Sinha Date: Mon, 24 Jun 2024 10:39:57 +0530 Subject: [PATCH 4/5] Simplified matrix variables --- .github/workflows/release.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 464b1580..d01c1653 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,12 +24,11 @@ jobs: cache: maven distribution: 'temurin' - - name: Build with Maven - run: mvn -B package -DskipTests -# - name: Deploy with Maven -# run: mvn -B deploy -DskipTests -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Deploy with Maven + run: mvn -B deploy -DskipTests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Save Executor jar for next job uses: actions/upload-artifact@v4 with: @@ -54,10 +53,8 @@ jobs: max-parallel: 1 matrix: include: - - image: ghcr.io/PhonePe/drove-executor - context: drove-executor - - image: ghcr.io/PhonePe/drove-controller - context: drove-controller + - context: drove-executor + - context: drove-controller permissions: contents: read packages: write @@ -86,7 +83,7 @@ jobs: id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: - images: ${{ matrix.image }} + images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.context }} - name: Build and push Docker image for executor uses: docker/build-push-action@v6 From 72c8bd510b0ee476babe941139d7bbbff83cc25f Mon Sep 17 00:00:00 2001 From: Santanu Sinha Date: Fri, 16 Aug 2024 12:49:11 +0530 Subject: [PATCH 5/5] Added sonar changes --- .github/workflows/sonar.yml | 37 +++++++++++++++++++++++++++++ drove-controller/configs/docker.yml | 20 ++++++++++++---- pom.xml | 2 ++ 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/sonar.yml diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 00000000..2bb950bf --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,37 @@ +name: SonarCloud Based Analysis +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available. + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=PhonePe_drove \ No newline at end of file diff --git a/drove-controller/configs/docker.yml b/drove-controller/configs/docker.yml index d85568c0..584992b8 100644 --- a/drove-controller/configs/docker.yml +++ b/drove-controller/configs/docker.yml @@ -5,13 +5,17 @@ server: adminConnectors: - type: http port: 4001 - applicationContextPath: / requestLog: appenders: - type: console timeZone: ${DROVE_TIMEZONE} - gzip: - syncFlush: true + - type: file + timeZone: ${DROVE_TIMEZONE} + currentLogFilename: /logs/drove-controller-access.log + archivedLogFilenamePattern: /logs/drove-controller-access.log-%d-%i + archivedFileCount: 3 + maxFileSize: 100MiB + logging: level: INFO @@ -20,8 +24,16 @@ logging: appenders: - type: console - threshold: TRACE + threshold: ALL + timeZone: ${DROVE_TIMEZONE} + logFormat: "%(%-5level) [%date] [%logger{0} - %X{appId}] %message%n" + - type: file + threshold: ALL timeZone: ${DROVE_TIMEZONE} + currentLogFilename: /logs/rove-controller.log + archivedLogFilenamePattern: /logs/drove-controller.log-%d-%i + archivedFileCount: 3 + maxFileSize: 100MiB logFormat: "%(%-5level) [%date] [%logger{0} - %X{appId}] %message%n" zookeeper: diff --git a/pom.xml b/pom.xml index 4b50baf4..bff1cfcd 100644 --- a/pom.xml +++ b/pom.xml @@ -65,6 +65,8 @@ **com/phonepe/drove/controller/ui/Handlebars**, 32.1.3-jre + phonepe + https://sonarcloud.io