From eef9318c2ffe0d29e136053c12cfb61fcade909b Mon Sep 17 00:00:00 2001 From: Dimitri Saridakis Date: Mon, 21 Aug 2023 14:09:05 +0100 Subject: [PATCH 1/4] build: add scorecard-bundle make target --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 6e1045257..7295931f8 100644 --- a/Makefile +++ b/Makefile @@ -467,3 +467,7 @@ imports: openshift-goimports ## Organize imports in go files using openshift-goi .PHONY: verify-imports verify-imports: openshift-goimports ## Run import verifications. ./hack/verify-imports.sh $(OPENSHIFT-GOIMPORTS) + +.PHONY: scorecard-bundle +scorecard-bundle: ## Run scorecard tests on bundle image. + $(OPERATOR_SDK) scorecard bundle From 658a7937b865010082ccceeb6655f60d5be74142 Mon Sep 17 00:00:00 2001 From: Dimitri Saridakis Date: Mon, 21 Aug 2023 14:09:30 +0100 Subject: [PATCH 2/4] ci: add scorecard-bundle to ci --- .github/workflows/olm_tests.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/olm_tests.yaml b/.github/workflows/olm_tests.yaml index 67c797beb..058cca6c1 100644 --- a/.github/workflows/olm_tests.yaml +++ b/.github/workflows/olm_tests.yaml @@ -134,6 +134,12 @@ jobs: BUNDLE_PUSH_OPT: "--tls-verify=false" CATALOG_PUSH_OPT: "--tls-verify=false" + - name: Scorecard check + run: | + make scorecard-bundle + env: + IMG: "${{ env.REGISTRY_ADDRESS }}/codeflare-operator:v0.0.1" + - name: Update Operator to the built version run: | ORIGINAL_POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=codeflare-operator -n openshift-operators -o json | jq -r .items[].metadata.name) From b672063e124f212003e61876c86a8ef53e6d862e Mon Sep 17 00:00:00 2001 From: Dimitri Saridakis Date: Mon, 21 Aug 2023 14:35:40 +0100 Subject: [PATCH 3/4] refactor: removing a test which has a bug in the operator-sdk --- .github/workflows/olm_tests.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/olm_tests.yaml b/.github/workflows/olm_tests.yaml index 058cca6c1..eb643b139 100644 --- a/.github/workflows/olm_tests.yaml +++ b/.github/workflows/olm_tests.yaml @@ -134,6 +134,15 @@ jobs: BUNDLE_PUSH_OPT: "--tls-verify=false" CATALOG_PUSH_OPT: "--tls-verify=false" + - name: Install yq + run: | + sudo wget -O /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v4.6.1/yq_linux_amd64 + sudo chmod +x /usr/bin/yq + + - name: Modify scorecard config + run: | + yq e 'del(.stages[].tests[] | select(.labels.test == "olm-crds-have-resources-test"))' -i bundle/tests/scorecard/config.yaml + - name: Scorecard check run: | make scorecard-bundle From 467b461262befeeb28b96ae7761cee7aeb10f7cb Mon Sep 17 00:00:00 2001 From: Dimitri Saridakis Date: Thu, 24 Aug 2023 13:57:34 +0100 Subject: [PATCH 4/4] ci: addition of scorecard in CI --- .github/workflows/olm_scorecard.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/olm_tests.yaml | 15 --------------- Makefile | 2 +- 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/olm_scorecard.yml diff --git a/.github/workflows/olm_scorecard.yml b/.github/workflows/olm_scorecard.yml new file mode 100644 index 000000000..ba83b801f --- /dev/null +++ b/.github/workflows/olm_scorecard.yml @@ -0,0 +1,28 @@ +name: Operator Scorecard Test + +on: [push, pull_request] + +jobs: + scorecard-check: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Setup and start KinD cluster + uses: ./.github/actions/kind + + - name: Build bundle + run: make bundle-build + + - name: Install yq + run: | + sudo wget -O /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v4.6.1/yq_linux_amd64 + sudo chmod +x /usr/bin/yq + + - name: Modify scorecard config + run: | + yq e 'del(.stages[].tests[] | select(.labels.test == "olm-crds-have-resources-test"))' -i bundle/tests/scorecard/config.yaml + + - name: Run Operator SDK Scorecard + run: make scorecard-bundle diff --git a/.github/workflows/olm_tests.yaml b/.github/workflows/olm_tests.yaml index eb643b139..67c797beb 100644 --- a/.github/workflows/olm_tests.yaml +++ b/.github/workflows/olm_tests.yaml @@ -134,21 +134,6 @@ jobs: BUNDLE_PUSH_OPT: "--tls-verify=false" CATALOG_PUSH_OPT: "--tls-verify=false" - - name: Install yq - run: | - sudo wget -O /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v4.6.1/yq_linux_amd64 - sudo chmod +x /usr/bin/yq - - - name: Modify scorecard config - run: | - yq e 'del(.stages[].tests[] | select(.labels.test == "olm-crds-have-resources-test"))' -i bundle/tests/scorecard/config.yaml - - - name: Scorecard check - run: | - make scorecard-bundle - env: - IMG: "${{ env.REGISTRY_ADDRESS }}/codeflare-operator:v0.0.1" - - name: Update Operator to the built version run: | ORIGINAL_POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=codeflare-operator -n openshift-operators -o json | jq -r .items[].metadata.name) diff --git a/Makefile b/Makefile index 7295931f8..f9eeec4b6 100644 --- a/Makefile +++ b/Makefile @@ -469,5 +469,5 @@ verify-imports: openshift-goimports ## Run import verifications. ./hack/verify-imports.sh $(OPENSHIFT-GOIMPORTS) .PHONY: scorecard-bundle -scorecard-bundle: ## Run scorecard tests on bundle image. +scorecard-bundle: install-operator-sdk ## Run scorecard tests on bundle image. $(OPERATOR_SDK) scorecard bundle