mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
skip generating report change request if there's entry results
This commit is contained in:
parent
596647dadb
commit
5303939f45
2 changed files with 9 additions and 1 deletions
|
@ -49,7 +49,7 @@ func GeneratePRsFromEngineResponse(ers []response.EngineResponse, log logr.Logge
|
|||
return pvInfos
|
||||
}
|
||||
|
||||
// Builder builds report request struct
|
||||
// Builder builds report change request struct
|
||||
// this is base type of namespaced and cluster policy report
|
||||
type Builder interface {
|
||||
build(info Info) (*unstructured.Unstructured, error)
|
||||
|
@ -87,6 +87,10 @@ func (pvb *requestBuilder) build(info Info) (req *unstructured.Unstructured, err
|
|||
results = append(results, result)
|
||||
}
|
||||
|
||||
if len(results) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if info.Resource.GetNamespace() != "" {
|
||||
rr := &report.ReportChangeRequest{
|
||||
Summary: calculateSummary(results),
|
||||
|
|
|
@ -237,6 +237,10 @@ func (gen *Generator) syncHandler(info Info) error {
|
|||
return fmt.Errorf("unable to build reportChangeRequest: %v", err)
|
||||
}
|
||||
|
||||
if reportChangeRequestUnstructured == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return gen.sync(reportChangeRequestUnstructured, info)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue