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 container spec args to to go debug #3276

Merged
merged 1 commit into from
Nov 21, 2019

Conversation

tejal29
Copy link
Contributor

@tejal29 tejal29 commented Nov 20, 2019

Description
When setting up skaffold for kaniko, skaffold debug failed with following error"

failed to port forward pod-kaniko-default-56268, port 56268 is taken, retrying...
time="2019-11-20T13:36:31-08:00" level=debug msg="terminated pod-kaniko-default-56268 due to context cancellation"
[kaniko] Error: unknown flag: --no-push
[kaniko] Usage:
[kaniko]   dlv exec <path/to/binary> [flags]
[kaniko] 
[kaniko] Flags:
[kaniko]       --continue   Continue the debugged process on start.
[kaniko] 
[kaniko] Global Flags:
[kaniko]       --accept-multiclient   Allows a headless server to accept multiple client connections.
[kaniko]       --api-version int      Selects API version when headless. (default 1)
[kaniko]       --backend string       Backend selection (see 'dlv help backend'). (default "default")
[kaniko]       --build-flags string   Build flags, to be passed to the compiler.
[kaniko]       --check-go-version     Checks that the version of Go in use is compatible with Delve. (default true)
[kaniko]       --headless             Run debug server only, in headless mode.
[kaniko]       --init string          Init file, executed by the terminal client.
[kaniko]   -l, --listen string        Debugging server listen address. (default "127.0.0.1:0")
[kaniko]       --log                  Enable debugging server logging.
[kaniko]       --log-dest string      Writes logs to the specified file or file descriptor (see 'dlv help log').
[kaniko]       --log-output string    Comma separated list of components that should produce debug output (see 'dlv help log')
[kaniko]       --wd string            Working directory for running the program. (default ".")
[kaniko] 
Port forwarding pod/kaniko in namespace default, remote port 56268 -> local port 56268

User facing changes
No

Debug Transformation Changes
Before
The container spec generated when debugging was


tejaldesai@@kaniko (add_skaffold)$ kubectl describe po/kaniko
Name:               kaniko
...
  kaniko:
    Container ID:  docker://ee1994b1b80eeb06ba8c506b3cf4b43410ef4ad1372d0559c03098c9ff488303
    Image:         gcr.io/tejal-test/gcr.io/kaniko-project/executor:v0.14.0-7-ge0e59e6-dirty@sha256:7a204497053998c62c69feb1f9b7bbbad92f5e9e9738d1a4147c841b6cb60204
    Image ID:      docker-pullable://gcr.io/tejal-test/gcr.io/kaniko-project/executor@sha256:7a204497053998c62c69feb1f9b7bbbad92f5e9e9738d1a4147c841b6cb60204
    Port:          56268/TCP
    Host Port:     0/TCP
    Command:
      /dbg/go/bin/dlv
      exec
      --headless
      --continue
      --accept-multiclient
      --listen=localhost:56268
      --api-version=2
      /go/src/github.com/GoogleContainerTools/kaniko/out/executor
    Args:
      --no-push
      --context=dir://workspace/
      --dockerfile=integration/dockerfiles/Dockerfile_test_add
....

After
After this PR, we now have -- added at the end

tejaldesai@@kaniko (add_skaffold)$ kubectl describe po/kaniko
Name:               kaniko
...
Containers:
  kaniko:
    Container ID:  docker://ee1994b1b80eeb06ba8c506b3cf4b43410ef4ad1372d0559c03098c9ff488303
    Image:         gcr.io/tejal-test/gcr.io/kaniko-project/executor:v0.14.0-7-ge0e59e6-dirty@sha256:7a204497053998c62c69feb1f9b7bbbad92f5e9e9738d1a4147c841b6cb60204
    Image ID:      docker-pullable://gcr.io/tejal-test/gcr.io/kaniko-project/executor@sha256:7a204497053998c62c69feb1f9b7bbbad92f5e9e9738d1a4147c841b6cb60204
    Port:          56268/TCP
    Host Port:     0/TCP
    Command:
      /dbg/go/bin/dlv
      exec
      --headless
      --continue
      --accept-multiclient
      --listen=localhost:56268
      --api-version=2
      /go/src/github.com/GoogleContainerTools/kaniko/out/executor
      --
    Args:
      --no-push
      --context=dir://workspace/
      --dockerfile=integration/dockerfiles/Dockerfile_test_add

Next PRs.
n/a
Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Mentions any output changes.
  • Adds documentation as needed: user docs, YAML reference, CLI reference.
  • Adds integration tests if needed.

Reviewer Notes

  • The code flow looks good.
  • Unit test added.
  • User facing changes look good.

Release Notes

Fix `skaffold debug` when go application have an entrypoint with arguments set.

@codecov
Copy link

codecov bot commented Nov 20, 2019

Codecov Report

Merging #3276 into master will not change coverage.
The diff coverage is 100%.

Impacted Files Coverage Δ
pkg/skaffold/debug/transform_go.go 86.17% <100%> (ø) ⬆️

Copy link
Member

@briandealwis briandealwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooo good find

@tejal29 tejal29 merged commit 41547f6 into GoogleContainerTools:master Nov 21, 2019
@tejal29 tejal29 changed the title add container spec args add container spec args to to go debug Nov 21, 2019
@tejal29 tejal29 deleted the fix_debug branch April 15, 2021 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants