Skip to content

Commit

Permalink
Merge pull request #129 from razo7/scorecard-testing-nmo
Browse files Browse the repository at this point in the history
Test Scorecard in Github CI
  • Loading branch information
openshift-merge-bot[bot] authored Mar 28, 2024
2 parents f094f9c + 7d26a9d commit d320cba
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
40 changes: 39 additions & 1 deletion .github/workflows/pre-submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs: # jobs to run
runs-on: ubuntu-22.04 # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -24,3 +24,41 @@ jobs: # jobs to run

- name: Build images
run: make container-build-community

scorecard-k8s:
name: Test Scorecard Tests # https://sdk.operatorframework.io/docs/testing-operators/scorecard/
runs-on: ubuntu-22.04
env:
# see https://github.com/kubernetes-sigs/kind/tags
KIND_VERSION: v0.22.0
# see https://hub.docker.com/r/kindest/node/tags for available versions!
K8S_VERSION: v1.27.11
NMO_VERSION: 0.18.0
NMO_PREVIOUS_VERSION: 0.17.0

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Start kind cluster
uses: container-tools/kind-action@v2
with:
version: ${{env.KIND_VERSION}}
config: ./hack/kind-scorecard-config.yaml
node_image: kindest/node:${{env.K8S_VERSION}}
kubectl_version: ${{env.K8S_VERSION}}
registry: true

- name: Cluster info
run: |
kubectl version -o=yaml
kubectl cluster-info
kubectl get nodes -o=wide
- name: Build bundle-community
run: PREVIOUS_VERSION=${{env.NMO_PREVIOUS_VERSION}} VERSION=${{env.NMO_VERSION}} make bundle-community

- name: Run scorecard tests
run: OPERATOR_NAMESPACE=default make test-scorecard
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ catalog-push: ## Push a catalog image.

##@ Targets used by CI

.PHONY: test-scorecard
test-scorecard: operator-sdk ## Run Scorecard testing for the bundle directory on OPERATOR_NAMESPACE
$(OPERATOR_SDK) scorecard ./bundle -n $(OPERATOR_NAMESPACE)

.PHONY: check
check: ## Dockerized version of make test
$(DOCKER_GO) "make test"
Expand Down
5 changes: 5 additions & 0 deletions hack/kind-scorecard-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# One control plane node cluster config for k8s e2e test in github workflow!
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane

0 comments on commit d320cba

Please sign in to comment.