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

The raw result should take container exit status into consideration #1968

Open
Brunomachadob opened this issue Apr 12, 2024 · 0 comments
Open

Comments

@Brunomachadob
Copy link

Describe the solution you'd like

I am trying to build a plugin that needs to run a simple task, which will always output everything in plain text format into the stdout and exit with either 0 or 1. Based on that, I believe it makes sense to make use of the result-format: raw format.

The problem is that no matter the exit code I use, sonobuoy interprets it as a success, just because it could stat the file with the outcomes, as stated here:

// RawProcessFile will return an Item object with the File value set to the path in question. If the
// file is unable to be stat'd then the status of the Item is StatusFailed (StatusPassed otherwise).

It would be nice to have this result to take the container exit code into consideration, as the report could be a success or failure, not depending on the file existing or not, but based on the exit code.

Anything else you would like to add:

Here's an example plugin config:

sonobuoy-config:
  driver: Job
  plugin-name: simple-plugin
  result-format: raw
spec:
  command:
    - sh
  args: ["-c", "echo whatever > ${SONOBUOY_RESULTS_DIR}/report.txt; echo ${SONOBUOY_RESULTS_DIR}/report.txt > ${SONOBUOY_RESULTS_DIR}/done; exit 1"]
  image: bitnami/kubectl:latest
  name: simple-plugin
  imagePullPolicy: Always
  resources: {}
  volumeMounts:
  - mountPath: /tmp/sonobuoy/results
    name: results

Being executed with:

sonobuoy run --sonobuoy-image sonobuoy/sonobuoy:latest --plugin simple-plugin.yaml

Environment:

  • Sonobuoy version: v0.57.1
  • Kubernetes version: v1.27.10-eks-508b6b3
  • Cloud provider or hardware configuration: EKS
  • OS (e.g. from /etc/os-release): MacOS
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

No branches or pull requests

1 participant