@@ -75,18 +75,30 @@ gmake codeserver-ubi9-python-3.12 BUILD_ARCH=linux/arm64 PUSH_IMAGES=no
7575| ` --component-dir DIR ` | Component directory (required), e.g. ` codeserver/ubi9-python-3.12 ` |
7676| ` --rhds ` | Use downstream (RHDS) lockfiles instead of upstream (ODH, the default) |
7777| ` --flavor NAME ` | Lock file flavor (default: ` cpu ` ) |
78- | ` --tekton-file FILE ` | Tekton PipelineRun YAML for npm path discovery (auto-detected from ` .tekton/ ` if omitted) |
7978| ` --activation-key KEY ` | Red Hat activation key for RHEL RPMs (optional) |
8079| ` --org ORG ` | Red Hat organization ID for RHEL RPMs (optional) |
8180
8281### What it does
8382
8483| Step | Condition | Script called |
8584| ------| -----------| ---------------|
86- | 1. Generic artifacts | ` artifacts.in.yaml ` exists | ` create-artifact-lockfile.py ` |
87- | 2. Pip wheels | ` pyproject.toml ` exists | ` create-requirements-lockfile.sh --download ` |
88- | 3. NPM packages | ` package-lock.json ` files found | ` download-npm.sh ` |
89- | 4. RPMs | ` rpms.in.yaml ` exists | ` hermeto-fetch-rpm.sh ` (if lockfile committed) or ` create-rpm-lockfile.sh --download ` |
85+ | 1. Generic artifacts | ` prefetch-input/<variant>/artifacts.in.yaml ` exists | ` create-artifact-lockfile.py ` |
86+ | 2. Pip wheels | ` pyproject.toml ` exists in component dir | ` create-requirements-lockfile.sh --download ` |
87+ | 3. NPM packages | Tekton PipelineRun found for component (see below) | ` download-npm.sh --tekton-file ` |
88+ | 4. RPMs | ` prefetch-input/<variant>/rpms.in.yaml ` exists | ` hermeto-fetch-rpm.sh ` (if lockfile committed) or ` create-rpm-lockfile.sh --download ` |
89+
90+ ** Variant directory:** Lockfiles live under ` prefetch-input/odh/ ` (upstream) or
91+ ` prefetch-input/rhds/ ` (downstream). If that directory is missing, steps 1 and 4
92+ are skipped; steps 2 (pip) and 3 (npm) still run when their inputs exist
93+ (` pyproject.toml ` , or a Tekton file for the component).
94+
95+ ** Step 3 (NPM):** The script finds the Tekton file automatically via
96+ ` find_tekton_yaml ` : it looks for a ` .tekton/*pull-request*.yaml ` whose
97+ ` dockerfile ` param matches this component — RHDS first
98+ (` COMPONENT_DIR/Dockerfile.konflux.* ` ), then ODH (` COMPONENT_DIR/Dockerfile.* ` ).
99+ If no Tekton file is found, npm is skipped. If the Tekton file has no
100+ ` npm ` -type ` prefetch-input ` entries, ` download-npm.sh ` exits successfully
101+ (nothing to download).
90102
91103Steps are skipped if their input files don't exist. For RPMs, if
92104` rpms.lock.yaml ` is already committed, it downloads directly (skipping
@@ -95,11 +107,13 @@ lockfile regeneration) — this avoids cross-platform issues on arm64 CI runners
95107### GitHub Actions integration
96108
97109The GHA workflow template (` .github/workflows/build-notebooks-TEMPLATE.yaml ` )
98- calls ` prefetch-all.sh ` automatically for codeserver targets before running
99- ` make ` . Non-codeserver targets skip the prefetch step entirely. After the
100- build, container tests run (e.g. ` tests/containers ` with pytest); image
101- metadata is read from both Docker ` Config ` and ` ContainerConfig ` so labels
102- work when the daemon is Podman (see
110+ derives the component directory from the ** Makefile** (dry-run of the build
111+ target, parsing ` #*# Image build directory: <...> ` ), so it works for all image
112+ targets (codeserver, jupyter-* , runtime-* , rstudio-* , base-images-* ). Prefetch
113+ runs when ` COMPONENT_DIR/prefetch-input ` exists; otherwise the step is skipped.
114+ After the build, container tests run (e.g. ` tests/containers ` with pytest);
115+ image metadata is read from both Docker ` Config ` and ` ContainerConfig ` so
116+ labels work when the daemon is Podman (see
103117[ tests/containers/docs/github-vs-local-image-metadata.md] ( ../../tests/containers/docs/github-vs-local-image-metadata.md ) ).
104118
105119** uv version:** The repo root ` uv.toml ` specifies the ` uv ` version (e.g.
@@ -516,7 +530,8 @@ collisions. Files that already exist are skipped.
516530- ` --lock-file <path>` — process a single `package-lock.json`.
517531- ` --tekton-file <path>` — parse a Tekton PipelineRun YAML to discover all
518532 ` npm` -type `prefetch-input` paths, then process every `package-lock.json`
519- found under them.
533+ found under them. If the file has **no** `npm`-type entries, the script
534+ exits 0 (nothing to download) instead of erroring.
520535
521536Both flags can be combined. URLs that are already local (`file:///cachi2/...`)
522537are automatically skipped.
@@ -712,34 +727,48 @@ python3 scripts/lockfile-generators/helpers/download-pip-packages.py \
712727After running `prefetch-all.sh`, the **recommended** way to build is via make :
713728
714729` ` ` bash
715- # Makefile auto-detects cachi2/output/ and injects --volume + LOCAL_BUILD=true
730+ # Make sets LOCAL_BUILD=true for hermetic targets; mounts cachi2/output when it exists
716731gmake codeserver-ubi9-python-3.12 BUILD_ARCH=linux/arm64 PUSH_IMAGES=no
717732` ` `
718733
719- The Makefile evaluates each target independently : ` CACHI2_VOLUME ` is only set
720- when both `cachi2/output/` exists AND the target directory has a
721- ` prefetch-input/ ` subdirectory. Non-hermetic targets are completely unaffected.
734+ The Makefile sets `LOCAL_BUILD=true` for any target that has `prefetch-input/`;
735+ it adds the cachi2 volume only when `cachi2/output/` exists (after prefetch).
736+ Non-hermetic targets are unaffected.
722737
723738# ## Alternative: manual podman build
724739
725- For developers who want to run `podman build` directly, the key flags are :
740+ Running `podman build` directly differs from `gmake` in these ways :
726741
727- - ` -v $(realpath ./cachi2):/cachi2:z` bind-mount the prefetched dependencies
728- so the Dockerfile can install from them offline.
729- - ` --build-arg LOCAL_BUILD=true` signals the Dockerfile that this is a local
730- build (configures dnf to use the local cachi2 RPM repo).
742+ | Aspect | `gmake codeserver-ubi9-python-3.12 BUILD_ARCH=... PUSH_IMAGES=no` | Manual `podman build ...` |
743+ |--------|-------------------------------------------------------------------|---------------------------|
744+ | **Build context** | Minimal (via `scripts/sandbox.py` : only files needed by the Dockerfile) | Full repo (`.`). |
745+ | **Volume** | `--volume $(ROOT_DIR)cachi2/output:/cachi2/output:Z` (mounts only `cachi2/output`) | Often `-v ./cachi2:/cachi2` (mounts whole dir); equivalent is `-v ./cachi2/output:/cachi2/output:z`. |
746+ | **Build args** | From `build-args/cpu.conf` : ` INDEX_URL` , `BASE_IMAGE`, `PYLOCK_FLAVOR` | You must pass these (and `LOCAL_BUILD=true`) explicitly. |
747+ | **Tag** | `$(IMAGE_REGISTRY):codeserver-ubi9-python-3.12-$(RELEASE)_$(DATE)` | Whatever you pass with `-t`. |
748+ | **Label** | `--label release=$(RELEASE)` | Omitted unless you add it. |
749+ | **Cache** | Default `CONTAINER_BUILD_CACHE_ARGS ?= --no-cache` | Podman uses its default cache unless you pass `--no-cache`. |
750+
751+ To approximate the make build when running podman manually, use the same volume
752+ path as make and pass all build-args from `build-args/cpu.conf` :
753+
754+ - Bind-mount **only** `cachi2/output` at `/cachi2/output` (same as make).
755+ - Pass `LOCAL_BUILD=true` and the same `BASE_IMAGE`, `PYLOCK_FLAVOR`, and
756+ ` INDEX_URL` as in `codeserver/ubi9-python-3.12/build-args/cpu.conf`.
731757
732758` ` ` bash
759+ # Same volume path as Makefile; build-args from build-args/cpu.conf
733760podman build \
734761 -f codeserver/ubi9-python-3.12/Dockerfile.cpu \
735- --platform linux/amd64 \
762+ --platform linux/arm64 \
736763 -t code-server-test \
737764 --build-arg LOCAL_BUILD=true \
738765 --build-arg BASE_IMAGE=quay.io/opendatahub/odh-base-image-cpu-py312-c9s:latest \
739766 --build-arg PYLOCK_FLAVOR=cpu \
740- -v "$(realpath ./cachi2):/cachi2:z" \
767+ --build-arg INDEX_URL=https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4-EA1/cpu-ubi9/simple/ \
768+ -v "$(realpath ./cachi2/output):/cachi2/output:z" \
741769 .
742770` ` `
743771
744- To build for a different architecture, change `--platform` and `ARCH`
745- accordingly (e.g. `linux/arm64` / `aarch64`, `linux/ppc64le` / `ppc64le`).
772+ To build for a different architecture, change `--platform` (e.g. `linux/amd64`,
773+ ` linux/arm64` , `linux/ppc64le`). The manual command uses the **full repo** as
774+ context; make uses a **sandboxed** context for reproducibility.
0 commit comments