cloud-code-intellij icon indicating copy to clipboard operation
cloud-code-intellij copied to clipboard

Debug mode mapping is hard-coded to project root

Open yfried opened this issue 3 years ago • 11 comments

(Please ensure you are running the latest version of Cloud Code for IntelliJ with Help > Check for Updates)

  • Cloud Code for IntelliJ version: 21.10.1
  • Google Cloud SDK version: 363.0.0
  • OS: Mac OS X 11.6

Pycharm version:

PyCharm 2021.2.3 (Professional Edition)
Build #PY-212.5457.59, built on October 19, 2021
Runtime version: 11.0.12+7-b1504.40 x86_64

macOS 11.6

Non-Bundled Plugins: com.intellij.ideolog (203.0.27.0), com.mnr.java.intellij.idea.plugin.base64helper (2.0.3), zielu.gittoolbox (212.7.15), de.netnexus.camelcaseplugin (3.0.8), org.jetbrains.plugins.go-template (212.5457.62), mobi.hsz.idea.gitignore (4.3.0), org.intellij.plugins.hcl (0.7.14), fr.alexisvisco.gitlablinks (1.2), com.intellij.kubernetes (212.5457.4), com.google.gct.core (21.10.1), izhangzhihao.rainbow.brackets (6.21)

When launching it debug mode, there's a prompt to map the project root dir to the target image. This is problematic for mono-repos and any case where the dockerized code isn't the project root.

What is the point of the debug mapping in the run configuration if it's not respected?

yfried avatar Nov 03 '21 14:11 yfried

What is the point of the debug mapping in the run configuration if it's not respected?

If you dismiss the prompt (hitting cancel) then it will ignore the prompt and respect the values in the debug mapping of the run configuration.

I can see how this might be confusing (and we can add some wording). Let me know if this addresses the issue.

But to answer your question specifically - the point of the prompt is to provide some attempted guesses at what the mapping might be. We can't know for sure since the container configuration can vary, which is why we also provide the ability to manually enter the mapping in the run configuration. Also, we prompt after hitting the debug button because Skaffold provides the guesses and it can't know until runtime.

etanshaul avatar Nov 03 '21 14:11 etanshaul

@etanshaul Thank you, but if I hit cancel, then there's no mapping at all. I get:

[billing-bot] pydev debugger: warning: Trying to add breakpoint to file that does not exist: /Users/yfried/<path_on_my_local_machine>/main.py (will have no effect).

I might be missing something here, but unless I create a fake path in my docker image that correlates to the project root, debug doesn't work

yfried avatar Nov 04 '21 07:11 yfried

In the old remote server config, I could configure mapping as I saw fit and even configure paths to exclude from sync. For example, I could exclude an entire dir, and then only map a certain subdir in it to the remote server

yfried avatar Nov 04 '21 07:11 yfried

Thank you, but if I hit cancel, then there's no mapping at all.

We may have a bug here, but just to confirm: did you set the necessary mapping in the Run Configuration debug tab? Even with that set, debug is not working after hitting cancel on the dialog - correct?

In the old remote server config, I could configure mapping as I saw fit and even configure paths to exclude from sync.

Sorry - what is the "old remove server config" you are referencing?

etanshaul avatar Nov 04 '21 14:11 etanshaul

We may have a bug here, but just to confirm: did you set the necessary mapping in the Run Configuration debug tab? Even with that set, debug is not working after hitting cancel on the dialog - correct?

Yes, I did, and they weren't used.

Sorry - what is the "old remove server config" you are referencing?

Pycharm has a feature for remote debugging, where you can map and sync file to a remote server via ssh and then run debug on it. I assumed Cloud Code mapping would work the same. https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config

yfried avatar Nov 07 '21 07:11 yfried

sounds good. we'll investigate this.

etanshaul avatar Nov 08 '21 15:11 etanshaul

Kamino cloned this issue to GoogleCloudPlatform/cloud-code-intellij-internal

etanshaul avatar Nov 08 '21 15:11 etanshaul

I can add the following; I have a single project with multiple source roots (same as OP). Running embedded skaffold v1.32.0 in PyCharm on Windows. I have configured source mapping in the "Run Configuration debug tab". If I press cancel, it seems the aforementioned source mapping is taken into account (I don't get the 'Trying to add breakpoint to file ...' warning, it seems it can apply the breakpoint), but I can't seem to stop at the set breakpoint... If I press OK (actually for me, the suggested mapping is good), no mapping is configured (I get the 'Trying to add breakpoint to file ...' warning mentioning my project directory on Windows).

Hope it helps, and also waiting patiently for a solution.

shoskensMagics avatar Nov 10 '21 14:11 shoskensMagics

@shoskensMagics thanks for those details. To confirm - in neither scenario we’re you able to stop at breakpoints? Or did it work when you clicked OK on the dialog?

etanshaul avatar Nov 10 '21 22:11 etanshaul

@etanshaul no, I could never jump into the debugger at those breakpoints.

shoskensMagics avatar Nov 15 '21 09:11 shoskensMagics

@etanshaul What is the status of the issue? I just encountered it as well.

uriariel avatar Mar 05 '23 23:03 uriariel