Skip to content

NO-JIRA: tools: fix verify-codegen in git worktrees#2888

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
mdbooth:investigate-verify-codegen-worktree
Jun 15, 2026
Merged

NO-JIRA: tools: fix verify-codegen in git worktrees#2888
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
mdbooth:investigate-verify-codegen-worktree

Conversation

@mdbooth

@mdbooth mdbooth commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

In a git worktree, .git is a file containing a gitdir: pointer to a worktree-specific directory (e.g. .git/worktrees/<name>/), not the usual .git directory. Set EnableDotGitCommonDir: true on both PlainOpenWithOptions call sites so that go-git reads the commondir file and overlays the shared repository, allowing it to resolve refs in linked worktrees.

See: https://pkg.go.dev/github.com/go-git/go-git/v5#PlainOpenOptions

In a git worktree, .git is a file containing a `gitdir:` pointer to a
worktree-specific directory (e.g. `.git/worktrees/<name>/`), not the
usual .git directory. Set EnableDotGitCommonDir: true on both
PlainOpenWithOptions call sites so that go-git reads the commondir file
and overlays the shared repository, allowing it to resolve refs in
linked worktrees.

See: https://pkg.go.dev/github.com/go-git/go-git/v5#PlainOpenOptions
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 12, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@mdbooth: This pull request explicitly references no jira issue.

Details

In response to this:

In a git worktree, .git is a file containing a gitdir: pointer to a worktree-specific directory (e.g. .git/worktrees/<name>/), not the usual .git directory. Set EnableDotGitCommonDir: true on both PlainOpenWithOptions call sites so that go-git reads the commondir file and overlays the shared repository, allowing it to resolve refs in linked worktrees.

See: https://pkg.go.dev/github.com/go-git/go-git/v5#PlainOpenOptions

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Hello @mdbooth! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 0316a387-bf1e-4655-8acd-bd9a8b1ff618

📥 Commits

Reviewing files that changed from the base of the PR and between 1b2a074 and 880765a.

📒 Files selected for processing (2)
  • tools/codegen/pkg/schemacheck/generator.go
  • tools/codegen/pkg/utils/git_diff.go

📝 Walkthrough

Walkthrough

This PR enables the EnableDotGitCommonDir option in git repository discovery across two codegen utilities. The schema check generator and git diff utility now open git repositories with both DetectDotGit and EnableDotGitCommonDir enabled, modifying how the underlying go-git library detects and locates .git metadata directories during repository resolution.

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing verify-codegen functionality in git worktrees by enabling additional git configuration options.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem with .git files in worktrees and the solution of setting EnableDotGitCommonDir: true.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR changes go-git PlainOpenOptions in codegen utils; modified files contain no Ginkgo tests. Existing Ginkgo titles are static (Describe("") and Entry(testEntry.Name) from static suite YAML).
Test Structure And Quality ✅ Passed PR #2888 changes only tools/codegen/pkg/schemacheck/generator.go and tools/codegen/pkg/utils/git_diff.go; no Ginkgo test code is modified, so the test-structure quality check is not applicable.
Microshift Test Compatibility ✅ Passed PR only changes tools/codegen/pkg/schemacheck/generator.go and tools/codegen/pkg/utils/git_diff.go (EnableDotGitCommonDir); no new Ginkgo e2e tests or MicroShift-incompatible APIs referenced.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR #2888 only changes tools/codegen/pkg/schemacheck/generator.go and tools/codegen/pkg/utils/git_diff.go (no Ginkgo e2e test additions detected), so SNO compatibility assumptions are not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR #2888 changes only tools/codegen/pkg/schemacheck/generator.go and tools/codegen/pkg/utils/git_diff.go (EnableDotGitCommonDir) and introduces no manifest/operator/controller scheduling constraints.
Ote Binary Stdout Contract ✅ Passed In tools/codegen/pkg/schemacheck/generator.go and tools/codegen/pkg/utils/git_diff.go, there are no fmt.Print*/os.Stdout writes or main/init/TestMain/BeforeSuite/etc suite-level code; changes only...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR #2888 only changes tools/codegen/pkg/schemacheck/generator.go and tools/codegen/pkg/utils/git_diff.go; no new Ginkgo e2e tests or IPv4/external connectivity assumptions are added. citeturn2vie...
No-Weak-Crypto ✅ Passed PR diff only adds go-git PlainOpenOptions EnableDotGitCommonDir in two files; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or crypto compares found in the changed diff/files.
Container-Privileges ✅ Passed PR #2888 changes only Go files (generator.go, git_diff.go); no Kubernetes/container manifests or privilege-related fields were modified.
No-Sensitive-Data-In-Logs ✅ Passed Reviewed schemacheck/generator.go and utils/git_diff.go: change only adds EnableDotGitCommonDir; no new log statements or sensitive data (tokens/passwords/PII/hostnames) found.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


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

@openshift-ci openshift-ci Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 12, 2026
@openshift-ci openshift-ci Bot requested review from JoelSpeed and everettraven June 12, 2026 13:36
@JoelSpeed

Copy link
Copy Markdown
Contributor

/lgtm
/verified by CI tests are green

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 15, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@JoelSpeed: This PR has been marked as verified by CI tests are green.

Details

In response to this:

/lgtm
/verified by CI tests are green

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

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

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

No second-stage tests were triggered for this PR.

This can happen when:

  • The changed files don't match any pipeline_run_if_changed patterns
  • All files match pipeline_skip_if_only_changed patterns
  • No pipeline-controlled jobs are defined for the master branch

Use /test ? to see all available tests.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 15, 2026
@openshift-ci

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@mdbooth: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit 261e3a0 into openshift:master Jun 15, 2026
16 checks passed
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants