Skip to content

[rhoai-2.25] docs(lockfile): align custom flavor on Dockerfile.konflux.<flavor> - #2705

Open
jiridanek wants to merge 2 commits into
rhoai-2.25from
fix/2700-lockfile-dockerfile-naming
Open

[rhoai-2.25] docs(lockfile): align custom flavor on Dockerfile.konflux.<flavor>#2705
jiridanek wants to merge 2 commits into
rhoai-2.25from
fix/2700-lockfile-dockerfile-naming

Conversation

@jiridanek

@jiridanek jiridanek commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Align --flavor docs and validation on Dockerfile.konflux.<flavor> after [rhoai-2.25] chore: remove orphan Dockerfiles and PDF install scripts #2694 removed legacy Dockerfile.<flavor> workbench files.
  • Validate Dockerfile.konflux.${FLAVOR} in create-requirements-lockfile.sh before lock generation.
  • Fix README custom-flavor example (build-args/konflux.cuda.conf, jupyter/minimal).

Fixes #2700

Test plan

  • bash -n scripts/lockfile-generators/create-requirements-lockfile.sh
  • ./scripts/lockfile-generators/create-requirements-lockfile.sh --help shows Dockerfile.konflux.<flavor>
  • Invalid --flavor exits with clear Dockerfile-not-found error

Made with Cursor

Summary by CodeRabbit

  • Documentation

    • Updated pip lockfile guidance for custom flavors.
    • Clarified required Dockerfile and build-argument naming conventions.
    • Updated the custom-flavor example to use the Jupyter minimal component.
    • Documented automatic flavor selection and explicit flavor requirements.
  • Bug Fixes

    • Automatically selects the first available CPU, CUDA, or ROCm flavor when no default is available.
    • Reports an error when an explicitly requested flavor is unavailable.
    • Ensures lockfiles use the resolved Konflux flavor consistently.

After #2694 removed legacy Dockerfile.<flavor> workbench files, update
create-requirements-lockfile.sh and README to document and validate
Dockerfile.konflux.<flavor> consistently with pylocks_generator.py.

Fixes #2700

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci
openshift-ci Bot requested review from daniellutz and dibryant August 4, 2026 18:31
@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown

