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 support for Sonarqube 8.9.0 #352

Merged
merged 2 commits into from
May 11, 2021
Merged

Add support for Sonarqube 8.9.0 #352

merged 2 commits into from
May 11, 2021

Conversation

mc1arke
Copy link
Owner

@mc1arke mc1arke commented May 9, 2021

Sonarqube 8.9 packages all the core code and dependencies as a single fat JAR, which means plugins can no longer add code to the classpath by dropping JARs into the lib/common directory as this directory does not exist. To allow the plugin's classes to be visible to the Compute Engine and Web class-loaders, a Java Agent has been introduced that intentionally leaks the plugin classes to the Sonarqube application, thereby allowing the Core Extension Loaders to continue to see and initialise the relevant extension classes, thereby allowing them to load the plugin's implementation classes into Sonarqube's dependency management system. The Docker files have been updated to remove the copying of the plugin to the legacy directory, and to pass additional environment variable so the agent options are added to the relevant Sonarqube component's command-line arguments.

Similarly, the fall-through logic in PlatformEditionProvider that had allowed the plugin to force the Compute Engine to believe it was running in Sonarqube developer edition has been removed, with the edition now being hard-coded to COMMUNITY, without any way of over-riding it. To overcome this, the agent that's being used to expose the plugin classes to Sonarqube's class-loaders is also altering the PlatformEditionProvider class definition during class-loading to force it to return DEVELOPER when running inside Compute Engine, so that the branch enforcement checks in Compute Engine pass.

As the GetBinding action has been moved into Sonarqube Community Edition's core from Developer edition, it no longer needs to be provided by this plugin, and has been removed to prevent is causing conflicts on application startup.


This MR also includes a change to fix the build having broken as a result of Bintray having been shut-down:

The Nodes dependency used for GraphQL communication in the Github Pull Request decorator is no longer available on Bintray due to Bintray being decommissioned, and is not available in the target version from any other repository. The JAR is therefore being included in the workspace and referenced directly in the build.gradle dependencies, and the Jackson dependency that was previously inherited through the Nodes dependency is being added directly to the project as a runtime dependency to ensure the relevant classes are still available during plugin execution.

mc1arke added 2 commits May 8, 2021 19:54
The Nodes dependency used for GraphQL communication in the Github Pull Request decorator is no longer available on Bintray due to Bintray being decommissioned, and is not available in the target version from any other repository. The JAR is therefore being included in the workspace and referenced directly in the build.gradle dependencies, and the Jackson dependency that was previously inherited through the Nodes dependency is being added directly to the project as a runtime dependency to ensure the relevant classes are still available during plugin execution.
Sonarqube 8.9 packages all the core code and dependencies as a single fat JAR, which means plugins can no longer add code to the classpath by dropping JARs into the `lib/common` directory as this directory does not exist. To allow the plugin's classes to be visible to the Compute Engine and Web class-loaders, a Java Agent has been introduced that intentionally leaks the plugin classes to the Sonarqube application, thereby allowing the Core Extension Loaders to continue to see and initialise the relevant extension classes, thereby allowing them to load the plugin's implementation classes into Sonarqube's dependency management system. The Docker files have been updated to remove the copying of the plugin to the legacy directory, and to pass additional environment variable so the agent options are added to the relevant Sonarqube component's command-line arguments.

Similarly, the fall-through logic in `PlatformEditionProvider` that had allowed the plugin to force the Compute Engine to believe it was running in Sonarqube developer edition has been removed, with the edition now being hard-coded to `COMMUNITY`, without any way of over-riding it. To overcome this, the agent that's being used to expose the plugin classes to Sonarqube's class-loaders is also altering the `PlatformEditionProvider` class definition during class-loading to force it to return `DEVELOPER` when running inside Compute Engine, so that the branch enforcement checks in Compute Engine pass.

As the `GetBinding` action has been moved into Sonarqube Community Edition's core from Developer edition, it no longer needs to be provided by this plugin, and has been removed to prevent is causing conflicts on application startup.
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 9, 2021

Kudos, SonarCloud Quality Gate passed!

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

94.1% 94.1% Coverage
0.0% 0.0% Duplication

@ghost
Copy link

ghost commented May 11, 2021

Waiting for this PR merge. Thanks

@mc1arke mc1arke merged commit a6b6db3 into master May 11, 2021
@mc1arke mc1arke deleted the sq-8_9-support branch May 11, 2021 20:36
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.

1 participant