From 43ee7337abb2c2354040f1a13ef5bdc095e2e91f Mon Sep 17 00:00:00 2001 From: Jakub Buczak Date: Wed, 11 Mar 2026 13:10:01 +0100 Subject: [PATCH 1/2] Add .gitattributes for generated files and update GitHub workflow to check for uncommitted changes - Introduced .gitattributes to mark generated files for better handling in version control. - Enhanced the build-test-push workflow by adding a new job to check for uncommitted changes after code generation, ensuring generated files are up to date before proceeding with the build. --- .gitattributes | 13 ++++++++++++ .../workflows/build-test-push-workflow.yml | 21 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..236490b0d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +# Generated by controller-gen (make generate) +api/**/zz_generated.deepcopy.go linguist-generated=true + +# Generated by controller-gen (make manifests) +config/crd/bases/*.yaml linguist-generated=true +config/rbac/role.yaml linguist-generated=true +config/rbac/role_binding.yaml linguist-generated=true +config/webhook/manifests.yaml linguist-generated=true + +# Generated by operator-sdk (make bundle) +config/manifests/bases/splunk-operator.clusterserviceversion.yaml linguist-generated=true +bundle/manifests/*.yaml linguist-generated=true +bundle/metadata/annotations.yaml linguist-generated=true diff --git a/.github/workflows/build-test-push-workflow.yml b/.github/workflows/build-test-push-workflow.yml index e457272b8..55e9dcbbe 100644 --- a/.github/workflows/build-test-push-workflow.yml +++ b/.github/workflows/build-test-push-workflow.yml @@ -82,9 +82,28 @@ jobs: report_paths: 'unit_test*.xml' check_name: 'Unit Test Results' detailed_summary: true + check-generated: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Dotenv Action + id: dotenv + uses: falti/dotenv-action@v1 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: ${{ steps.dotenv.outputs.GO_VERSION }} + - name: Run code generation + run: make manifests generate + - name: Check for uncommitted changes + run: | + if ! git diff --exit-code; then + echo "::error::Generated files are out of date. Run 'make manifests generate' and commit the result." + exit 1 + fi build-operator-image: runs-on: ubuntu-latest - needs: [check-formating, unit-tests] + needs: [check-formating, unit-tests, check-generated] env: SPLUNK_ENTERPRISE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_IMAGE }} SPLUNK_OPERATOR_IMAGE_NAME: splunk/splunk-operator From f8b8f9ecbe34c02146ef685cd66b60acafe5b87f Mon Sep 17 00:00:00 2001 From: Jakub Buczak Date: Thu, 12 Mar 2026 13:21:11 +0100 Subject: [PATCH 2/2] Add .gitattributes to mark generated files for improved version control --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitattributes b/.gitattributes index 236490b0d..8589c1129 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ +# Generated by kubebuilder/operator-sdk (scaffolding) +PROJECT linguist-generated=true + # Generated by controller-gen (make generate) api/**/zz_generated.deepcopy.go linguist-generated=true