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

feat: save host run file output #1376

Merged
merged 15 commits into from
Nov 8, 2023
Merged

Conversation

cwyl02
Copy link
Contributor

@cwyl02 cwyl02 commented Oct 19, 2023

Description, Motivation and Context

Address the collector part of #1078

  • added .env to allow user to specify which env vars to import into this host run
  • added .input to allow user to create input files(e.g., config file, sample data for this host run). User needs to utilize TS_INPUT_DIR env var in their script, with the filename they specify in .input , e.g., $TS_INPUT_DIR/dummy.yaml
  • added .outputDir to allow user to specify a name of a directory(within the directory of the collector in bundle) to host their host run command file output. Note that command run has no access to this directory

Example SupportBundle:

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: run
spec:
  hostCollectors:
    - run:
        collectorName: "some-magic-on-host"
        command: "/home/cwyl02/custom-host-run.sh"
        args: ["--timeout", "10m"]
        env:
            - AWS_REGION=us-west-2
        ignoreParentEnvs: false  # Whether to inherit all the variable or not. If true, inheritEnvs would be made redundant
        inheritEnvs:   # list of env variables to inherit from the parent process
            - SHELL
            - LANG
            - PYTHON
        outputDir: "magic-outputs"
        input:
          dummy.yaml: |-
            username: postgres
            password: <my-pass>
            dbHost: <hostname>
            map:
              key: value
            list:
              - val1
              - val2
          config.toml: |-
             title = "TOML Example"
             [owner]
             name = "Tom Preston-Werner"

Result bundle:

├── analysis.json
├── execution-data
│   └── summary.txt
├── host-collectors
│   └── run-host
│       └── some-magic-on-host
│           ├── collector-info.json
│           ├── collector.txt
│           └── magic-outputs
│               ├── magic-dir-0
│               │   └── t1.txt
│               └── magic-dir-1
│                   └── t2.txt
└── version.yaml

Checklist

  • New and existing tests pass locally with introduced changes.
  • Tests for the changes have been added (for bug fixes / features)
  • The commit message(s) are informative and highlight any breaking changes
  • Any documentation required has been added/updated. For changes to https://troubleshoot.sh/ create a PR here

Does this PR introduce a breaking change?

  • Yes
  • No

@cwyl02 cwyl02 requested a review from a team as a code owner October 19, 2023 18:05
@cwyl02 cwyl02 mentioned this pull request Oct 19, 2023
6 tasks
York Chen added 5 commits October 25, 2023 17:16
the user invokes the input already got the input but those content could be sensitive to another user who received this bundle
pkg/collect/host_run.go Outdated Show resolved Hide resolved
pkg/collect/host_run.go Outdated Show resolved Hide resolved
pkg/collect/host_run.go Outdated Show resolved Hide resolved
pkg/collect/host_run.go Show resolved Hide resolved
York Chen added 2 commits November 7, 2023 11:35
@xavpaice xavpaice added the type::feature New feature or request label Nov 7, 2023
Copy link
Member

@banjoh banjoh left a comment

Choose a reason for hiding this comment

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

I've run some tests and the changes LGTM now. I added some suggestions. Once those are accepted, I'll approve the PR

pkg/collect/host_run.go Outdated Show resolved Hide resolved
pkg/collect/host_run.go Outdated Show resolved Hide resolved
pkg/collect/host_run.go Show resolved Hide resolved
Copy link
Member

@banjoh banjoh left a comment

Choose a reason for hiding this comment

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

LGTM

@banjoh banjoh merged commit f6373f3 into replicatedhq:main Nov 8, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants