Open samrocketman opened 1 year ago
Alternately, I could add a Vagrantfile so that you could provision from any host OS and debug with what I'm working with (from Mac or Windows).
I added a Vagrantfile
. You can:
git clone https://github.com/samrocketman/jervis.git
cd jervis
vagrant up
Eventually the machine will reboot into a GUI. Both VirtualBox and Vagrant are required.
vagrant
vagrant
You can use that machine on either Windows or Mac and you can replicate the full dev environment I use. Also, it assumes a lot of memory. I have 8 CPU cores and 32GB of RAM; so I set the box to 4 cores and 8GB of RAM. If you have fewer resources available lower the requirements for your needs by editing the Vagrantfile
before provisioning.
After the machine boots it will automatically open VSCode. You may get a message to open in Dev Container. If you do not, then press the little green icon in the lower left corner of VSCode and choose Reopen in Container
.
Once inside of the Dev Container here's screenshot instructions.
If you visit the SonarQube tab of your extension you can see trying to refresh throws an error. All of my commands assume it is inside of the Docker container. I think somehow your extension is not inside of the container in some way.
Here's some more resources for you that I think may help.
https://github.com/microsoft/vscode-remote-release lists documentation for extension developers.
I tried seeing if I could use port forwarding with localhost on the off chance it was attempting the connection outside of the container. Unfortunately it didn't work. Here's a diff of my attempt on my code base.
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
index 91f41e0..1799a9a 100644
--- a/.devcontainer/docker-compose.yml
+++ b/.devcontainer/docker-compose.yml
@@ -45,6 +45,8 @@ services:
- sonar-conf:/opt/sonarqube/conf
- sonar-extensions:/opt/sonarqube/extensions
- sonar-data:/opt/sonarqube/data
+ ports:
+ - 127.0.0.1:9000:9000
networks:
- internal
vault:
diff --git a/.vscode/project.json b/.vscode/project.json
index 31737db..1ec0e7e 100644
--- a/.vscode/project.json
+++ b/.vscode/project.json
@@ -1,6 +1,6 @@
{
"project": "jervis",
- "sonarURL": "http://sonarqube:9000",
+ "sonarURL": "http://127.0.0.1:9000",
"auth": {
"username": "admin",
"password": "admin"
I was able to pull a stack trace out of the plugin
Failed to fetch measures
TypeError: n.SecurityReview is not iterable
at /home/vscode/.vscode-server/extensions/adisreyaj.sonarqube-status-1.2.0/dist/extension.js:2:65425
at Generator.next (<anonymous>)
at a (/home/vscode/.vscode-server/extensions/adisreyaj.sonarqube-status-1.2.0/dist/extension.js:2:64242)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
After deleting https://github.com/adisreyaj/vscode-sonarqube-status/blob/b4b01ea464f7dd8c9aa7f6586489ff7757be0946/src/extension.ts#L42 it works.
I recommend adding better debug output to your extension such as changing https://github.com/adisreyaj/vscode-sonarqube-status/blob/b4b01ea464f7dd8c9aa7f6586489ff7757be0946/src/extension.ts#L64-L66 to
} catch (error) {
- vscode.window.showErrorMessage('Failed to fetch measures');
+ vscode.window.showErrorMessage('Failed to fetch measures\n\n' + error.stack);
}
I notice you mention you test with SonarQube Cloud https://github.com/adisreyaj/vscode-sonarqube-status/issues/34#issuecomment-1295410149
Your extension appears to be incompatible with SonarQube Community Edition. I'll update the title.
I looked through Sonar Web API and there does not appear to be an easy way to auto detect Community Edition. It might be best to default to whatever you want and enable an option to select CE or Pro via project.json
. This is one of those settings which is unlikely change once the user configures it.
Is this issue going to be fixed in some point? I am also using a SonarQube Community Edition and I only see
with the proper
"project": "project_name", "sonarURL": "http://xx.xx.xx.xx:9000", "auth": { "username": "admin", "password": "XXXXX" } }
If I run >
mvn clean verify sonar:sonar -Dsonar.projectKey=project_name -Dsonar.host.url=http://xx.xx.xx.xx:9000 -Dsonar.login=token
the
http://xx.xx.xx.xx:9000/dashboard?id=project_name
is ok.
Updated details
When using SonarQube Community Edition (or via Docker) or otherwise this extension fails due to reliance on a Pro edition only feature.
Fetching measures fails with the following exception.
Measures successfully fetch when deleting the following line of code.
https://github.com/adisreyaj/vscode-sonarqube-status/blob/b4b01ea464f7dd8c9aa7f6586489ff7757be0946/src/extension.ts#L42
Other details
Please see my comment https://github.com/adisreyaj/vscode-sonarqube-status/issues/36#issuecomment-1320388446
Old issue details
Original issue text (Click to expand)
I use VSCode dev containers and in one of my projects I provision SonarQube via docker-compose in the devcontainer. For my project, I'm able to publish code coverage and view the results. I also tested some of the metrics APIs your plugin uses with curl and they seem to work. ### Error > Failed to fetch measures Stacktrace ``` 4workbench.desktop.main.js:sourcemap:820 Failed to fetch measures onDidChangeNotification @ workbench.desktop.main.js:sourcemap:820 workbench.desktop.main.js:sourcemap:609 ERR this._core._renderService?._onIntersectionChange is not a function: TypeError: this._core._renderService?._onIntersectionChange is not a function at zi.forceUnpause (vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1971:27069) at Hi._resizeNow (vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3121:3652) at Hi._resize (vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3121:2736) at vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:6:42864 workbench.desktop.main.js:sourcemap:609 ERR this._core._renderService?._onIntersectionChange is not a function: TypeError: this._core._renderService?._onIntersectionChange is not a function at zi.forceUnpause (vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1971:27069) at Hi._resizeNow (vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3121:3652) at Hi._resize (vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3121:2736) at vscode-file://vscode-app/snap/code/113/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:6:42864 ``` ### Try it out Here's my project you can try it yourself. https://github.com/samrocketman/jervis Small note: My host OS is Ubuntu 20.04 running X11. So the direct rendering, pulse audio, DBus, and X11 socket passthrough via volume mounts and devices assumes this. If you're not on Linux you may comment out the devices. If you do that you won't be able to launch Firefox but publishing results should still work. You should add port forwarding to the docker-compose file. I can temporarily make updates to my project if you need to debug from somewhere other than Linux.