tilt-extensions icon indicating copy to clipboard operation
tilt-extensions copied to clipboard

kubefwd problem with mktemp suffix argument

Open bamorim opened this issue 3 years ago • 3 comments

Hey, sorry if this is an issue but it is by design.

When using the kubefwd extension on mac, it fails with an error about the --suffix argument.

I believe the version of mktemp on mac doesn't support this argument.

Maybe we can use a prefix instead?

I know the extensions says it requires coreutils to be installed, but homebrew by default prefixs everything with g, so the binary is actually gmktemp and replacing these things on OS by changing the path or something.

The workaround was to execute tilt with PATH=/usr/local/opt/coreutils/gnubin:$PATH. However, even after that the script is trying to run /Users/username/Library/Application because it is not escaping/wrapping in quotes the path which is supposed to be /Users/username/Libarary/Application Support/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions/kubefwd/run-kubefwd.sh, but this seems to be more a problem on how local_resource serve_cmd is setup.

Maybe we can make it more accessible somehow? I'm happy to submit a PR if that is what we are aiming for.

Thanks.

bamorim avatar Oct 27 '21 11:10 bamorim

thanks for the report!

  1. i think the suffix bit is purely cosmetic, so it's probably fine to remove it.
  2. not sure what the escaping issue is about, let me poke around at that...

nicks avatar Oct 27 '21 16:10 nicks

@nicks @bamorim I'm facing the same issue regarding the space escaping.

I've tried to add a backlash in the path when there is a space in the sudo-kubefed.sh script:

RUN_KUBEFWD=$(echo  "$RUN_KUBEFWD" | sed 's/ /\\ /g')
DIR=$(echo  "$DIR" | sed 's/ /\\ /g')

but then get a :

+ /usr/bin/osascript -e 'do shell script "/Users/eric/Library/Application\ Support/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions/kubefwd/run-kubefwd.sh /opt/homebrew/bin/kubefwd /Users/eric/.kube/config /opt/homebrew/bin/entr /var/folders/xh/003_hq_j3qq29mtv3nn8kw6c0000gn/T//tilt-kubefwd.nXOFvvLqd" with administrator privileges'
./sudo-kubefwd.sh: line 43: /Users/eric/Library/Application\ Support/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions/kubefwd/watch-namespaces.sh: No such file or directory
49:50: syntax error: Expected “"” but found unknown token. (-2741)

erickhun avatar Mar 30 '22 10:03 erickhun

@erickhun i left a comment on the other issue you filed - https://github.com/tilt-dev/tilt-extensions/issues/368, thanks for reporting!

nicks avatar Mar 31 '22 15:03 nicks