Skip to content

Commit

Permalink
Chore: Fix Sonar CircleCi Job
Browse files Browse the repository at this point in the history
Created a new Sonar token and added a sonar profile

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
  • Loading branch information
rohanKanojia committed Jun 9, 2021
1 parent 578e4eb commit 3f2daa9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
10 changes: 2 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,13 @@ jobs:
key: dmp-sonar-pr-{{ checksum "pom.xml" }}
- run: |
if [ -n "${CIRCLE_PR_NUMBER}" ]; then
mvn clean -Pjacoco org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
mvn clean -Pjacoco,sonar org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
-Dsonar.pullrequest.base=master \
-Dsonar.pullrequest.branch=${CIRCLE_BRANCH} \
-Dsonar.pullrequest.key=${CIRCLE_PR_NUMBER} \
-Dsonar.pullrequest.provider=GitHub \
-Dsonar.pullrequest.github.repository=fabric8io/docker-maven-plugin \
-Dsonar.github.oauth=${GITHUB_COMMENT_TOKEN} \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=default \
-Dsonar.login=${SONARQUBE_TOKEN}
else
echo "No Sonar PR analysis as this is not a pull request"
fi
Expand All @@ -87,10 +84,7 @@ jobs:
- restore_cache:
key: dmp-sonar-{{ checksum "pom.xml" }}
- run: |
mvn clean -Pjacoco org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=default \
-Dsonar.login=${SONARQUBE_TOKEN}
mvn clean -Pjacoco,sonar org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
- save_cache:
key: dmp-sonar-{{ checksum "pom.xml" }}
paths:
Expand Down
29 changes: 29 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -656,5 +656,34 @@
<excludedGroups/>
</properties>
</profile>
<profile>
<id>sonar</id>
<properties>
<sonar.projectKey>fabric8io_docker-maven-plugin</sonar.projectKey>
<sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
<sonar.organization>fabric8io</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.login>${env.SONAR_TOKEN}</sonar.login>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<executions>
<execution>
<id>sonar</id>
<phase>install</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 3f2daa9

Please sign in to comment.