Skip to content

Commit f38d5dc

Browse files
committed
Use the AIPCC Python package index
This also adds hermetic support for Python and RPMs. Yarn is still work in progress due to missing GitHub dependency support. Signed-off-by: mprahl <mprahl@users.noreply.github.com>
1 parent 8ac2dae commit f38d5dc

10 files changed

Lines changed: 721 additions & 68 deletions

File tree

.tekton/mlflow-pull-request.yaml

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,70 @@ apiVersion: tekton.dev/v1
22
kind: PipelineRun
33
metadata:
44
annotations:
5-
build.appstudio.openshift.io/repo: https://github.com/opendatahub-io/mlflow?rev={{revision}}
5+
build.appstudio.openshift.io/repo: https://github.com/red-hat-data-services/mlflow?rev={{revision}}
66
build.appstudio.redhat.com/commit_sha: '{{revision}}'
77
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
8-
build.appstudio.redhat.com/pull_request_number: '{{pull_request_number}}'
9-
pipelinesascode.tekton.dev/cancel-in-progress: "false"
8+
build.appstudio.redhat.com/pull_request_number: "{{pull_request_number}}"
109
pipelinesascode.tekton.dev/max-keep-runs: "3"
11-
pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch
12-
== "master"
13-
creationTimestamp: null
10+
pipelinesascode.tekton.dev/on-comment: "^/build-konflux mlflow"
11+
pipelinesascode.tekton.dev/on-event: "[pull_request]"
12+
pipelinesascode.tekton.dev/cancel-in-progress: "true"
1413
labels:
15-
appstudio.openshift.io/application: opendatahub-builds
16-
appstudio.openshift.io/component: mlflow-ci
14+
appstudio.openshift.io/application: automation
15+
appstudio.openshift.io/component: pull-request-pipelines-mlflow
1716
pipelines.appstudio.openshift.io/type: build
1817
name: mlflow-on-pull-request
19-
namespace: open-data-hub-tenant
18+
namespace: rhoai-tenant
2019
spec:
2120
params:
2221
- name: git-url
2322
value: '{{source_url}}'
2423
- name: revision
2524
value: '{{revision}}'
25+
- name: additional-tags
26+
value:
27+
- 'pr-{{pull_request_number}}-into-{{target_branch}}'
28+
- name: additional-labels
29+
value:
30+
- version=on-pr-{{revision}}
31+
- io.openshift.tags=mlflow
2632
- name: output-image
27-
value: quay.io/opendatahub/mlflow:odh-pr
33+
value: quay.io/rhoai/pull-request-pipelines:mlflow-{{revision}}
34+
- name: rhoai-version
35+
value: "3.4.0-ea.1"
2836
- name: dockerfile
2937
value: Dockerfile.konflux
3038
- name: path-context
3139
value: .
32-
- name: additional-tags
33-
value:
34-
- 'odh-pr-{{revision}}'
35-
- name: pipeline-type
36-
value: pull-request
40+
- name: hermetic
41+
value: false
42+
- name: prefetch-input
43+
value: |
44+
[{"type": "pip", "path": ".", "requirements_files": ["requirements/konflux-extra.txt"]}, {"type": "rpm", "path": "requirements"}]
45+
- name: build-source-image
46+
value: true
47+
- name: build-image-index
48+
value: true
3749
- name: build-platforms
3850
value:
39-
- linux-extra-fast/amd64
51+
- linux/x86_64
52+
- linux-m2xlarge/arm64
53+
- linux/ppc64le
54+
- name: image-expires-after
55+
value: 5d
56+
- name: enable-slack-failure-notification
57+
value: "false"
4058
pipelineRef:
4159
resolver: git
4260
params:
4361
- name: url
44-
value: https://github.com/opendatahub-io/odh-konflux-central.git
62+
value: https://github.com/red-hat-data-services/konflux-central.git
4563
- name: revision
46-
value: main
64+
value: '{{ target_branch }}'
4765
- name: pathInRepo
48-
value: pipeline/multi-arch-container-build.yaml
66+
value: pipelines/multi-arch-container-build.yaml
4967
taskRunTemplate:
50-
serviceAccountName: build-pipeline-mlflow
68+
serviceAccountName: build-pipeline-pull-request-pipelines
5169
workspaces:
5270
- name: git-auth
5371
secret:

.tekton/mlflow-push.yaml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,63 @@ apiVersion: tekton.dev/v1
22
kind: PipelineRun
33
metadata:
44
annotations:
5-
build.appstudio.openshift.io/repo: https://github.com/opendatahub-io/mlflow?rev={{revision}}
5+
build.appstudio.openshift.io/repo: https://github.com/red-hat-data-services/mlflow?rev={{revision}}
66
build.appstudio.redhat.com/commit_sha: '{{revision}}'
77
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
8-
pipelinesascode.tekton.dev/cancel-in-progress: "false"
98
pipelinesascode.tekton.dev/max-keep-runs: "3"
10-
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch
11-
== "master"
9+
pipelinesascode.tekton.dev/on-cel-expression: |
10+
event == "push"
11+
&& target_branch == "rhoai-3.4"
12+
&& ( !".tekton/**".pathChanged() || ".tekton/mlflow-push.yaml".pathChanged() )
1213
creationTimestamp: null
1314
labels:
14-
appstudio.openshift.io/application: opendatahub-builds
15-
appstudio.openshift.io/component: mlflow-ci
15+
appstudio.openshift.io/application: rhoai-v3-4
16+
appstudio.openshift.io/component: mlflow-v3-4
1617
pipelines.appstudio.openshift.io/type: build
17-
name: mlflow-on-push
18-
namespace: open-data-hub-tenant
18+
name: mlflow-v3-4-on-push
19+
namespace: rhoai-tenant
1920
spec:
2021
params:
2122
- name: git-url
2223
value: '{{source_url}}'
2324
- name: revision
2425
value: '{{revision}}'
26+
- name: additional-tags
27+
value:
28+
- '{{target_branch}}-{{revision}}'
2529
- name: output-image
26-
value: quay.io/opendatahub/mlflow:odh-stable
30+
value: quay.io/rhoai/odh-mlflow-rhel9:{{target_branch}}
31+
- name: rhoai-version
32+
value: "3.4.0-ea.1"
2733
- name: dockerfile
2834
value: Dockerfile.konflux
2935
- name: path-context
3036
value: .
37+
- name: hermetic
38+
value: false
39+
- name: prefetch-input
40+
value: |
41+
[{"type": "pip", "path": ".", "requirements_files": ["requirements/konflux-extra.txt"]}, {"type": "rpm", "path": "requirements"}]
42+
- name: build-source-image
43+
value: true
44+
- name: build-image-index
45+
value: true
3146
- name: build-platforms
3247
value:
33-
- linux-extra-fast/amd64
48+
- linux/x86_64
49+
- linux-m2xlarge/arm64
50+
- linux/ppc64le
3451
pipelineRef:
3552
resolver: git
3653
params:
3754
- name: url
38-
value: https://github.com/opendatahub-io/odh-konflux-central.git
55+
value: https://github.com/red-hat-data-services/konflux-central.git
3956
- name: revision
40-
value: main
57+
value: '{{ target_branch }}'
4158
- name: pathInRepo
42-
value: pipeline/multi-arch-container-build.yaml
59+
value: pipelines/multi-arch-container-build.yaml
4360
taskRunTemplate:
44-
serviceAccountName: build-pipeline-mlflow
61+
serviceAccountName: build-pipeline-mlflow-v3-4
4562
workspaces:
4663
- name: git-auth
4764
secret:

Dockerfile.konflux

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,19 @@ ENV MLFLOW_ENABLE_AI_GATEWAY=false
99
RUN yarn install --silent \
1010
&& NODE_OPTIONS="--max_old_space_size=4096" yarn build
1111

12-
FROM registry.access.redhat.com/ubi9/python-311@sha256:bb09d55bce99b839b0df565ab9e244cdc545037e612dad388569016137367cab AS python-builder
12+
FROM registry.access.redhat.com/ubi9/python-312:9.7@sha256:bcdbab62d80f7dd88b4c2ce69a5cf8e9e1e367ac39b2e5d7f5d3f532d936ec80 AS python-builder
1313
WORKDIR /src
1414
USER 0
15-
COPY --chown=1001:0 . .
16-
RUN set -eux; \
17-
python -m pip install --no-cache-dir build; \
18-
cp pyproject.release.toml pyproject.toml; \
19-
python -m build --wheel --outdir /tmp/dist libs/tracing; \
20-
python -m build --wheel --outdir /tmp/dist libs/skinny; \
21-
python -m build --wheel --outdir /tmp/dist; \
15+
COPY --chown=1001:0 kubernetes-workspace-provider/ kubernetes-workspace-provider/
16+
# Unset Cachi2 pip overrides (auto-injected by Konflux) so we can
17+
# fetch from the AIPCC Python package index.
18+
RUN unset PIP_NO_INDEX PIP_FIND_LINKS && \
19+
python -m pip install --no-cache-dir \
20+
--index-url https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4-EA1/cpu-ubi9-test/simple \
21+
build && \
2222
python -m build --wheel --outdir /tmp/dist kubernetes-workspace-provider
2323

24-
FROM registry.access.redhat.com/ubi9/python-311@sha256:bb09d55bce99b839b0df565ab9e244cdc545037e612dad388569016137367cab
25-
# Build cryptography from source against the system OpenSSL for FIPS compliance.
26-
# The pip manylinux wheel bundles its own non-FIPS OpenSSL, so we must compile
27-
# from source with OPENSSL_NO_VENDOR=1 to link against the system library.
28-
RUN set -eux; \
29-
dnf install -y --setopt=tsflags=nodocs openssl-devel cargo rust gcc python3.11-devel && \
30-
OPENSSL_NO_VENDOR=1 python -m pip wheel --no-cache-dir --no-binary cryptography "cryptography>=43.0.0,<47" -w /tmp/dist && \
31-
dnf clean all
24+
FROM registry.access.redhat.com/ubi9/python-312:9.7@sha256:bcdbab62d80f7dd88b4c2ce69a5cf8e9e1e367ac39b2e5d7f5d3f532d936ec80
3225
ENV PYTHONDONTWRITEBYTECODE=1 \
3326
PYTHONUNBUFFERED=1 \
3427
MLFLOW_DISABLE_TELEMETRY=true \
@@ -39,26 +32,23 @@ WORKDIR /app
3932

4033
USER 0
4134
COPY --from=python-builder /tmp/dist/ /tmp/dist/
35+
COPY requirements/konflux.txt /tmp/konflux.txt
36+
COPY requirements/konflux-extra.txt /tmp/konflux-extra.txt
37+
# Unset Cachi2 pip overrides (auto-injected by Konflux) so we can
38+
# fetch from the AIPCC Python package index first, then re-source
39+
# cachi2.env for the hermetically prefetched extra packages.
4240
RUN set -eux; \
43-
dnf install -y --setopt=tsflags=nodocs postgresql-devel gcc python3.11-devel && \
44-
python -m pip install --no-cache-dir /tmp/dist/mlflow*.whl && \
45-
python -m pip install --no-cache-dir --force-reinstall /tmp/dist/cryptography-*.whl && \
46-
python -m pip install --no-cache-dir boto3 psycopg2 prometheus-flask-exporter && \
41+
dnf install -y --setopt=tsflags=nodocs postgresql-devel gcc python3.12-devel openblas-threads && \
42+
unset PIP_NO_INDEX PIP_FIND_LINKS && \
43+
python -m pip install --no-cache-dir \
44+
--index-url https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4-EA1/cpu-ubi9-test/simple \
45+
-r /tmp/konflux.txt && \
46+
if [ -f /cachi2/cachi2.env ]; then . /cachi2/cachi2.env; fi && \
47+
python -m pip install --no-cache-dir --no-deps --require-hashes \
48+
-r /tmp/konflux-extra.txt && \
49+
python -m pip install --no-cache-dir --no-deps /tmp/dist/mlflow_kubernetes_workspace_provider-*.whl && \
4750
dnf clean all && \
48-
rm -rf /tmp/dist
49-
50-
# FIPS compliance: verify the cryptography package uses the system OpenSSL
51-
# rather than a bundled copy. The system OpenSSL on UBI 9 is FIPS-validated
52-
# and will operate in FIPS mode when the host kernel has FIPS enabled.
53-
RUN set -eux; \
54-
sys_openssl=$(openssl version | awk '{print $1, $2, $3, $4, $5}'); \
55-
py_openssl=$(python -c "from cryptography.hazmat.backends.openssl.backend import backend; print(backend.openssl_version_text())"); \
56-
echo "System OpenSSL: ${sys_openssl}"; \
57-
echo "cryptography OpenSSL: ${py_openssl}"; \
58-
[ "${sys_openssl}" = "${py_openssl}" ] || { \
59-
echo "FIPS ERROR: cryptography is not using the system OpenSSL"; \
60-
exit 1; \
61-
}
51+
rm -rf /tmp/dist /tmp/konflux.txt /tmp/konflux-extra.txt
6252

6353
# Copy built UI from builder stage
6454
COPY --from=ui-builder /opt/app-root/src/build /tmp/mlflow-ui-build

requirements/konflux-extra.in

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Packages NOT available on the AIPCC Python package index that are
2+
# needed in the Konflux (RHOAI) container build. These are prefetched
3+
# hermetically by Cachi2 during the Konflux pipeline.
4+
#
5+
# All transitive dependencies of these packages are already satisfied by
6+
# the AIPCC Python package index (requirements/konflux.txt), so only these two
7+
# packages themselves need to be listed here.
8+
#
9+
# To regenerate the lock file (requirements/konflux-extra.txt), run:
10+
#
11+
# uv pip compile requirements/konflux-extra.in \
12+
# --python-platform linux --python-version 3.12 \
13+
# --no-deps --generate-hashes \
14+
# -o requirements/konflux-extra.txt
15+
16+
psycopg2
17+
prometheus-flask-exporter

requirements/konflux-extra.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile requirements/konflux-extra.in --python-platform linux --python-version 3.12 --no-deps --generate-hashes -o requirements/konflux-extra.txt
3+
prometheus-flask-exporter==0.23.2 \
4+
--hash=sha256:41fc9bbd7d48cc958ed8384aacf60c3621d9e903768be61c4e7f0c63872eaf1a \
5+
--hash=sha256:94922a636d4c1d8b68e1ee605c30a23e9bbb0b21756df8222aa919634871784c
6+
# via -r requirements/konflux-extra.in
7+
psycopg2==2.9.11 \
8+
--hash=sha256:103e857f46bb76908768ead4e2d0ba1d1a130e7b8ed77d3ae91e8b33481813e8 \
9+
--hash=sha256:210daed32e18f35e3140a1ebe059ac29209dd96468f2f7559aa59f75ee82a5cb \
10+
--hash=sha256:6ecddcf573777536bddfefaea8079ce959287798c8f5804bee6933635d538924 \
11+
--hash=sha256:8dc379166b5b7d5ea66dcebf433011dfc51a7bb8a5fc12367fa05668e5fc53c8 \
12+
--hash=sha256:964d31caf728e217c697ff77ea69c2ba0865fa41ec20bb00f0977e62fdcc52e3 \
13+
--hash=sha256:e03e4a6dbe87ff81540b434f2e5dc2bddad10296db5eea7bdc995bf5f4162938 \
14+
--hash=sha256:f10a48acba5fe6e312b891f290b4d2ca595fc9a06850fe53320beac353575578
15+
# via -r requirements/konflux-extra.in

requirements/konflux.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Top-level requirements for the Konflux (RHOAI) container build.
2+
#
3+
# To regenerate the lock file (requirements.konflux.txt), run:
4+
#
5+
# uv pip compile requirements/konflux.in \
6+
# --index-url https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4-EA1/cpu-ubi9-test/simple \
7+
# --python-platform linux --python-version 3.12 \
8+
# --prerelease=allow --generate-hashes \
9+
# -o requirements/konflux.txt
10+
#
11+
# Note: mlflow-kubernetes-workspace-provider is installed separately from the
12+
# repo (not from the package index). Its dependencies (mlflow, kubernetes,
13+
# graphql-core) are satisfied by the packages listed here.
14+
#
15+
# Packages not on the AIPCC Python package index (psycopg2, prometheus-flask-exporter)
16+
# are installed separately in the Dockerfile.
17+
18+
mlflow==3.10.0rc0+rhai1
19+
boto3
20+
prometheus-client

0 commit comments

Comments
 (0)