-
Notifications
You must be signed in to change notification settings - Fork 5
/
pluto.go
31 lines (27 loc) · 828 Bytes
/
pluto.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package ci
import (
"os"
"path/filepath"
"github.com/fairwindsops/insights-plugins/plugins/ci/pkg/commands"
"github.com/fairwindsops/insights-plugins/plugins/ci/pkg/models"
)
func (ci *CIScan) GetPlutoReport() (*models.ReportInfo, error) {
report := models.ReportInfo{
Report: "pluto",
Filename: "pluto.json",
}
// Scan with Pluto
plutoResults, err := commands.Exec("pluto", "detect-files", "-d", ci.configFolder, "-o", "json", "--ignore-deprecations", "--ignore-removals")
if err != nil {
return nil, err
}
err = os.WriteFile(filepath.Join(ci.config.Options.TempFolder, report.Filename), []byte(plutoResults), 0644)
if err != nil {
return nil, err
}
report.Version = os.Getenv("plutoVersion")
return &report, nil
}
func (ci *CIScan) PlutoEnabled() bool {
return *ci.config.Reports.Pluto.Enabled
}