Skip to content

Commit

Permalink
Add check for deepcopy files to CI (#3776)
Browse files Browse the repository at this point in the history
This PR does 2 things:

It speeds up the deepcopy command and adds it to the manifest. This speed improvement is achieved by only searching in the relevant folders
It adds a check to the CI to verify that the deepcopy files were updated if needed
  • Loading branch information
gkrenn authored Sep 11, 2024
1 parent 2116eb5 commit e100adb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ jobs:
run: |
make go/deadcode
generated-files:
name: Check generated files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Check deepcopy files
id: deepcopy
run: |
make manifests/deepcopy
git diff --exit-code
security:
name: Code security scanning alerts
runs-on: ubuntu-latest
Expand Down Expand Up @@ -186,7 +201,7 @@ jobs:
build:
name: Build images
runs-on: ubuntu-latest
needs: [prepare, tests, linting]
needs: [prepare, tests, linting, generated-files]
strategy:
matrix:
platform: [amd64, arm64, ppc64le, s390x]
Expand Down
6 changes: 3 additions & 3 deletions hack/make/manifests/manifests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ manifests/prepare-directory:
find $(MANIFESTS_DIR) -type f -not -name 'kustomization.yaml' -delete

## Generates manifests e.g. CRD, RBAC etc, for Kubernetes and OpenShift
manifests: manifests/prepare-directory manifests/kubernetes manifests/openshift
manifests: manifests/prepare-directory manifests/kubernetes manifests/openshift manifests/deepcopy

## Generate deep copy files
manifests/deepcopy:
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
manifests/deepcopy: prerequisites/controller-gen
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./pkg/api/..."

0 comments on commit e100adb

Please sign in to comment.