Skip to content

Remove setup-envtest if different arch during make test#2152

Open
kaovilai wants to merge 1 commit intoopenshift:oadp-devfrom
kaovilai:envtest-autoremove-diffarch
Open

Remove setup-envtest if different arch during make test#2152
kaovilai wants to merge 1 commit intoopenshift:oadp-devfrom
kaovilai:envtest-autoremove-diffarch

Conversation

@kaovilai
Copy link
Copy Markdown
Member

@kaovilai kaovilai commented Apr 7, 2026

Signed-off-by: Tiger Kaovilai tkaovila@redhat.com

Why the changes were made

How to test the changes made

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
Copilot AI review requested due to automatic review settings April 7, 2026 21:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b292e31-8876-4c92-9ce0-1ec8dafb022d

📥 Commits

Reviewing files that changed from the base of the PR and between 3cceb1e and 5097978.

📒 Files selected for processing (1)
  • Makefile

Walkthrough

Modified the envtest tool-install recipe in a Makefile to detect and remove incompatible binaries before reinstalling. If an existing $(ENVTEST) binary fails the --help command check, it is removed before fresh installation via go-install-tool.

Changes

Cohort / File(s) Summary
Build Tool Configuration
Makefile
Added platform compatibility validation to envtest target. Removes incompatible binary if it exists and --help fails, before reinstalling via go-install-tool.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

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

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

@kaovilai
Copy link
Copy Markdown
Member Author

kaovilai commented Apr 7, 2026

/cc @shubham-pampattiwar @mpryc

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 7, 2026

[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 Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make make test more reliable by automatically cleaning up an incompatible setup-envtest binary that may have been written into the shared bin/ directory by a container build targeting a different architecture.

Changes:

  • Adds a pre-check in the setup-envtest installation rule to remove an existing setup-envtest binary if it can’t be executed on the current platform.
  • Documents the cross-architecture scenario that can cause make test failures due to a non-native binary in bin/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 327 to 334
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
@if [ -f $(ENVTEST) ] && ! $(ENVTEST) --help >/dev/null 2>&1; then \
echo "Removing incompatible setup-envtest binary"; \
rm -f $(ENVTEST); \
fi
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20250308055145-5fe7bb3edc86)
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The incompatibility check is inside the $(ENVTEST) file target recipe, but that recipe won’t run when $(ENVTEST) already exists and is considered up-to-date. In the exact scenario this PR describes (a wrong-arch bin/setup-envtest already present), make test will usually skip this recipe and the bad binary won’t be removed. Consider making the compatibility check run unconditionally (e.g., move the check into the .PHONY: envtest target, or add a phony FORCE prerequisite to $(ENVTEST) so the recipe always executes; go-install-tool already avoids re-installing when the file is present).

Copilot uses AI. Check for mistakes.
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 8, 2026

@kaovilai: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.23-e2e-test-aws 5097978 link false /test 4.23-e2e-test-aws
ci/prow/4.22-e2e-test-cli-aws 5097978 link true /test 4.22-e2e-test-cli-aws
ci/prow/4.22-e2e-test-aws 5097978 link true /test 4.22-e2e-test-aws

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.

2 participants