diff --git a/pkg/actions/run_scorecard.go b/pkg/actions/run_scorecard.go index 7cb3e197..d97a6af7 100644 --- a/pkg/actions/run_scorecard.go +++ b/pkg/actions/run_scorecard.go @@ -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) { @@ -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) diff --git a/pkg/actions/scorecardDefaultConfigFragment.yaml b/pkg/actions/scorecardDefaultConfigFragment.yaml new file mode 100644 index 00000000..3d529d5e --- /dev/null +++ b/pkg/actions/scorecardDefaultConfigFragment.yaml @@ -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 \ No newline at end of file