Skip to content

CSPL-4610: Add CI check for stale generated files and mark them in .gitattributes#1767

Open
kubabuczak wants to merge 2 commits intodevelopfrom
CSPL-4610-improve-generated-files-handling
Open

CSPL-4610: Add CI check for stale generated files and mark them in .gitattributes#1767
kubabuczak wants to merge 2 commits intodevelopfrom
CSPL-4610-improve-generated-files-handling

Conversation

@kubabuczak
Copy link
Collaborator

@kubabuczak kubabuczak commented Mar 11, 2026

Adds a CI gate to catch stale generated files (CRDs, RBAC, DeepCopy) and marks all generated files with linguist-generated so GitHub collapses them by default in PR diffs.

Key Changes

  • .github/workflows/build-test-push-workflow.yml
    • New check-generated job that runs make manifests generate and fails if git diff detects uncommitted changes
    • build-operator-image now depends on check-generated in addition to check-formating and unit-tests
  • .gitattributes (new file)
    • Marks api/**/zz_generated.deepcopy.go, config/crd/bases/*.yaml, config/rbac/role.yaml, config/rbac/role_binding.yaml, config/webhook/manifests.yaml, bundle/manifests/*.yaml, bundle/metadata/annotations.yaml, and config/manifests/bases/splunk-operator.clusterserviceversion.yaml as linguist-generated=true

Testing and Verification

  • CI job can be verified by pushing a branch with intentionally stale generated files (e.g. modify an API type in api/v4/ without running make manifests generate) — the new check-generated job should fail
  • linguist-generated behavior is verified by GitHub automatically on any PR that touches these files — they will appear collapsed in the diff view

Related Issues

PR Checklist

  • Code changes adhere to the project's coding standards.
  • Relevant unit and integration tests are included.
  • Documentation has been updated accordingly.
  • All tests pass locally.
  • The PR description follows the project's guidelines.

…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.
@kubabuczak kubabuczak changed the title Add .gitattributes for generated files and update GitHub workflow to … CSPL-4610: Add CI check for stale generated files and mark them in .gitattributes Mar 11, 2026
@kubabuczak kubabuczak marked this pull request as ready for review March 11, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant