Skip to content

[SREP-4485] add pre-commit hooks to golang-osd-operator convention - #723

Merged
openshift-merge-bot[bot] merged 4 commits into
openshift:masterfrom
charlesgong:SREP-4485
May 5, 2026
Merged

openshift-merge-bot[bot] merged 4 commits into
openshift:masterfrom
charlesgong:SREP-4485

Conversation

@charlesgong

@charlesgong charlesgong commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds .pre-commit-config.yaml deployment to all operators subscribing to the golang-osd-operator boilerplate convention.

Files added to convention:

  • pre-commit-config.yaml: Tier 1 common hooks mirroring ci/prow/lint (file hygiene, gitleaks, golangci-lint, go-build, go-mod-tidy, RBAC wildcard check)
  • commands/pre-commit.md: /pre-commit Claude Code agent with golden rule compliance (2-retry limit, security escalation, structured output)

update script now deploys both files to operator repos:

  • .pre-commit-config.yaml at repo root
  • .claude/commands/pre-commit.md for Claude Code agent support

Golden rules ticket: SREP-4450
Rules document: Doc

Adds .pre-commit-config.yaml deployment to all operators subscribing to
the golang-osd-operator boilerplate convention.

Files added to convention:
- pre-commit-config.yaml: Tier 1 common hooks mirroring ci/prow/lint
  (file hygiene, gitleaks, golangci-lint, go-build, go-mod-tidy,
   RBAC wildcard check)
- commands/pre-commit.md: /pre-commit Claude Code agent with golden
  rule compliance (2-retry limit, security escalation, structured output)

update script now deploys both files to operator repos:
- .pre-commit-config.yaml at repo root
- .claude/commands/pre-commit.md for Claude Code agent support

Golden rules: SREP-4450

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented May 4, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (3)
  • boilerplate/openshift/golang-osd-operator/pre-commit-config.yaml is excluded by !boilerplate/**
  • boilerplate/openshift/golang-osd-operator/standard.mk is excluded by !boilerplate/**
  • boilerplate/openshift/golang-osd-operator/update is excluded by !boilerplate/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4c76b84b-68ce-469c-9b8b-fafdcca46688

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
openshift-ci Bot requested review from luis-falcon and reedcort May 4, 2026 04:27
@devppratik

Copy link
Copy Markdown
Contributor

/hold Putting on hold to finalize on how we rollout the changes

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2026
Claude Code skill (.claude/commands/pre-commit.md) moved to SREP-4410.
This MR now contains only the pre-commit-config.yaml addition.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@devppratik

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2026
@devppratik

Copy link
Copy Markdown
Contributor

/hold cancel
This is good to be shipped with rest of the changes.

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 5, 2026
@@ -0,0 +1,136 @@
# =============================================================================
# Tier 1 — Common Pre-Commit Hooks for OSD Operators
# SREP-4485 | Golden rules: SREP-4450

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the golden rules here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would be better if we can put the document in the repo, and link to the doc rather than the card ID?

- Merge duplicate pre-commit-hooks repo entries into one block
- Move RBAC wildcard check logic to make target rbac-wildcard-check
  in standard.mk for readability and reuse; hook now calls make target
- Clean up inline comments

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label May 5, 2026
- Renumber hooks 1-6 after merging file hygiene and YAML syntax sections
- Clean up inline golden-rule references from comments
- Make rbac-wildcard-check warn-only (exit 0) to avoid blocking repos
  with pre-existing wildcard RBAC; will promote to blocking after cleanup
- Add go-build binary note: compile-only, no artifacts written to repo

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@devppratik

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2026
@bmeng

bmeng commented May 5, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bmeng, charlesgong, devppratik

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants