GoogleCloudPlatform / GoogleCloudPlatform/cloud-code-intellij

Problem launching debug session

Open
#3,115 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
325
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Hello, thanks for your work on the plugin.

I have been struggling to raise a public build in Cloud Code IntelliJ debug. Everything works fine in IntelliJ without debug. The containers are loaded by Skaffold and the delve ports are there, but the IntelliJ debug sessions are opened and immediately closed. A dialog like this is presented once for each session.
![Screenshot 2022-11-23 at 7 03 14 AM](https://user-images.githubusercontent.com/158115/203566229-84581e17-c337-4783-beb2-869694fa0a7d.png)

The build is in Go 1.19.3, leading up to this point there was an issue with the debug containers in Skaffold not being recent enough and log entries that indicated some kind of port reuse conflict. The Skaffold team was able to get me through the former and I [changed the build](https://github.com/briantopping/gardener/commit/c2f868c5dd42356d843dc8660a26d259c5c86c1f) to see if I could get through the latter. The port conflict was resolved, but the problem described above did not. The logs for such a session are at https://gist.github.com/briantopping/72d3e37d6eb6db276bc502bd21a43286. The session was manually stopped shortly after the dialog above is presented.

It is worth noting that [with the changes above](https://github.com/briantopping/gardener/commit/c2f868c5dd42356d843dc8660a26d259c5c86c1f), I am able to get the VSC environment to run things without error.

### To Reproduce
The instructions for bringing up the build are well-documented [here](https://github.com/briantopping/gardener/blob/master/docs/deployment/getting_started_locally.md) or in the [upstream repo](https://github.com/gardener/gardener/blob/master/docs/deployment/getting_started_locally.md) this repo with the skaffold.yaml change is forked from. This build runs in KinD, so Docker is required. Generally, once the project is checked out:
1. Make sure that your local setup is covered [here](https://github.com/gardener/gardener/blob/master/docs/development/local_setup.md#prerequisites). There are not a lot of them and they are generally installations using a package manager versus uncontained configuration or routing changes.
2. I generally iterate with fresh builds from bash history with `make kind-down && sleep 20 && make kind-up && cp example/gardener-local/kind/local/kubeconfig ~/.kube/config`. You may want to change the last bit to merge the k8s context instead of overwrite.
3. Set up the IntelliJ plugin against the environment:
1. Image repository set to `localhost:5001`
2. Set the run environment variables to the following. The LD_FLAGS are referenced from the existing build that is not fully thought through to run interactively like this so I've just copied them here from a random build, will clean it up later. The other two variables were getting set by the `Makefile` builds and I copied them over for completeness.
```
LD_FLAGS=-X k8s.io/component-base/version.gitMajor=1 -X k8s.io/component-base/version.gitMinor=59+ -X k8s.io/component-base/version.gitVersion=v1.59.2-dev -X k8s.io/component-base/version.gitTreeState=dirty -X k8s.io/component-base/version.gitCommit=687710226e12c02722dcb6da5713903366d83cc7 -X k8s.io/component-base/version.buildDate=2022-11-14T14:27:59-07:00 -X k8s.io/component-base/version/verflag.programName=Gardener;SKAFFOLD_DEFAULT_REPO=localhost:5001;SKAFFOLD_PUSH=true
```
3. Other than targeting the `skaffold.yaml` at the root of the directory and targeting the kubeconfig as it is documented in step 2 above, I have left other settings alone
4. At this point, one should be able to launch the IJ debug configuration. The build will happen inside Skaffold, deploy to the local registry and everything should launch.

Please don't hesitate to reach out with questions or requests, hopefully everything was captured here and I can get on Slack for interactive help at any time. It's actually pretty easy to set up and I wouldn't want anyone who is taking the time to look at this to struggle with it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.