okteto icon indicating copy to clipboard operation
okteto copied to clipboard

`deploy` on Windows uses bash

Open mladedav opened this issue 3 years ago • 3 comments

Describe the bug I added a custom command to deploy a service. However instead of okteto using powershell (from which it was called and where I have all necessary commands) it tried using WSL where commands are missing.

To Reproduce add

deploy:
  - name: test
    command: whoami

to your okteto.yml. Notice that it outputs your username from WSL, not Windows.

Expected behavior For okteto to not use WSL by default. There can either be a flag to tell it what shell to use or we can use bash as part of the command, but I think it should use the native environment by default.

Desktop

  • OS: Windows
  • Version 10

Workaround

It is possible to prepend the command with /mnt/c/Program\ Files/Powershell/7/pwsh.exe -c to invoke powershell from bash. This is suboptimal since we have a team with developers using different OS's.

mladedav avatar Apr 26 '22 12:04 mladedav

Could reproduce, I tried with ls / command as I have the same username in WSL and my windows machine.

The issue seems to be here, when you run bash from a windows machine with WSL, it redirects to the bash inside WSL. Maybe there's a way to let the go executor take care of this

AgustinRamiroDiaz avatar May 06 '22 13:05 AgustinRamiroDiaz

@jmacelroy Are there any fixes for this issue?

danny900714 avatar Jun 04 '22 15:06 danny900714

@jmacelroy Are there any fixes for this issue?

@ZhaoTzuHsien For now there are 2 possible workarouds:

  1. Prepend the command with /mnt/c/Program\ Files/Powershell/7/pwsh.exe -c
  2. Use okteto from inside WSL

The issue will be fixed in the future so these workarounds are not needed

AgustinRamiroDiaz avatar Jun 06 '22 11:06 AgustinRamiroDiaz

@mladedav @ZhaoTzuHsien This issue is already fixed in master and will be included in the next cli 2.7.0 release 🚀

AgustinRamiroDiaz avatar Sep 06 '22 14:09 AgustinRamiroDiaz