Skip to content

Commit 26ef3f0

Browse files
authored
Merge pull request #1074 from raptorsun/rhai-base-image
konflux: use RHAI base image
2 parents 0e5455a + 5d3522a commit 26ef3f0

14 files changed

Lines changed: 312 additions & 719 deletions

.tekton/lightspeed-stack-pull-request.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ spec:
5555
],
5656
"requirements_build_files": ["requirements-build.txt"],
5757
"binary": {
58-
"packages": "accelerate,aiohappyeyeballs,aiohttp,aiosignal,aiosqlite,annotated-doc,annotated-types,anyio,asyncpg,attrs,autoevals,cffi,charset-normalizer,chevron,click,cryptography,datasets,dill,distro,dnspython,durationpy,faiss-cpu,fire,frozenlist,fsspec,googleapis-common-protos,grpcio,h11,hf-xet,httpcore,httpx,httpx-sse,huggingface-hub,idna,jinja2,jiter,joblib,jsonschema-specifications,lxml,markdown-it-py,mdurl,mpmath,networkx,nltk,numpy,oauthlib,opentelemetry-api,opentelemetry-exporter-otlp,opentelemetry-exporter-otlp-proto-common,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-exporter-otlp-proto-http,opentelemetry-instrumentation,opentelemetry-proto,opentelemetry-sdk,opentelemetry-semantic-conventions,packaging,pandas,pillow,ply,polyleven,prompt-toolkit,propcache,proto-plus,psycopg2-binary,pyaml,pyarrow,pyasn1,pyasn1-modules,pydantic,pydantic-core,pydantic-settings,pygments,python-dateutil,python-dotenv,pytz,pyyaml,referencing,requests,requests-oauthlib,rpds-py,rsa,safetensors,scikit-learn,scipy,setuptools,six,sniffio,sqlalchemy,starlette,sympy,threadpoolctl,tiktoken,tokenizers,torch,tornado,transformers,triton,typing-extensions,typing-inspection,tzdata,websocket-client,wrapt,xxhash,yarl,zipp,uv,pip,maturin",
58+
"packages": "accelerate,aiohappyeyeballs,aiohttp,aiosignal,aiosqlite,annotated-doc,annotated-types,anyio,asyncpg,attrs,autoevals,cffi,charset-normalizer,chevron,click,cryptography,datasets,dill,distro,dnspython,durationpy,faiss-cpu,fire,frozenlist,fsspec,googleapis-common-protos,grpcio,h11,hf-xet,httpcore,httpx,httpx-sse,idna,jinja2,jiter,joblib,jsonschema-specifications,lxml,markdown-it-py,mdurl,mpmath,networkx,nltk,numpy,oauthlib,opentelemetry-api,opentelemetry-exporter-otlp,opentelemetry-exporter-otlp-proto-common,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-exporter-otlp-proto-http,opentelemetry-instrumentation,opentelemetry-proto,opentelemetry-sdk,opentelemetry-semantic-conventions,packaging,pandas,pillow,ply,prompt-toolkit,propcache,psycopg2-binary,pyaml,pyarrow,pyasn1,pyasn1-modules,pydantic,pydantic-core,pydantic-settings,pygments,python-dateutil,python-dotenv,pytz,pyyaml,referencing,requests,requests-oauthlib,rpds-py,rsa,safetensors,scikit-learn,scipy,setuptools,six,sniffio,sqlalchemy,starlette,sympy,threadpoolctl,tiktoken,tokenizers,torch,tornado,transformers,triton,typing-extensions,typing-inspection,tzdata,websocket-client,wrapt,xxhash,yarl,zipp,uv,pip,maturin",
5959
"os": "linux",
6060
"arch": "x86_64,aarch64",
6161
"py_version": 312
@@ -66,6 +66,8 @@ spec:
6666
value: 'true'
6767
- name: dockerfile
6868
value: Containerfile
69+
- name: build-args-file
70+
value: build-args-konflux.conf
6971
pipelineSpec:
7072
description: |
7173
This pipeline is ideal for building multi-arch container images from a Containerfile while maintaining trust after pipeline customization.

.tekton/lightspeed-stack-push.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
],
4848
"requirements_build_files": ["requirements-build.txt"],
4949
"binary": {
50-
"packages": "accelerate,aiohappyeyeballs,aiohttp,aiosignal,aiosqlite,annotated-doc,annotated-types,anyio,asyncpg,attrs,autoevals,cffi,charset-normalizer,chevron,click,cryptography,datasets,dill,distro,dnspython,durationpy,faiss-cpu,fire,frozenlist,fsspec,googleapis-common-protos,grpcio,h11,hf-xet,httpcore,httpx,httpx-sse,huggingface-hub,idna,jinja2,jiter,joblib,jsonschema-specifications,lxml,markdown-it-py,mdurl,mpmath,networkx,nltk,numpy,oauthlib,opentelemetry-api,opentelemetry-exporter-otlp,opentelemetry-exporter-otlp-proto-common,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-exporter-otlp-proto-http,opentelemetry-instrumentation,opentelemetry-proto,opentelemetry-sdk,opentelemetry-semantic-conventions,packaging,pandas,pillow,ply,polyleven,prompt-toolkit,propcache,proto-plus,psycopg2-binary,pyaml,pyarrow,pyasn1,pyasn1-modules,pydantic,pydantic-core,pydantic-settings,pygments,python-dateutil,python-dotenv,pytz,pyyaml,referencing,requests,requests-oauthlib,rpds-py,rsa,safetensors,scikit-learn,scipy,setuptools,six,sniffio,sqlalchemy,starlette,sympy,threadpoolctl,tiktoken,tokenizers,torch,tornado,transformers,triton,typing-extensions,typing-inspection,tzdata,websocket-client,wrapt,xxhash,yarl,zipp,uv,pip,maturin",
50+
"packages": "accelerate,aiohappyeyeballs,aiohttp,aiosignal,aiosqlite,annotated-doc,annotated-types,anyio,asyncpg,attrs,autoevals,cffi,charset-normalizer,chevron,click,cryptography,datasets,dill,distro,dnspython,durationpy,faiss-cpu,fire,frozenlist,fsspec,googleapis-common-protos,grpcio,h11,hf-xet,httpcore,httpx,httpx-sse,idna,jinja2,jiter,joblib,jsonschema-specifications,lxml,markdown-it-py,mdurl,mpmath,networkx,nltk,numpy,oauthlib,opentelemetry-api,opentelemetry-exporter-otlp,opentelemetry-exporter-otlp-proto-common,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-exporter-otlp-proto-http,opentelemetry-instrumentation,opentelemetry-proto,opentelemetry-sdk,opentelemetry-semantic-conventions,packaging,pandas,pillow,ply,prompt-toolkit,propcache,psycopg2-binary,pyaml,pyarrow,pyasn1,pyasn1-modules,pydantic,pydantic-core,pydantic-settings,pygments,python-dateutil,python-dotenv,pytz,pyyaml,referencing,requests,requests-oauthlib,rpds-py,rsa,safetensors,scikit-learn,scipy,setuptools,six,sniffio,sqlalchemy,starlette,sympy,threadpoolctl,tiktoken,tokenizers,torch,tornado,transformers,triton,typing-extensions,typing-inspection,tzdata,websocket-client,wrapt,xxhash,yarl,zipp,uv,pip,maturin",
5151
"os": "linux",
5252
"arch": "x86_64,aarch64",
5353
"py_version": 312
@@ -58,6 +58,8 @@ spec:
5858
value: 'true'
5959
- name: dockerfile
6060
value: Containerfile
61+
- name: build-args-file
62+
value: build-args-konflux.conf
6163
pipelineSpec:
6264
description: |
6365
This pipeline is ideal for building multi-arch container images from a Containerfile while maintaining trust after pipeline customization.

Containerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# vim: set filetype=dockerfile
2-
FROM registry.access.redhat.com/ubi9/python-312 AS builder
2+
ARG BUILDER_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312
3+
ARG BUILDER_DNF_COMMAND=dnf
4+
ARG RUNTIME_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312-minimal
5+
ARG RUNTIME_DNF_COMMAND=microdnf
36

7+
FROM ${BUILDER_BASE_IMAGE} AS builder
8+
9+
ARG BUILDER_DNF_COMMAND=dnf
410
ARG APP_ROOT=/app-root
511
ARG LSC_SOURCE_DIR=.
612

@@ -18,7 +24,7 @@ USER root
1824
# Install gcc - required by polyleven python package on aarch64
1925
# (dependency of autoevals, no pre-built binary wheels for linux on aarch64)
2026
# cmake and cargo are required by fastuuid, maturin
21-
RUN dnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs gcc cmake cargo
27+
RUN ${BUILDER_DNF_COMMAND} install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs gcc gcc-c++ cmake cargo
2228

2329
# Install uv package manager
2430
RUN pip3.12 install "uv>=0.8.15"
@@ -51,7 +57,8 @@ RUN if [ -f /cachi2/cachi2.env ]; then \
5157
RUN uv pip uninstall ecdsa
5258

5359
# Final image without uv package manager
54-
FROM registry.access.redhat.com/ubi9/python-312-minimal
60+
FROM ${RUNTIME_BASE_IMAGE}
61+
ARG RUNTIME_DNF_COMMAND=microdnf
5562
ARG APP_ROOT=/app-root
5663
WORKDIR /app-root
5764

@@ -79,7 +86,7 @@ COPY --from=builder /app-root/LICENSE /licenses/
7986
USER root
8087

8188
# Additional tools for derived images
82-
RUN microdnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs jq patch libpq libtiff openjpeg2 lcms2 libjpeg-turbo libwebp
89+
RUN ${RUNTIME_DNF_COMMAND} install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs jq patch
8390

8491
# Create llama-stack directories for library mode
8592
RUN mkdir -p /opt/app-root/src/.llama/storage /opt/app-root/src/.llama/providers.d && \

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ upload-distribution-archives: ## Upload distribution archives into Python regist
124124
konflux-requirements: ## generate hermetic requirements.*.txt file for konflux build
125125
./scripts/konflux_requirements.sh
126126

127+
konflux-rpm-lock: ## generate rpm.lock.yaml file for konflux build
128+
./scripts/generate-rpm-lock.sh
129+
127130
help: ## Show this help screen
128131
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
129132
@echo ''

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The service includes comprehensive user data collection capabilities for various
3636
* [1. Static Tokens from Files (Recommended for Service Credentials)](#1-static-tokens-from-files-recommended-for-service-credentials)
3737
* [2. Kubernetes Service Account Tokens (For K8s Deployments)](#2-kubernetes-service-account-tokens-for-k8s-deployments)
3838
* [3. Client-Provided Tokens (For Per-User Authentication)](#3-client-provided-tokens-for-per-user-authentication)
39+
* [Client-Authenticated MCP Servers Discovery](#client-authenticated-mcp-servers-discovery)
3940
* [Combining Authentication Methods](#combining-authentication-methods)
4041
* [Authentication Method Comparison](#authentication-method-comparison)
4142
* [Important: Automatic Server Skipping](#important-automatic-server-skipping)
@@ -768,6 +769,7 @@ verify Run all linters
768769
distribution-archives Generate distribution archives to be uploaded into Python registry
769770
upload-distribution-archives Upload distribution archives into Python registry
770771
konflux-requirements generate hermetic requirements.*.txt file for konflux build
772+
konflux-rpm-lock generate rpm.lock.yaml file for konflux build
771773
```
772774

773775
## Running Linux container image
@@ -1229,20 +1231,35 @@ The script also updates the Tekton pipeline configurations (`.tekton/lightspeed-
12291231

12301232
### Updating RPM Dependencies
12311233

1232-
**Prerequisites:** Install [rpm-lockfile-prototype](https://github.com/konflux-ci/rpm-lockfile-prototype?tab=readme-ov-file#installation)
1234+
**Prerequisites:**
1235+
- Install [rpm-lockfile-prototype](https://github.com/konflux-ci/rpm-lockfile-prototype?tab=readme-ov-file#installation)
1236+
- Have an active RHEL Subscription, get activation keys from [RH console](https://console.redhat.com/insights/connector/activation-keys)
1237+
- Have `dnf` installed in system
12331238

12341239
**Steps:**
12351240

12361241
1. **List your RPM packages** in `rpms.in.yaml` under the `packages` field
12371242

12381243
2. **If you changed the base image**, extract its repo file:
12391244
```shell
1245+
# UBI images
12401246
podman run -it $BASE_IMAGE cat /etc/yum.repos.d/ubi.repo > ubi.repo
1247+
# RHEL images
1248+
podman run -it $BASE_IMAGE cat /etc/yum.repos.d/redhat.repo > redhat.repo
1249+
```
1250+
If the repo file contains too many entries, we can filter them and keep only required repositories.
1251+
Here is the command to check active repositories:
1252+
```shell
1253+
dnf repolist
1254+
```
1255+
Replace the architecture tag (`uname -m`) to `$basearch` so that rpm-lockfile-prototype can replace it with requested architecture names.
1256+
```shell
1257+
sed -i "s/$(uname -m)/\$basearch/g" redhat.repo
12411258
```
12421259

1243-
3. **Generate the lock file**:
1260+
1. **Generate the lock file**:
12441261
```shell
1245-
rpm-lockfile-prototype --image $BASE_IMAGE rpms.in.yaml
1262+
make konflux-rpm-lock
12461263
```
12471264

12481265
This creates `rpms.lock.yaml` with pinned RPM versions.

build-args-konflux.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BUILDER_BASE_IMAGE=registry.redhat.io/rhai/base-image-cpu-rhel9:3.2
2+
BUILDER_DNF_COMMAND=dnf
3+
RUNTIME_BASE_IMAGE=registry.redhat.io/rhai/base-image-cpu-rhel9:3.2
4+
RUNTIME_DNF_COMMAND=dnf

redhat.repo

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[codeready-builder-for-rhel-9-$basearch-eus-rpms]
2+
name = Red Hat CodeReady Linux Builder for RHEL 9 $basearch - Extended Update Support (RPMs)
3+
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.6/$basearch/codeready-builder/os
4+
enabled = 1
5+
gpgcheck = 1
6+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
7+
sslverify = 1
8+
sslcacert = /etc/rhsm/ca/redhat-uep.pem
9+
sslverifystatus = 1
10+
metadata_expire = 86400
11+
enabled_metadata = 0
12+
sslclientkey = $SSL_CLIENT_KEY
13+
sslclientcert = $SSL_CLIENT_CERT
14+
15+
[rhel-9-for-$basearch-appstream-eus-rpms]
16+
name = Red Hat Enterprise Linux 9 for $basearch - AppStream - Extended Update Support (RPMs)
17+
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.6/$basearch/appstream/os
18+
enabled = 1
19+
gpgcheck = 1
20+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
21+
sslverify = 1
22+
sslcacert = /etc/rhsm/ca/redhat-uep.pem
23+
sslverifystatus = 1
24+
metadata_expire = 86400
25+
enabled_metadata = 0
26+
sslclientkey = $SSL_CLIENT_KEY
27+
sslclientcert = $SSL_CLIENT_CERT
28+
29+
[rhel-9-for-$basearch-baseos-eus-rpms]
30+
name = Red Hat Enterprise Linux 9 for $basearch - BaseOS - Extended Update Support (RPMs)
31+
baseurl = https://cdn.redhat.com/content/eus/rhel9/9.6/$basearch/baseos/os
32+
enabled = 1
33+
gpgcheck = 1
34+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
35+
sslverify = 1
36+
sslcacert = /etc/rhsm/ca/redhat-uep.pem
37+
sslverifystatus = 1
38+
metadata_expire = 86400
39+
enabled_metadata = 0
40+
sslclientkey = $SSL_CLIENT_KEY
41+
sslclientcert = $SSL_CLIENT_CERT
42+
43+
[rhocp-4.17-for-rhel-9-$basearch-rpms]
44+
name = Red Hat OpenShift Container Platform 4.17 for RHEL 9 $basearch (RPMs)
45+
baseurl = https://cdn.redhat.com/content/dist/layered/rhel9/$basearch/rhocp/4.17/os
46+
enabled = 0
47+
gpgcheck = 1
48+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
49+
sslverify = 1
50+
sslcacert = /etc/rhsm/ca/redhat-uep.pem
51+
sslverifystatus = 1
52+
metadata_expire = 86400
53+
enabled_metadata = 0
54+
sslclientkey = $SSL_CLIENT_KEY
55+
sslclientcert = $SSL_CLIENT_CERT
56+
57+
[rhocp-4.17-for-rhel-9-$basearch-source-rpms]
58+
name = Red Hat OpenShift Container Platform 4.17 for RHEL 9 $basearch (Source RPMs)
59+
baseurl = https://cdn.redhat.com/content/dist/layered/rhel9/$basearch/rhocp/4.17/source/SRPMS
60+
enabled = 0
61+
gpgcheck = 1
62+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
63+
sslverify = 1
64+
sslcacert = /etc/rhsm/ca/redhat-uep.pem
65+
sslverifystatus = 1
66+
metadata_expire = 86400
67+
enabled_metadata = 0
68+
sslclientkey = $SSL_CLIENT_KEY
69+
sslclientcert = $SSL_CLIENT_CERT

requirements-build.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.13
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pybuild-deps compile --output-file=requirements-build.txt requirements.source.txt
@@ -56,6 +56,7 @@ maturin==1.10.2
5656
# via fastuuid
5757
packaging==26.0
5858
# via
59+
# dunamai
5960
# hatchling
6061
# setuptools-scm
6162
# wheel
@@ -122,7 +123,9 @@ setuptools==80.10.2
122123
# multiprocess
123124
# pathspec
124125
# pluggy
126+
# polyleven
125127
# prometheus-client
128+
# proto-plus
126129
# psutil
127130
# pycparser
128131
# pycryptodomex

0 commit comments

Comments
 (0)