Skip to content

Provide warning for ImageStreams#31

Merged
aufi merged 4 commits into
migtools:mainfrom
aufi:image-warn
Jun 18, 2026
Merged

Provide warning for ImageStreams#31
aufi merged 4 commits into
migtools:mainfrom
aufi:image-warn

Conversation

@aufi

@aufi aufi commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

When plugin process ImageStream resource, it should provide a warning since images are not subject of migration by the plugin (should be solved outside of crane with e.g. skopeo).

Also populating README file and adding basic PR golang check (unit test and build to spot a failure soon enough).

Fixes: migtools/crane#452

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation

    • Expanded README with OpenShift plugin overview, resource transformations, limitations, CLI flags, and development/build instructions.
  • New Features

    • Improved OpenShift transform handling for image resources by warning about internal registry images and marking affected objects for whiteout.
  • Tests

    • Added automated coverage to verify whiteout behavior for image-related resources and non-whiteout for unrelated resources, including log assertions.
  • Chores

    • Added a PR Checks GitHub Actions workflow to run tests and build on pull requests.

When plugin process ImageStream resource, it should provide a warning
since images are not subject of migration by the plugin.

Fixes: migtools/crane#452

Signed-off-by: Marek Aufart <maufart@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds an ImageStream case to OpenShiftTransformPlugin.Run that logs a migration warning and sets whiteOut = true. Two new test functions validate whiteout behavior and log output for image resources and the empty-namespace edge case. The README is expanded from a placeholder into full project documentation. A GitHub Actions workflow automates testing and building on pull requests.

Changes

ImageStream Whiteout and Documentation

Layer / File(s) Summary
ImageStream whiteout logic
openshift/plugin.go
A new case "ImageStream" added to the Run kind switch emits warning/info logs about internal registry images not being migrated and sets whiteOut = true.
Tests for whiteout and warning logging
openshift/plugin_test.go
TestImageStreamDetection and TestImageStreamWithEmptyNamespace validate that ImageStream, ImageStreamTag, and ImageTag resources are whiteoutd while Pod resources are not, assert expected log substrings including skopeo mentions, and cover the empty-namespace edge case. Local contains/findSubstring helpers support log assertions.
README documentation
README.md
README replaced from a single-line placeholder with sections for plugin features, internal image registry migration limitations with example warnings and manual migration guidance, CLI usage flags and defaults, and development test/build commands.
GitHub Actions CI/CD workflow
.github/workflows/pr-checks.yml
New PR Checks workflow triggers on pull requests to main, sets up Go 1.25.0, executes go test ./..., and performs a release-style build to bin/crane-plugin-openshift.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • migtools/crane-plugin-openshift#28: Directly extends the same kind-switch whiteout logic in OpenShiftTransformPlugin.Run to cover ImageStreamTag and ImageTag, making it a predecessor to this PR's ImageStream handling.
  • migtools/crane-plugin-openshift#29: Refactors openshift/plugin.go to restructure the Run method and logging, which is the same file and function this PR modifies to add ImageStream whiteout.

Suggested reviewers

  • nachandr

Poem

🐇 Hop, hop, through the registry maze,
ImageStreams now earn a whiteout glaze,
Skopeo's the tool to copy them right,
A README now shines with docs so bright,
CI pipelines run with automated care —
The bunny has shipped, the migration is fair! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Provide warning for ImageStreams' accurately summarizes the main change: adding warning notifications for ImageStream resources in the OpenShift crane plugin.
Linked Issues check ✅ Passed The PR fully implements Solution 1 from issue #452: detecting ImageStream resources and informing users that referenced images are not automatically migrated via logging warnings.
Out of Scope Changes check ✅ Passed All changes are directly related to the ImageStream warning implementation and supporting infrastructure (documentation, tests, CI workflow), with no unrelated modifications.

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

✨ 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 and usage tips.

@aufi

aufi commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 2

🤖 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 `@openshift/plugin.go`:
- Around line 92-99: The case statement checking for "ImageStream" at line 92
only validates the kind without checking the API group, which allows
non-OpenShift resources with the same kind to be incorrectly whiteout'd. Add an
additional check to verify that the unstructured object u belongs to the
image.openshift.io API group before executing the whiteout logic and logging the
warning message. Extract the API group from the object (via GetAPIVersion or
similar method on the unstructured object) and confirm it matches the OpenShift
image API group namespace before proceeding with the namespace, name extraction,
and whiteOut assignment.

In `@README.md`:
- Around line 26-29: The fenced code block containing the warning and info
messages about ImageStream and registry migration is missing a language
identifier, which violates the markdown linting rule MD040. Add the language
identifier `text` to the opening triple backticks of this code block to specify
that the content is plain text, changing the opening from triple backticks to
triple backticks followed by `text`.
🪄 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

Run ID: a9a3be57-5949-43d6-ad3a-58df0e8590eb

📥 Commits

Reviewing files that changed from the base of the PR and between 3e4378d and 594883c.

📒 Files selected for processing (3)
  • README.md
  • openshift/plugin.go
  • openshift/plugin_test.go

Comment thread openshift/plugin.go
Comment thread README.md Outdated
aufi added 2 commits June 17, 2026 16:24
Signed-off-by: Marek Aufart <maufart@redhat.com>
Signed-off-by: Marek Aufart <maufart@redhat.com>
@aufi aufi requested a review from stillalearner June 17, 2026 14:40
Comment thread openshift/plugin_test.go Outdated

@stillalearner stillalearner 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

Signed-off-by: Marek Aufart <maufart@redhat.com>

@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: 1

🤖 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/pr-checks.yml:
- Around line 12-18: The workflow uses floating action version tags
(actions/setup-go@v5 and actions/checkout@v4) which weakens supply-chain
security by allowing action updates without explicit control. Replace the
floating tags with pinned commit SHAs for both the setup-go and checkout
actions. Additionally, add persist-credentials: false to the checkout action to
prevent unnecessary credential exposure in PR-triggered runs.
🪄 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

Run ID: d511044a-4dd3-4f2b-8d3a-67ee9665f4d4

📥 Commits

Reviewing files that changed from the base of the PR and between 594883c and 7cecead.

📒 Files selected for processing (3)
  • .github/workflows/pr-checks.yml
  • README.md
  • openshift/plugin_test.go
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • openshift/plugin_test.go

Comment thread .github/workflows/pr-checks.yml
@aufi aufi merged commit 1ae5e2a into migtools:main Jun 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Images data migration

2 participants