Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sonarqube 10.2 support+ #797

Closed
wants to merge 21 commits into from
Closed

Add sonarqube 10.2 support+ #797

wants to merge 21 commits into from

Conversation

TheMeinerLP
Copy link

@TheMeinerLP TheMeinerLP commented Sep 5, 2023

mc1arke and others added 6 commits April 7, 2023 15:28
Sonarqube 10 has removed legacy support for modules as well as removing
deprecated properties historically used for specifying branch targets.
Additionally, the interface for managing Sonarqube features has had a
method renamed, which makes the new version of Sonarqube binary
incompatible with the plugin. The references to Sonarqube's removed code
have been removed from the plugin, and the implementations of the
interface and Java agent that dynamically updates Sonarqube code that
also implements the interface have been updated to use the new method
name.

As the Sonarqube server binaries are now compiled against Java 17, the
build process has been bumped to JDK 17, but continues to produce Java
11 artefacts to allow scanner components to be compatible with the
ongoing Java 11 support in the scanner.
    based on the branch: feature/sonarqube-10_0-support

    1. upgrade sonarqubeVersion to '10.0.0.68432'
    2. fixed dbClient.componentDao().insert(DbSession session, ComponentDto item, boolean isMainBranch)
    3. fixed UT code
@TheMeinerLP TheMeinerLP marked this pull request as draft September 5, 2023 12:07
@TheMeinerLP TheMeinerLP marked this pull request as ready for review September 5, 2023 13:38
@luisgfmarques
Copy link

Hello @TheMeinerLP, this MR is still in progress or is already working ?

@TheMeinerLP
Copy link
Author

Working

@markoftw
Copy link

markoftw commented Sep 8, 2023

Seems to work fine, thanks!

image

@rnoberger
Copy link

Is there already a downloadable jar file anywhere?

@gjabouley-invn
Copy link

gjabouley-invn commented Sep 11, 2023

Need to wait for @mc1arke approval, so GitHub CI starts and build artefact can be downloaded.

Or you can of course build it yourself, this is quite straightforward

@iSergio
Copy link

iSergio commented Sep 11, 2023

Hi all!
With this PR, plugin worked on existed projects, creates on lower version of SonarQube (9x or 10.1), but in new projects this not worked (
Plugin build from source, in java 17.0.8....

With mvn -Dsonar.branch.name=test will return:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project sonarqube: You're not authorized to analyze this project or the project doesn't exist on SonarQube and you're not authorized to create it. Please contact an administrator.

And some more logs:
[DEBUG] 22:50:07.566 Upload report [DEBUG] 22:50:07.632 POST 403 https://xxxxx/sonarqube/api/ce/submit?projectKey=KEY&projectName=KEY&characteristic=branch%3Ddevelop&characteristic=branchType%3DBRANCH | time=66ms [DEBUG] 22:50:07.632 Error response content: {"errors":[{"msg":"Insufficient privileges"}]}, headers: {content-type=[application/json], date=[Mon, 11 Sep 2023 19:50:04 GMT], server=[nginx/1.20.1], vary=[accept-encoding]}

Can anybody approve this or help fix this issue ? =)
Thanks!

@iSergio
Copy link

iSergio commented Sep 12, 2023

Hi all! With this PR, plugin worked on existed projects, creates on lower version of SonarQube (9x or 10.1), but in new projects this not worked ( Plugin build from source, in java 17.0.8....

With mvn -Dsonar.branch.name=test will return: [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project sonarqube: You're not authorized to analyze this project or the project doesn't exist on SonarQube and you're not authorized to create it. Please contact an administrator.

And some more logs: [DEBUG] 22:50:07.566 Upload report [DEBUG] 22:50:07.632 POST 403 https://xxxxx/sonarqube/api/ce/submit?projectKey=KEY&projectName=KEY&characteristic=branch%3Ddevelop&characteristic=branchType%3DBRANCH | time=66ms [DEBUG] 22:50:07.632 Error response content: {"errors":[{"msg":"Insufficient privileges"}]}, headers: {content-type=[application/json], date=[Mon, 11 Sep 2023 19:50:04 GMT], server=[nginx/1.20.1], vary=[accept-encoding]}

Can anybody approve this or help fix this issue ? =) Thanks!

Fixed for me, now testing
This happens because if we create new project and create master branch, sonar correct create foreign key in table project_branches (project_uuid) to project table. But if we create any branch, project_uuid not correct. Example:
(uuid, see) of projects table
AYqImV-jOEETREXde7zH SonarQube
(project_uuid, kee) of project_branches table (default)
AYqImV-jOEETREXde7zH master
And if we create new branch as -Dsonar.branch.name=test_sonar
AYqImV-hOEETREXde7zG test_sonar

I fixed this by force set project_uuid to branchDto before insert
branchDto.setProjectUuid(mainComponentBranchDto.getProjectUuid()); dbClient.branchDao().insert(dbSession, branchDto);

@fmdaboville
Copy link

@iSergio you updated a specific file to make it work ?

@hballangan-mdsol
Copy link

hballangan-mdsol commented Sep 14, 2023

Is it possible for you to release a jar in your fork?

@qalinn
Copy link

qalinn commented Sep 14, 2023

@mc1arke Any plan for when will be released this new version compatible with 10.2?

@iSergio
Copy link

iSergio commented Sep 14, 2023

Is it possible for you to release a jar in your fork?

https://github.com/iSergio/sonarqube-community-branch-plugin/releases/tag/1.16.1

@wooch82
Copy link

wooch82 commented Sep 14, 2023

Almost the same problem as @iSergio had... It works well with existing projects but it won't publish a result with a new one. We use Azure Pipeline task and the analysis went without any error but it fails at the publish to SQ server step:

##[debug][SQ] Waiting for task 'AYqTC8FH9DIvDEyLKXWE' to complete.
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AYqTC8FH9DIvDEyLKXWE"}"
##[debug]Response: 200 Body: "{"task":{"id":"AYqTC8FH9DIvDEyLKXWE","type":"REPORT","componentId":"AYqTCcYi9DIvDEyLKXV3","componentKey":"Project_AYqTCcWZ9DIvDEyLKXV2","componentName":"Project","componentQualifier":"TRK","status":"FAILED","submittedAt":"2023-09-14T05:35:35-0400","submitterLogin":"admin","startedAt":"2023-09-14T05:35:37-0400","executedAt":"2023-09-14T05:35:40-0400","executionTimeMs":3461,"errorMessage":"Could not find main branch","hasScannerContext":true,"warningCount":1,"warnings":["SonarScanner will require Java 17 to run, starting in SonarQube 10.3. Please upgrade the version of Java that executes the scanner and refer to <a href=\"[https://docs.sonarsource.com/sonarqube/10.2/analyzing-source-code/scanner-environment/\"](https://docs.sonarsource.com/sonarqube/10.2/analyzing-source-code/scanner-environment//%22) target=\"_blank\">the documentation</a> if needed."]}}"
##[debug][SQ] Task status:FAILED
##[debug][SQ] Publish task error: [SQ] Task failed with status FAILED, Error message: Could not find main branch
##[debug]task result: Failed

At the server's side:

Error Details
java.lang.IllegalStateException: Could not find main branch
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:68)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:50)
	at org.sonar.ce.task.projectanalysis.component.BranchLoader.load(BranchLoader.java:50)
	at org.sonar.ce.task.projectanalysis.step.LoadReportAnalysisMetadataHolderStep.execute(LoadReportAnalysisMetadataHolderStep.java:74)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:79)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:70)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:57)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:212)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:194)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:160)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:75)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Unfortunately, @iSergio's fix doesn't help with this issue.

Update.
It works with a key sonar.branch.name=$(Build.SourceBranchName)

@TheMeinerLP
Copy link
Author

Maybe i need to check again some stuff here. I can provide via R2 from Cloudflare are jar file for other users.

@ChengYen-Tang
Copy link

Almost the same problem as @iSergio had... It works well with existing projects but it won't publish a result with a new one. We use Azure Pipeline task and the analysis went without any error but it fails at the publish to SQ server step:

##[debug][SQ] Waiting for task 'AYqTC8FH9DIvDEyLKXWE' to complete.
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AYqTC8FH9DIvDEyLKXWE"}"
##[debug]Response: 200 Body: "{"task":{"id":"AYqTC8FH9DIvDEyLKXWE","type":"REPORT","componentId":"AYqTCcYi9DIvDEyLKXV3","componentKey":"Project_AYqTCcWZ9DIvDEyLKXV2","componentName":"Project","componentQualifier":"TRK","status":"FAILED","submittedAt":"2023-09-14T05:35:35-0400","submitterLogin":"admin","startedAt":"2023-09-14T05:35:37-0400","executedAt":"2023-09-14T05:35:40-0400","executionTimeMs":3461,"errorMessage":"Could not find main branch","hasScannerContext":true,"warningCount":1,"warnings":["SonarScanner will require Java 17 to run, starting in SonarQube 10.3. Please upgrade the version of Java that executes the scanner and refer to <a href=\"[https://docs.sonarsource.com/sonarqube/10.2/analyzing-source-code/scanner-environment/\"](https://docs.sonarsource.com/sonarqube/10.2/analyzing-source-code/scanner-environment//%22) target=\"_blank\">the documentation</a> if needed."]}}"
##[debug][SQ] Task status:FAILED
##[debug][SQ] Publish task error: [SQ] Task failed with status FAILED, Error message: Could not find main branch
##[debug]task result: Failed

At the server's side:

Error Details
java.lang.IllegalStateException: Could not find main branch
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:68)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:50)
	at org.sonar.ce.task.projectanalysis.component.BranchLoader.load(BranchLoader.java:50)
	at org.sonar.ce.task.projectanalysis.step.LoadReportAnalysisMetadataHolderStep.execute(LoadReportAnalysisMetadataHolderStep.java:74)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:79)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:70)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:57)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:212)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:194)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:160)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:75)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Unfortunately, @iSergio's fix doesn't help with this issue.

Update. It works with a key sonar.branch.name=$(Build.SourceBranchName)

I get the same error, and it can be executed normally without adding a key in (10.1+sonarqube-community-branch-plugin 1.15)

@randymelo
Copy link

its work for me, thanks!

@OneCyrus
Copy link
Contributor

anyone tried this snapshot/PR with the latest SonarQube 10.3 already?

@teknatha136
Copy link

anyone tried this snapshot/PR with the latest SonarQube 10.3 already?

1.16.1-SNAPSHOT is working with 10.3.0.82913

@gjabouley-invn
Copy link

1.16.1-SNAPSHOT is working with 10.3.0.82913

Hello, what is this version 1.16.1-SNAPSHOT? can you point to repo/commit?

@teknatha136
Copy link

teknatha136 commented Nov 17, 2023

1.16.1-SNAPSHOT is working with 10.3.0.82913

Hello, what is this version 1.16.1-SNAPSHOT? can you point to repo/commit?

I got link from one of the comment threads to @iSergio's Fork

@fmdaboville
Copy link

Are we planning to merge this to have a consolidated version for latest releases ?
Latest SNAPSHOT is working with both 10.2.1 and 10.3 versions ?

@dennys
Copy link

dennys commented Nov 20, 2023

I try to use sonarqube-community-branch-plugin-1.16.0-SNAPSHOT (The file date is 2023/10/20) and SonarQube 10.2.1 to analyze new project.
I see the branch is detected in log and I can see the branch name in Background Tasks.
The log in gitlab is INFO: Auto detected BRANCH configuration with source branch1 using com.github.mc1arke.sonarqube.plugin.scanner.autoconfiguration.GitlabCiAutoConfigurer

