Skip to content

HYPERFLEET-1068 - fix: whitelist bot authors in commitlint validation#9

Merged
ciaranRoche merged 1 commit into
mainfrom
feat/whitelist-bot-authors
May 13, 2026
Merged

HYPERFLEET-1068 - fix: whitelist bot authors in commitlint validation#9
ciaranRoche merged 1 commit into
mainfrom
feat/whitelist-bot-authors

Conversation

@ciaranRoche
Copy link
Copy Markdown
Contributor

@ciaranRoche ciaranRoche commented May 13, 2026

Summary

  • Adds author-based whitelisting to the commitlint validator so commits from known bot accounts (e.g., Konflux) are automatically skipped during validation
  • Whitelists both commit author email (git path) and PR author login (GitHub API path)
  • Removes unused getCommitMessage function (logic inlined in validateCommits)
  • Adds AuthorEmail to PRCommit and refactors GetPRTitle to GetPRInfo to include PR author login
  • Adds tests for whitelist behaviour in both git and validator paths

Problem

Konflux PaC sends onboarding PRs with commit messages like Red Hat Konflux kflux-prd-rh02 update hyperfleet-api which fail the HyperFleet commit standard. Both the commit message AND the PR title fail validation, blocking merge of .tekton/ pipeline files on all three component repos.

Approach

Whitelist by author identity rather than commit message pattern — bot identities are stable, messages could change. Whitelisted commits and PR titles print SKIP (whitelisted author: ...) and count as passed.

Currently whitelisted:

  • konflux@no-reply.konflux-ci.dev (commit author email)
  • red-hat-konflux-kflux-prd-rh02[bot] (GitHub PR author login)

Manual Verification

Built locally and ran against the actual Konflux onboarding PR (hyperfleet-api #132):

$ PULL_BASE_SHA=0f2e440 PULL_PULL_SHA=165fe1e REPO_OWNER=openshift-hyperfleet \
  REPO_NAME=hyperfleet-api PULL_NUMBER=132 ./hyperfleet-hooks commitlint --pr

🔍 Validating commits in range: 0f2e440..165fe1e
📝 Found 1 commit(s) to validate

Checking: 165fe1ed - Red Hat Konflux kflux-prd-rh02 update hyperfleet-api
  ⏭️  SKIP (whitelisted author: konflux@no-reply.konflux-ci.dev)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Validating PR title...
PR #132: Red Hat Konflux kflux-prd-rh02 update hyperfleet-api
  ⏭️  SKIP (whitelisted author: red-hat-konflux-kflux-prd-rh02[bot])

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ All 1 commit(s) passed validation!
✅ PR title passed validation!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Follow-up

After this merges and a new release is cut, the Prow presubmit job in openshift/release needs updating to use the new version.

Test plan

  • TestValidator_IsWhitelistedAuthor — unit tests for whitelist lookup (email, GitHub login, case insensitive, empty, non-whitelisted)
  • TestValidateCommits_WhitelistedAuthor — integration test: bot commit skipped, user commit validated
  • TestValidateCommits_WhitelistedAuthorInvalidMessage — non-whitelisted author with bad message still fails
  • TestGetPRInfo_InvalidRepoFormat — updated from GetPRTitle
  • TestGetPRInfoFromEnv_MissingEnvVars — updated from GetPRTitleFromEnv
  • All existing tests pass

🤖 Generated with Claude Code

@ciaranRoche ciaranRoche force-pushed the feat/whitelist-bot-authors branch from 7df3d4a to a86221e Compare May 13, 2026 07:37
Konflux PaC onboarding PRs fail commitlint because the bot commit
messages don't follow the HyperFleet commit standard. Add author-based
whitelisting so commits from known bot accounts are automatically
skipped during validation.

- Add whitelistedAuthors field to Validator with IsWhitelistedAuthor()
- Skip validation for commits from konflux@no-reply.konflux-ci.dev
- Add AuthorEmail to PRCommit for GitHub API fallback path
- Remove unused getCommitMessage function (inlined in validateCommits)
- Add tests for whitelist behaviour in both git and validator paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ciaranRoche ciaranRoche force-pushed the feat/whitelist-bot-authors branch from a86221e to 0575f9e Compare May 13, 2026 07:44
@rh-amarin
Copy link
Copy Markdown

/lgtm

@ciaranRoche ciaranRoche merged commit ddd3cc2 into main May 13, 2026
2 checks passed
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.

2 participants