Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Debugging: Allow to define a wrapper to make it SSH, Docker, docker-compose and Kubernetes friendly #678

Open

Description

@Nowaker

request=launch in .vscode/launch.json is for running the code locally. request=attach is for attaching to a remote rdebug-ide process . These two approaches make it impossible to launch the code remotely. This is the goal:

    {
      "name": "Rails",
      "type": "Ruby",
      "request": "launch",
      "wrapper": "bin/launch-wrapper.sh",
      "cwd": "${workspaceRoot}",
      "remoteWorkspaceRoot": "/var/www/appcode",
      "program": "${env:GEM_HOME}/bin/puma",
      "useBundler": true
    }

And bin/launch-wrapper.sh is:

#!/usr/bin/env bash
set -x
cd "$(dirname "$0")/.."
docker-compose exec -T app $@

or

#!/usr/bin/env bash
set -x
ssh -A user@example.com bash -c "cd /blah; $@"

and even multiple hops:

#!/usr/bin/env bash
set -x
ssh -A user@jumpbox.com bash -c "ssh -A otheruser@corp-network-host \"kubectl exec -it podname -n namespace bash -c '$@'\""

When wrapper is present, the extension will construct the whole command as it would normally do, e.g. bundle exec rdebug-ide -- ${env:GEM_HOME}/bin/puma, but pass it as arguments to the wrapper, making it bin/${wrapper} bundle exec rdebug-ide -- ${env:GEM_HOME}/bin/puma.

Introduction of wrapper for request=launch is imperative of allowing remoteWorkspaceRoot to accommodate for different paths on source host and launch host, just like it's a case for request=attach.

Some extensions already allow this. For example, Perl Language Server allows perl.sshCmd in settings.json, and I configured it to execute the Perl Language Server inside a docker-compose container.

Activity

  1. github-actions commented on Dec 6, 2020

    @github-actions

    This issue has not had activity for 30 days. It will be automatically closed in 7 days.

  2. Nowaker commented on Dec 6, 2020

    @Nowaker
    Author

    Don't you dare, bot.

  3. added
    feature-requestAdds currently unsupported functionality
    and removed on Dec 6, 2020
  4. self-assigned this
    on Dec 6, 2020
  5. exocode commented on Dec 26, 2021

    @exocode

    End of 2021. Any news on how to debug within a Kubernetes cluster?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature-requestAdds currently unsupported functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions