Skip to content

Fix ENVTESTPATH arch decided at Makefile-parse time on cold bin/ - #2379

Open
kaovilai wants to merge 2 commits into
openshift:oadp-1.4from
kaovilai:fix-envtest-cold-bin-arch-oadp-1.4
Open

kaovilai wants to merge 2 commits into
openshift:oadp-1.4from
kaovilai:fix-envtest-cold-bin-arch-oadp-1.4

Conversation

@kaovilai

@kaovilai kaovilai commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Fix ENVTESTPATH arch decided at Makefile-parse time on cold bin/

Fixes #2377

ENVTESTPATH was previously computed via a make ifeq, which evaluates
its $(shell ...) condition at Makefile-parse time, before any target's
prerequisites run. On a cold bin/ (setup-envtest not yet installed),
$(ENVTEST) list failed silently, the grep found nothing, and
ENVTESTPATH got permanently redefined to force --arch=amd64 —
regardless of host arch — even though setup-envtest is correctly
installed for the host's native arch by the time the test recipe
actually runs.

KUBEBUILDER_ASSETS is now resolved inline in the test recipe itself,
via $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path — the same mechanism oadp-1.5/oadp-1.6/oadp-dev already use.
This only runs after envtest (a prerequisite of test) has installed
the right arch, and it lets setup-envtest resolve its own native-arch
assets directly against $(LOCALBIN) rather than this Makefile
maintaining a separate arch-fallback variable, removing the
parse-time/run-time ordering problem entirely.

Kept separate from #2368 (already approved) since that PR's body
explicitly scoped this exact bug out on purpose ("tracked as #2377, not
fixed here... out of scope rather than a reason to expand this PR's diff
a third time") — not reopening that scope decision here.

oadp-1.3 has the same bug but the fix doesn't cherry-pick cleanly
(predates the go-install-tool-versioned refactor from #2368), so it's
fixed separately in #2378 rather than via cherry-pick bot.

Testing

Verified locally on arm64: KUBEBUILDER_ASSETS resolves to
bin/k8s/<version>-darwin-arm64 (native, not the previous incorrect
amd64 fallback), and go build ./... passes clean.

Note

Responses generated with Claude and Hermes Agent

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 92120e51-fe2e-4eb6-842b-69809ee8259a

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

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

@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaovilai

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-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2026
@codecov-commenter

codecov-commenter commented Aug 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.37%. Comparing base (c0b5d84) to head (1bc79bc).

⚠️ Current head 1bc79bc differs from pull request most recent head eccd2e8

Please upload reports for the commit eccd2e8 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff            @@
##           oadp-1.4    #2379   +/-   ##
=========================================
  Coverage     39.37%   39.37%           
=========================================
  Files            30       30           
  Lines          5211     5211           
=========================================
  Hits           2052     2052           
  Misses         2959     2959           
  Partials        200      200           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kaovilai

This comment has been minimized.

@kaovilai

This comment has been minimized.

ifeq evaluates its $(shell ...) condition at parse time, before any
target's prerequisites run. On a cold bin/ (setup-envtest not yet
installed), `$(ENVTEST) list` fails silently, the grep finds nothing,
and ENVTESTPATH gets permanently redefined to force --arch=amd64 --
regardless of host arch -- even though setup-envtest is correctly
installed for the host's native arch by the time the `test` recipe
actually runs.

Move the fallback entirely into the shell expression itself (still a
recursively-expanded variable, so it's only evaluated when referenced
in the `test` recipe, after `envtest` has installed the right arch).

Fixes openshift#2377

Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
Copilot AI lite review requested due to automatic review settings September 25, 2026 16:25
@kaovilai
kaovilai force-pushed the fix-envtest-cold-bin-arch-oadp-1.4 branch from 96a505d to d406d1d Compare September 25, 2026 16:25

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Address the fallback failure under .SHELLFLAGS = -ec and avoid removing valid cached binaries on every invocation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Fixes envtest architecture resolution by deferring it until recipe execution.

Changes:

  • Adds runtime native-architecture resolution with fallback.
  • Updates envtest installation and validation prerequisites.
File Summary
Makefile Updates envtest path resolution and installation checks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
…p-1.5/1.6/dev

Copilot flagged two real bugs in the previous ENVTESTPATH/check-envtest-arch
approach:
- The native-use command substitution's own nonzero exit (under this
  Makefile's .SHELLFLAGS = -ec) aborted the recipe before the amd64 fallback
  check ran.
- check-envtest-arch treated setup-envtest's documented --help exit code 2
  as a broken binary, deleting and reinstalling a perfectly good cached
  binary on every invocation.

Rather than patching around both, adopt the simpler mechanism
oadp-1.5/oadp-1.6/oadp-dev already use: resolve KUBEBUILDER_ASSETS inline
in the test recipe via '$(ENVTEST) use ... --bin-dir $(LOCALBIN) -p path',
after $(ENVTEST) is guaranteed installed for the host's real arch. This
drops the separate ENVTESTPATH variable and check-envtest-arch target
entirely, fixing openshift#2377 without introducing either of Copilot's flagged
issues.

Verified locally on arm64: ENVTESTPATH resolves to
bin/k8s/<version>-darwin-arm64 (native), and go build ./... passes clean.

> [!Note]
> Responses generated with Hermes Agent
@kaovilai

Copy link
Copy Markdown
Member Author

/retest

@openshift-ci

openshift-ci Bot commented Sep 25, 2026

Copy link
Copy Markdown

@kaovilai: 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants