Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/actions/run_scorecard.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ type BundleAnnotations struct {
}

func RunScorecard(bundleDir string, auditBundle *models.AuditBundle) *models.AuditBundle {
log.Info("\n----bundleDir----\n", bundleDir)
scorecardTestsPath := filepath.Join(bundleDir, "tests", "scorecard")
log.Info("\n----scorecardTestsPath----\n", scorecardTestsPath)
annotationsPath := filepath.Join(bundleDir, "metadata", "annotations.yaml")
log.Info("\n----annotationsPath----\n", annotationsPath)

// If find the annotations file then, check for the scorecard path on it.
if _, err := os.Stat(annotationsPath); err == nil && !os.IsNotExist(err) {
Expand Down Expand Up @@ -116,8 +119,12 @@ func RunScorecard(bundleDir string, auditBundle *models.AuditBundle) *models.Aud
return auditBundle
}

scorecardConfig := "false"
scorecardFilePath := "github.com/operator-framework/audit/pkg/actions/scorecardDefaultConfigFragment.yaml"
// Add Logic to update scorecardConfig

// run scorecard against bundle
cmd := exec.Command("operator-sdk", "scorecard", bundleDir, "--wait-time=120s", "--output=json")
cmd := exec.Command("operator-sdk", "scorecard", bundleDir, "--wait-time=120s", "--output=json", "--scorecard-config", scorecardFilePath, "--scorecard-custom-tests", scorecardConfig)
output, _ := pkg.RunCommand(cmd)
if len(output) < 1 {
log.Errorf("unable to get scorecard output: %s", output)
Expand Down
49 changes: 49 additions & 0 deletions pkg/actions/scorecardDefaultConfigFragment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests:
- entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.22.0
labels:
suite: basic
test: basic-check-spec-test
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.22.0
labels:
suite: olm
test: olm-bundle-validation-test
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.22.0
labels:
suite: olm
test: olm-crds-have-validation-test
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.22.0
labels:
suite: olm
test: olm-crds-have-resources-test
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.22.0
labels:
suite: olm
test: olm-spec-descriptors-test
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.22.0
labels:
suite: olm
test: olm-status-descriptors-test