-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save host run file output (#1376)
* feat: save cmd run output * chore: schema changes * chore: example hostCollector * chore: add log messages to key actions * fix: correctly inherit all parent env by default * chore: do not save input file the user invokes the input already got the input but those content could be sensitive to another user who received this bundle * test: unit test for host run * revert: "chore: do not save input file" This reverts commit 6af77ad. that commit is wrong * chore: fix log msg and example yaml * Ensure child cmd runs in its own working dir * Check filename for slashes not content * Update logging * Add using relative path files as commands --------- Co-authored-by: Evans Mungai <[email protected]>
- Loading branch information
Showing
10 changed files
with
503 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: troubleshoot.sh/v1beta2 | ||
kind: HostCollector | ||
metadata: | ||
name: run-host-cmd-and-save-output | ||
spec: | ||
collectors: | ||
- run: | ||
collectorName: "my-custom-run" | ||
command: "sh" | ||
# this is for demonstration purpose only -- you probably don't want to drop your input to the bundle! | ||
args: | ||
- "-c" | ||
- "cat $TS_INPUT_DIR/dummy.yaml > $TS_WORKSPACE_DIR/dummy_content.yaml" | ||
outputDir: "myCommandOutputs" | ||
env: | ||
- AWS_REGION=us-west-1 | ||
# if ignoreParentEnvs is true, it will not inherit envs from parent process. | ||
# values specified in inheritEnv will not be used either | ||
# ignoreParentEnvs: true | ||
inheritEnvs: | ||
- USER | ||
input: | ||
dummy.conf: |- | ||
[hello] | ||
hello = 1 | ||
[bye] | ||
bye = 2 | ||
dummy.yaml: |- | ||
username: postgres | ||
password: <my-pass> | ||
dbHost: <hostname> | ||
map: | ||
key: value | ||
list: | ||
- val1 | ||
- val2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.