feat(scanner): report per-scanner health and the bypass behind a decision

The manager now exposes the cached health, and the CLI version, of every
registered scanner. A scan decision also names the admin bypass that
applied to the package, so callers can tell a bypassed package from a
cleared one.
This commit is contained in:
2026-11-24 00:42:41 +00:00
parent 916e2b0aa5
commit 2b6f3bd892
10 changed files with 272 additions and 48 deletions
+7 -1
View File
@@ -14,6 +14,7 @@ import (
"github.com/lukaszraczylo/gohoarder/pkg/config"
"github.com/lukaszraczylo/gohoarder/pkg/metadata"
"github.com/lukaszraczylo/gohoarder/pkg/scanner/scanerr"
"github.com/lukaszraczylo/gohoarder/pkg/scanner/scanver"
"github.com/lukaszraczylo/gohoarder/pkg/uuid"
"github.com/rs/zerolog/log"
)
@@ -23,7 +24,8 @@ const ScannerName = "trivy"
// Scanner implements the Scanner interface using Trivy
type Scanner struct {
config config.TrivyConfig
version scanver.Cache
config config.TrivyConfig
}
// TrivyResult represents Trivy JSON output structure
@@ -247,6 +249,10 @@ func (s *Scanner) Health(ctx context.Context) error {
return fmt.Errorf("trivy not available: %w (output: %s)", err, string(output))
}
s.version.Record(string(output))
log.Debug().Str("version", strings.TrimSpace(string(output))).Msg("Trivy health check passed")
return nil
}
// Version returns the version the last successful health check reported.
func (s *Scanner) Version() string { return s.version.Version() }