Skip to content

Conversation

@mikebonnet
Copy link
Collaborator

@mikebonnet mikebonnet commented Oct 31, 2025

Konflux supports prefetching dependencies via Hermeto. This allows for creation of more accurate SBOMs and source containers, and will improve the performance and reliability of builds when caching is implemented.

Retrieve dependencies for the -rag images using prefetch, and run the uv pip install command offline.

Summary by Sourcery

Enable prefetching Python dependencies for RAG container images using Hermeto and uv to generate accurate SBOMs and support offline pip installs in CI builds.

New Features:

  • Generate and split requirements files per backend and index using uv pip compile and an AWK script to enable Hermeto prefetch.
  • Add uv version check and incorporate offline pip install logic in build_rag.sh, including a fixup for gguf package archives.
  • Inject prefetch-input configuration blocks into Tekton pipelines for CUDA, ROCm, Intel GPU, and CPU RAG images.

Enhancements:

  • Refactor Makefiles to handle multiple Python versions and platforms, rename and combine requirement targets, and orchestrate generation of prefetched requirement files.
  • Update root Makefile rag-requirements target to trigger all new prefetched requirement files.

Konflux prefetch (Hermeto) supports downloading packages from indexes other than pypi, via
the --index-url option. However, only one --index-url may be specified per requriements file
and all packages in that file will be retrieved from that index.

Split the requirements files generated by "uv pip compile" into separate files by index.

Generate requirements files for build dependencies, as required by Hermeto.

Signed-off-by: Mike Bonnet <[email protected]>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 31, 2025

Reviewer's Guide

This PR integrates Hermeto-based prefetching into the -rag image build process by overhauling Makefile rules for uv pip compilation, splitting and naming requirement files per index, updating the build script for offline installation with gguf fixups, and injecting prefetch configuration into Tekton pipelines.

File-Level Changes

Change Details Files
Overhaul Makefiles to drive uv-based prefetch and dynamic requirement compilation
  • Rename version/platform variables and derive per-backend values
  • Introduce check-uv target enforcing minimum uv version
  • Implement combined and split requirement targets with uv pip compile
  • Update rag-requirements target and root Makefile invoke
  • Parameterize Python version and platform per backend and architecture
container-images/common/Makefile
Makefile
Add script to split compiled requirements by index source
  • Create split-reqs.awk to parse --emit-index-annotation output
  • Generate per-index requirement files preserving headers
  • Prevent manual edits by embedding generation comment
container-images/common/split-reqs.awk
Enhance build_rag.sh for offline installation and gguf repackaging
  • Assemble uv pip install arguments for multiple index files
  • Comment out index-url lines and use PIP_FIND_LINKS with --offline
  • Add fixup_gguf to repackage gguf tarball and update checksum
  • Replace legacy uv pip sync calls and clean up temporary artifacts
container-images/scripts/build_rag.sh
Rename and introduce per-backend/index requirement files
  • Strip requirements-rag prefix and rename to backend.txt
  • Add pypi.org and download.pytorch.org variants per backend and arch
  • Create build.txt and build-cuda.txt for build-time dependencies
  • Add requirements-rag-build.in input for build targets
container-images/common/requirements-rag.in
container-images/common/requirements-rag-build.in
container-images/common/build.txt
container-images/common/build-cuda.txt
container-images/common/cpu-pypi.org.txt
container-images/common/cpu-download.pytorch.org.txt
container-images/common/cpu-aarch64-pypi.org.txt
container-images/common/cpu-aarch64-download.pytorch.org.txt
container-images/common/cu128-pypi.org.txt
container-images/common/cu128-download.pytorch.org.txt
container-images/common/cu128-aarch64-pypi.org.txt
container-images/common/cu128-aarch64-download.pytorch.org.txt
container-images/common/rocm6.3-pypi.org.txt
container-images/common/rocm6.3-download.pytorch.org.txt
container-images/common/xpu-pypi.org.txt
container-images/common/xpu-download.pytorch.org.txt
Inject Hermeto prefetch-input into Tekton pipeline specs
  • Add prefetch-input section with pip type and file lists
  • Reference both requirements_files and requirements_build_files
  • Enable binary caching directive for :all: packages
.tekton/cuda-rag/cuda-rag-pull-request.yaml
.tekton/cuda-rag/cuda-rag-push.yaml
.tekton/ramalama-rag/ramalama-rag-pull-request.yaml
.tekton/ramalama-rag/ramalama-rag-push.yaml
.tekton/intel-gpu-rag/intel-gpu-rag-pull-request.yaml
.tekton/intel-gpu-rag/intel-gpu-rag-push.yaml
.tekton/rocm-rag/rocm-rag-pull-request.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Konflux supports prefetching dependencies via Hermeto. This allows for creation of more
accurate SBOMs and source containers, and will improve the performance and reliability
of builds when caching is implemented.

When using prefetched dependencies (indicated by PIP_FIND_LINKS being set), run
"uv pip install" in offline mode.

Signed-off-by: Mike Bonnet <[email protected]>
@mikebonnet mikebonnet force-pushed the konflux-rag-deps-prefetch branch from 6cd28b2 to c365af7 Compare October 31, 2025 23:23
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.

2 participants