Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

capture exit code for sarif #576

Merged
merged 1 commit into from
Nov 27, 2023
Merged

capture exit code for sarif #576

merged 1 commit into from
Nov 27, 2023

Conversation

dani-santos-code
Copy link
Contributor

Description

When running kubeaudit on the cli, we generally yield an exit code other than 0 if the report contains errors.

However, when we run it with the sarif format, we get 0 even when we have errors. This happens, because we're returning
here to avoid printing extra info to the console. This means we never reach this line.

Fixes #575

Type of change
  • Bug fix 🐛
  • New feature ✨
  • This change requires a documentation update 📖
  • Breaking changes ⚠️
How Has This Been Tested?
  • Test A
  1. use one of the manifest files in the repo to test. Example: auditors/privileged/fixtures/privileged-nil.yml

  2. go run ./cmd/main.go all -f auditors/privileged/fixtures/privileged-nil.yml --format=sarif

  3. when you run echo $? you should see 2

Checklist:
  • I have 🎩 my changes (A 🎩 specifically includes pulling down changes, setting them up, and manually testing the changed features and potential side effects to make sure nothing is broken)
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The test coverage did not decrease
  • I have signed the appropriate Contributor License Agreement

Copy link

@clintonShopify clintonShopify left a comment

Choose a reason for hiding this comment

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

LGTM

@dani-santos-code dani-santos-code merged commit db8a302 into main Nov 27, 2023
5 checks passed
@dani-santos-code dani-santos-code deleted the ds/error-on-sarif branch November 27, 2023 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sarif report with errors with exit code 0
2 participants