Skip to content

RHAIENG-2846 Prefetch: COMPONENT_DIR from Makefile, local build default, Tekton discovery#3044

Open
ysok wants to merge 1 commit intoopendatahub-io:mainfrom
ysok-opendatahub-io:RHAIENG-2846-post-hermetic-cleanup
Open

RHAIENG-2846 Prefetch: COMPONENT_DIR from Makefile, local build default, Tekton discovery#3044
ysok wants to merge 1 commit intoopendatahub-io:mainfrom
ysok-opendatahub-io:RHAIENG-2846-post-hermetic-cleanup

Conversation

@ysok
Copy link
Contributor

@ysok ysok commented Mar 1, 2026

RHAIENG-2846 Post-hermetic cleanup

  • GHA: Derive COMPONENT_DIR from Makefile; fail clearly if missing.
  • Makefile: Always pass LOCAL_BUILD=true for hermetic targets; require cachi2/output when prefetch-input exists; skip prefetch check when goal is all-images (matrix generation); fix empty-variable warning.
  • prefetch-all.sh: Add find_tekton_yaml (ODH/RHDS by dockerfile param); remove --tekton-file and package-lock fallback; allow running without variant dir.
  • download-npm.sh: Exit 0 when Tekton file has no npm entries.
  • Regenerate artifacts.lock.yaml and pylock.cpu.toml; update README.

Summary by CodeRabbit

  • Documentation

    • Updated prefetch and lockfile-generation docs to describe variant-aware input paths, Tekton-based NPM discovery, and clarified manual build instructions and volume/arg behavior.
  • Chores

    • Component directory is now derived from the build configuration; builds error early if it cannot be determined.
    • Local-build flags, conditional cache/volume mounting, and prefetch validation improved.
    • Tekton-file option removed; NPM discovery is automatic and empty results now exit gracefully.
  • Data

    • Updated prefetched artifact metadata and checksums for some architectures.

@github-actions github-actions bot added the review-requested GitHub Bot creates notification on #pr-review-ai-ide-team slack channel label Mar 1, 2026
@openshift-ci openshift-ci bot requested review from atheo89 and jiridanek March 1, 2026 19:47
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign daniellutz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/l and removed size/l labels Mar 1, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Walkthrough

Derives COMPONENT_DIR from the Makefile, tightens Makefile build/prefetch logic (conditional LOCAL_BUILD_ARG, cachi2 volume, prefetch validation), adds Tekton YAML auto-discovery for NPM in prefetch scripts, adjusts download-npm behavior to no-op on empty results, and updates README to variant-aware prefetched-input paths and build guidance.

Changes

Cohort / File(s) Summary
CI / Workflow
.github/workflows/build-notebooks-TEMPLATE.yaml
COMPONENT_DIR derivation changed to extract image build directory from Makefile (dry-run + regex).
Makefile / Build
Makefile
Reworked local vs GHA build flow: introduced LOCAL_BUILD_ARG, conditional CACHI2_VOLUME mounting, prefetch artifact validation (error when prefetch-input exists but artifacts missing), use of $(empty) expansions, and docker/podman build args updated to include LOCAL_BUILD_ARG. Review build-arg/volume conditional logic.
Prefetch scripts
scripts/lockfile-generators/prefetch-all.sh, scripts/lockfile-generators/download-npm.sh
Added find_tekton_yaml() and removed --tekton-file CLI; NPM step now auto-detects Tekton YAML (RHDS first, then ODH) and skips gracefully if none found; download-npm.sh changed to exit 0 when no npm entries. Verify new discovery logic and control flow.
Lockfile tooling docs
scripts/lockfile-generators/README.md
Extensive rewrite: variant-aware prefetched-input paths, Tekton-based NPM discovery, updated Makefile/manual podman build comparison, skip rules when variant dir missing, and formatting/narrative updates.
Artifact locks
codeserver/ubi9-python-3.12/prefetch-input/odh/artifacts.lock.yaml
Adjusted platform-specific artifact filenames/URLs/checksums (aarch64, powerpc64le, s390x). Verify checksums and filename consistency.
Lock metadata comment
codeserver/ubi9-python-3.12/uv.lock.d/pylock.cpu.toml
Moved/added top-of-file uv command comment; no lock data changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description is concise but covers the key changes. However, required sections from the template (How Has This Been Tested and all merge criteria checkboxes) are missing. Add 'How Has This Been Tested?' section with testing details and complete all merge criteria checkboxes with x marks to indicate review and testing completion.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: deriving COMPONENT_DIR from Makefile, setting local build as default, and implementing Tekton discovery for npm handling.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@openshift-ci openshift-ci bot added size/l and removed size/l labels Mar 1, 2026
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: 1

🧹 Nitpick comments (1)
scripts/lockfile-generators/prefetch-all.sh (1)

245-252: Prefer selected variant first when resolving Tekton file.

Line 245 currently probes RHDS before ODH unconditionally. Using the active VARIANT as primary lookup would reduce mismatch risk if npm paths diverge per variant later.

♻️ Suggested variant-priority lookup
-if [[ -d ".tekton" ]] && command -v yq &>/dev/null; then
-  tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "rhds" 2>/dev/null | head -1) || true
-  if [[ -z "$tekton_file" ]]; then
-    tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "odh" 2>/dev/null | head -1) || true
-  fi
+if [[ -d ".tekton" ]] && command -v yq &>/dev/null; then
+  primary_variant="$VARIANT"
+  fallback_variant=$([[ "$VARIANT" == "rhds" ]] && echo "odh" || echo "rhds")
+  tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "$primary_variant" 2>/dev/null | head -1) || true
+  if [[ -z "$tekton_file" ]]; then
+    tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "$fallback_variant" 2>/dev/null | head -1) || true
+  fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/lockfile-generators/prefetch-all.sh` around lines 245 - 252, The
lookup currently always tries the "rhds" variant first; change it to prefer the
active VARIANT by calling find_tekton_yaml with "$COMPONENT_DIR" and "$VARIANT"
first (assigning to tekton_file), and only if that returns empty fall back to
the other variant (e.g., test the alternate literal like "rhds" or "odh");
update the tekton_file resolution logic around the find_tekton_yaml calls so the
active VARIANT is attempted first, then the alternate is attempted as a
fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Around line 90-97: The prefetch guard currently triggers the $(error ...)
branch even for dry-run discovery (make -n) and blocks CI; update the error
conditional in the Makefile so it skips the prefetch check when a bypass flag is
set (e.g. SKIP_PREFETCH_CHECK=yes) or when MAKEFLAGS indicates a metadata-only
dry-run. Specifically, change the nested $(if ...) that emits $(error Prefetch
required for hermetic build...) to first test that SKIP_PREFETCH_CHECK is empty
(and/or that $(filter -n,$(MAKEFLAGS)) is false) before emitting the error; keep
the existing BUILD_DIR, LOCAL_BUILD_ARG and CACHI2_VOLUME logic intact. Ensure
the new condition allows calling make -n SKIP_PREFETCH_CHECK=yes <target> to
bypass the prefetch check.

---

Nitpick comments:
In `@scripts/lockfile-generators/prefetch-all.sh`:
- Around line 245-252: The lookup currently always tries the "rhds" variant
first; change it to prefer the active VARIANT by calling find_tekton_yaml with
"$COMPONENT_DIR" and "$VARIANT" first (assigning to tekton_file), and only if
that returns empty fall back to the other variant (e.g., test the alternate
literal like "rhds" or "odh"); update the tekton_file resolution logic around
the find_tekton_yaml calls so the active VARIANT is attempted first, then the
alternate is attempted as a fallback.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3c7287e and 4d5f08f.

📒 Files selected for processing (7)
  • .github/workflows/build-notebooks-TEMPLATE.yaml
  • Makefile
  • codeserver/ubi9-python-3.12/prefetch-input/odh/artifacts.lock.yaml
  • codeserver/ubi9-python-3.12/uv.lock.d/pylock.cpu.toml
  • scripts/lockfile-generators/README.md
  • scripts/lockfile-generators/download-npm.sh
  • scripts/lockfile-generators/prefetch-all.sh

@ysok ysok force-pushed the RHAIENG-2846-post-hermetic-cleanup branch from 4d5f08f to a7ee952 Compare March 1, 2026 20:07
@openshift-ci openshift-ci bot added size/l and removed size/l labels Mar 1, 2026
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.

🧹 Nitpick comments (2)
scripts/lockfile-generators/prefetch-all.sh (2)

245-252: Prefer selected variant first, then fallback to the other variant.

NPM Tekton discovery currently tries RHDS first unconditionally. Using $VARIANT as first choice keeps behavior aligned with caller intent.

Proposed patch
-  tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "rhds" 2>/dev/null | head -1) || true
+  tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "$VARIANT" 2>/dev/null | head -1) || true
   if [[ -z "$tekton_file" ]]; then
-    tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "odh" 2>/dev/null | head -1) || true
+    fallback_variant=$([[ "$VARIANT" == "rhds" ]] && echo "odh" || echo "rhds")
+    tekton_file=$(find_tekton_yaml "$COMPONENT_DIR" "$fallback_variant" 2>/dev/null | head -1) || true
   fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/lockfile-generators/prefetch-all.sh` around lines 245 - 252, The
Tekton YAML discovery currently hardcodes trying "rhds" first then "odh"; change
it to try the caller-selected variant first by calling find_tekton_yaml with
"$VARIANT" (e.g., find_tekton_yaml "$COMPONENT_DIR" "$VARIANT") and if that
returns empty fall back to the other variant (compute the alternate like "rhds"
vs "odh" and call find_tekton_yaml again), storing the result in tekton_file;
keep using the same head -1 and || true behavior.

94-95: Use null-safe selector in yq query to explicitly handle missing structure.

The current .spec.params[] selector fails on all 29 pull-request.yaml files since they lack the .spec.params structure entirely. While error suppression masks this, the query is brittle and relies on 2>/dev/null for correctness. The proposed fix with .spec.params[]? and // empty explicitly handles missing structures and is more robust:

Proposed patch
-    dockerfile_path=$(yq -r '.spec.params[] | select(.name == "dockerfile") | .value' "$f" 2>/dev/null)
+    dockerfile_path=$(yq -r '.spec.params[]? | select(.name == "dockerfile") | .value // empty' "$f" 2>/dev/null || true)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/lockfile-generators/prefetch-all.sh` around lines 94 - 95, The yq
query used to populate dockerfile_path is brittle when .spec.params is missing;
update the yq expression in the dockerfile_path assignment (the command that
sets the dockerfile_path variable) to use a null-safe selector like
.spec.params[]? and append a fallback (// empty) so missing structures return
empty instead of erroring, removing reliance on 2>/dev/null for correctness;
keep the rest of the conditional ([[ -n "$dockerfile_path" ]] || continue)
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/lockfile-generators/prefetch-all.sh`:
- Around line 245-252: The Tekton YAML discovery currently hardcodes trying
"rhds" first then "odh"; change it to try the caller-selected variant first by
calling find_tekton_yaml with "$VARIANT" (e.g., find_tekton_yaml
"$COMPONENT_DIR" "$VARIANT") and if that returns empty fall back to the other
variant (compute the alternate like "rhds" vs "odh" and call find_tekton_yaml
again), storing the result in tekton_file; keep using the same head -1 and ||
true behavior.
- Around line 94-95: The yq query used to populate dockerfile_path is brittle
when .spec.params is missing; update the yq expression in the dockerfile_path
assignment (the command that sets the dockerfile_path variable) to use a
null-safe selector like .spec.params[]? and append a fallback (// empty) so
missing structures return empty instead of erroring, removing reliance on
2>/dev/null for correctness; keep the rest of the conditional ([[ -n
"$dockerfile_path" ]] || continue) unchanged.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4d5f08f and a7ee952.

📒 Files selected for processing (7)
  • .github/workflows/build-notebooks-TEMPLATE.yaml
  • Makefile
  • codeserver/ubi9-python-3.12/prefetch-input/odh/artifacts.lock.yaml
  • codeserver/ubi9-python-3.12/uv.lock.d/pylock.cpu.toml
  • scripts/lockfile-generators/README.md
  • scripts/lockfile-generators/download-npm.sh
  • scripts/lockfile-generators/prefetch-all.sh
✅ Files skipped from review due to trivial changes (1)
  • codeserver/ubi9-python-3.12/uv.lock.d/pylock.cpu.toml
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/lockfile-generators/download-npm.sh
  • codeserver/ubi9-python-3.12/prefetch-input/odh/artifacts.lock.yaml

…lt, Tekton discovery

- GHA: Derive COMPONENT_DIR from Makefile; fail clearly if missing.
- Makefile: Always pass LOCAL_BUILD=true for hermetic targets; require cachi2/output when prefetch-input exists; fix empty-variable warning.
- prefetch-all.sh: Add find_tekton_yaml (ODH/RHDS by dockerfile param); remove --tekton-file and package-lock fallback; allow running without variant dir.
- download-npm.sh: Exit 0 when Tekton file has no npm entries.
- Regenerate artifacts.lock.yaml and pylock.cpu.toml; update README.
@ysok ysok force-pushed the RHAIENG-2846-post-hermetic-cleanup branch from a7ee952 to bcc6c30 Compare March 1, 2026 20:19
@openshift-ci openshift-ci bot added size/l and removed size/l labels Mar 1, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 1, 2026

@ysok: 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/codeserver-ubi9-python-3-12-pr-image-mirror bcc6c30 link true /test codeserver-ubi9-python-3-12-pr-image-mirror
ci/prow/images bcc6c30 link true /test images

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.

@ysok
Copy link
Contributor Author

ysok commented Mar 1, 2026

All Konflux builds are good, but failed with OOM while pushing to quay.io
https://github.com/opendatahub-io/notebooks/pull/3044/checks?check_run_id=65322811239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-requested GitHub Bot creates notification on #pr-review-ai-ide-team slack channel size/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant