Skip to content

Commit

Permalink
Merge pull request #141 from razo7/scorecard-testing-far
Browse files Browse the repository at this point in the history
Test Scorecard testing in Makefile
  • Loading branch information
razo7 authored Apr 16, 2024
2 parents e2a5486 + b46a8af commit ec0c8f6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
41 changes: 39 additions & 2 deletions .github/workflows/pre-submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ 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

- name: Set up Go # https://github.com/actions/setup-go/blob/main/action.yml
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'
Expand All @@ -35,3 +35,40 @@ 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
FAR_VERSION: 0.3.0
FAR_PREVIOUS_VERSION: 0.2.1

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.FAR_PREVIOUS_VERSION}} VERSION=${{env.FAR_VERSION}} make bundle-community

- name: Run scorecard tests
run: OPERATOR_NAMESPACE=default make test-scorecard
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ catalog-push: ## Push a catalog image.
verify-unchanged: ## Verify there are no un-committed changes
./hack/verify-unchanged.sh

.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: container-build
container-build: docker-build bundle-build ## Build containers

Expand Down Expand Up @@ -486,8 +490,6 @@ test-e2e: ginkgo ## Run end to end (E2E) tests
.PHONY: bundle-reset
bundle-reset:
VERSION=0.0.1 $(MAKE) manifests bundle
# empty creation date
sed -r -i "s|createdAt: .*|createdAt: \"\"|;" ${BUNDLE_CSV}

.PHONY: full-gen
full-gen: go-verify manifests generate manifests fmt bundle fix-imports bundle-reset ## generates all automatically generated content
full-gen: go-verify manifests generate manifests fmt bundle fix-imports bundle-reset ## generates all automatically generated content
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 ec0c8f6

Please sign in to comment.