[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 caponetto 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

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Superseded by newer run: https://github.com/red-hat-data-services/notebooks/actions/runs/30939043570

CI status [antigravity]

Run: Build Notebooks (push) #309390295372/2 complete · 2 skipped
Last updated: 2026-08-04T18:32:00Z

Workflow completed with skipped jobs.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The lockfile generators now resolve Dockerfile.konflux.<flavor> files. Explicit missing flavors fail. Default flavor selection falls back to the first available cpu, cuda, or rocm flavor. Documentation and examples use the same contract.

Changes

Konflux flavor resolution

Layer / File(s) Summary
Flavor naming contract
scripts/lockfile-generators/README.md, scripts/lockfile-generators/create-requirements-lockfile.sh, scripts/lockfile-generators/prefetch-all.sh
Documentation and help text define Konflux Dockerfile naming, RH-index build-args requirements, fallback behavior, and updated Jupyter examples.
Requirements lockfile flavor resolution
scripts/lockfile-generators/create-requirements-lockfile.sh
The script distinguishes explicit flavors, validates or selects a Konflux Dockerfile, and uses the resolved flavor for generated paths.
Prefetch flavor resolution
scripts/lockfile-generators/prefetch-all.sh
The script distinguishes explicit flavors, rejects missing explicit Dockerfiles, and selects the first available fallback flavor in order.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: daniellutz, dibryant

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Automatic flavor selection and rh-index-specific configuration changes extend beyond issue #2700's Dockerfile naming alignment scope. Move automatic flavor selection and rh-index configuration changes to a separate pull request, or link issues that explicitly require them.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the lockfile flavor documentation change and the Dockerfile.konflux. convention.
Description check ✅ Passed The description explains the changes and provides relevant test results, although it omits the repository checklist sections.
Linked Issues check ✅ Passed The README, option help, validation, and examples consistently use Dockerfile.konflux. as required by issue #2700.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2700-lockfile-dockerfile-naming

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

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Superseded by newer run: https://github.com/red-hat-data-services/notebooks/actions/runs/30943127627

CI status [antigravity]

Run: Build Notebooks (pr) #309390435702/2 complete · 1 passed · 1 skipped
Last updated: 2026-08-04T18:32:52Z

No workbench image jobs ran; all matrix jobs were skipped.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

📋 Review Summary

The pull request successfully updates script documentation, default flavor handling, and Konflux Dockerfile validation (Dockerfile.konflux.<flavor>) across lockfile generation scripts. The implementation is clean, robust, and properly handles automatic resolution and fallback for available component flavors.

🔍 General Feedback

  • The fallback resolution logic in scripts/lockfile-generators/prefetch-all.sh effectively checks for available Dockerfile.konflux.{cpu,cuda,rocm} flavors when no explicit flavor or default cpu Dockerfile is found, preventing silent failures.
  • Documentation updates in scripts/lockfile-generators/README.md are clear and consistent with the new naming conventions.

I did not find any issues requiring code modifications or inline comments.

@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 `@scripts/lockfile-generators/create-requirements-lockfile.sh`:
- Around line 114-115: Update the flavor resolution before constructing
KONFLUX_DOCKERFILE so projects without Dockerfile.konflux.cpu can select an
available non-CPU flavor (such as CUDA or ROCm), while still honoring an
explicitly provided --flavor; alternatively require --flavor when no suitable
default exists. Ensure the availability check uses the resolved flavor rather
than blindly assuming cpu.

In `@scripts/lockfile-generators/README.md`:
- Line 853: Update the --flavor option description in the README to state that
build-args/konflux.<flavor>.conf is required only for the rh-index flow, while
retaining the Dockerfile flavor matching and output filename details for all
flavors.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f1529506-c171-49bf-b99f-43a3ac1034f7

📥 Commits

Reviewing files that changed from the base of the PR and between ddb3f83 and 3630278.

📒 Files selected for processing (2)
  • scripts/lockfile-generators/README.md
  • scripts/lockfile-generators/create-requirements-lockfile.sh

Comment thread scripts/lockfile-generators/create-requirements-lockfile.sh Outdated
Comment thread scripts/lockfile-generators/README.md Outdated
When --flavor is omitted and Dockerfile.konflux.cpu is absent, resolve
the flavor from the first available Dockerfile.konflux.{cpu,cuda,rocm}
in create-requirements-lockfile.sh and prefetch-all.sh.

Also scope konflux.conf requirement to rh-index in docs and --help.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Superseded by newer run: https://github.com/red-hat-data-services/notebooks/actions/runs/30943130271

CI status [antigravity]

Run: Build Notebooks (push) #309431276272/2 complete · 2 skipped
Last updated: 2026-08-04T19:24:51Z

Workflow completed with skipped jobs.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

CI status [antigravity]

Run: Build Notebooks (pr) #309431302712/2 complete · 1 passed · 1 skipped
Last updated: 2026-08-04T19:25:40Z

No workbench image jobs ran; all matrix jobs were skipped.

@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 `@scripts/lockfile-generators/prefetch-all.sh`:
- Around line 64-65: Update the --flavor option help text in prefetch-all.sh to
state that an explicitly supplied flavor must exactly match an available
Dockerfile.konflux.<flavor>; retain the existing documentation for the cpu
default and fallback behavior.
- Line 163: Update find_tekton_yaml to select the Tekton YAML whose Dockerfile
declaration matches Dockerfile.konflux.${FLAVOR} exactly, rather than relying on
head -1. Pass the resolved FLAVOR from the surrounding prefetch flow so CPU,
CUDA, and ROCm configurations resolve their corresponding YAML and inputs.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3914949f-0dda-49a8-b710-68b8f6636935

📥 Commits

Reviewing files that changed from the base of the PR and between 3630278 and dd12f37.

📒 Files selected for processing (3)
  • scripts/lockfile-generators/README.md
  • scripts/lockfile-generators/create-requirements-lockfile.sh
  • scripts/lockfile-generators/prefetch-all.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/lockfile-generators/README.md

Comment on lines +64 to +65
--flavor NAME Lock file flavor (default: cpu, or first available
Dockerfile.konflux.{cpu,cuda,rocm} when cpu is absent)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document explicit flavor validation in prefetch-all.sh --help.

The resolver rejects an explicitly supplied flavor when Dockerfile.konflux.<flavor> is missing. The help text only documents the default fallback. Add the exact-match requirement so users can predict validation behavior.

Proposed help-text update
   --flavor NAME           Lock file flavor (default: cpu, or first available
                           Dockerfile.konflux.{cpu,cuda,rocm} when cpu is absent)
+                          Must match Dockerfile.konflux.<flavor> in the
+                          component directory.
📝 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.

Suggested change
--flavor NAME Lock file flavor (default: cpu, or first available
Dockerfile.konflux.{cpu,cuda,rocm} when cpu is absent)
--flavor NAME Lock file flavor (default: cpu, or first available
Dockerfile.konflux.{cpu,cuda,rocm} when cpu is absent)
Must match Dockerfile.konflux.<flavor> in the
component directory.
🤖 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 `@scripts/lockfile-generators/prefetch-all.sh` around lines 64 - 65, Update the
--flavor option help text in prefetch-all.sh to state that an explicitly
supplied flavor must exactly match an available Dockerfile.konflux.<flavor>;
retain the existing documentation for the cpu default and fallback behavior.


[[ -z "$COMPONENT_DIR" ]] && error_exit "--component-dir is required."
[[ -d "$COMPONENT_DIR" ]] || error_exit "Component directory not found: $COMPONENT_DIR"
FLAVOR="$(resolve_konflux_flavor "$COMPONENT_DIR" "$FLAVOR" "$FLAVOR_EXPLICIT")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -u

rg -n -C 10 \
  'find_tekton_yaml|TEKTON_YAML|FLAVOR=|dockerfile_path' \
  scripts/lockfile-generators/prefetch-all.sh

printf '\nFlavor-specific Tekton references:\n'
rg -n -C 4 \
  'Dockerfile\.konflux\.(cpu|cuda|rocm)|Dockerfile\.konflux\.' \
  .tekton scripts --glob '*.yaml' --glob '*.sh'

Repository: red-hat-data-services/notebooks

Length of output: 50387


🏁 Script executed:

#!/usr/bin/env bash
set -u

printf '%s\n' 'Relevant implementation:'
sed -n '74,140p;292,325p' scripts/lockfile-generators/prefetch-all.sh

printf '\n%s\n' 'NPM downloader input handling:'
fd -i 'download-npm' scripts/lockfile-generators
sed -n '1,220p' scripts/lockfile-generators/download-npm.sh

printf '\n%s\n' 'Pull-request Tekton files grouped by component directory and flavor:'
python3 - <<'PY'
from pathlib import Path
import re
from collections import defaultdict

groups = defaultdict(list)
for path in sorted(Path(".tekton").glob("*pull-request*.yaml")):
    text = path.read_text()
    m = re.search(
        r'(?m)^\s*value:\s*["\']?([^"\']*?/Dockerfile\.konflux\.([A-Za-z0-9_-]+))["\']?\s*$',
        text,
    )
    if not m:
        continue
    dockerfile, flavor = m.groups()
    component = dockerfile.rsplit("/Dockerfile.konflux.", 1)[0]
    groups[component].append((flavor, str(path), dockerfile))

for component, entries in groups.items():
    flavors = sorted({flavor for flavor, _, _ in entries})
    if len(flavors) > 1:
        print(component)
        for flavor, path, dockerfile in entries:
            print(f"  {flavor}: {path} -> {dockerfile}")
PY

Repository: red-hat-data-services/notebooks

Length of output: 12884


🏁 Script executed:

#!/usr/bin/env bash
set -u

python3 - <<'PY'
from pathlib import Path
from collections import defaultdict
import re

# Extract the scalar immediately following a dockerfile parameter.
records = []
for path in sorted(Path(".tekton").glob("*pull-request*.yaml")):
    lines = path.read_text().splitlines()
    for i, line in enumerate(lines):
        if re.match(r"^\s*-\s*name:\s*dockerfile\s*$", line):
            for value_line in lines[i + 1:i + 5]:
                m = re.match(r"^\s*value:\s*[\"']?([^\"']+?)[\"']?\s*$", value_line)
                if m:
                    dockerfile = m.group(1).strip()
                    if "/Dockerfile.konflux." in dockerfile:
                        component, flavor = dockerfile.rsplit("/Dockerfile.konflux.", 1)
                        records.append((component, flavor, str(path), dockerfile))
                    break
            break

by_component = defaultdict(list)
for record in records:
    by_component[record[0]].append(record)

print(f"pull-request YAMLs with Konflux dockerfiles: {len(records)}")
print(f"components represented: {len(by_component)}")
print("\nComponents with multiple matching pull-request YAMLs:")
collision_count = 0
for component in sorted(by_component):
    entries = by_component[component]
    if len(entries) > 1:
        collision_count += 1
        print(component)
        for _, flavor, path, dockerfile in entries:
            print(f"  {flavor}\t{path}\t{dockerfile}")
if collision_count == 0:
    print("  none")

print("\nFlavor distribution:")
flavors = defaultdict(int)
for _, flavor, _, _ in records:
    flavors[flavor] += 1
for flavor, count in sorted(flavors.items()):
    print(f"  {flavor}: {count}")

print("\nFirst matching YAML for each component under lexical glob order:")
for component in sorted(by_component):
    first = by_component[component][0]
    print(f"{component}\t{first[1]}\t{first[2]}")
PY

printf '\nDockerfiles with multiple Konflux flavors:\n'
find . -type f -name 'Dockerfile.konflux.*' -print \
  | sed 's#^\./##' \
  | awk '
    {
      path=$0
      sub(/\/Dockerfile\.konflux\.[^/]+$/, "", path)
      count[path]++
      files[path]=files[path] "\n    " $0
    }
    END {
      for (path in count)
        if (count[path] > 1)
          print path ":" files[path]
    }
  ' | sort

Repository: red-hat-data-services/notebooks

Length of output: 2887


🏁 Script executed:

#!/usr/bin/env bash
set -u

for f in \
  .tekton/odh-workbench-jupyter-minimal-cpu-py312-pull-request.yaml \
  .tekton/odh-workbench-jupyter-minimal-cuda-py312-pull-request.yaml \
  .tekton/odh-workbench-jupyter-minimal-rocm-py312-pull-request.yaml
do
  printf '\n--- %s ---\n' "$f"
  rg -n -C 3 'name: dockerfile|name: prefetch-input|type: npm|path:|build-args-file' "$f"
done

printf '\nFlavor-specific Dockerfiles and package-lock locations:\n'
for f in \
  jupyter/minimal/ubi9-python-3.12/Dockerfile.konflux.cpu \
  jupyter/minimal/ubi9-python-3.12/Dockerfile.konflux.cuda \
  jupyter/minimal/ubi9-python-3.12/Dockerfile.konflux.rocm
do
  printf '\n--- %s ---\n' "$f"
  rg -n '^(FROM|COPY|ADD)|package-lock|package\.json|prefetch-input|npm' "$f" || true
done

printf '\nNPM prefetch paths by YAML (textual YAML extraction):\n'
python3 - <<'PY'
from pathlib import Path
import re

files = [
    Path(".tekton/odh-workbench-jupyter-minimal-cpu-py312-pull-request.yaml"),
    Path(".tekton/odh-workbench-jupyter-minimal-cuda-py312-pull-request.yaml"),
    Path(".tekton/odh-workbench-jupyter-minimal-rocm-py312-pull-request.yaml"),
]
for path in files:
    lines = path.read_text().splitlines()
    dockerfile = next(
        (re.match(r"\s*value:\s*[\"']?([^\"']+?)[\"']?\s*$", lines[i + 1]).group(1)
         for i, line in enumerate(lines[:-1])
         if re.match(r"\s*-\s*name:\s*dockerfile\s*$", line)
         and re.match(r"\s*value:", lines[i + 1])),
        "<not found>",
    )
    npm_paths = []
    in_npm = False
    for i, line in enumerate(lines):
        if re.match(r"\s*-\s*type:\s*npm\s*$", line):
            in_npm = True
        elif in_npm:
            m = re.match(r"\s*path:\s*(\S+)\s*$", line)
            if m:
                npm_paths.append(m.group(1))
                in_npm = False
            elif re.match(r"\s*-\s*type:", line):
                in_npm = False
    print(path)
    print(f"  dockerfile: {dockerfile}")
    print(f"  npm paths: {npm_paths}")
PY

Repository: red-hat-data-services/notebooks

Length of output: 3249


Make find_tekton_yaml flavor-aware.

jupyter/minimal/ubi9-python-3.12 has CPU, CUDA, and ROCm pull-request YAML files. head -1 selects the CPU file for every resolved flavor. The current files have no npm inputs, but this can select incorrect npm inputs when flavor-specific inputs exist. Match Dockerfile.konflux.${FLAVOR} exactly.

🤖 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 `@scripts/lockfile-generators/prefetch-all.sh` at line 163, Update
find_tekton_yaml to select the Tekton YAML whose Dockerfile declaration matches
Dockerfile.konflux.${FLAVOR} exactly, rather than relying on head -1. Pass the
resolved FLAVOR from the surrounding prefetch flow so CPU, CUDA, and ROCm
configurations resolve their corresponding YAML and inputs.

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.

1 participant