-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat: Add a new resource of type "shell" #264
Conversation
0a5b931
to
6c2d101
Compare
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
7aad03c
to
26d527b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Some style nits and suggestions, feel free to disregard if not relevant 😄
Co-authored-by: Julien Levesy <jlevesy@gmail.com>
Co-authored-by: Julien Levesy <jlevesy@gmail.com>
Co-authored-by: Julien Levesy <jlevesy@gmail.com>
Co-authored-by: Julien Levesy <jlevesy@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Co-authored-by: Julien Levesy <jlevesy@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Ping @olblak , it's ready to 🚢 (at least to be reviewed by you :) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Style nit, otherwise LGTM
Co-authored-by: Julien Levesy <jlevesy@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice pull request, now I have to upper the quality of mines :D
Most of the credit goes to @jlevesy ❤️ for his careful reviews, explanation and teaching me :) |
Add a new resource of type "shell"
Closes #263
What this PR does?
It introduces a new resource of type
shell
to allow executing a custom command.For sources, this resource uses the stdout of the command to report the value to updatecli, if and only if the exit code is 0, otherwise it fails, and the stderr of the command is reported by updatecli to the end user.
For conditions, this resource executes a command with the associated source appended as last argument. If the exit code is 0 then the condition succeed, otherwise it fails.
For targets, this resource executes a command with the associated source appended as last argument. Then:
DRY_RUN
is set either tofalse
ortrue
in the target's command environmentThere is an generic example in
examples/updateCli.generic/shell/shell.yaml
(along with shell scripts).What this PR does not?
Test
To test this pull request, you can run the following commands:
~95% of the package
shell
is coveredAdditional Information
os/exec
Golang package AND each command is a single strings, it should work as expectedPotential improvement
command
specification could be improved to support "array mode" ala Dockerfile (for entrypoints/CMD inDockerfiles
)