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

Expose workdir parameter to shell resource #1112

Merged
merged 4 commits into from
Jan 26, 2023

Conversation

olblak
Copy link
Member

@olblak olblak commented Jan 25, 2023

  • Handle command error
  • Expose workdir parameter to shell resource

This pullrequest allows to specify a custom working directory from where to execute the shell command.
This parameter is needed as part of the autodiscovery feature link.

If spec.workdir is unset then nothing change compared to today
if spec.workdir is a relative path, then we join the current path with spec.workdir value
if spec.workir is an absolute path, then it overrides the current path (scm or not)

Signed-off-by: Olblak me@olblak.com

Test

To test this pull request, you can run the following commands:

cd pkg/plugins/resources/shell
go test .
go build -o bin/updatecli .
./bin/updatecli diff --config e2e/updatecli.d/success.d/shell/workDir.yaml

Additional Information

Tradeoff

In this pullrequest I also noticed that the function func (s *Shell) executeCommand(inputCmd command) didn't handle error which was a bit confusing to me why so I added that support.

Potential improvement

/

Handle command error

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added the enhancement New feature or request label Jan 25, 2023
olblak and others added 2 commits January 25, 2023 21:21
@olblak olblak added the resource-shell Resource of kind Shell label Jan 25, 2023
@olblak olblak changed the title Expose workDir parameter to shell resource Expose workdir parameter to shell resource Jan 26, 2023
@olblak olblak added this to the 0.44.0 milestone Jan 26, 2023
@olblak
Copy link
Member Author

olblak commented Jan 26, 2023

I am merging this PR now as I need it for #1065 and it doesn't change the current behavior
I am fine renaming workdir to something else until we release 0.44.0 which shouldn't happen until FOSDEM
Once 0.44.0 is released, it would need to be deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resource-shell Resource of kind Shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant