-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
skaffold ko
builder issues using skaffold debug
functionality
#6843
Comments
@halvards |
Also, the suggested default path in the image (from the Cloud Code |
Thanks for filing this @aaron-prindle! This is caused by A workaround right now is to use a non-empty But we should consider ensuring that this flag isn't set when debugging. I'll work with the For the VS Code launch configuration, the remote path should match the local path, so you can use a mapping such as this: "debug": [
{
"image": "your image name from skaffold.yaml",
"sourceFileMap": {
"${workspaceFolder}": "${workspaceFolder}"
}
}
]
The "remote path" name is misleading IMO, it means "the source path used when compiling the code". For example, when building an image for a Go app using Docker, the full path to the source files will be different in the IDE (the key in the map above) to the full path used when compiling, since the compilation happens in a temporary container. For instance, a IntelliJ IDEA and Goland appear to work out this mapping automatically. In addition to a fix for the |
Update explanation of how Go debugging works in Skaffold and add explanations for ko builder users. Also update links to the VS Code Go extension. Related: GoogleContainerTools#6843 Tracking: GoogleContainerTools#6041
Enables programmatic control of whether `ko` adds the `-trimpath` flag to `go build`. The `-trimpath` flag removes file system paths from the resulting binary. `ko` adds `-trimpath` by default as it aids in achieving reproducible builds. However, removing file system paths makes interactive debugging more challenging, in particular in mapping source file locations in the IDE to debug information in the binary. If you set `Trimpath` to `false` to enable interactive debugging, you probably also want to set `DisableOptimizations` to `true` to disable compiler optimizations and inlining. Reference for `-trimpath`: https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies Resolves: #500 Related: #71, #78, GoogleContainerTools/skaffold#6843
Enables programmatic control of whether `ko` adds the `-trimpath` flag to `go build`. The `-trimpath` flag removes file system paths from the resulting binary. `ko` adds `-trimpath` by default as it aids in achieving reproducible builds. However, removing file system paths makes interactive debugging more challenging, in particular in mapping source file locations in the IDE to debug information in the binary. If you set `Trimpath` to `false` to enable interactive debugging, you probably also want to set `DisableOptimizations` to `true` to disable compiler optimizations and inlining. Reference for `-trimpath`: https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies Resolves: #500 Related: #71, #78, GoogleContainerTools/skaffold#6843
`ko` adds the `-trimpath` flag to `go build` by default, as this aids in achieving reproducible builds. The `-trimpath` flag removes file system paths from the resulting binary, and this makes interactive debugging more difficult. This change instructs `ko` to _not_ add the `-trimpath` flag when users run `skaffold debug` with the `ko` builder. Bumps the `ko` version to pick up the `Trimpath` build option. Also, simplifies the `ko` example config since it's no longer necessary to add a non-empty `flags` field to `skaffold.yaml` to allow for interactive debugging. Fixes: GoogleContainerTools#6843 Tracking: GoogleContainerTools#6041
`ko` adds the `-trimpath` flag to `go build` by default, as this aids in achieving reproducible builds. The `-trimpath` flag removes file system paths from the resulting binary, and this makes interactive debugging more difficult. This change instructs `ko` to _not_ add the `-trimpath` flag when users run `skaffold debug` with the `ko` builder. Bumps the `ko` version to pick up the `Trimpath` build option. Also, simplifies the `ko` example config since it's no longer necessary to add a non-empty `flags` field to `skaffold.yaml` to allow for interactive debugging. Fixes: #6843 Tracking: #6041
`ko` adds the `-trimpath` flag to `go build` by default, as this aids in achieving reproducible builds. The `-trimpath` flag removes file system paths from the resulting binary, and this makes interactive debugging more difficult. This change instructs `ko` to _not_ add the `-trimpath` flag when users run `skaffold debug` with the `ko` builder. Bumps the `ko` version to pick up the `Trimpath` build option. Also, simplifies the `ko` example config since it's no longer necessary to add a non-empty `flags` field to `skaffold.yaml` to allow for interactive debugging. Fixes: #6843 Tracking: #6041
In attempting to use the
ko
builder with the sample atskaffold/integration/examples/ko
with Cloud Code'sDebug on Kubernetes
I was not able to successfully setup a debug flow. The app builds and deploys properly and it serves requests but none of the breakpoints trigger as expected forDebug on Kubernetes
. My approach was as follows:Open
/skaffold/integration/examples/ko
in VS Code (w/ Cloud Code installed):Add some breakpoints to the source code
Set the following values from the Cloud Code
Debug on Kubernetes
wizardimage registry: gcr.io/aprindle-test-clusters
directory in the remote container where the program can be found: /ko-app
From this setup, I am able to interact and see the images/deployments which work properly but none of the breakpoints seem to triggering.
The text was updated successfully, but these errors were encountered: