Skip to content

🌱 Remove defunct --export-dir flag from apply command - #692

Merged
Tamar-Dinavetsky merged 3 commits into
migtools:mainfrom
Tamar-Dinavetsky:refactor/remove-export-dir-flag-from-apply
Jul 27, 2026
Merged

🌱 Remove defunct --export-dir flag from apply command#692
Tamar-Dinavetsky merged 3 commits into
migtools:mainfrom
Tamar-Dinavetsky:refactor/remove-export-dir-flag-from-apply

Conversation

@Tamar-Dinavetsky

@Tamar-Dinavetsky Tamar-Dinavetsky commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

#665

Summary

Removes the --export-dir flag from the apply command - the flag was registered but never used. It was a
leftover from when apply was intended to run the full pipeline automatically, but that was never fully
implemented.

  • Remove ExportDir field and flag registration from cmd/apply/apply.go
  • Remove ExportDir field and args injection from e2e-tests/framework/crane.go
  • Update consistency check in e2e-tests/framework/pipeline.go to remove the now-irrelevant a.ExportDir comparison
  • Remove ExportDir from ApplyOptions in all test files (~40 files, bulk search & replace)

Test plan

  • go build ./... passes
  • go test ./internal/... ./cmd/... passes

Summary by CodeRabbit

  • Breaking Changes
    • Removed support for the --export-dir option from the apply command; apply now uses only the transform and output directories.
  • New Features
    • Added --ignored-patches-dir to the transform command.
  • Bug Fixes
    • Tightened pipeline directory consistency validation to match the updated apply workflow.
  • Documentation
    • Updated crane apply command docs to remove the --export-dir flag.
  • Tests
    • Updated e2e pipeline wiring, determinism, and expectations to align with the new apply/patch behavior, plus updated golden manifests.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Tamar-Dinavetsky, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ec4c982-91f9-4301-8b3d-09b065013b1e

📥 Commits

Reviewing files that changed from the base of the PR and between f3a3528 and 2a0304d.

📒 Files selected for processing (46)
  • cmd/apply/apply.go
  • docs/commands/apply.md
  • e2e-tests/framework/crane.go
  • e2e-tests/framework/pipeline.go
  • e2e-tests/tests/tier0/mta_801_stateful_migration_test.go
  • e2e-tests/tests/tier0/mta_802_ignored_resources_test.go
  • e2e-tests/tests/tier0/mta_804_empty_pvc_migration_test.go
  • e2e-tests/tests/tier0/mta_805_sets_test.go
  • e2e-tests/tests/tier0/mta_806_pvc_data_integrity_test.go
  • e2e-tests/tests/tier0/mta_807_data_validation_test.go
  • e2e-tests/tests/tier0/mta_808_cronjob_quiesced_test.go
  • e2e-tests/tests/tier0/mta_809_initcontainer_test.go
  • e2e-tests/tests/tier0/mta_810_configmap_test.go
  • e2e-tests/tests/tier0/mta_811_mongodb_non_admin_test.go
  • e2e-tests/tests/tier0/mta_812_role_migration_test.go
  • e2e-tests/tests/tier0/mta_813_cronJob_PVC_test.go
  • e2e-tests/tests/tier0/mta_817_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_827_custom_transformation_stage_test.go
  • e2e-tests/tests/tier0/mta_828_instructions_file_migration_test.go
  • e2e-tests/tests/tier0/mta_831_validate_compatible_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_833_compatible_resources_live_test.go
  • e2e-tests/tests/tier0/mta_837_hpa_migration_test.go
  • e2e-tests/tests/tier0/mta_838_multi_container_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_839_networkpolicy_migration_test.go
  • e2e-tests/tests/tier0/mta_840_same_cluster_migration_test.go
  • e2e-tests/tests/tier0/mta_843_pipeline_determinism_test.go
  • e2e-tests/tests/tier0/mta_844_validate_mixed_resources_live_test.go
  • e2e-tests/tests/tier0/mta_845_validate_mixed_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier0/olm_whiteout_base_test.go
  • e2e-tests/tests/tier1/mta_829_validate_alternative_gv_suggestion_test.go
  • e2e-tests/tests/tier1/mta_830_instructions_file_force_reconcile_test.go
  • e2e-tests/tests/tier1/mta_832_validate_alternative_gv_suggestion_offline_test.go
  • e2e-tests/tests/tier1/mta_836_validate_core_group_omitted_offline_test.go
  • e2e-tests/tests/tier1/mta_841_missing_configmap_ref_test.go
  • e2e-tests/tests/tier1/mta_842_secrets_migration_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/tests/tier1/mta_857_service_account_subject_test.go
  • e2e-tests/tests/tier1/mta_858_user_subject_test.go
  • e2e-tests/tests/tier1/mta_859_group_subject_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • e2e-tests/tests/tier1/olm_whiteout_auditability_test.go
📝 Walkthrough

Walkthrough

The apply command no longer accepts --export-dir. Transform gains ignored-patches directory configuration, PVC transfers reject same-cluster contexts, and end-to-end tests and fixtures remove obsolete OpenShift-specific behavior.

Changes

Apply and transform option wiring

Layer / File(s) Summary
CLI option contracts
cmd/apply/apply.go, cmd/transform/transform.go, docs/commands/apply.md
Removes apply export-directory configuration and adds the --ignored-patches-dir transform option.
Framework and path wiring
e2e-tests/framework/crane.go, e2e-tests/framework/pipeline.go, internal/file/file_helper.go
Passes ignored-patches paths through transform handling, removes export-directory arguments from apply, and updates pipeline directory checks.
Pipeline callers
e2e-tests/tests/tier0/*, e2e-tests/tests/tier1/*
Updates apply options to omit or reorder the removed export-directory field.

Same-cluster PVC transfer handling

Layer / File(s) Summary
Validation and runtime wiring
cmd/transfer-pvc/transfer-pvc.go, cmd/transfer-pvc/transfer-pvc_test.go
Rejects same-cluster transfers and removes intra-cluster label, secret, and client-handling branches and tests.

Deterministic end-to-end fixtures

Layer / File(s) Summary
Instructions and validation tests
e2e-tests/tests/tier0/mta_828*, e2e-tests/tests/tier0/mta_831*, e2e-tests/tests/tier0/mta_833*, e2e-tests/tests/tier0/mta_839*, e2e-tests/tests/tier0/mta_844*, e2e-tests/tests/tier1/mta_830*, e2e-tests/utils/utils.go
Removes OpenShift-dependent stage, Route, and validation expectations and uses fixed test paths and counts.
Golden manifests
e2e-tests/golden-manifests*/simple-nginx-nopv/*
Removes Route fixtures and unnamed Service port metadata.

Changed-test workflow

Layer / File(s) Summary
Focus regex invocation
.github/workflows/e2e-pr-tester.yaml
Passes the detected focus-file regex directly to Ginkgo.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Possibly related PRs

Suggested labels: test

Suggested reviewers: msajidmansoori12, aufi, midays, stillalearner

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: removing the defunct --export-dir flag from the apply command.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
e2e-tests/framework/pipeline.go (1)

21-22: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the independent directory checks.

Please verify tests cover both rejected mismatches and the valid case where export and apply use different directory fields. As per coding guidelines, “Bug fixes should include regression tests when possible.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e-tests/framework/pipeline.go` around lines 21 - 22, Expand regression
coverage for the directory validation around the pipeline check: add tests that
reject an export-directory mismatch and a transform-directory mismatch, plus a
valid case where export and apply intentionally use different directory fields.
Anchor the tests to the pipeline validation entry point and assert both the
error and successful result.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@e2e-tests/framework/pipeline.go`:
- Around line 21-22: Expand regression coverage for the directory validation
around the pipeline check: add tests that reject an export-directory mismatch
and a transform-directory mismatch, plus a valid case where export and apply
intentionally use different directory fields. Anchor the tests to the pipeline
validation entry point and assert both the error and successful result.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b0a8e302-2122-41ff-af8b-3b2c7ba30f96

📥 Commits

Reviewing files that changed from the base of the PR and between 5c411a5 and 735fa41.

📒 Files selected for processing (45)
  • cmd/apply/apply.go
  • e2e-tests/framework/crane.go
  • e2e-tests/framework/pipeline.go
  • e2e-tests/tests/tier0/mta_801_stateful_migration_test.go
  • e2e-tests/tests/tier0/mta_802_ignored_resources_test.go
  • e2e-tests/tests/tier0/mta_804_empty_pvc_migration_test.go
  • e2e-tests/tests/tier0/mta_805_sets_test.go
  • e2e-tests/tests/tier0/mta_806_pvc_data_integrity_test.go
  • e2e-tests/tests/tier0/mta_807_data_validation_test.go
  • e2e-tests/tests/tier0/mta_808_cronjob_quiesced_test.go
  • e2e-tests/tests/tier0/mta_809_initcontainer_test.go
  • e2e-tests/tests/tier0/mta_810_configmap_test.go
  • e2e-tests/tests/tier0/mta_811_mongodb_non_admin_test.go
  • e2e-tests/tests/tier0/mta_812_role_migration_test.go
  • e2e-tests/tests/tier0/mta_813_cronJob_PVC_test.go
  • e2e-tests/tests/tier0/mta_817_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_827_custom_transformation_stage_test.go
  • e2e-tests/tests/tier0/mta_828_instructions_file_migration_test.go
  • e2e-tests/tests/tier0/mta_831_validate_compatible_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_833_compatible_resources_live_test.go
  • e2e-tests/tests/tier0/mta_837_hpa_migration_test.go
  • e2e-tests/tests/tier0/mta_838_multi_container_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_839_networkpolicy_migration_test.go
  • e2e-tests/tests/tier0/mta_840_same_cluster_migration_test.go
  • e2e-tests/tests/tier0/mta_843_pipeline_determinism_test.go
  • e2e-tests/tests/tier0/mta_844_validate_mixed_resources_live_test.go
  • e2e-tests/tests/tier0/mta_845_validate_mixed_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier0/olm_whiteout_base_test.go
  • e2e-tests/tests/tier1/mta_829_validate_alternative_gv_suggestion_test.go
  • e2e-tests/tests/tier1/mta_830_instructions_file_force_reconcile_test.go
  • e2e-tests/tests/tier1/mta_832_validate_alternative_gv_suggestion_offline_test.go
  • e2e-tests/tests/tier1/mta_836_validate_core_group_omitted_offline_test.go
  • e2e-tests/tests/tier1/mta_841_missing_configmap_ref_test.go
  • e2e-tests/tests/tier1/mta_842_secrets_migration_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/tests/tier1/mta_857_service_account_subject_test.go
  • e2e-tests/tests/tier1/mta_858_user_subject_test.go
  • e2e-tests/tests/tier1/mta_859_group_subject_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • e2e-tests/tests/tier1/olm_whiteout_auditability_test.go
💤 Files with no reviewable changes (4)
  • cmd/apply/apply.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • e2e-tests/framework/crane.go

@Tamar-Dinavetsky

Copy link
Copy Markdown
Contributor Author

/rfr

@aufi aufi 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.

Overall looks good, thanks for the PR! Please update also docs e.g. https://github.com/migtools/crane/blob/main/docs/commands/apply.md

@midays midays 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.

LGTM

@Tamar-Dinavetsky
Tamar-Dinavetsky force-pushed the refactor/remove-export-dir-flag-from-apply branch 2 times, most recently from f3a3528 to 7720bdd Compare July 27, 2026 10:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/e2e-pr-tester.yaml:
- Line 207: Update the ginkgo invocation in the E2E workflow to stop
interpolating the PR-controlled focus_file_regex GitHub expression directly into
the shell command. Pass the value through the step’s env configuration and
reference it only via a properly quoted shell variable, preserving the existing
--focus-file behavior.

In `@cmd/transfer-pvc/transfer-pvc.go`:
- Around line 373-375: Update the source certificate secret creation flow around
srcClient.Create to handle an existing secret by retrieving and updating it, or
otherwise using the repository’s established upsert behavior, instead of
aborting on AlreadyExists. Preserve creation for missing secrets, and add a
fake-client regression test covering a pre-existing source secret and successful
retry.
- Around line 233-234: Update the same-cluster validation error in the transfer
flow to use grammatically correct wording and include both context names plus
t.sourceContext.Cluster. Preserve the existing validation condition and error
behavior while making the message clearly identify the conflicting source and
destination configuration.

In `@cmd/transform/transform.go`:
- Line 46: Add tests for the new IgnoredPatchesDir configuration and
--ignored-patches-dir CLI parsing, then cover the conflict path to verify
ignored patches are written beneath the configured directory using the ignored-
filename prefix. Reuse the existing transform and conflict-output test helpers
and preserve current behavior when the option is unset.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f94ecbf-4422-4fd1-9df5-b48fe1ebfe81

📥 Commits

Reviewing files that changed from the base of the PR and between 33f6fd1 and f3a3528.

📒 Files selected for processing (61)
  • .github/workflows/e2e-pr-tester.yaml
  • cmd/apply/apply.go
  • cmd/transfer-pvc/transfer-pvc.go
  • cmd/transfer-pvc/transfer-pvc_test.go
  • cmd/transform/transform.go
  • docs/commands/apply.md
  • e2e-tests/framework/crane.go
  • e2e-tests/framework/pipeline.go
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/export/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/export/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/output.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests/simple-nginx-nopv/export/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests/simple-nginx-nopv/output/output.yaml
  • e2e-tests/golden-manifests/simple-nginx-nopv/output/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/testdata/basic-instructions-file-ocp.yaml
  • e2e-tests/tests/tier0/mta_801_stateful_migration_test.go
  • e2e-tests/tests/tier0/mta_802_ignored_resources_test.go
  • e2e-tests/tests/tier0/mta_804_empty_pvc_migration_test.go
  • e2e-tests/tests/tier0/mta_805_sets_test.go
  • e2e-tests/tests/tier0/mta_806_pvc_data_integrity_test.go
  • e2e-tests/tests/tier0/mta_807_data_validation_test.go
  • e2e-tests/tests/tier0/mta_808_cronjob_quiesced_test.go
  • e2e-tests/tests/tier0/mta_809_initcontainer_test.go
  • e2e-tests/tests/tier0/mta_810_configmap_test.go
  • e2e-tests/tests/tier0/mta_811_mongodb_non_admin_test.go
  • e2e-tests/tests/tier0/mta_812_role_migration_test.go
  • e2e-tests/tests/tier0/mta_813_cronJob_PVC_test.go
  • e2e-tests/tests/tier0/mta_817_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_827_custom_transformation_stage_test.go
  • e2e-tests/tests/tier0/mta_828_instructions_file_migration_test.go
  • e2e-tests/tests/tier0/mta_831_validate_compatible_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_833_compatible_resources_live_test.go
  • e2e-tests/tests/tier0/mta_837_hpa_migration_test.go
  • e2e-tests/tests/tier0/mta_838_multi_container_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_839_networkpolicy_migration_test.go
  • e2e-tests/tests/tier0/mta_840_same_cluster_migration_test.go
  • e2e-tests/tests/tier0/mta_843_pipeline_determinism_test.go
  • e2e-tests/tests/tier0/mta_844_validate_mixed_resources_live_test.go
  • e2e-tests/tests/tier0/mta_845_validate_mixed_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier0/olm_whiteout_base_test.go
  • e2e-tests/tests/tier1/mta_829_validate_alternative_gv_suggestion_test.go
  • e2e-tests/tests/tier1/mta_830_instructions_file_force_reconcile_test.go
  • e2e-tests/tests/tier1/mta_832_validate_alternative_gv_suggestion_offline_test.go
  • e2e-tests/tests/tier1/mta_836_validate_core_group_omitted_offline_test.go
  • e2e-tests/tests/tier1/mta_841_missing_configmap_ref_test.go
  • e2e-tests/tests/tier1/mta_842_secrets_migration_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/tests/tier1/mta_857_service_account_subject_test.go
  • e2e-tests/tests/tier1/mta_858_user_subject_test.go
  • e2e-tests/tests/tier1/mta_859_group_subject_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • e2e-tests/tests/tier1/olm_whiteout_auditability_test.go
  • e2e-tests/utils/utils.go
  • internal/file/file_helper.go
💤 Files with no reviewable changes (8)
  • e2e-tests/testdata/basic-instructions-file-ocp.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/export/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • cmd/apply/apply.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • cmd/transfer-pvc/transfer-pvc_test.go
  • e2e-tests/utils/utils.go
🚧 Files skipped from review as they are similar to previous changes (33)
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_841_missing_configmap_ref_test.go
  • e2e-tests/tests/tier0/mta_801_stateful_migration_test.go
  • e2e-tests/tests/tier0/mta_827_custom_transformation_stage_test.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier1/mta_836_validate_core_group_omitted_offline_test.go
  • e2e-tests/tests/tier0/mta_802_ignored_resources_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier1/mta_857_service_account_subject_test.go
  • e2e-tests/tests/tier0/mta_845_validate_mixed_resources_offline_test.go
  • e2e-tests/tests/tier1/mta_858_user_subject_test.go
  • e2e-tests/tests/tier1/mta_829_validate_alternative_gv_suggestion_test.go
  • e2e-tests/tests/tier1/mta_859_group_subject_test.go
  • e2e-tests/tests/tier0/mta_809_initcontainer_test.go
  • e2e-tests/tests/tier0/mta_817_stateless_migration_test.go
  • e2e-tests/tests/tier0/olm_whiteout_base_test.go
  • e2e-tests/tests/tier0/mta_807_data_validation_test.go
  • e2e-tests/tests/tier0/mta_804_empty_pvc_migration_test.go
  • e2e-tests/tests/tier1/mta_842_secrets_migration_test.go
  • e2e-tests/tests/tier0/mta_806_pvc_data_integrity_test.go
  • e2e-tests/tests/tier0/mta_840_same_cluster_migration_test.go
  • e2e-tests/tests/tier1/mta_832_validate_alternative_gv_suggestion_offline_test.go
  • e2e-tests/framework/pipeline.go
  • e2e-tests/tests/tier0/mta_808_cronjob_quiesced_test.go
  • e2e-tests/tests/tier0/mta_812_role_migration_test.go
  • e2e-tests/tests/tier1/olm_whiteout_auditability_test.go
  • e2e-tests/tests/tier0/mta_813_cronJob_PVC_test.go
  • e2e-tests/tests/tier0/mta_838_multi_container_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_837_hpa_migration_test.go
  • e2e-tests/tests/tier0/mta_843_pipeline_determinism_test.go
  • e2e-tests/framework/crane.go
  • e2e-tests/tests/tier0/mta_811_mongodb_non_admin_test.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/e2e-pr-tester.yaml:
- Line 207: Update the ginkgo invocation in the E2E workflow to stop
interpolating the PR-controlled focus_file_regex GitHub expression directly into
the shell command. Pass the value through the step’s env configuration and
reference it only via a properly quoted shell variable, preserving the existing
--focus-file behavior.

In `@cmd/transfer-pvc/transfer-pvc.go`:
- Around line 373-375: Update the source certificate secret creation flow around
srcClient.Create to handle an existing secret by retrieving and updating it, or
otherwise using the repository’s established upsert behavior, instead of
aborting on AlreadyExists. Preserve creation for missing secrets, and add a
fake-client regression test covering a pre-existing source secret and successful
retry.
- Around line 233-234: Update the same-cluster validation error in the transfer
flow to use grammatically correct wording and include both context names plus
t.sourceContext.Cluster. Preserve the existing validation condition and error
behavior while making the message clearly identify the conflicting source and
destination configuration.

In `@cmd/transform/transform.go`:
- Line 46: Add tests for the new IgnoredPatchesDir configuration and
--ignored-patches-dir CLI parsing, then cover the conflict path to verify
ignored patches are written beneath the configured directory using the ignored-
filename prefix. Reuse the existing transform and conflict-output test helpers
and preserve current behavior when the option is unset.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f94ecbf-4422-4fd1-9df5-b48fe1ebfe81

📥 Commits

Reviewing files that changed from the base of the PR and between 33f6fd1 and f3a3528.

📒 Files selected for processing (61)
  • .github/workflows/e2e-pr-tester.yaml
  • cmd/apply/apply.go
  • cmd/transfer-pvc/transfer-pvc.go
  • cmd/transfer-pvc/transfer-pvc_test.go
  • cmd/transform/transform.go
  • docs/commands/apply.md
  • e2e-tests/framework/crane.go
  • e2e-tests/framework/pipeline.go
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/export/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/export/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/output.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests/simple-nginx-nopv/export/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests/simple-nginx-nopv/output/output.yaml
  • e2e-tests/golden-manifests/simple-nginx-nopv/output/resources/simple-nginx-nopv/Service__v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/testdata/basic-instructions-file-ocp.yaml
  • e2e-tests/tests/tier0/mta_801_stateful_migration_test.go
  • e2e-tests/tests/tier0/mta_802_ignored_resources_test.go
  • e2e-tests/tests/tier0/mta_804_empty_pvc_migration_test.go
  • e2e-tests/tests/tier0/mta_805_sets_test.go
  • e2e-tests/tests/tier0/mta_806_pvc_data_integrity_test.go
  • e2e-tests/tests/tier0/mta_807_data_validation_test.go
  • e2e-tests/tests/tier0/mta_808_cronjob_quiesced_test.go
  • e2e-tests/tests/tier0/mta_809_initcontainer_test.go
  • e2e-tests/tests/tier0/mta_810_configmap_test.go
  • e2e-tests/tests/tier0/mta_811_mongodb_non_admin_test.go
  • e2e-tests/tests/tier0/mta_812_role_migration_test.go
  • e2e-tests/tests/tier0/mta_813_cronJob_PVC_test.go
  • e2e-tests/tests/tier0/mta_817_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_827_custom_transformation_stage_test.go
  • e2e-tests/tests/tier0/mta_828_instructions_file_migration_test.go
  • e2e-tests/tests/tier0/mta_831_validate_compatible_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_833_compatible_resources_live_test.go
  • e2e-tests/tests/tier0/mta_837_hpa_migration_test.go
  • e2e-tests/tests/tier0/mta_838_multi_container_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_839_networkpolicy_migration_test.go
  • e2e-tests/tests/tier0/mta_840_same_cluster_migration_test.go
  • e2e-tests/tests/tier0/mta_843_pipeline_determinism_test.go
  • e2e-tests/tests/tier0/mta_844_validate_mixed_resources_live_test.go
  • e2e-tests/tests/tier0/mta_845_validate_mixed_resources_offline_test.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier0/olm_whiteout_base_test.go
  • e2e-tests/tests/tier1/mta_829_validate_alternative_gv_suggestion_test.go
  • e2e-tests/tests/tier1/mta_830_instructions_file_force_reconcile_test.go
  • e2e-tests/tests/tier1/mta_832_validate_alternative_gv_suggestion_offline_test.go
  • e2e-tests/tests/tier1/mta_836_validate_core_group_omitted_offline_test.go
  • e2e-tests/tests/tier1/mta_841_missing_configmap_ref_test.go
  • e2e-tests/tests/tier1/mta_842_secrets_migration_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/tests/tier1/mta_857_service_account_subject_test.go
  • e2e-tests/tests/tier1/mta_858_user_subject_test.go
  • e2e-tests/tests/tier1/mta_859_group_subject_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • e2e-tests/tests/tier1/olm_whiteout_auditability_test.go
  • e2e-tests/utils/utils.go
  • internal/file/file_helper.go
💤 Files with no reviewable changes (8)
  • e2e-tests/testdata/basic-instructions-file-ocp.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/output/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • e2e-tests/golden-manifests-ocp/simple-nginx-nopv/export/resources/simple-nginx-nopv/Route_route.openshift.io_v1_simple-nginx-nopv_my-simple-nginx-nopv.yaml
  • cmd/apply/apply.go
  • e2e-tests/tests/tier0/mta_862_ordered_apply_test.go
  • e2e-tests/tests/tier1/mta_860_validate_malformed_api_surface_test.go
  • cmd/transfer-pvc/transfer-pvc_test.go
  • e2e-tests/utils/utils.go
🚧 Files skipped from review as they are similar to previous changes (33)
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_841_missing_configmap_ref_test.go
  • e2e-tests/tests/tier0/mta_801_stateful_migration_test.go
  • e2e-tests/tests/tier0/mta_827_custom_transformation_stage_test.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier1/mta_836_validate_core_group_omitted_offline_test.go
  • e2e-tests/tests/tier0/mta_802_ignored_resources_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier1/mta_857_service_account_subject_test.go
  • e2e-tests/tests/tier0/mta_845_validate_mixed_resources_offline_test.go
  • e2e-tests/tests/tier1/mta_858_user_subject_test.go
  • e2e-tests/tests/tier1/mta_829_validate_alternative_gv_suggestion_test.go
  • e2e-tests/tests/tier1/mta_859_group_subject_test.go
  • e2e-tests/tests/tier0/mta_809_initcontainer_test.go
  • e2e-tests/tests/tier0/mta_817_stateless_migration_test.go
  • e2e-tests/tests/tier0/olm_whiteout_base_test.go
  • e2e-tests/tests/tier0/mta_807_data_validation_test.go
  • e2e-tests/tests/tier0/mta_804_empty_pvc_migration_test.go
  • e2e-tests/tests/tier1/mta_842_secrets_migration_test.go
  • e2e-tests/tests/tier0/mta_806_pvc_data_integrity_test.go
  • e2e-tests/tests/tier0/mta_840_same_cluster_migration_test.go
  • e2e-tests/tests/tier1/mta_832_validate_alternative_gv_suggestion_offline_test.go
  • e2e-tests/framework/pipeline.go
  • e2e-tests/tests/tier0/mta_808_cronjob_quiesced_test.go
  • e2e-tests/tests/tier0/mta_812_role_migration_test.go
  • e2e-tests/tests/tier1/olm_whiteout_auditability_test.go
  • e2e-tests/tests/tier0/mta_813_cronJob_PVC_test.go
  • e2e-tests/tests/tier0/mta_838_multi_container_stateless_migration_test.go
  • e2e-tests/tests/tier0/mta_837_hpa_migration_test.go
  • e2e-tests/tests/tier0/mta_843_pipeline_determinism_test.go
  • e2e-tests/framework/crane.go
  • e2e-tests/tests/tier0/mta_811_mongodb_non_admin_test.go
🛑 Comments failed to post (4)
.github/workflows/e2e-pr-tester.yaml (1)

207-207: 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Do not interpolate the PR-controlled regex directly into the shell script.

focus_file_regex is derived from changed filenames, so a malicious PR can inject shell syntax through this GitHub expression. Pass it via env and reference the quoted shell variable instead.

Proposed fix
+        env:
+          FOCUS_FILE_REGEX: ${{ needs.detect-changes.outputs.focus_file_regex }}
         run: |
           if [ "${{ needs.detect-changes.outputs.run_mode }}" = "all" ]; then
             ginkgo run -v -r "$E2E_SUITE_DIR" -- $GINKGO_COMMON_ARGS
           else
-            ginkgo run -v -r --focus-file="${{ needs.detect-changes.outputs.focus_file_regex }}" "$E2E_SUITE_DIR" -- $GINKGO_COMMON_ARGS
+            ginkgo run -v -r --focus-file="$FOCUS_FILE_REGEX" "$E2E_SUITE_DIR" -- $GINKGO_COMMON_ARGS
           fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        env:
          FOCUS_FILE_REGEX: ${{ needs.detect-changes.outputs.focus_file_regex }}
        run: |
          if [ "${{ needs.detect-changes.outputs.run_mode }}" = "all" ]; then
            ginkgo run -v -r "$E2E_SUITE_DIR" -- $GINKGO_COMMON_ARGS
          else
            ginkgo run -v -r --focus-file="$FOCUS_FILE_REGEX" "$E2E_SUITE_DIR" -- $GINKGO_COMMON_ARGS
          fi
🧰 Tools
🪛 zizmor (1.26.1)

[info] 207-207: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/e2e-pr-tester.yaml at line 207, Update the ginkgo
invocation in the E2E workflow to stop interpolating the PR-controlled
focus_file_regex GitHub expression directly into the shell command. Pass the
value through the step’s env configuration and reference it only via a properly
quoted shell variable, preserving the existing --focus-file behavior.

Source: Linters/SAST tools

cmd/transfer-pvc/transfer-pvc.go (2)

233-234: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include the conflicting contexts and cluster in this validation error.

This message is grammatically incorrect and does not identify what must change. Include both context names and t.sourceContext.Cluster.

Proposed fix
 if t.sourceContext.Cluster == t.destinationContext.Cluster {
- დაბრუნ  return fmt.Errorf("both source and destination cluster are the same, this is not support right now, coming soon")
+ վերադարձ  return fmt.Errorf(
+     "source context %q and destination context %q resolve to the same cluster %q; PVC transfer requires distinct clusters",
+     t.Flags.SourceContext,
+     t.Flags.DestinationContext,
+     t.sourceContext.Cluster,
+   )
 }

As per coding guidelines, “Prefer explicit error messages with context in Go code.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/transfer-pvc/transfer-pvc.go` around lines 233 - 234, Update the
same-cluster validation error in the transfer flow to use grammatically correct
wording and include both context names plus t.sourceContext.Cluster. Preserve
the existing validation condition and error behavior while making the message
clearly identify the conflicting source and destination configuration.

Source: Coding guidelines


373-375: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Preserve retryability when the source certificate secret already exists.

A run failing after this Create but before garbageCollect leaves the secret behind; the next run reaches this loop and aborts on AlreadyExists. Restore get-and-update/upsert handling and add a fake-client regression test for a pre-existing source secret.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/transfer-pvc/transfer-pvc.go` around lines 373 - 375, Update the source
certificate secret creation flow around srcClient.Create to handle an existing
secret by retrieving and updating it, or otherwise using the repository’s
established upsert behavior, instead of aborting on AlreadyExists. Preserve
creation for missing secrets, and add a fake-client regression test covering a
pre-existing source secret and successful retry.

Source: Coding guidelines

cmd/transform/transform.go (1)

46-46: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add coverage for --ignored-patches-dir.

No test in this change exercises the new flag or verifies ignored patches are emitted under the configured directory with the ignored- prefix. Add coverage for both configuration/CLI parsing and conflict-path output behavior. As per coding guidelines, “All new features require tests.”

Also applies to: 160-160

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/transform/transform.go` at line 46, Add tests for the new
IgnoredPatchesDir configuration and --ignored-patches-dir CLI parsing, then
cover the conflict path to verify ignored patches are written beneath the
configured directory using the ignored- filename prefix. Reuse the existing
transform and conflict-output test helpers and preserve current behavior when
the option is unset.

Source: Coding guidelines

@Tamar-Dinavetsky
Tamar-Dinavetsky force-pushed the refactor/remove-export-dir-flag-from-apply branch from 7720bdd to 735fa41 Compare July 27, 2026 10:45

@aufi aufi 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.

LGTM

@Tamar-Dinavetsky
Tamar-Dinavetsky merged commit ada7ac7 into migtools:main Jul 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants