Skip to content

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

Merged
kubabuczak merged 2 commits intodevelopfrom
CSPL-4610-improve-generated-files-handling
Mar 30, 2026
Merged

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

Conversation

@kubabuczak
Copy link
Copy Markdown
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
@kubabuczak kubabuczak merged commit 80bafa5 into develop Mar 30, 2026
68 of 80 checks passed
@kubabuczak kubabuczak deleted the CSPL-4610-improve-generated-files-handling branch March 30, 2026 07:54
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants