Skip to content

Conversation

@nammn
Copy link
Collaborator

@nammn nammn commented Dec 10, 2025

Summary

  • introducing pre-commit and migrating our self written pre-commit hook to it
  • introducing common pre-commit hooks
  • i changed isort to use 120 to match what black does, apparently we didn't before
  • changed snippet validator to skip git ignored folders
  • why: we decided to migrate to a common used tool for better support, composability and maintenance

core changes (out of all files): can be seen in the first commit, all the subsequent commits are fixing those

Next

  • activate file and whitespace linter in the next pr which will also change tons of files

Proof of Work

  • green ci
  • red ci when something is wrong from the first commit: patch

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you added changelog file?

@nammn nammn added the skip-changelog Use this label in Pull Request to not require new changelog entry file label Dec 10, 2025
@nammn nammn force-pushed the pre-commit branch 2 times, most recently from d3ddcb8 to 53ed895 Compare December 11, 2025 07:25
nammn added a commit that referenced this pull request Dec 11, 2025
This branch contains only the core implementation files for review.
The full PR (#642) includes additional auto-formatted files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
nammn added a commit that referenced this pull request Dec 11, 2025
This branch contains only the core implementation files for review.
The full PR (#642) includes additional auto-formatted files.
@nammn nammn force-pushed the pre-commit branch 2 times, most recently from 922b4cd to c3113c3 Compare December 11, 2025 09:13
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

⚠️ (this preview might not be accurate if the PR is not rebased on current master branch)

MCK 1.6.1 Release Notes

Bug Fixes

  • Backed up the agent password in a secret for SCRAM authentication to prevent unnecessary password rotations.
  • MongoDB Adding missing ownerrefs to ensure proper resource deletion by kubernetes.
  • Single Cluster Deleting resources created by CRD now only happens on multi-cluster deployments. Single Cluster will solely rely on ownerrefs.
  • MongoDB, MongoDBOpsManager: Improve validation for featureCompatibilityVersion field in MongoDB and MongoDBOpsManager spec.
    The field now enforces proper semantic versioning. Previously, invalid semver values could be accepted,
    potentially resulting in incorrect configurations.
  • Roles configured via Ops Manager UI or API will no longer be removed by the operator

Other Changes

  • Future releases will include a new asset, release_info_.json, which provides detailed information about each MongoDB Controllers for Kubernetes release, including a clear list of all container images. This will help customers, especially those running in air-gapped environments, easily identify all required images for a given release.
  • Operator configuration: Removed the unused MDB_IMAGE_TYPE environment variable and the corresponding mongodb.imageType Helm value. This variable was deprecated in v1.28.0 of the MongoDB Enterprise Kubernetes Operator when it switched to architecture-based image selection (ubi9 for static, ubi8 for non-static). This is a cleanup change with no functional impact.

@@ -0,0 +1,213 @@
#!/usr/bin/env bash
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thyis is mostly cp and paste from pre-commit

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in later pr i plan to enable newlines and trailing whitespace fixer, but then we will need to ensure that all generated files follow this - otherwise, pre-commit will fail if pre-commit needs to fix it

source scripts/dev/set_env_context.sh
source scripts/funcs/printing

# Strip trailing whitespace from files to ensure clean generation output
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't do this, then we generate and then pre-commit runs and fixes them and then it fails as it changed something

@nammn nammn marked this pull request as ready for review December 11, 2025 11:48
@nammn nammn requested review from a team and vinilage as code owners December 11, 2025 11:48
@nammn nammn force-pushed the pre-commit branch 4 times, most recently from f4fde10 to 1c4f4be Compare December 11, 2025 12:28
# yamllint configuration file
# See https://yamllint.readthedocs.io/en/stable/configuration.html

extends: default
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generated to match what we currently have

Copy link
Collaborator Author

@nammn nammn Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later prs can fix all of them. I decided to not do this in this PR as this would basically fix all files

@nammn nammn marked this pull request as draft December 11, 2025 12:42
@nammn nammn force-pushed the pre-commit branch 4 times, most recently from 224f8a2 to d68a102 Compare December 11, 2025 14:26
@nammn nammn marked this pull request as ready for review December 12, 2025 12:23
@nammn nammn requested a review from m1kola December 12, 2025 12:28
…framework

This commit migrates from the custom .githooks/pre-commit bash script to
the official pre-commit framework (https://pre-commit.com).

Changes:
- Add .pre-commit-config.yaml with all existing hooks migrated
- Add .yamllint.yaml for YAML linting configuration
- Create scripts/dev/generate_files.sh - extracted file generation logic
- Create scripts/dev/regenerate_multicluster_rbac.sh - extracted RBAC regeneration
- Simplify .githooks/pre-commit to delegate to pre-commit framework
- Update scripts/evergreen/check_precommit.sh for CI integration
- Update Makefile precommit targets
- Add pre-commit to requirements.txt
- Fix prepare-openshift-bundles-for-e2e.sh to call generate_files.sh directly
- Fix validate_snippets.py to ignore git-ignored directories
- Fix pyproject.toml isort config to use line_length=120 (matching black)

Note: trailing-whitespace and end-of-file-fixer hooks are commented out
for now (they modify 200+ files). These will be enabled in a follow-up PR.
@nammn nammn force-pushed the pre-commit branch 4 times, most recently from be1c93a to 0b8d1f6 Compare December 12, 2025 13:45
Update generate_files.sh to run all generation/validation jobs
concurrently for faster execution. The script:
- Runs all independent jobs in background
- Properly handles dependency: generate_standalone_yaml waits for
  update_release_json and update_values_yaml_files to complete first
- Prefixes job output for easy debugging
- Reports failures with job names and PIDs
@nammn nammn marked this pull request as draft December 12, 2025 14:00
@nammn nammn marked this pull request as ready for review December 12, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Use this label in Pull Request to not require new changelog entry file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants