Skip to content

Commit 8460b61

Browse files
committed
konflux: hermetic build
Signed-off-by: Haoyu Sun <[email protected]>
1 parent fa2121a commit 8460b61

File tree

9 files changed

+3659
-53
lines changed

9 files changed

+3659
-53
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@ spec:
2727
value: quay.io/redhat-user-workloads/lightspeed-core-tenant/lightspeed-stack:on-pr-{{revision}}
2828
- name: image-expires-after
2929
value: 5d
30+
# todo: add arm64. refer to https://konflux.pages.redhat.com/docs/users/getting-started/multi-platform-builds.html#arm64-2
3031
- name: build-platforms
3132
value:
3233
- linux/x86_64
34+
# todo: change on-push pipeline,too
35+
- name: build-source-image
36+
value: 'true'
37+
- name: prefetch-input
38+
value: '[{"type": "rpm", "path": "."}, {"type": "pip", "path": ".", "allow_binary": "true"}]'
39+
- name: hermetic
40+
value: 'true'
3341
- name: dockerfile
3442
value: Containerfile
3543
pipelineSpec:

Containerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ RUN pip3.12 install "uv==0.8.15"
2222
# Add explicit files and directories
2323
# (avoid accidental inclusion of local directories or env files or credentials)
2424
COPY ${LSC_SOURCE_DIR}/src ./src
25-
COPY ${LSC_SOURCE_DIR}/pyproject.toml ${LSC_SOURCE_DIR}/LICENSE ${LSC_SOURCE_DIR}/README.md ${LSC_SOURCE_DIR}/uv.lock ./
25+
COPY ${LSC_SOURCE_DIR}/pyproject.toml ${LSC_SOURCE_DIR}/LICENSE ${LSC_SOURCE_DIR}/README.md ${LSC_SOURCE_DIR}/uv.lock ${LSC_SOURCE_DIR}/requirements.txt ./
2626

2727
# Bundle additional dependencies for library mode.
28-
RUN uv sync --locked --no-dev --group llslibdev
28+
# Source cachi2 environment for hermetic builds if available, otherwise use normal installation
29+
RUN if [ -f /cachi2/cachi2.env ]; then \
30+
. /cachi2/cachi2.env && cat /cachi2/cachi2.env && uv venv && uv pip sync --group llslibdev-hermetic pyproject.toml; \
31+
else \
32+
uv sync --locked --no-dev --group llslibdev; \
33+
fi
2934

3035
# Explicitly remove some packages to mitigate some CVEs
3136
# - GHSA-wj6h-64fc-37mp: python-ecdsa package won't fix it upstream.

pyproject.toml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,23 @@ Issues = "https://github.com/lightspeed-core/lightspeed-stack/issues"
8686
name = "pytorch-cpu"
8787
url = "https://download.pytorch.org/whl/cpu"
8888
explicit = true
89+
90+
[[tool.uv.index]]
91+
name = "pypi-default"
92+
url = "https://pypi.org/simple"
93+
explicit = true
8994
[tool.uv.sources]
90-
torch = [{ index = "pytorch-cpu" }]
95+
torch = [
96+
{ index = "pytorch-cpu", group = "llslibdev" },
97+
{ index = "pypi-default", group = "llslibdev-hermetic" }
98+
]
99+
[tool.uv]
100+
conflicts = [
101+
[
102+
{ group = "llslibdev" },
103+
{ group = "llslibdev-hermetic" },
104+
],
105+
]
91106

92107
[dependency-groups]
93108
dev = [
@@ -160,6 +175,54 @@ llslibdev = [
160175
"blobfile>=3.0.0",
161176
"psutil>=7.0.0",
162177
]
178+
llslibdev-hermetic = [
179+
# the same as llslibdev, just using default index.
180+
"matplotlib>=3.10.0",
181+
"pillow>=11.1.0",
182+
"pandas>=2.2.3",
183+
"scikit-learn>=1.5.2",
184+
"psycopg2-binary>=2.9.10",
185+
# API eval: inline::meta-reference
186+
"tree_sitter>=0.24.0",
187+
"pythainlp>=3.0.10",
188+
"langdetect>=1.0.9",
189+
"emoji>=2.1.0",
190+
"nltk>=3.8.1",
191+
# API inference: remote::gemini
192+
"litellm>=1.75.5.post1",
193+
# API inference: inline::sentence-transformers
194+
"sentence-transformers>=5.0.0",
195+
# API vector_io: inline::faiss
196+
"faiss-cpu>=1.11.0",
197+
# API scoring: inline::basic
198+
"requests>=2.32.4",
199+
# API datasetio: inline::localfs
200+
"aiosqlite>=0.21.0",
201+
# API datasetio: remote::huggingface
202+
"datasets>=3.6.0",
203+
# API telemetry: inline::meta-reference
204+
"opentelemetry-sdk>=1.34.1",
205+
"opentelemetry-exporter-otlp>=1.34.1",
206+
# API tool_runtime: inline::rag-runtime
207+
"transformers>=4.34.0",
208+
"numpy==2.2.6",
209+
# API tool_runtime: remote::model-context-protocol
210+
"mcp>=1.9.4",
211+
# API post_training: inline::huggingface
212+
"torch==2.7.1",
213+
"trl>=0.18.2",
214+
"peft>=0.15.2",
215+
# Other
216+
"autoevals>=0.0.129",
217+
"fire>=0.7.0",
218+
"opentelemetry-instrumentation>=0.55b0",
219+
"blobfile>=3.0.0",
220+
"psutil>=7.0.0",
221+
]
222+
tool-hermetic = [
223+
"uv==0.8.15",
224+
"pdm>=2.21.0",
225+
]
163226

164227
build = [
165228
"build>=1.2.2.post1",

requirements.hermetic.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
uv==0.8.15
2+
pdm>=2.21.0

requirements.txt

Lines changed: 2555 additions & 0 deletions
Large diffs are not rendered by default.

rpms.in.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages: [gcc, jq, patch]
2+
contentOrigin:
3+
repofiles: ["./ubi.repo"]
4+
arches: [x86_64, aarch64]

0 commit comments

Comments
 (0)