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

Not working when using SSH remote #35

Closed
OiYouYeahYou opened this issue Nov 20, 2019 · 5 comments
Closed

Not working when using SSH remote #35

OiYouYeahYou opened this issue Nov 20, 2019 · 5 comments
Labels
question Further information is requested

Comments

@OiYouYeahYou
Copy link

I am using the VSC Remote Development extension to develop in a VM. I have built and installed hadolint on that VM. The binary is here /home/jason/.local/bin/hadolint and is on the path.

But the extension is unable to find the binary

Error:

{ Error: spawnSync hadolint ENOENT
    at Object.spawnSync (internal/child_process.js:982:20)
    at Object.spawnSync (child_process.js:596:24)
    at Function.spawnSync [as sync] (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/cross-spawn/index.js:26:23)
    at Object.lint (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/out/service/hadolint.js:30:35)
    at validateTextDocument (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/out/server.js:47:49)
    at documents.onDidOpen (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/out/server.js:22:5)
    at CallbackList.invoke (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-jsonrpc/lib/events.js:62:39)
    at Emitter.fire (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-jsonrpc/lib/events.js:120:36)
    at connection.onDidOpenTextDocument (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-languageserver/lib/main.js:180:29)
    at handleNotification (/home/jason/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-jsonrpc/lib/main.js:489:43)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawnSync hadolint',
  path: 'hadolint',
  spawnargs: [ '/home/jason/Dockerfile' ] }

I had suspected that the extension is looking for the binary on my client instead of host. But the extension is running in the VM so I'm puzzled. The folloing is the error on a clean test user on the same VM to at least prove that the extesnion is on the VM not client

Error:

{ Error: spawnSync hadolint ENOENT
    at Object.spawnSync (internal/child_process.js:982:20)
    at Object.spawnSync (child_process.js:596:24)
    at Function.spawnSync [as sync] (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/cross-spawn/index.js:26:23)
    at Object.lint (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/out/service/hadolint.js:30:35)
    at validateTextDocument (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/out/server.js:47:49)
    at documents.onDidSave (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/out/server.js:26:5)
    at CallbackList.invoke (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-jsonrpc/lib/events.js:62:39)
    at Emitter.fire (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-jsonrpc/lib/events.js:120:36)
    at connection.onDidSaveTextDocument (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-languageserver/lib/main.js:223:33)
    at handleNotification (/home/test/.vscode-server/extensions/exiasr.hadolint-0.3.0/server/node_modules/vscode-jsonrpc/lib/main.js:489:43)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawnSync hadolint',
  path: 'hadolint',
  spawnargs: [ '/home/test/Dockerfile' ] }
@michaellzc
Copy link
Owner

Hi @OiYouYeahYou ,

Thanks for reaching out.

Actually I didn't try out the remote dev feature till last week :(

I will properly take a look into this later this month.

@michaellzc michaellzc added the bug Something isn't working label Dec 3, 2019
@OiYouYeahYou
Copy link
Author

Thank you for the reply, I hope it's an easy bug to fix 😄

@michaellzc
Copy link
Owner

michaellzc commented Dec 24, 2019

Hi @OiYouYeahYou ,

I have identified the root cause of the issue.

It looks like the config, hadolint.hadolintPath (the configuration of the path to the executable) on the vscode-server (the instance of vscode running on your remote host, container, etc) is inherent from the global setting of the local machine which initiates the setup.

Therefore, if you have prior custom path config on the local machine, this could break the extension on the remote host (unlike the default setting, it's just hadolint instead of an absolute path to the executable).

I would suggest creating a workspace settings on the remote host with hadolint.hadolintPath set to either hadolint or the absolute path to the executable in case the former is not available in the $PATH

{remote_project_root}/.vscode/settings.json

{
  "hadolint.hadolintPath": "/home/ubuntu/.bin/hadolint"
}

In terms of the fix, unless vscode supports namespace for extension configuration, i.e, config.local.hadolint, config.remote.hadolint, I am not sure what is the proper way to handle such a scenario.

@michaellzc michaellzc added question Further information is requested and removed bug Something isn't working labels Dec 24, 2019
@SuperSandro2000
Copy link

Can I point it to $HOME/.local/bin/hadolint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants