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

Added support of running Helmsman on Windows #287

Merged
merged 1 commit into from
Oct 23, 2019

Conversation

PeterBrun
Copy link
Contributor

@PeterBrun PeterBrun commented Aug 19, 2019

Any execution of a command using bash with the command parameter has been replaced with just the expected command executable (helm and kubectl). And instead of building the arguments as a single string, they are now built using string arrays. This solves the "quoting" problem, that is there when using a single string with all arguments. For example, before this change, a path had to be quoted on Windows to work. By just building string arrays with all the arguments, this problem is solved by Go' os/exec package.

It also solves the problem of using a password protected Helm repo, where the username contains a '$' (for example Harbor creates robot accounts with this). This could be escaped using '$$', but then it still was being interpreted by bash as an environment variable. This could have been solved by adding quotes around in the old solution, but it is just simpler to just use the "native" string array arguments approach as described above. And still if the environment variable was intended as input, then it is already applied by the "substituteEnv" functionality.

decision_maker.go Outdated Show resolved Hide resolved
@PeterBrun PeterBrun force-pushed the windows-support branch 3 times, most recently from 13e27e6 to fd6c50e Compare August 28, 2019 09:18
@PeterBrun PeterBrun force-pushed the windows-support branch 2 times, most recently from 6d947e1 to 6d77ad7 Compare September 20, 2019 15:04
Copy link
Collaborator

@luisdavim luisdavim left a comment

Choose a reason for hiding this comment

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

LGTM, have you tested this on both Linux and Windows?

@nvanheuverzwijn
Copy link
Contributor

@luisdavim any reason why commands used to be call with bash -c instead of using helm directly ? This PR changes how helm is called, not sure if it has any impact or not.

@nvanheuverzwijn
Copy link
Contributor

@PeterBrun I have highlighted details that seemed to me that would change the behavior but it might be OK. I just wanted to highlight them for you to make sure that everything is intended by this patch and not a typo or a bug in a search & replace.

@PeterBrun
Copy link
Contributor Author

PeterBrun commented Sep 30, 2019

@nvanheuverzwijn 👍

@luisdavim I have mostly tested on Windows. Using it there with some clusters. I have only tested the Linux build using the provided unit tests (not with a real cluster).

So I cannot guarantee all use cases. So please go ahead and do a test drive 🙂

@luisdavim
Copy link
Collaborator

@sami-alajrami this LGTM but I wonder if there was any particular reason to start the helm and kubectl commands in a sub-shell instead of calling them directly.

@luisdavim
Copy link
Collaborator

@mkubaczyk do you know what a sub-shell is being used?

@luisdavim
Copy link
Collaborator

Hi can you take a look at the conflicts? Thanks.

@sami-alajrami
Copy link
Contributor

@sami-alajrami this LGTM but I wonder if there was any particular reason to start the helm and kubectl commands in a sub-shell instead of calling them directly.

No, I don't think there was a special reason. Unless if it was to get error codes back .. but my memory is vague on it

@luisdavim
Copy link
Collaborator

I that case I think we can merge this as soon as the conflicts are addressed. Thanks

Any execution of a command using bash with the command parameter has been replaced with just the expected command executable (helm and kubectl). And instead of building the arguments as a single string, they are now built using string arrays. This solves the "quoting" problem, that is there when using a single string with all arguments. For example, before this change, a path had to be quoted on Windows to work. By just building string arrays with all the arguments, this problem is solved by Go' os/exec package.

It also solves the problem of using a password protected Helm repo, where the username contains a '$' (for example Harbor creates robot accounts with this). This could be escaped using '$$', but then it still was being interpreted by bash as an environment variable. This could have been solved by adding quotes around in the old solution, but it is just simpler to just use the "native" string array arguments approach as described above. And still if the environment variable was intended as input, then it is already applied by the "substituteEnv" functionality.
@luisdavim luisdavim merged commit 6c2dafa into Praqma:master Oct 23, 2019
mkubaczyk pushed a commit that referenced this pull request Aug 18, 2023
Added support of running Helmsman on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants