Skip to content

Conversation

@mpryc
Copy link
Contributor

@mpryc mpryc commented Oct 8, 2025

Change that makes rebase of oadp-operator possible:

  • Make make help instant by deferring CLUSTER_TYPE evaluation to runtime (was 12s, now 0.06s - 200x faster)
  • Move cloud-specific variables to test-e2e targets to avoid parse-time cluster API calls that hang when not connected
  • Preserve createdAt timestamp in CSV when only timestamp changed
  • Suppress tool version check warnings when binaries don't exist yet
  • Make container tool check lazy (only runs when needed)
  • Clean up commented code with concise explanatory notes

Why the changes were made

To allow rebasebot properly run $ make bundle, without access to the cluster.
Without this change it's impossible to update manifests without being logged to the cluster.

How to test the changes made

Reading Makefile, asking right questions to claude and modifying code by hand + testing with few make targets:
$ make help
$ make manifests
$ make build
$ make bundle
$ make deploy-olm
$ make run
$ make install
$ make undeploy-olm
$ make uninstall

Tests should be performed by prow CI to execute some other make targets.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 8, 2025
OLD_CREATEDAT=$$(grep '^ createdAt: ' /tmp/oadp-old-csv.yaml); \
NEW_CREATEDAT=$$(grep '^ createdAt: ' bundle/manifests/oadp-operator.clusterserviceversion.yaml); \
cp bundle/manifests/oadp-operator.clusterserviceversion.yaml /tmp/oadp-new-csv-with-old-timestamp.yaml; \
$(SED) -i "s/^ createdAt: .*/$$OLD_CREATEDAT/" /tmp/oadp-new-csv-with-old-timestamp.yaml; \
Copy link
Member

Choose a reason for hiding this comment

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

Just noting that sed -i would work here only with gsed on macos hence the prior > + mv

oadp-operator/Makefile

Lines 422 to 438 in b9229e4

SED = sed
# if on macos, install gsed
# https://formulae.brew.sh/formula/gnu-sed
# Codecov OS String for use in download url
ifeq ($(OS),Windows_NT)
OS_String = windows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS_String = linux
endif
ifeq ($(UNAME_S),Darwin)
OS_String = macos
SED = gsed
endif
endif

Copy link
Member

Choose a reason for hiding this comment

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

Anyone w macos once installing gsed should be good to go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kaovilai that part was not chaged (discovery of SED on MacOS X), could you please check if the reworked Makefile requires some changes to work in it, or we are fine here?

Copy link
Member

Choose a reason for hiding this comment

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

we are fine here.

Copy link
Member

Choose a reason for hiding this comment

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

just trailing notes

@mpryc
Copy link
Contributor Author

mpryc commented Oct 9, 2025

/test images

@mpryc
Copy link
Contributor Author

mpryc commented Oct 9, 2025

/test 4.19-e2e-test-cli-aws

@weshayutin
Copy link
Contributor

I'm working to fix 4.19-e2e-test-cli-aws seperately... can override 4.19-e2e-test-cli-aws

@weshayutin
Copy link
Contributor

/test images

1 similar comment
@weshayutin
Copy link
Contributor

/test images

@weshayutin
Copy link
Contributor

/retest

kaovilai
kaovilai previously approved these changes Oct 9, 2025
weshayutin
weshayutin previously approved these changes Oct 9, 2025
Copy link
Contributor

@weshayutin weshayutin left a comment

Choose a reason for hiding this comment

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

this all worked for me.. thank you!

@weshayutin
Copy link
Contributor

/retest

1 similar comment
@kaovilai
Copy link
Member

kaovilai commented Oct 9, 2025

/retest

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 14, 2025
@kaovilai
Copy link
Member

kaovilai commented Nov 7, 2025

rebase!

@weshayutin
Copy link
Contributor

@mpryc this is a good pr, let's get er done

@mpryc mpryc dismissed stale reviews from weshayutin and kaovilai via 34fd433 November 21, 2025 14:19
@mpryc mpryc force-pushed the makefile_rework_for_rebasebot branch from c6c2fdd to 34fd433 Compare November 21, 2025 14:19
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

Added a new public Makefile target check-container-tool, made multiple build/push/catalog targets depend on it, and moved many parse-time conditionals to runtime (cluster type/OS/arch, credentials, test filters). Also added runtime CSV timestamp-preservation during bundle generation and updated login/test flows to compute runtime values.

Changes

Cohort / File(s) Summary
Container tool validation
Makefile
Added public target check-container-tool that verifies the configured container tool is available, errors when absent, and prints the tool name when present.
Public target dependency updates
Makefile
Updated public targets to depend on check-container-tool: docker-build, docker-push, bundle-build, bundle-push, catalog-push; catalog-build now depends on opm and check-container-tool; catalog-test-upgrade prerequisites updated to include opm, login-required, and check-container-tool.
Runtime-driven build/push logic
Makefile
Reworked docker-build, bundle-build, catalog-build, related docker/e2e targets to evaluate cluster/platform/arch at runtime (CLUSTER_OS/CLUSTER_ARCH) and conditionally pass platform-specific build args or fall back to DOCKER_BUILD_ARGS. Added runtime safeguards around container-tool usage in recipes.
Runtime environment & e2e tests
Makefile
Refactored login/test/e2e flows (test-e2e-setup, test-e2e, related targets) to compute CLUSTER_TYPE, CLUSTER_OS, CLUSTER_ARCH, credentials, KVM emulation, dynamic ginkgo label filters, and runtime test filter/provider values at execution time instead of parse time.
Bundle & CSV handling
Makefile
Enhanced bundle build/test paths to preserve/compare CSV createdAt timestamps using temporary files and runtime checks to decide when to preserve timestamps; adjusted bundle-build/test semantics accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check check-container-tool correctness across supported container tools and its error messages.
  • Verify updated target dependencies and execution order for catalog-build, catalog-push, and catalog-test-upgrade.
  • Review runtime evaluation logic for CLUSTER_TYPE/CLUSTER_OS/CLUSTER_ARCH to ensure parity with previous parse-time behavior.
  • Validate CSV timestamp comparison/preservation logic and temporary-file handling for correctness and cleanup.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3dc6361 and 56659c0.

📒 Files selected for processing (1)
  • Makefile (10 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • Makefile
🔇 Additional comments (13)
Makefile (13)

93-99: Lazy container tool validation approach looks good.

The check-container-tool target correctly validates that the selected container tool exists. The shell result is checked at make-parse time, and the target is a dependency of targets that need it, so validation fails early if the tool is missing.


248-252: Lazy evaluation with timeout correctly defers cluster checks.

The variables use lazy evaluation (=) and timeout guards to prevent parse-time cluster API calls from blocking simple targets like make help. This is the core performance improvement (reported ~12s → ~0.06s speedup). The approach is sound.


260-266: Defensive platform checks correctly prevent invalid syntax.

The target now verifies all three variables (CLUSTER_TYPE, CLUSTER_OS, CLUSTER_ARCH) are non-empty before constructing --platform=OS/ARCH. The fallback to DOCKER_BUILD_ARGS is safe and correct. This resolves the prior issue flagged by previous review.


347-374: Bundle timestamp preservation logic is well-implemented.

The new logic (lines 361–374) correctly preserves the old CSV createdAt timestamp when it's the only change. The approach of saving, regenerating, comparing (with timestamp normalized), and conditionally restoring is sound. Uses the cross-platform $(SED) variable correctly.

Minor edge case: if the createdAt: field is missing from the CSV, the grep on line 363 would capture nothing, and the diff might not behave as intended. However, this is unlikely in well-formed CSV manifests, and the overall target would still succeed (just without timestamp preservation).


376-382: Defensive platform checks consistently applied.

The bundle-build target mirrors the docker-build defensive checks, verifying all three variables (CLUSTER_TYPE, CLUSTER_OS, CLUSTER_ARCH) are non-empty before constructing the platform argument. Consistent and safe.


268-270: Container tool dependencies correctly added to push targets.

Both docker-push and bundle-push now depend on check-container-tool, ensuring the container tool is available before attempting image operations. The delegation pattern in bundle-push is correct.

Also applies to: 384-386


418-425: Catalog targets correctly depend on opm and container-tool checks.

The catalog-build target appropriately depends on both opm (for the index add operation) and check-container-tool. The catalog-push target correctly depends on check-container-tool. Dependencies are well-ordered.


735-757: catalog-test-upgrade dependencies are well-ordered.

The target correctly depends on opm, login-required (for cluster authentication), and check-container-tool (for container operations). The ordering ensures prerequisites are validated before the complex build/test sequence begins.


545-552: login-required runtime check defers cluster authentication validation.

The target now performs the CLUSTER_TYPE check at runtime (in the recipe), avoiding parse-time cluster API calls. The error handling is clear, and the output confirms CLUSTER_TYPE value on success. Good user experience.


796-831: Cloud-specific variable computation correctly deferred to runtime.

The test-e2e-setup target now computes all cluster-type-dependent variables (PROVIDER, OADP_CRED_FILE, BUCKET, KVM_EMULATION, etc.) at runtime within the recipe. This eliminates parse-time cluster API overhead. The conditional logic for handling azure4→azure, openstack KVM emulation, and cloud-specific credential paths is clear and correct. Variables are properly passed as environment to the bash script.


854-881: Test filter construction now safely guards against empty CLUSTER_TYPE.

The test-e2e target now computes the Ginkgo label filter at runtime. Line 858 adds a critical guard ([ -z "$$ACTUAL_CLUSTER_TYPE" ] && { ... exit 1; }) that prevents malformed filter construction when CLUSTER_TYPE is unset (e.g., if cluster timeout occurs). This resolves the prior critical issue flagged by previous review.

The filter construction (line 859) using sed to remove the cluster-specific label is now safe because ACTUAL_CLUSTER_TYPE is guaranteed non-empty. All test flags (TEST_VIRT, TEST_UPGRADE, TEST_HCP, etc.) and provider/KVM values are correctly computed and passed at runtime, enabling dynamic test selection without parse-time cluster dependency.


787-789: Helpful comment documents performance optimization rationale.

The comment block clearly explains why cloud-specific variables are deferred to runtime rather than evaluated at parse time, and notes the impact on simple targets like make help. Good documentation for future maintainers.


844-852: Comment correctly documents runtime label-filter construction.

The note at lines 844–848 clearly explains that --label-filter is omitted from GINKGO_FLAGS and added at runtime in test-e2e to avoid parse-time CLUSTER_TYPE evaluation. This supports maintainability and prevents accidental regressions.


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

@openshift-ci
Copy link

openshift-ci bot commented Nov 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mpryc

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

The pull request process is described here

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

2 similar comments
@openshift-ci
Copy link

openshift-ci bot commented Nov 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mpryc

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

The pull request process is described here

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
Copy link

openshift-ci bot commented Nov 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mpryc

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

The pull request process is described here

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
Makefile (1)

377-382: Same issue as docker-build: defensive check needed for CLUSTER_OS and CLUSTER_ARCH.

See the comment for docker-build (lines 261–266). Apply the same defensive check to bundle-build.

🧹 Nitpick comments (1)
Makefile (1)

787-831: Runtime variable computation is correct but complex.

Deferring cloud-specific variable evaluation to target invocation time (rather than parse time) achieves the performance goal and enables rebasebot to run bundle targets without cluster access. The bash logic is sound but dense; for future maintainability, consider extracting this logic into a dedicated shell script (e.g., tests/e2e/scripts/setup_runtime_vars.sh) to simplify the Makefile and improve testability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 5d074fc and 34fd433.

📒 Files selected for processing (1)
  • Makefile (10 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • Makefile
🔇 Additional comments (6)
Makefile (6)

93-99: Lazy container tool validation is well-implemented.

Deferring the tool existence check to runtime (only when targets that need it are invoked) avoids spurious failures during parse-time evaluation (e.g., make help). The error message is clear, and the conditional logic correctly detects absence.


248-252: Verify downstream code handles empty CLUSTER_TYPE, CLUSTER_OS, and CLUSTER_ARCH.

The timeout 2 wrapper prevents hanging when not connected to a cluster, which is essential for the rebasebot use case. However, if the timeout expires, these variables will be empty strings. Confirm that conditional logic in docker-build, bundle-build, and test-e2e-setup safely handles empty values without generating invalid build arguments or shell syntax errors.


349-374: CSV timestamp preservation is well-implemented.

The logic correctly detects when only the createdAt timestamp has changed and preserves the old value, reducing spurious bundle diffs. The temp file handling is clean, and the use of $(SED) is correct for runtime evaluation. The approach assumes consistent YAML formatting for the createdAt field; if this assumption breaks in the future, a YAML-aware tool (like yq, which is already available in the Makefile) could replace sed-based manipulation.


547-552: Runtime deferral of CLUSTER_TYPE check is correct.

Moving the cluster login validation from parse time to target invocation time prevents spurious failures during make help and aligns with the performance goal of this PR.


334-334: Operator-SDK and OPM version checks correctly suppress errors for missing binaries.

The conditions now only download tools if they don't exist or the version doesn't match, without emitting spurious error messages. This aligns with the PR goal of quieting tool-version warnings when binaries aren't yet installed.

Also applies to: 391-391


419-419: Catalog build/push dependencies are correct.

Adding check-container-tool ensures the container tool is validated before attempting catalog operations.

Also applies to: 424-424

@mpryc mpryc force-pushed the makefile_rework_for_rebasebot branch from 34fd433 to 3dc6361 Compare November 21, 2025 14:28
Change that makes rebase of oadp-operator possible:

  - Make `make help` instant by deferring CLUSTER_TYPE evaluation to runtime
    (was 12s, now 0.06s - 200x faster)
  - Move cloud-specific variables to test-e2e targets to avoid parse-time
    cluster API calls that hang when not connected
  - Preserve createdAt timestamp in CSV when only timestamp changed
  - Suppress tool version check warnings when binaries don't exist yet
  - Make container tool check lazy (only runs when needed)
  - Clean up commented code with concise explanatory notes

Signed-off-by: Michal Pryc <[email protected]>
Co-Authored-By: Claude <[email protected]>
@mpryc mpryc force-pushed the makefile_rework_for_rebasebot branch from 3dc6361 to 56659c0 Compare November 21, 2025 16:26
@mpryc
Copy link
Contributor Author

mpryc commented Nov 21, 2025

/retest

@openshift-ci
Copy link

openshift-ci bot commented Dec 3, 2025

@mpryc: 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.20-e2e-test-kubevirt-aws 56659c0 link true /test 4.20-e2e-test-kubevirt-aws
ci/prow/4.20-e2e-test-aws 56659c0 link true /test 4.20-e2e-test-aws
ci/prow/4.20-e2e-test-cli-aws 56659c0 link true /test 4.20-e2e-test-cli-aws

Full PR test history. Your PR dashboard.

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-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2025
@openshift-merge-robot
Copy link

PR needs rebase.

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.

@kaovilai
Copy link
Member

kaovilai commented Dec 3, 2025

/retest

ai-retester: The e2e test e2e-test-aws failed because the MySQL application two Vol CSI test timed out after 540 seconds while waiting for the todolist pod to become ready. The container exited with error code 2.

comment for /pull/1984

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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants