From 78dd042fdb49d0d9c48835347447d2f76f53b0a8 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:41:21 +0200 Subject: [PATCH 01/13] Initial version main.yml Initial version forked from victorit project --- .github/workflows/main.yml | 40 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe8db829..acdd9a1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,27 +21,32 @@ jobs: key: "${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}" restore-keys: | ${{ runner.os }}-maven3- + # Configure java to version 17 - name: Configure Java uses: actions/setup-java@v4.5.0 with: java-version: "17" distribution: temurin + - name: Cache SonarQube dependencies uses: actions/cache@v3 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar - - name: "Run Maven" - shell: bash - run: mvn clean install --batch-mode -PintegrationTests + - name: Run SonarQube Scanner env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} + SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} run: | - mvn clean verify sonar:sonar -Dsonar.organization=victorit -Dsonar.projectKey=victorit_my_training -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.exclusions=target/**,bin/**,**/*.class -Dsonar.report.export.path=/home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/codeql-results.sarif - ls -al . - ls -al /home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/ - ls -al /home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/ + mvn clean verify sonar:sonar -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN -Dsonar.exclusions=target/**,bin/**,**/*.class + + # Build project + - name: "Run Maven" + shell: bash + run: mvn clean install --batch-mode -PintegrationTests + # Download the SARIF file if it's an artifact from a previous job or step #- name: Download SARIF file # uses: actions/download-artifact@v3 @@ -54,25 +59,24 @@ jobs: # uses: github/codeql-action/upload-sarif@v3 # with: # sarif_file: '/home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/*.sarif' - + # Create project - name: Package run: mvn -B clean package -DskipTests # Set up JFrog CLI - - name: Install JFrog CLI - run: | - curl -fL https://getcli.jfrog.io | sh - sudo mv jfrog /usr/local/bin/ - + - name: Setup JFrog CLI + uses: jfrog/setup-jfrog-cli@v4 + with: + version: 4.4.3 # JFrog Xray Scan - name: JFrog CLI env: - JFROG_URL: ${{ secrets.ARTIFACTORY_URL }} + JFROG_URL: ${{ env.ARTIFACTORY_URL }} JFROG_USER: ${{ secrets.ARTIFACTORY_USER }} JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} run: | - #jfrog config add exam-server --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --interactive=false + #jfrog config add exam-server --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --interactive=false #jfrog config show - jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD" - jfrog rt bp "my-build" "1" --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD" - jfrog rt bs "my-build" "1" --url="https://trialkl8y5h.jfrog.io/artifactory" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail + jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" + jfrog rt bp "my-build" "1" --url=--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" + jfrog rt bs "my-build" "1" --url=--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail From e8cc241204204e2817cc0027902152eb6065e14b Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:52:34 +0200 Subject: [PATCH 02/13] Update main.yml Change jfrog cli version to 4.4.2 --- .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 acdd9a1e..af785746 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,7 +67,7 @@ jobs: - name: Setup JFrog CLI uses: jfrog/setup-jfrog-cli@v4 with: - version: 4.4.3 + version: 4.4.2 # JFrog Xray Scan - name: JFrog CLI env: From d224632f512908c78db6f7186b113baa34026def Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:00:02 +0200 Subject: [PATCH 03/13] Update main.yml Update jfrog cli version tp 2.72.2 --- .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 af785746..227c42bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,9 +65,9 @@ jobs: # Set up JFrog CLI - name: Setup JFrog CLI - uses: jfrog/setup-jfrog-cli@v4 + uses: jfrog/setup-jfrog-cli@v2 with: - version: 4.4.2 + version: 2.72.2 # JFrog Xray Scan - name: JFrog CLI env: From 9aa2a3fd4ed8b5d3ddc423df012a6cd73c05be17 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:06:28 +0200 Subject: [PATCH 04/13] fix syntax error remove --url --- .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 227c42bd..0a3fa162 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -77,6 +77,6 @@ jobs: run: | #jfrog config add exam-server --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --interactive=false #jfrog config show - jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" + jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" jfrog rt bp "my-build" "1" --url=--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" jfrog rt bs "my-build" "1" --url=--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail From 0553c67692b423e360a66416843c06b3761cd382 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:12:39 +0200 Subject: [PATCH 05/13] fix syntax error main.yml remove --url --- .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 0a3fa162..31dcadfb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,5 +78,5 @@ jobs: #jfrog config add exam-server --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --interactive=false #jfrog config show jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" - jfrog rt bp "my-build" "1" --url=--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" - jfrog rt bs "my-build" "1" --url=--url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail + jfrog rt bp "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" + jfrog rt bs "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail From e908836f148f322a17809a091e716667bf2d9abe Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:24:45 +0200 Subject: [PATCH 06/13] add url addres of artifactory main.yml --- .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 31dcadfb..9d525d50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: # JFrog Xray Scan - name: JFrog CLI env: - JFROG_URL: ${{ env.ARTIFACTORY_URL }} + JFROG_URL: https://trialkl8y5h.jfrog.io/artifactory JFROG_USER: ${{ secrets.ARTIFACTORY_USER }} JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} run: | From 1b703590f4d295131c5981b465fad8466f188fee Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:32:08 +0200 Subject: [PATCH 07/13] Update deprecated command to jfrog bs in main.yml --- .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 9d525d50..671c98be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,4 +79,4 @@ jobs: #jfrog config show jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" jfrog rt bp "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" - jfrog rt bs "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail + jfrog bs "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail From 2b234b31ac7fdf1d0d20cae52468d9b44594969e Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:49:29 +0200 Subject: [PATCH 08/13] add jfrog rt bs to main.yml --- .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 671c98be..9d525d50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,4 +79,4 @@ jobs: #jfrog config show jfrog rt u "frontend-maven-plugin/target/*.jar" "exam-snapshot/" --build-name="my-build" --build-number="1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" jfrog rt bp "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" - jfrog bs "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail + jfrog rt bs "my-build" "1" --url="$JFROG_URL" --user="$JFROG_USER" --password="$JFROG_PASSWORD" --fail From 072cbfbafa2654d4e41a590807eb67c6b7785f0d Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:00:06 +0200 Subject: [PATCH 09/13] Update sonar_url in main.yml --- .github/workflows/main.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d525d50..299c28cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,26 +39,21 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} + SONAR_URL: https://sonarcloud.io run: | - mvn clean verify sonar:sonar -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN -Dsonar.exclusions=target/**,bin/**,**/*.class - + mvn clean verify sonar:sonar -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_URL -Dsonar.token=$SONAR_TOKEN -Dsonar.exclusions=target/**,bin/**,**/*.class + + - name: Upload SonarQube results to GitHub Insights + uses: sonarsource/sonarcloud-github-action@v2 + with: + sonar-token: ${{ secrets.SONAR_TOKEN }} + # Build project - name: "Run Maven" shell: bash run: mvn clean install --batch-mode -PintegrationTests - # Download the SARIF file if it's an artifact from a previous job or step - #- name: Download SARIF file - # uses: actions/download-artifact@v3 - # with: - # name: sarif-file # The artifact name you want to download - # path: /home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar - - # Upload the SARIF results to GitHub CodeQL - #- name: Upload SARIF results - # uses: github/codeql-action/upload-sarif@v3 - # with: - # sarif_file: '/home/runner/work/frontend-maven-plugin/frontend-maven-plugin/target/sonar/*.sarif' + # Create project - name: Package run: mvn -B clean package -DskipTests From fa75d818eb0432fa9c7ef273a6cbcd54cf35b7f0 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:12:26 +0200 Subject: [PATCH 10/13] Upload SonarQube to GitHub Insight in main.yml --- .github/workflows/main.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 299c28cc..0d0b89fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,7 @@ jobs: key: "${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}" restore-keys: | ${{ runner.os }}-maven3- + # Configure java to version 17 - name: Configure Java uses: actions/setup-java@v4.5.0 @@ -33,21 +34,27 @@ jobs: with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar - + # Run SunarQube Scanner - name: Run SonarQube Scanner env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} - SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} - SONAR_URL: https://sonarcloud.io + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} + SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} + SONAR_URL: https://sonarcloud.io run: | mvn clean verify sonar:sonar -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_URL -Dsonar.token=$SONAR_TOKEN -Dsonar.exclusions=target/**,bin/**,**/*.class - + # Upload SonarQube to GitHub Insight - name: Upload SonarQube results to GitHub Insights uses: sonarsource/sonarcloud-github-action@v2 with: - sonar-token: ${{ secrets.SONAR_TOKEN }} - + entryPoint: "/entrypoint.sh" + args: | + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} + -Dsonar.host.url=https://sonarcloud.io + -Dsonar.token=${{ secrets.SONAR_TOKEN }} + -Dsonar.exclusions=target/**,bin/**,**/*.class + # Build project - name: "Run Maven" shell: bash From 6b4515e5f568a8d8d36b9f40b10426f98b44ae80 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:20:18 +0200 Subject: [PATCH 11/13] Fix syntax error upload sonarqube in main.yml --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d0b89fa..fb64ceff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,7 @@ jobs: SONAR_URL: https://sonarcloud.io run: | mvn clean verify sonar:sonar -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_URL -Dsonar.token=$SONAR_TOKEN -Dsonar.exclusions=target/**,bin/**,**/*.class + # Upload SonarQube to GitHub Insight - name: Upload SonarQube results to GitHub Insights uses: sonarsource/sonarcloud-github-action@v2 @@ -52,9 +53,10 @@ jobs: -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} -Dsonar.host.url=https://sonarcloud.io - -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.exclusions=target/**,bin/**,**/*.class - + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # Build project - name: "Run Maven" shell: bash From 8868098948f97bea85e46ff2761e5ecb661e8f97 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:30:03 +0200 Subject: [PATCH 12/13] Fix upload sonar main.yml --- .github/workflows/main.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb64ceff..9c9c2ce8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,12 +50,14 @@ jobs: with: entryPoint: "/entrypoint.sh" args: | - -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} - -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} - -Dsonar.host.url=https://sonarcloud.io - -Dsonar.exclusions=target/**,bin/**,**/*.class + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} + -Dsonar.host.url=https://sonarcloud.io + -Dsonar.java.binaries=target/classes + -Dsonar.exclusions=target/**,bin/**,**/*.class env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # Build project - name: "Run Maven" From be2e4d19c50399ddc1fa9f48ad8f7524f6023168 Mon Sep 17 00:00:00 2001 From: Viktoryath <38876394+Viktoryath@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:33:25 +0200 Subject: [PATCH 13/13] Update Dsonar.java.binaries main.yml --- .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 9c9c2ce8..c019e64f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,7 +53,7 @@ jobs: -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} -Dsonar.host.url=https://sonarcloud.io - -Dsonar.java.binaries=target/classes + -Dsonar.java.binaries=frontend-maven-plugin/target/classes -Dsonar.exclusions=target/**,bin/**,**/*.class env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}