Add IronCore-in-a-Box integration test targets#720
Conversation
Verify current libvirt-provider changes with ironcore-in-a-box test target. Can be run locally on Mac and runs also in GitHub Actions on Ubuntu. Signed-off-by: Felix Riegger <felix.riegger@sap.com>
6088396 to
6f6e2bc
Compare
📝 WalkthroughWalkthroughThis PR introduces a new integration test infrastructure for IronCore-in-a-Box (iiab), enabling the project to run iiab's end-to-end tests in CI and locally. A Bash orchestration script handles cloning the iiab repository, building and patching Docker images, deploying to a local kind cluster, and executing tests. The test is wired into the build system via Make targets and GitHub Actions workflows. ChangesIronCore-in-a-Box Integration Tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
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 `@hack/iiab-tests.sh`:
- Around line 75-79: The clean() function currently does rm -rf "${IIAB_DIR}" on
a user-controlled path; add a safety guard before deletion to ensure IIAB_DIR is
non-empty, not "/" or ".", and matches an expected safe pattern (e.g., resides
under /tmp or contains a specific prefix like "iiab") and only proceed if those
checks pass; if the checks fail, log an error and skip deletion. Reference the
clean() function and the IIAB_DIR variable when adding these validations and
retain the kind delete cluster step unchanged.
- Around line 40-47: The kustomization patch hardcodes newName/newTag to
"libvirt-provider:local" so an IIAB_IMG override is ignored; update the sed
replacements in the IIAB script (the blocks that reference variables config_path
and kustomization) to detect IIAB_IMG and split it into image name and tag, then
use those values instead of the hardcoded "libvirt-provider" and "local" (i.e.,
set newName to the image name portion and newTag to the tag portion when
IIAB_IMG is non-empty), ensuring both the macOS (sed -i '') and Linux (sed -i)
branches apply the same conditional substitution logic.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 09bf8a6b-ba0b-4e91-865a-378c7bd3077b
📒 Files selected for processing (4)
.github/workflows/iiab-tests.yml.gitignoreMakefilehack/iiab-tests.sh
| sed -i '' "s|github.com/ironcore-dev/libvirt-provider/config/default?ref=.*|${config_path}|" "${kustomization}" | ||
| sed -i '' "s|newName: ghcr.io/ironcore-dev/libvirt-provider|newName: libvirt-provider|" "${kustomization}" | ||
| sed -i '' "/newName: libvirt-provider/{n;s|newTag:.*|newTag: local|;}" "${kustomization}" | ||
| else | ||
| sed -i "s|github.com/ironcore-dev/libvirt-provider/config/default?ref=.*|${config_path}|" "${kustomization}" | ||
| sed -i "s|newName: ghcr.io/ironcore-dev/libvirt-provider|newName: libvirt-provider|" "${kustomization}" | ||
| sed -i "/newName: libvirt-provider/{n;s|newTag:.*|newTag: local|;}" "${kustomization}" | ||
| fi |
There was a problem hiding this comment.
IIAB_IMG override is ignored during kustomization patching.
At Line 41–46, newName/newTag are hardcoded to libvirt-provider:local. If IIAB_IMG is set (documented in usage), deploy references a different image than the one built/loaded.
Suggested fix
patch() {
echo "==> Patching iiab kustomization..."
local kustomization="${IIAB_DIR}/base/libvirt-provider/kustomization.yaml"
+ local image_name="${IIAB_IMG%:*}"
+ local image_tag="${IIAB_IMG##*:}"
+ if [[ "${IIAB_IMG}" != *:* ]]; then
+ image_tag="latest"
+ fi
@@
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' "s|github.com/ironcore-dev/libvirt-provider/config/default?ref=.*|${config_path}|" "${kustomization}"
- sed -i '' "s|newName: ghcr.io/ironcore-dev/libvirt-provider|newName: libvirt-provider|" "${kustomization}"
- sed -i '' "/newName: libvirt-provider/{n;s|newTag:.*|newTag: local|;}" "${kustomization}"
+ sed -i '' "s|newName: ghcr.io/ironcore-dev/libvirt-provider|newName: ${image_name}|" "${kustomization}"
+ sed -i '' "/newName: /{n;s|newTag:.*|newTag: ${image_tag}|;}" "${kustomization}"
else
sed -i "s|github.com/ironcore-dev/libvirt-provider/config/default?ref=.*|${config_path}|" "${kustomization}"
- sed -i "s|newName: ghcr.io/ironcore-dev/libvirt-provider|newName: libvirt-provider|" "${kustomization}"
- sed -i "/newName: libvirt-provider/{n;s|newTag:.*|newTag: local|;}" "${kustomization}"
+ sed -i "s|newName: ghcr.io/ironcore-dev/libvirt-provider|newName: ${image_name}|" "${kustomization}"
+ sed -i "/newName: /{n;s|newTag:.*|newTag: ${image_tag}|;}" "${kustomization}"
fi🤖 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 `@hack/iiab-tests.sh` around lines 40 - 47, The kustomization patch hardcodes
newName/newTag to "libvirt-provider:local" so an IIAB_IMG override is ignored;
update the sed replacements in the IIAB script (the blocks that reference
variables config_path and kustomization) to detect IIAB_IMG and split it into
image name and tag, then use those values instead of the hardcoded
"libvirt-provider" and "local" (i.e., set newName to the image name portion and
newTag to the tag portion when IIAB_IMG is non-empty), ensuring both the macOS
(sed -i '') and Linux (sed -i) branches apply the same conditional substitution
logic.
| clean() { | ||
| echo "==> Cleaning up..." | ||
| kind delete cluster --name "${IIAB_CLUSTER_NAME}" || true | ||
| rm -rf "${IIAB_DIR}" | ||
| } |
There was a problem hiding this comment.
Add a safety guard before deleting IIAB_DIR.
At Line 78, rm -rf "${IIAB_DIR}" runs on a user-configurable path. A bad env value can wipe unintended directories.
Suggested fix
clean() {
echo "==> Cleaning up..."
kind delete cluster --name "${IIAB_CLUSTER_NAME}" || true
+ if [[ -z "${IIAB_DIR}" || "${IIAB_DIR}" == "/" ]]; then
+ echo "Refusing to remove unsafe IIAB_DIR='${IIAB_DIR}'" >&2
+ return 1
+ fi
rm -rf "${IIAB_DIR}"
}📝 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.
| clean() { | |
| echo "==> Cleaning up..." | |
| kind delete cluster --name "${IIAB_CLUSTER_NAME}" || true | |
| rm -rf "${IIAB_DIR}" | |
| } | |
| clean() { | |
| echo "==> Cleaning up..." | |
| kind delete cluster --name "${IIAB_CLUSTER_NAME}" || true | |
| if [[ -z "${IIAB_DIR}" || "${IIAB_DIR}" == "/" ]]; then | |
| echo "Refusing to remove unsafe IIAB_DIR='${IIAB_DIR}'" >&2 | |
| return 1 | |
| fi | |
| rm -rf "${IIAB_DIR}" | |
| } |
🤖 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 `@hack/iiab-tests.sh` around lines 75 - 79, The clean() function currently does
rm -rf "${IIAB_DIR}" on a user-controlled path; add a safety guard before
deletion to ensure IIAB_DIR is non-empty, not "/" or ".", and matches an
expected safe pattern (e.g., resides under /tmp or contains a specific prefix
like "iiab") and only proceed if those checks pass; if the checks fail, log an
error and skip deletion. Reference the clean() function and the IIAB_DIR
variable when adding these validations and retain the kind delete cluster step
unchanged.
Verify current libvirt-provider changes with ironcore-in-a-box test target. Can be run locally on Mac and
runs also in GitHub Actions on Ubuntu.
Fixes #719
Summary by CodeRabbit
Release Notes