From b79f4eb0cedf3fe2eac369b1e53d5b373cf95d6a Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 22:41:31 +0200 Subject: [PATCH 01/17] :green_heart: Add SonarQube analysis in GitHub Actions Part of #25 --- .github/workflows/maven-java-feature.yml | 13 +++++- .github/workflows/maven-java.yml | 15 ++++++- .github/workflows/settings.xml | 4 +- pom.xml | 50 +++++++++++++++++++++--- 4 files changed, 73 insertions(+), 9 deletions(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index 223048e..746be2c 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -36,6 +36,12 @@ jobs: ${{ runner.os }}-m2-${{ env.cache-name }}- ${{ runner.os }}-m2- ${{ runner.os }}- + #TODO? - name: Extract branch name + #TODO? id: extract-branch-name + #TODO? shell: bash + #TODO? run: | + #TODO? echo "::set-output name=BRANCH::${GITHUB_REF#refs/heads/}" + #TODO? #TODO? echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - name: Get Maven Project information id: maven-project-info run: | @@ -65,5 +71,10 @@ jobs: #TODO run: checkout du parent commun #TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' - #TODO - name: Quality Gate [SonarQube] + - name: Quality Gate [SonarQube] #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' + run: mvn -U sonar:sonar -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} --file pom.xml --settings .github/workflows/settings.xml + env: + SERVER_USERNAME: $GITHUB_ACTOR + SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/maven-java.yml b/.github/workflows/maven-java.yml index f1e48f6..d0f4353 100644 --- a/.github/workflows/maven-java.yml +++ b/.github/workflows/maven-java.yml @@ -65,6 +65,12 @@ jobs: ${{ runner.os }}-m2-${{ env.cache-name }}- ${{ runner.os }}-m2- ${{ runner.os }}- + #TODO? - name: Extract branch name + #TODO? id: extract-branch-name + #TODO? shell: bash + #TODO? run: | + #TODO? echo "::set-output name=BRANCH::${GITHUB_REF#refs/heads/}" + #TODO? #TODO? echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - name: Get Maven Project information id: maven-project-info run: | @@ -111,8 +117,13 @@ jobs: #TODO run: checkout du parent commun #TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' - #TODO - name: Quality Gate [SonarQube] - #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' + - name: Quality Gate [SonarQube] + #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' + run: mvn -U sonar:sonar -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} --file pom.xml --settings .github/workflows/settings.xml + env: + SERVER_USERNAME: $GITHUB_ACTOR + SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Publish to GitHub Packages Apache Maven run: mvn -U -Dmaven.main.skip -Dunit.test.skip -Dverify.skip jar:jar@default-jar assembly:single@make-assembly source:jar-no-fork@attach-sources javadoc:jar@attach-javadocs deploy --file pom.xml --settings .github/workflows/settings.xml env: diff --git a/.github/workflows/settings.xml b/.github/workflows/settings.xml index e1dbe0d..273b971 100644 --- a/.github/workflows/settings.xml +++ b/.github/workflows/settings.xml @@ -45,7 +45,9 @@ - + + org.sonarsource.scanner.maven + diff --git a/pom.xml b/pom.xml index 18adaf9..7bf7f3f 100644 --- a/pom.xml +++ b/pom.xml @@ -108,8 +108,8 @@ UTF-8 true true - false - false + true + true 3.2.0 3.2.0 @@ -126,15 +126,19 @@ 0.8.5 ${project.build.directory}/coverage-reports/jacoco-ut.exec ${project.build.directory}/coverage-reports/jacoco-it.exec - true 3.9.0 3.0.0 2.3 + + 3.7.0.1746 + https://sonarcloud.io + bdelion-github + ${project.groupId}:${project.artifactId} + + ${jacoco.utReportPath}, ${jacoco.itReportPath} @@ -547,6 +551,42 @@ maven-project-info-reports-plugin ${maven-project-info-reports-plugin} + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} + + + + + From 8dff014330c4026175805a117974ee59105154a7 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 22:57:08 +0200 Subject: [PATCH 02/17] :green_heart: Add SonarQube analysis in Travis CI Part of #25 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0c1e754..d6cf6f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ jobs: - mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml - mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml - mvn -U -Dmaven.main.skip -Dunit.test.skip verify --file pom.xml --settings .github/workflows/settings.xml + - mvn -U sonar:sonar -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} --file pom.xml --settings .github/workflows/settings.xml - stage: Deploy and make Site name: Publish to GitHub Packages Apache Maven From e899575df963f23701351472184e8c12f8e4deec Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Thu, 23 Apr 2020 07:42:09 +0200 Subject: [PATCH 03/17] :pencil: Add SonarCloud Quality Gate badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cfde026..30dee48 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ ![Maven CI for Java](https://github.com/bdelion/java-parent/workflows/Maven%20CI%20for%20Java/badge.svg?branch=develop) [![Travis CI Build Status](https://travis-ci.com/bdelion/java-parent.svg?branch=develop)](https://travis-ci.com/bdelion/java-parent) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fr.fifiz.socle.java:java-parent&metric=alert_status&branch=feature/issue-25)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java:java-parent&branch=feature/issue-25) + [![Known Vulnerabilities](https://snyk.io/test/github/bdelion/java-parent/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/bdelion/java-parent?targetFile=pom.xml)

From ec4b08ee413fbb859577ba05ccb6a35642fab8f3 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Thu, 23 Apr 2020 07:59:30 +0200 Subject: [PATCH 04/17] :pencil: Bad param branch in SonarCloud badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30dee48..5bfb69f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![Maven CI for Java](https://github.com/bdelion/java-parent/workflows/Maven%20CI%20for%20Java/badge.svg?branch=develop) [![Travis CI Build Status](https://travis-ci.com/bdelion/java-parent.svg?branch=develop)](https://travis-ci.com/bdelion/java-parent) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fr.fifiz.socle.java:java-parent&metric=alert_status&branch=feature/issue-25)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java:java-parent&branch=feature/issue-25) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fr.fifiz.socle.java:java-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java:java-parent) [![Known Vulnerabilities](https://snyk.io/test/github/bdelion/java-parent/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/bdelion/java-parent?targetFile=pom.xml) From 876a143f0a8491952de3bbff25b4005f958c4256 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Thu, 23 Apr 2020 08:04:38 +0200 Subject: [PATCH 05/17] :pencil: Fix param branch in SonarCloud badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bfb69f..13b72fc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![Maven CI for Java](https://github.com/bdelion/java-parent/workflows/Maven%20CI%20for%20Java/badge.svg?branch=develop) [![Travis CI Build Status](https://travis-ci.com/bdelion/java-parent.svg?branch=develop)](https://travis-ci.com/bdelion/java-parent) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fr.fifiz.socle.java:java-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java:java-parent) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=feature%2Fissue-25&project=fr.fifiz.socle.java%3Ajava-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java%3Ajava-parent&branch=feature%2Fissue-25) [![Known Vulnerabilities](https://snyk.io/test/github/bdelion/java-parent/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/bdelion/java-parent?targetFile=pom.xml) From 6db12dea511ea746d28db97fa873b5505e6f5ac6 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Thu, 23 Apr 2020 08:07:17 +0200 Subject: [PATCH 06/17] :rotating_light: Remove editorconfig-maven-plugin --- pom.xml | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/pom.xml b/pom.xml index 7bf7f3f..f7a3b92 100644 --- a/pom.xml +++ b/pom.xml @@ -557,36 +557,6 @@ sonar-maven-plugin ${sonar-maven-plugin.version} - - - - From 1e12782ac717914e340f09d56a899b5f256511d7 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Thu, 23 Apr 2020 22:49:41 +0200 Subject: [PATCH 07/17] :wrench: Add pom properties for Sonar --- pom.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f7a3b92..ea7a8e9 100644 --- a/pom.xml +++ b/pom.xml @@ -122,6 +122,7 @@ 5.6.2 3.0.0-M4 + ${project.build.directory}/surefire-reports 3.0.0-M4 0.8.5 ${project.build.directory}/coverage-reports/jacoco-ut.exec @@ -137,8 +138,15 @@ https://sonarcloud.io bdelion-github ${project.groupId}:${project.artifactId} + ${project.name} + ${project.version} + ${project.build.sourceEncoding} - ${jacoco.utReportPath}, ${jacoco.itReportPath} + ${surefire.reportsDirectory} + + ${jacoco.utReportPath}, ${jacoco.itReportPath}, ${project.build.directory}/coverage-reports/merged.exec @@ -330,6 +338,7 @@ maven-surefire-plugin ${maven-surefire-plugin.version} + ${surefire.reportsDirectory} false alphabetical From 1222bb375570292685f5d0a11c322b5f747fac13 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Thu, 23 Apr 2020 23:23:26 +0200 Subject: [PATCH 08/17] :green_heart: GH Actions delete Extract branch name --- .github/workflows/maven-java-feature.yml | 6 ------ .github/workflows/maven-java.yml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index 746be2c..a44a11c 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -36,12 +36,6 @@ jobs: ${{ runner.os }}-m2-${{ env.cache-name }}- ${{ runner.os }}-m2- ${{ runner.os }}- - #TODO? - name: Extract branch name - #TODO? id: extract-branch-name - #TODO? shell: bash - #TODO? run: | - #TODO? echo "::set-output name=BRANCH::${GITHUB_REF#refs/heads/}" - #TODO? #TODO? echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - name: Get Maven Project information id: maven-project-info run: | diff --git a/.github/workflows/maven-java.yml b/.github/workflows/maven-java.yml index d0f4353..b175ee3 100644 --- a/.github/workflows/maven-java.yml +++ b/.github/workflows/maven-java.yml @@ -65,12 +65,6 @@ jobs: ${{ runner.os }}-m2-${{ env.cache-name }}- ${{ runner.os }}-m2- ${{ runner.os }}- - #TODO? - name: Extract branch name - #TODO? id: extract-branch-name - #TODO? shell: bash - #TODO? run: | - #TODO? echo "::set-output name=BRANCH::${GITHUB_REF#refs/heads/}" - #TODO? #TODO? echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - name: Get Maven Project information id: maven-project-info run: | From ab8f467b7e6b312a298563cb64614de445c172f9 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 08:10:08 +0200 Subject: [PATCH 09/17] :loud_sound: log sonar.host.url in GitHub Actions --- .github/workflows/maven-java-feature.yml | 3 ++- .github/workflows/maven-java.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index a44a11c..8742ab4 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -43,6 +43,7 @@ jobs: echo "$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" echo "$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" echo "$(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" + echo "$(mvn help:evaluate -Dexpression=sonar.host.url -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} @@ -67,7 +68,7 @@ jobs: #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' - name: Quality Gate [SonarQube] #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' - run: mvn -U sonar:sonar -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} --file pom.xml --settings .github/workflows/settings.xml + run: mvn -U -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} diff --git a/.github/workflows/maven-java.yml b/.github/workflows/maven-java.yml index b175ee3..c015d25 100644 --- a/.github/workflows/maven-java.yml +++ b/.github/workflows/maven-java.yml @@ -107,13 +107,13 @@ jobs: env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} - #TODO - name: Set Leak Period [SonarQube] - #TODO run: checkout du parent commun - #TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' - #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' +#TODO - name: Set Leak Period [SonarQube] +#TODO run: checkout du parent commun +#TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' +#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' - name: Quality Gate [SonarQube] - #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' - run: mvn -U sonar:sonar -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} --file pom.xml --settings .github/workflows/settings.xml +#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' + run: mvn -U -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} From cbe1325a1129c992b54723d53e9c704dd90ad072 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 08:34:44 +0200 Subject: [PATCH 10/17] :green_heart: Set tags on Sonar project in GitHub Actions --- .github/workflows/maven-java-feature.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index 8742ab4..e53d52b 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -43,7 +43,8 @@ jobs: echo "$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" echo "$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" echo "$(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" - echo "$(mvn help:evaluate -Dexpression=sonar.host.url -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" + echo "::set-output name=SONAR_HOST_URL::$(mvn help:evaluate -Dexpression=sonar.host.url -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" + echo "::set-output name=SONAR_PROJECT_KEY::$(mvn help:evaluate -Dexpression=sonar.projectKey -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} @@ -73,3 +74,10 @@ jobs: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Add tags [SonarQube] + run: | + curl ${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project={{ steps.maven-project-info.outputs.SONAR_HOST_URL }}&tags=socle,java + env: + SERVER_USERNAME: $GITHUB_ACTOR + SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From a57ff61186139db59c858903cfdb9c11eb8a7c23 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 08:45:42 +0200 Subject: [PATCH 11/17] :bug: Step outputs not interpreted in curl POST SonarCloud --- .github/workflows/maven-java-feature.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index e53d52b..791ab08 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -63,21 +63,21 @@ jobs: env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} - #TODO - name: Set Leak Period [SonarQube] + #TODO - name: Set Leak Period [SonarCloud.io] #TODO run: checkout du parent commun #TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' - - name: Quality Gate [SonarQube] + - name: Quality Gate [SonarCloud.io] #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' run: mvn -U -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Add tags [SonarQube] + - name: Add tags [SonarCloud.io] run: | - curl ${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project={{ steps.maven-project-info.outputs.SONAR_HOST_URL }}&tags=socle,java - env: - SERVER_USERNAME: $GITHUB_ACTOR - SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + curl "-u ${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project={{ steps.maven-project-info.outputs.SONAR_HOST_URL }}&tags=socle,java" + #TODO env: + #TODO SERVER_USERNAME: $GITHUB_ACTOR + #TODO SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} + #TODO SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 45068a437293018c49385a2ce2926dda4b573523 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 08:53:45 +0200 Subject: [PATCH 12/17] :bug: Bad copy past for SONAR_PROJECT_KEY --- .github/workflows/maven-java-feature.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index 791ab08..0f02df3 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -76,7 +76,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Add tags [SonarCloud.io] run: | - curl "-u ${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project={{ steps.maven-project-info.outputs.SONAR_HOST_URL }}&tags=socle,java" + curl "-u ${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project={{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" #TODO env: #TODO SERVER_USERNAME: $GITHUB_ACTOR #TODO SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} From 3e7ad100f2f92eeaab5969a1ab25ca563c226aba Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 08:58:06 +0200 Subject: [PATCH 13/17] :bug: Forgetting $ before SONAR_PROJECT_KEY variable --- .github/workflows/maven-java-feature.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index 0f02df3..e8c6b79 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -76,7 +76,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Add tags [SonarCloud.io] run: | - curl "-u ${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project={{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" + curl "-u ${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" #TODO env: #TODO SERVER_USERNAME: $GITHUB_ACTOR #TODO SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} From 378f9b21151eaf179bebca44806e0b72766dad84 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 09:09:30 +0200 Subject: [PATCH 14/17] :bug: curl -u option pb --- .github/workflows/maven-java-feature.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index e8c6b79..90b4e7c 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -76,7 +76,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Add tags [SonarCloud.io] run: | - curl "-u ${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" + curl -u "${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" #TODO env: #TODO SERVER_USERNAME: $GITHUB_ACTOR #TODO SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} From ae521611b95dab8fab4ab2b24e83070ec3a368cd Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 09:15:29 +0200 Subject: [PATCH 15/17] :sparkles: Finalize POST SonarCloud tags --- .github/workflows/maven-java-feature.yml | 4 ---- .github/workflows/maven-java.yml | 17 +++++++++++------ .travis.yml | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index 90b4e7c..cd975f5 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -77,7 +77,3 @@ jobs: - name: Add tags [SonarCloud.io] run: | curl -u "${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" - #TODO env: - #TODO SERVER_USERNAME: $GITHUB_ACTOR - #TODO SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} - #TODO SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/maven-java.yml b/.github/workflows/maven-java.yml index c015d25..a6d72ed 100644 --- a/.github/workflows/maven-java.yml +++ b/.github/workflows/maven-java.yml @@ -72,6 +72,8 @@ jobs: echo "$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" echo "::set-output name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" echo "::set-output name=PACKAGING::$(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" + echo "::set-output name=SONAR_HOST_URL::$(mvn help:evaluate -Dexpression=sonar.host.url -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" + echo "::set-output name=SONAR_PROJECT_KEY::$(mvn help:evaluate -Dexpression=sonar.projectKey -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} @@ -107,17 +109,20 @@ jobs: env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} -#TODO - name: Set Leak Period [SonarQube] -#TODO run: checkout du parent commun -#TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' -#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' - - name: Quality Gate [SonarQube] -#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' + #TODO - name: Set Leak Period [SonarCloud.io] + #TODO run: checkout du parent commun + #TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true' + #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832' + - name: Quality Gate [SonarCloud.io] + #TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555' run: mvn -U -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Add tags [SonarCloud.io] + run: | + curl -u "${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java" - name: Publish to GitHub Packages Apache Maven run: mvn -U -Dmaven.main.skip -Dunit.test.skip -Dverify.skip jar:jar@default-jar assembly:single@make-assembly source:jar-no-fork@attach-sources javadoc:jar@attach-javadocs deploy --file pom.xml --settings .github/workflows/settings.xml env: diff --git a/.travis.yml b/.travis.yml index d6cf6f0..4497448 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ jobs: - mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml - mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml - mvn -U -Dmaven.main.skip -Dunit.test.skip verify --file pom.xml --settings .github/workflows/settings.xml - - mvn -U sonar:sonar -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} --file pom.xml --settings .github/workflows/settings.xml + - mvn -U -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml - stage: Deploy and make Site name: Publish to GitHub Packages Apache Maven From a4207205b8b71fc179c7a5ffd34a70f0613d3918 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 09:41:04 +0200 Subject: [PATCH 16/17] :bug: sonar.jacoco.reportPaths is deprecated switch to sonar.coverage.jacoco.xmlReportPaths --- README.md | 2 +- pom.xml | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 13b72fc..9384a2a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![Maven CI for Java](https://github.com/bdelion/java-parent/workflows/Maven%20CI%20for%20Java/badge.svg?branch=develop) [![Travis CI Build Status](https://travis-ci.com/bdelion/java-parent.svg?branch=develop)](https://travis-ci.com/bdelion/java-parent) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=feature%2Fissue-25&project=fr.fifiz.socle.java%3Ajava-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java%3Ajava-parent&branch=feature%2Fissue-25) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=develop&project=fr.fifiz.socle.java%3Ajava-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java%3Ajava-parent&branch=develop) [![Known Vulnerabilities](https://snyk.io/test/github/bdelion/java-parent/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/bdelion/java-parent?targetFile=pom.xml) diff --git a/pom.xml b/pom.xml index ea7a8e9..1029532 100644 --- a/pom.xml +++ b/pom.xml @@ -143,10 +143,7 @@ ${project.build.sourceEncoding} ${surefire.reportsDirectory} - - ${jacoco.utReportPath}, ${jacoco.itReportPath}, ${project.build.directory}/coverage-reports/merged.exec + ${project.reporting.outputDirectory}/jacoco-it/jacoco.xml,${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml,${project.reporting.outputDirectory}/jacoco-aggregate/jacoco.xml From 98b5fc4ea0e6d72958c4752a65c2921ef740a6d9 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Sat, 25 Apr 2020 09:47:26 +0200 Subject: [PATCH 17/17] :art: Badges in README --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9384a2a..179df41 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,7 @@ ![Maven CI for Java](https://github.com/bdelion/java-parent/workflows/Maven%20CI%20for%20Java/badge.svg?branch=develop) [![Travis CI Build Status](https://travis-ci.com/bdelion/java-parent.svg?branch=develop)](https://travis-ci.com/bdelion/java-parent) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=develop&project=fr.fifiz.socle.java%3Ajava-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java%3Ajava-parent&branch=develop) - -[![Known Vulnerabilities](https://snyk.io/test/github/bdelion/java-parent/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/bdelion/java-parent?targetFile=pom.xml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=develop&project=fr.fifiz.socle.java%3Ajava-parent&metric=alert_status)](https://sonarcloud.io/dashboard?id=fr.fifiz.socle.java%3Ajava-parent&branch=develop) [![Known Vulnerabilities](https://snyk.io/test/github/bdelion/java-parent/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/bdelion/java-parent?targetFile=pom.xml)

Sourcerer gitMemory