Skip to content

Commit 1721a92

Browse files
RHAIENG-5164: build: remove Dockerfile symlinks and rename KONFLUX to PRODUCT (#3984)
Complete PR2 cleanup after Dockerfile.konflux.* migration: drop legacy Dockerfile.cpu|cuda|rocm symlinks, remove the alignment checker, rename KONFLUX=yes|no to PRODUCT=odh|rhoai, and update CI helpers, workflows, and docs accordingly. * RHAIENG-5164: fix: detect Dockerfile.konflux.* flavors in pylocks_generator After symlink removal, detect_flavors() still looked for Dockerfile.cpu and siblings, so generate_code.sh found no flavors and failed lock generation for every notebook image. * RHAIENG-5164: test: address CodeRabbit review on symlink tests Clear _symlink_reverse_map after pyfakefs teardown, exercise should_build_target via dependency matching (not directory short-circuit), and drop stale alignment-check mention from testing docs. * RHAIENG-5164: test: clear symlink cache via request.addfinalizer Use request.addfinalizer instead of a yield teardown; monkeypatch has no addfinalizer API. * RHAIENG-5164: fix: keep pytest out of gha_pr_changed_files import path GHA resolves COMPONENT_DIR via plain python3 without dev deps; move pyfakefs symlink tests to gha_pr_changed_files_symlink_test.py. * RHAIENG-5164: chore: fix ruff import order and lockfile README Ruff wants local imports before pytest in symlink test module. Also align lockfile manual podman example with konflux.cpu.conf. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 8147de2 commit 1721a92

47 files changed

Lines changed: 164 additions & 275 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-notebooks-TEMPLATE.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ name: Build & Publish Notebook Servers (TEMPLATE)
2828
default: false
2929
description: "add RHEL subscription from github secret"
3030
type: boolean
31-
konflux:
31+
product:
3232
required: false
33-
default: false
34-
description: "build from Dockerfile.konflux.* instead of Dockerfile.*"
35-
type: boolean
33+
default: odh
34+
description: "product variant: odh (midstream) or rhoai (downstream)"
35+
type: string
3636
PLATFORM_RUNNERS:
3737
required: false
3838
# language=json
@@ -48,7 +48,7 @@ name: Build & Publish Notebook Servers (TEMPLATE)
4848

4949
jobs:
5050
build:
51-
name: "${{ inputs.konflux && 'rhoai' || 'odh' }}"
51+
name: "${{ inputs.product }}"
5252
# https://docs.github.com/en/actions/how-tos/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
5353
runs-on: ${{ fromJSON(inputs.PLATFORM_RUNNERS)[inputs.platform] || 'no-such-runner' }}
5454
env:
@@ -195,7 +195,7 @@ jobs:
195195
TARGET: ${{ inputs.target }}
196196
REGISTRY: ${{ env.IMAGE_REGISTRY }}
197197
PLATFORM: ${{ inputs.platform }}
198-
KONFLUX: ${{ inputs.konflux }}
198+
PRODUCT: ${{ inputs.product }}
199199
# language=python
200200
run: |
201201
import os, re, sys
@@ -208,7 +208,7 @@ jobs:
208208
TARGET: str
209209
REGISTRY: str
210210
PLATFORM: str
211-
KONFLUX: str
211+
PRODUCT: str
212212
213213
@classmethod
214214
def from_env(cls):
@@ -228,7 +228,7 @@ jobs:
228228
229229
# Build a suffix from build type and platform so that different
230230
# odh/rhoai builds and architectures get distinct tags.
231-
build_type = "rhoai" if env.KONFLUX == "true" else "odh"
231+
build_type = env.PRODUCT
232232
suffix = f"{build_type}_{sanitized_platform}"
233233
234234
# 7-char SHA prefix is enough to identify a commit uniquely
@@ -431,7 +431,7 @@ jobs:
431431
CONTAINER_BUILD_CACHE_ARGS: "${{ steps.extra-container-build-args.outputs.CONTAINER_BUILD_CACHE_ARGS }} ${{ steps.prefetch.outputs.EXTRA_BUILD_ARGS }}"
432432
# We don't have access to image registry for PRs, so disable pushing
433433
PUSH_IMAGES: "${{ (fromJson(inputs.github).event_name == 'pull_request' || fromJson(inputs.github).event_name == 'pull_request_target') && 'no' || 'yes' }}"
434-
KONFLUX: "${{ inputs.konflux && 'yes' || 'no' }}"
434+
PRODUCT: ${{ inputs.product }}
435435

436436
- name: "Show podman images information"
437437
run: podman images --digests
@@ -531,7 +531,7 @@ jobs:
531531
IMAGE_TAG: "${{ steps.calculated_vars.outputs.IMAGE_TAG }}"
532532
# for make deploy, mandatory to specify for the more exotic cases
533533
NOTEBOOK_TAG: "${{ inputs.target }}-${{ steps.calculated_vars.outputs.IMAGE_TAG }}"
534-
KONFLUX: "${{ inputs.konflux && 'yes' || 'no' }}"
534+
PRODUCT: ${{ inputs.product }}
535535

536536
# endregion
537537

.github/workflows/build-notebooks-pr-aipcc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,5 @@ jobs:
119119
platform: "${{ matrix.platform }}"
120120
# rhds/notebooks builds from AIPCC base images that are RHEL-based
121121
subscription: ${{ true }}
122-
konflux: ${{ true }}
122+
product: rhoai
123123
secrets: inherit

.github/workflows/build-notebooks-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,5 @@ jobs:
113113
github: "${{ toJSON(github) }}"
114114
platform: "${{ matrix.platform }}"
115115
subscription: ${{ true }}
116-
konflux: ${{ true }}
116+
product: rhoai
117117
secrets: inherit

.github/workflows/build-notebooks-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ jobs:
8181
platform: "${{ matrix.platform }}"
8282
# rhds/notebooks builds from AIPCC base images that are RHEL-based
8383
subscription: ${{ true }}
84-
konflux: ${{ true }}
84+
product: rhoai
8585
secrets: inherit

.github/workflows/params-env.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
include:
3333
- variant: odh
3434
packages: skopeo jq
35-
konflux: ''
35+
product: odh
3636
- variant: rhoai
3737
packages: skopeo jq git-crypt
38-
konflux: 'yes'
38+
product: rhoai
3939
name: validation-of-params-env-${{ matrix.variant }}
4040
steps:
4141
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
@@ -73,4 +73,4 @@ jobs:
7373
run: |
7474
bash ./ci/check-params-env.sh
7575
env:
76-
KONFLUX: ${{ matrix.konflux }}
76+
PRODUCT: ${{ matrix.product }}

AGENTS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ that embeds that stage. Do not assume there is one shared parent image definitio
5959

6060
### ODH vs RHOAI builds
6161

62-
`KONFLUX` selects the product variant (ODH midstream vs RHOAI downstream), not whether
62+
`PRODUCT` selects the product variant (ODH midstream vs RHOAI downstream), not whether
6363
the build runs on Konflux/Tekton. ODH workbenches stack on c9s odh-base-images;
6464
RHOAI stacks on RHEL 9.6 AIPCC bases (`ubi9-python-*` paths are EL9 naming only).
6565
See [ARCHITECTURE.md](ARCHITECTURE.md) for details and
@@ -85,7 +85,7 @@ make refresh-lock-files
8585

8686
## Boundaries
8787

88-
- **Always:** Run `make test` after Dockerfile or dependency changes. Keep `KONFLUX`
88+
- **Always:** Run `make test` after Dockerfile or dependency changes. Keep `PRODUCT`
8989
consistent across `make <target>` and `make test-<target>`. Override the entrypoint
9090
when inspecting images (`podman run --rm -it --entrypoint="" <image> bash`).
9191
- **Ask first:** Adding new base images, changing CI workflow structure, modifying
@@ -108,9 +108,9 @@ Use formatting: bold, italics and code blocks.
108108
Without this, arguments are ignored and Jupyter starts.
109109
- One-off commands (no interactive shell):
110110
`podman run --rm --entrypoint="" <image> rpm -qa | sort`
111-
- `KONFLUX` must match between `make <target>` and `make test-<target>`.
111+
- `PRODUCT` must match between `make <target>` and `make test-<target>`.
112112
Mismatches cause version assertion failures because the test reads the
113-
imagestream manifest selected by `KONFLUX`.
113+
imagestream manifest selected by `PRODUCT`.
114114
- Python 3.14: `except ExcA, ExcB:` (no parentheses) is valid when there is no
115115
`as` clause (PEP 758). Ruff format enforces this style. Parentheses are still
116116
required when binding: `except (ExcA, ExcB) as e:`.
@@ -127,7 +127,7 @@ Most dependency/CVE work is `chore`. See `.coderabbit.yaml` for validation rules
127127
## Repo-specific reminders
128128

129129
- Use `uv` and `make refresh-lock-files`. Keep dependency guidance aligned with current repo tooling.
130-
- For local testing gotchas such as worktree naming, `pyfakefs`, `KONFLUX` matching, and CI `-n` metadata,
130+
- For local testing gotchas such as worktree naming, `pyfakefs`, `PRODUCT` matching, and CI `-n` metadata,
131131
see [CONTRIBUTING.md](CONTRIBUTING.md).
132132
- For GitHub Actions changes, run the SHA pinning flow in [`.github/AGENTS.md`](.github/AGENTS.md).
133133
- For browser tests, follow [`tests/browser/AGENTS.md`](tests/browser/AGENTS.md) instead of inventing local conventions.

ARCHITECTURE.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,16 @@ make all-images # build everything
8686
make test # run quick static tests (pytest + lint)
8787
```
8888

89-
The `KONFLUX` Makefile variable selects the **product variant**, not whether the build
89+
The `PRODUCT` Makefile variable selects the **product variant**, not whether the build
9090
runs on Konflux/Tekton:
9191

92-
- **ODH mode** (default: `KONFLUX=no` or unset): uses `build-args/<variant>.conf`
92+
- **ODH** (default: `PRODUCT=odh` or unset): uses `build-args/<variant>.conf`
9393
and `manifests/odh/`
94-
- **RHOAI mode** (`KONFLUX=yes`): uses `build-args/konflux.<variant>.conf`
94+
- **RHOAI** (`PRODUCT=rhoai`): uses `build-args/konflux.<variant>.conf`
9595
and `manifests/rhoai/`
9696

97-
Since RHAIENG-4516, `Dockerfile.<variant>` paths and `Dockerfile.konflux.<variant>`
98-
paths resolve to the same content, so the meaningful difference is the selected
99-
build-args file and manifest set rather than a separate Dockerfile implementation.
97+
Each notebook image uses a single `Dockerfile.konflux.<variant>`; `PRODUCT` selects
98+
which build-args conf file and manifest set the Makefile passes to the build.
10099
Both variants can be built locally or on Konflux/Tekton.
101100

102101
### OpenShift file ownership during image build (#3928)
@@ -112,9 +111,6 @@ Leaf stages do not run full-tree `fix-permissions`. Paths outside site-packages
112111
build steps create directly (e.g. `jupyter_server_config.py`, `labconfig/`, `pf.css`
113112
from `apply.sh`) get explicit modes or `chmod` at creation time; see [#3928](https://github.com/opendatahub-io/notebooks/issues/3928).
114113

115-
Non-konflux `Dockerfile.cpu|cuda|rocm` paths are symlinks to `Dockerfile.konflux.*` and
116-
inherit the same ownership model.
117-
118114
## Testing layers
119115

120116
| Layer | Location | What it tests | How to run |

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ make test-${NOTEBOOK_NAME}
146146

147147
#### ODH vs RHOAI local builds
148148

149-
`KONFLUX` selects the product variant, not whether the build runs on Konflux/Tekton.
149+
`PRODUCT` selects the product variant, not whether the build runs on Konflux/Tekton.
150150
Both variants are built on Konflux in CI; the variable changes which `build-args/*.conf`
151151
and manifest tree the Makefile uses locally.
152152

153-
| `KONFLUX` value | Product variant | Build args | Manifests |
153+
| `PRODUCT` value | Product variant | Build args | Manifests |
154154
|-----------------|-----------------|------------|-----------|
155-
| unset or `no` | ODH (midstream default) | `build-args/<variant>.conf` | `manifests/odh/` |
156-
| `yes` | RHOAI downstream | `build-args/konflux.<variant>.conf` | `manifests/rhoai/` |
155+
| unset or `odh` | ODH (midstream default) | `build-args/<variant>.conf` | `manifests/odh/` |
156+
| `rhoai` | RHOAI downstream | `build-args/konflux.<variant>.conf` | `manifests/rhoai/` |
157157

158-
Keep the same `KONFLUX` value for both the build step and the matching `make test-*`
158+
Keep the same `PRODUCT` value for both the build step and the matching `make test-*`
159159
step so the imagestream manifests and expected package versions line up.
160160

161161
For deeper references:

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ CONTAINER_BUILD_SECURITY_ARGS ?= $(if $(filter podman,$(CONTAINER_ENGINE)),--sec
3131
PUSH_IMAGES ?= yes
3232
# INDEX_MODE: auto (default), public-index, or rh-index - controls lock file generation
3333
INDEX_MODE ?= auto
34-
# KONFLUX: select RHOAI build-args (konflux.*.conf) vs ODH (default: no)
35-
KONFLUX ?= no
34+
# PRODUCT: select ODH (odh) vs RHOAI (rhoai) build-args conf files
35+
PRODUCT ?= odh
36+
ifneq ($(filter odh rhoai,$(PRODUCT)),$(PRODUCT))
37+
$(error PRODUCT must be 'odh' or 'rhoai', got '$(PRODUCT)')
38+
endif
3639

3740

3841
# OS dependant: Generate date, select appropriate cmd to locate container engine
@@ -153,7 +156,7 @@ define image
153156
$(eval DOCKERFILE := $(BUILD_DIRECTORY)/Dockerfile.konflux.$(VARIANT))
154157
$(if $(wildcard $(DOCKERFILE)),,$(error Dockerfile not found for variant '$(VARIANT)' in '$(BUILD_DIRECTORY)'))
155158

156-
$(eval CONF_FILE := $(BUILD_DIRECTORY)/build-args/$(if $(KONFLUX:no=),konflux.,$(empty))$(shell echo $(VARIANT)).conf)
159+
$(eval CONF_FILE := $(BUILD_DIRECTORY)/build-args/$(if $(filter rhoai,$(PRODUCT)),konflux.,)$(shell echo $(VARIANT)).conf)
157160
$(info #*# Image build Dockerfile: <$(DOCKERFILE)> #(MACHINE-PARSED LINE)#*#...)
158161
$(info #*# Image build directory: <$(BUILD_DIRECTORY)> #(MACHINE-PARSED LINE)#*#...)
159162

@@ -529,7 +532,6 @@ validate-renovate-config:
529532
test:
530533
@echo "Running quick static tests"
531534
uv run pytest -m 'not buildonlytest'
532-
@./scripts/check_dockerfile_alignment.sh
533535

534536
.PHONY: check-actions
535537
check-actions:

ci/cached-builds/gen_gha_matrix_jobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class TestSelf(unittest.TestCase):
215215
def test_select_changed_targets_dockerfile(self):
216216
targets = extract_image_targets(makefile_dir=project_dir)
217217

218-
changed_files = ["jupyter/datascience/ubi9-python-3.12/Dockerfile.cpu"]
218+
changed_files = ["jupyter/datascience/ubi9-python-3.12/Dockerfile.konflux.cpu"]
219219

220220
targets = gha_pr_changed_files.filter_out_unchanged(targets, changed_files)
221221
assert set(targets) == {"jupyter-datascience-ubi9-python-3.12"}

0 commit comments

Comments
 (0)