But when I try to click the branch (e.g. http://localhost:9000/dashboard?branch=branch1&id=project1), it's redirected to login page and show You are not authorized to access this page. Please log in with more privileges and try again..
I use administrator and get the same error.

And I also try to access a non-existed branch, e.g. http://localhost:9000/dashboard?branch=branch_non_exist&id=project1, and it shows The requested project could not be found.. It seems the branch is existed in SonarQube now, but I cannot access it?

This is my 1st time to use this plugin, I just follow README.md to download .jar and modify conf/sonar.properties. But when I restart SonarQube, it doesn't show warning about using third-party plugins. Is there any thing I can do ?

And I don't set sonar.branch.name in .gitlab-ci.yml

@Pexers
Copy link

Pexers commented Nov 20, 2023

Also experiencing the same problem others addressed when creating new projects. In my case the branch dropdown gets locked, and I can only make analysis to the default branch. Trying new branches throws the below error:

java.lang.IllegalStateException: Project 'AYvtOB68KNLEW...' not found

Using the latest SonarQube version available (v10.3.0) as well as the JAR provided by @iSergio (1.16.1-SNAPSHOT).
Screenshot 2023-11-20 at 16 17 12

@rnoberger
Copy link

rnoberger commented Nov 21, 2023

I am unable to confirm the behavior described by @Pexers. When I start an analysis of a project, the dropdown menu remains grayed out because there is only one branch. However, after initiating an analysis of a second branch, the dropdown menu becomes available as expected. Can anyone else confirm either my or @Pexers's observations?

I used the same setup with Sonarqube 10.3.0 and the Snapshot of iSergio.

@Pexers
Copy link

Pexers commented Nov 21, 2023

From the logs I can see that the analysis was successful, however, when trying to access the report, I get an unauthorized error, even when trying to login with admin.

Despite that, I have made a test with a local sonar scanner CLI, and it can indeed make the analysis using different branches. So at the moment I'm a bit confused. 🫠

  scanner:
    image: sonarsource/sonar-scanner-cli
    networks: [ sonar-network ]
    volumes:
      - ./src:/usr/src
    entrypoint: >
      /bin/sh -c "
      sonar-scanner -Dsonar.login=admin -Dsonar.password=admin -Dsonar.host.url=http://sonarqube:9000 -Dsonar.organization=my-org -Dsonar.projectKey=proj-1 -Dsonar.branch.name=staging-qa -Dsonar.sources=/usr/src
      "

@brumouta
Copy link

Any plans on making a docker for this version?

@rnoberger
Copy link

@Pexers, can you try to log in to the index.html of sonarqube to verify that the credentials are correct and then navigate to the project and switch to the newly analyzed branch?

@Pexers
Copy link

Pexers commented Nov 21, 2023

@rnoberger I've fixed my issue.

Problem

Somehow, I've managed to break my SonarQube project, and I couldn't start an analysis for branches called staging-qa on a specific project. If the branch was called any other name, it worked with no errors.

I started by doing a backup & restore of the DB using clean SonarQube & PSQL instances. During the index process, the bellow error was logged:

WARN web[][o.s.s.m.c.RecentTasksDurationTask] Can't report metric data for a CE task with component uuid <broken_uuid>

Meaning that the project for that specific <broken_uuid> didn't exist.

Fix

I had to access the PSQL instance and run the following query:

SELECT * FROM project_branches WHERE project_uuid='<broken_uuid>';

The result of the query showed the staging-qa branch within this "ghost" project, so I just had to delete this row:

DELETE FROM project_branches WHERE project_uuid='<broken_uuid>';

After completing these steps, I was able to create the staging-qa branch analysis with no issues.

@TheMeinerLP
Copy link
Author

Thanks for that feedback, i will try to fix the issues and analyze it.

@byronestebancndt
Copy link

Is there any ETA for this PR to be merged?

@vinicius-solon-silva
Copy link

Hey everyone, any updates?

@Numichi
Copy link

Numichi commented Dec 10, 2023

Does anyone not want to take it over and release it if the repo owner does nothing?
@TheMeinerLP

@TheMeinerLP
Copy link
Author

@Numichi thanks for that hint. I am currently too busy to manage that kind of big project but if someone else has the intention to do that. I am happy to contribute my code there. I do this PR beside my normal company work. I hope I can go further on and fix some issues and do a update

@wooch82
Copy link

wooch82 commented Dec 12, 2023

Has anyone else experienced the same behavior? Thank you.

I can see this behavior if I haven't scanned the master/main branch yet.

@hiakki
Copy link

hiakki commented Dec 18, 2023

SonarQube - Community Edition Version 10.3 (build 82913)
Maven - 3.8.5
Java - 17
Infra - K8s v1.27
Deployed via - Helm Chart 10.4.0
Plugin - 1.16.1

Everything worked like a charm.
Thanks Everyone.
image

@byronestebancndt
Copy link

SonarQube - Community Edition Version 10.3 (build 82913) Maven - 3.8.5 Java - 17 Infra - K8s v1.27 Deployed via - Helm Chart 10.4.0 Plugin - 1.16.1

Everything worked like a charm. Thanks Everyone. image

How were you able to deploy it using helm ? the plugin is still not available for 10.x.x, I can see last release was 1.14.0

@hiakki
Copy link

hiakki commented Dec 19, 2023

SonarQube - Community Edition Version 10.3 (build 82913) Maven - 3.8.5 Java - 17 Infra - K8s v1.27 Deployed via - Helm Chart 10.4.0 Plugin - 1.16.1
Everything worked like a charm. Thanks Everyone. image

How were you able to deploy it using helm ? the plugin is still not available for 10.x.x, I can see last release was 1.14.0

In this comment, you can find the direct link to plugin's jar file - #797 (comment)

You can use that link in helm chart under this section -

plugins:
  image: curlimages/curl:8.2.1
  install:
    - https://github.com/iSergio/sonarqube-community-branch-plugin/releases/download/1.16.1/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar
  noCheckCertificate: false

env:
  - name: SONAR_WEB_JAVAOPTS
    value: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web"
  - name: SONAR_CE_JAVAOPTS
    value: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce"

@maltunok
Copy link

I receive this error with your exact config:

helm upgrade --install -n sonarqube sonarqube sonarqube/sonarqube -f values.yaml
Error: UPGRADE FAILED: cannot patch "sonarqube-sonarqube" with kind StatefulSet: The order in patch list:
[map[name:SONAR_WEB_JAVAOPTS value:-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web] map[name:SONAR_WEB_JAVAOPTS value:-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web] map[name:SONAR_CE_JAVAOPTS value:-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce] map[name:SONAR_CE_JAVAOPTS value:-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce]]
doesn't match $setElementOrder list:
[map[name:SONAR_WEB_JAVAOPTS] map[name:SONAR_CE_JAVAOPTS] map[name:SONAR_HELM_CHART_VERSION] map[name:SONAR_WEB_JAVAOPTS] map[name:SONAR_WEB_CONTEXT] map[name:SONAR_CE_JAVAOPTS] map[name:SONAR_JDBC_PASSWORD] map[name:SONAR_WEB_SYSTEMPASSCODE]]

SonarQube - Community Edition Version 10.3 (build 82913) Maven - 3.8.5 Java - 17 Infra - K8s v1.27 Deployed via - Helm Chart 10.4.0 Plugin - 1.16.1
Everything worked like a charm. Thanks Everyone. image

How were you able to deploy it using helm ? the plugin is still not available for 10.x.x, I can see last release was 1.14.0

In this comment, you can find the direct link to plugin's jar file - #797 (comment)

You can use that link in helm chart under this section -

plugins:
  image: curlimages/curl:8.2.1
  install:
    - https://github.com/iSergio/sonarqube-community-branch-plugin/releases/download/1.16.1/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar
  noCheckCertificate: false

env:
  - name: SONAR_WEB_JAVAOPTS
    value: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web"
  - name: SONAR_CE_JAVAOPTS
    value: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce"

@hiakki
Copy link

hiakki commented Dec 20, 2023

@maltunok This is not a helm/plugin related issue. It is STS related issue.
Issue -
Once you have deployed an STS via helm chart, if you are going to update it, please make sure all things except the changes are exact in same place.

In your case, ENVs orders are changed (and it is normal). If possible, recreate the STS.

@maltunok
Copy link

@hiakki when i delete the env: section and add the following to my values.yaml it sucessfully deploys to kubernetes but this time branch not found error is returned.

`
jvmOpts: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web"

jvmCeOpts: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce"`

@maltunok This is not a helm/plugin related issue. It is STS related issue. Issue - Once you have deployed an STS via helm chart, if you are going to update it, please make sure all things except the changes are exact in same place.

In your case, ENVs orders are changed (and it is normal). If possible, recreate the STS.

@maltunok
Copy link

I seems worked finally.

Thank you community.

values.yaml
image: repository: sonarqube tag: 10.3.0-{{ .Values.edition }} pullPolicy: IfNotPresent plugins: image: curlimages/curl:8.2.1 install: - "https://github.com/iSergio/sonarqube-community-branch-plugin/releases/download/1.16.1/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar" noCheckCertificate: false jvmOpts: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web" jvmCeOpts: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce"

Dockerfile:
`ARG SONAR_URL=$SONAR_URL
ARG SONAR_TOKEN=$SONAR_TOKEN
ARG SONAR_BRANCH_NAME=$SONAR_BRANCH_NAME

RUN apk update
RUN apk add openjdk17
RUN dotnet tool install --global dotnet-sonarscanner
ENV PATH="$PATH:/root/.dotnet/tools"

RUN dotnet sonarscanner begin /k:"xxx" /d:sonar.host.url="$SONAR_URL" /d:sonar.login="$SONAR_TOKEN" /d:sonar.branch.name="$SONAR_BRANCH_NAME"`

pipeline:
`steps:

  • task: Docker@1
    displayName: 'Build an image'
    inputs:
    azureSubscriptionEndpoint: 'xxx'
    azureContainerRegistry: xxx
    dockerFile: Dockerfile
    arguments: '--build-arg SONAR_URL=$(SONAR_URL) --build-arg SONAR_TOKEN=$(SONAR_TOKEN) --build-arg SONAR_BRANCH_NAME=$(Build.SourceBranchName)'
    imageName: '$(Build.Repository.Name):v$(Build.BuildNumber)'
    useDefaultContext: false
    buildContext: '$(Build.Repository.LocalPath)'`

image

@hiakki when i delete the env: section and add the following to my values.yaml it sucessfully deploys to kubernetes but this time branch not found error is returned.

` jvmOpts: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=web"

jvmCeOpts: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.16.1-SNAPSHOT.jar=ce"`

@maltunok This is not a helm/plugin related issue. It is STS related issue. Issue - Once you have deployed an STS via helm chart, if you are going to update it, please make sure all things except the changes are exact in same place.
In your case, ENVs orders are changed (and it is normal). If possible, recreate the STS.

@mc1arke
Copy link
Owner

mc1arke commented Dec 30, 2023

I'm superseding this with #839 since this PR currently has conflicts and doesn't appear to be setting the project UUID properly on branches and pull requests. Thanks for the proposed contribution though!

@mc1arke mc1arke closed this Dec 30, 2023
@TheMeinerLP TheMeinerLP deleted the feature/sonarqube-10_2-support branch January 2, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet