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

#753: Add support for Sonarqube 10.0 #754

Merged
merged 1 commit into from
Sep 16, 2023
Merged

Conversation

mc1arke
Copy link
Owner

@mc1arke mc1arke commented Apr 5, 2023

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.

@mc1arke mc1arke force-pushed the feature/sonarqube-10_0-support branch from 94dd33b to 17d0c0f Compare April 6, 2023 19:39
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.
@mc1arke mc1arke force-pushed the feature/sonarqube-10_0-support branch from 17d0c0f to ebe6388 Compare April 7, 2023 19:44
@sonarcloud
Copy link

sonarcloud bot commented Apr 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@Ixiodor
Copy link

Ixiodor commented Apr 14, 2023

I'm unable to compile.
From windows and using Dockerfile.
100 errors show up.

@nixel2007
Copy link

@Ixiodor no errors - no help.

@phawzy
Copy link

phawzy commented Apr 16, 2023

when will the image be pushed to dockerhub ?

@Ixiodor
Copy link

Ixiodor commented Apr 16, 2023

errors.txt
Here you go.

@Nicolas-M
Copy link

I was able to reproduce @Ixiodor's issue by building the Dockerfile included in the repository. It looks like most of these errors seem are caused by a mismatch between Java versions, where Java 17 is expected but Java 11 is used. To fix this, I suggest:

  1. Updating the image used in the Dockerfile to gradle:7.3.3-jdk17-alpine
  2. (Optionally) Update the compatibility lines in build.gradle to JavaVersion.VERSION_17. Although this isn't fully required, it will ensure Java 17 is used everywhere in the project.

@fmiqbal
Copy link

fmiqbal commented Apr 18, 2023

built on windows (no docker), can confirm its working as expected
image

image

action "delete PR" is also working

the MR decoration is also working

image

@rddimon
Copy link

rddimon commented Apr 21, 2023

Hi there,

Any chance to release it?

@ionutzaharia
Copy link

Tested it, works well with SonarQube Server 10.0.0.

@pragmaticivan
Copy link

👋🏼 any chance we can get that released this upcoming week?

@c1sc0
Copy link

c1sc0 commented May 1, 2023

If you're interested in using the plugin, it can be downloaded from the provided URL, but please note that it is not an official plugin and should be used at your own risk. https://ipfs.obiwan.xyz/ipfs/QmXS3BhVpigNhMUBHnFkKn9X4hXyPJBwDLMrT2kp7Txecd/sonarqube-community-branch-plugin-1.15.0-SNAPSHOT.jar

@gjabouley-invn
Copy link

gjabouley-invn commented May 4, 2023

Hi

please note that thanks to GitHub Actions, you can download the generated artefact of this PR directly from GitHub Checks pages:

  1. https://github.com/mc1arke/sonarqube-community-branch-plugin/pull/754/checks
  2. https://github.com/mc1arke/sonarqube-community-branch-plugin/actions/runs/4640906442?pr=754
  3. https://github.com/mc1arke/sonarqube-community-branch-plugin/suites/12099751729/artifacts/637296316

It needs a little time to get use to the Checks display and layout, but then you can grab a lot of interesting things 😉

No need to use a custom build artefact from another source.

@frcho
Copy link

frcho commented May 4, 2023

Hi
I'm testing this version with azure devops, but the pull request decorator doesn't work.
Somebody can verify to validate, If I'm make something bad.

Update:

After verifying, I found that the problem was that I didn't have DevOps Platform Integration activated for the project I wanted to analyze, and that's why the pull request decorator wasn't working. Conclusion: the plugin version is working for SonarQube 10.
image

@c1sc0
Copy link

c1sc0 commented May 4, 2023

I've tested with azure devops PR:
image

It looks like this.

@sharkymcdongles
Copy link

sharkymcdongles commented May 11, 2023

Could this possibly cause issues with the analyzer from differentiating between new code and the entire code base?

@sharkymcdongles
Copy link

Okay to me it seems they added a new code feature now that changes what code gets checked as new and for us it seems it causes critical issues to always fail no matter how we set our gates. But maybe it is a different thing within 10 I am missing, but my suspicion is maybe the API is different for this slightly.

@MickaelCa
Copy link

I managed to build this branch successfuly with the gradle:7.3.3-jdk17-alpine container, temporarly published the build here.
So far, working as expected on sonarqube 10.0.0.68432 deployed with helm

@theodury
Copy link

@mc1arke any chance we get a date about the released ? 🙏

@nicolaizav93
Copy link

I have upgraded from version 9.7.1 to version 10 of SonarQube. I also updated the sonarqube-community-branch-plugin to version 1.14.0. I made the necessary changes in the sonar.properties file. However, after logging in, I'm experiencing an endless loading of SonarQube. In the logs, I see the following error:

12:54:55.516 [main] INFO com.github.mc1arke.sonarqube.plugin.CommunityBranchAgent - Loading agent
12:54:55.525 [main] DEBUG com.github.mc1arke.sonarqube.plugin.CommunityBranchAgent - Transforming class org.sonar.core.platform.PlatformEditionProvider
12:54:55.601 [main] DEBUG com.github.mc1arke.sonarqube.plugin.CommunityBranchAgent - Transforming class org.sonar.server.almsettings.MultipleAlmFeature
12:54:55.604 [main] ERROR com.github.mc1arke.sonarqube.plugin.CommunityBranchAgent - Could not transform class org.sonar.server.almsettings.MultipleAlmFeature, will use default class definition
javassist.NotFoundException: isEnabled(..) is not found in org.sonar.server.almsettings.MultipleAlmFeature

Java version: 17
On SonarQube version 9.9.0, everything was working fine with the plugin version 1.14.0.

@gjabouley-invn
Copy link

gjabouley-invn commented Jun 2, 2023

This plugin (latest version 1.14.0) does not work yet with SonarQube 10.

Snapshot version from this PR can be downloaded from here: https://github.com/mc1arke/sonarqube-community-branch-plugin/suites/12099751315/artifacts/637297350

This is the purpose of this PR to add support for SonarQube 10. Looking forward to get this merged soon 🤞

@kzhuklinets
Copy link

I think it is too early to merge due to the lack of branches support now. PR works, and SQ has separated analysis for those, but when you build a non master branch, all results still go to the master's one.

@mc1arke
Copy link
Owner Author

mc1arke commented Jun 2, 2023

when you build a non master branch, all results still go to the master's one

Do you have details I can use to replicate this? The point of this PR sitting open for a while is to gather feedback, and I've not seen any reports from anyone about this issue. The branch scanning functionality is one of the standard features the plugin has supported in all previous versions and doesn't appear to be something that Sonarsource have changed the operations for.

@kzhuklinets
Copy link

kzhuklinets commented Jun 2, 2023

when you build a non master branch, all results still go to the master's one

Do you have details I can use to replicate this? The point of this PR sitting open for a while is to gather feedback, and I've not seen any reports from anyone about this issue. The branch scanning functionality is one of the standard features the plugin has supported in all previous versions and doesn't appear to be something that Sonarsource have changed the operations for.

The update after some internal investigation: Azure DevOps recognizes the type of SQ and has stopped passing the sonar.branch.name property with SQ 10 Community Edition. And the fix is to use SQ extensions v5+, because v4 doesn't recognize the SQ version correctly and decides that it doesn't support branch analysis.

So no issues with the plugin there, thank you:)!

@joshbalfour
Copy link

Looking swish on github :)

image

If helpful, this is the Dockerfile I used along with the snapshot from the artefact:

FROM sonarqube:latest

ENV PLUGIN_VERSION=1.15.0-SNAPSHOT

ADD --chown=sonarqube:sonarqube sonarqube-community-branch-plugin-*.jar /opt/sonarqube/extensions/plugins/
ENV SONAR_WEB_JAVAADDITIONALOPTS="-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar=web"
ENV SONAR_CE_JAVAADDITIONALOPTS="-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar=ce"

@123Haynes
Copy link

tested it with gitlab 16 and sonarqube 10.0.

Works perfectly 👍

@coderguy1998
Copy link

coderguy1998 commented Jun 23, 2023

For some reason all my PRs are passing the quality gate and they aren't showing the number of bugs or anything, but the same code in the main branch is showing the bugs, why is it so? Is my New Code configuration wrong or is it some issue with the plugin? I'm not able to see go to PR button next to the branch drop down too. Thanks.

@gilsdav
Copy link

gilsdav commented Jun 30, 2023

seems to work in version 10.0.0 but not in 10.1.0

@metajiji
Copy link

Any news for 10.1.0?

build.gradle Show resolved Hide resolved
@marianosaldarriaga
Copy link

marianosaldarriaga commented Jul 4, 2023

Hi team,

The docker image of the version 10.0 community use the Sonarqube version 10.1.0.73491 but this PR need the version 10.0.0.68432: https://github.com/mc1arke/sonarqube-community-branch-plugin/blob/feature/sonarqube-10_0-support/build.gradle#L43

You need download the Dockerfile and entrypoint.sh of Sonarqube repository and edit this paramenter for use this PR build: https://github.com/SonarSource/docker-sonarqube/blob/9b79d014844155923673ca1fbe72ecc0d9ff361c/10/community/Dockerfile#L12

Also, replace the last line with ENTRYPOINT ["/bin/bash", "/opt/sonarqube/docker/entrypoint.sh"]

@bluebu
Copy link
Contributor

bluebu commented Jul 21, 2023

Any news for 10.1.0?

hope it can help you. #786

bluebu added a commit to bluebu/sonarqube-community-branch-plugin that referenced this pull request Jul 21, 2023
    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
bluebu added a commit to bluebu/sonarqube-community-branch-plugin that referenced this pull request Jul 21, 2023
    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
bluebu added a commit to bluebu/sonarqube-community-branch-plugin that referenced this pull request Jul 21, 2023
    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
bluebu added a commit to bluebu/sonarqube-community-branch-plugin that referenced this pull request Jul 21, 2023
    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
@stifm
Copy link

stifm commented Jul 24, 2023

Any news for 10.1.0?

hope it can help you. #786

Any chance to let GitHub build the artifact of this PR?

@bluebu
Copy link
Contributor

bluebu commented Jul 24, 2023

Any news for 10.1.0?

hope it can help you. #786

Any chance to let GitHub build the artifact of this PR?

Get the Artifacts, see as:

https://github.com/bluebu/sonarqube-community-branch-plugin/actions/runs/5621946627

@stifm
Copy link

stifm commented Jul 25, 2023

Any news for 10.1.0?

hope it can help you. #786

Any chance to let GitHub build the artifact of this PR?

Get the Artifacts, see as:

https://github.com/bluebu/sonarqube-community-branch-plugin/actions/runs/5621946627

Thanks a lot, it works for our 10.1 installation!

@hballangan-mdsol
Copy link

Any update on the fix?

@maartenheebink
Copy link

how is 10.2 support?

@mc1arke mc1arke merged commit 0f5fbd8 into master Sep 16, 2023
@mc1arke mc1arke deleted the feature/sonarqube-10_0-support branch September 16, 2023 11:44
@hballangan-mdsol
Copy link

Thanks for the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet