build(container): backport media-codec compliance to release/1.3.0 - #11846
Closed
saturley-hall wants to merge 13 commits into
Closed
build(container): backport media-codec compliance to release/1.3.0#11846saturley-hall wants to merge 13 commits into
saturley-hall wants to merge 13 commits into
Conversation
…stage (OPS-7665) Add a compliance scan that fails the image build if a media-codec library/binary ships outside our in-tree ffmpeg allowlist. We build an in-tree ffmpeg to a narrow media set; this keeps the finished image aligned by catching a distro libav*, a wheel-bundled libavcodec, libx264/265, or a stray/imageio-bundled ffmpeg pulled in by a base-image or dependency bump. The gate is a filesystem scan (bundled codec .so files don't appear as SBOM components) plus an optional SBOM version floor, driven by container/compliance/policy/codec_policy.yaml. Matches under our in-tree allow_paths pass; a reasoned per-entry exception (e.g. NVIDIA DALI's bundled libav*, owned by its own team) is logged but does not fail. It runs in the licenses stage of compliance.Dockerfile, so a violation fails the build. Unit-tested against the real bundled-library paths; see OPS-7665 for background. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
… allowlist (OPS-7665) The in-tree ffmpeg restricted encoders/muxers but still shipped ffmpeg's full default decoder set (291 video + 212 audio decoders) in the libav*.so copied into every runtime image. Narrow it to the media formats we actually build and use. Switch the wheel_builder configure to an allowlist: blanket --disable-decoders/--disable-demuxers/--disable-parsers/--disable-protocols plus exactly the components the two real paths need: - encode CLI (imageio): rawvideo demux/decode over a pipe -> h264_nvenc/vp9 - Rust media-ffmpeg VideoDecoder: VP8/VP9 in mp4/webm/mkv Image decode does not use ffmpeg (Rust `image` crate), so no still-image decoders are enabled. HW NVDEC (h264_cuvid/hevc_cuvid) can be re-added if a decode feature needs it. Also bump ffmpeg 8.1 -> 8.1.2 (an upstream maintenance release) to pick up security fixes and trim the decode surface further. Test fixtures are re-encoded to VP9-in-mp4; filenames and the Rust/Python tests that consume them are unchanged. Validated by building ffmpeg 8.1.2 with this exact allowlist and decoding every fixture to the expected frame counts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
…m images (OPS-7625) Upstream TRT-LLM made cv2 an optional video extra (NVIDIA/TensorRT-LLM#16206) and no longer preinstalls it on main; its imports were already function-local in 1.3.x, so nothing in the image needs it at import time. Align the trtllm runtime images with that: uninstall the package (via the system interpreter -- with VIRTUAL_ENV set, plain pip targets the venv and exits 0 without touching the system-site install) and mirror the removal in the pre_runtime whiteout, since the squash COPY cannot represent deletions. Build fails if cv2 survives either stage, and a dependencies test guards against a base-image bump reintroducing it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
Remove codec-bearing Python packages inherited from the SGLang base, build the Dynamo runtime without media-ffmpeg, and fail the image build if FFmpeg, H.264, H.265, or AAC libraries remain. Signed-off-by: Harrison King Saturley-Hall <hsaturleyhal@nvidia.com>
The ARM64 Inkling base installs the distribution as decord2, whose wheel bundles FFmpeg, x264, and x265 shared libraries. Remove that package and its residual files before the final codec guard. Signed-off-by: Harrison King Saturley-Hall <hsaturleyhal@nvidia.com>
Address review: hoist the `pathlib` import in test_no_opencv.py to module scope per the repo import-placement rule, and remove the internal ticket reference from the docstring. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
- Move the optional `packaging.version` import to module scope and narrow the fallback to ImportError only, so a malformed version string surfaces (and fails the scan) instead of silently degrading to the naive comparator. - Rename unused unpacked values in the tests (RUF059). - Drop internal ticket references from the policy/scanner comments. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
- Scan /tmp and /run: only the virtual kernel filesystems (proc/sys/dev) are pruned now, so a codec left in /tmp still gets flagged. - Fail when an explicitly-supplied --sbom path is missing, instead of silently disabling the version-floor gate. - Flag denied SBOM components that carry no version (cannot prove they meet the fixed floor) rather than letting them pass. - Add the required pytest markers to the test module and cover the three behaviors above. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
- Drop internal ticket references from the wheel_builder + media README comments. - Make the fixture-regeneration ffmpeg command in the video.rs docstring executable by adding the output filename. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
The TRT-LLM diffusion encode path (imageio -> ffmpeg -c:v h264_nvenc -> mp4) regressed after the decoder allowlist. The h264 *parser* (not the H.264 decoder) is needed for the mp4 muxer to package the h264_nvenc bitstream, so add it back. A parser carries no codec implementation, so this does not reintroduce any software H.264 encode/decode surface; h264_nvenc remains the NVIDIA hardware encoder (the sanctioned path). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
The vllm-openai base ships PyAV, opencv, decord, torchcodec, and PyNvVideoCodec, each bundling its own full ffmpeg with software H.264/H.265/AAC (PyAV and decord also ship GPL libx264/libx265). Dynamo's vLLM component imports none of them, so they are unused decode-side dead weight. Uninstall + remove them, with a guard that fails the build if cv2/av survive. The in-tree LGPL ffmpeg and imageio-ffmpeg are kept for the omni HW video-encode path (h264_nvenc, the sanctioned NVIDIA hardware encoder). This drops software video *decode* from the vLLM images (mirrors the SGLang codec removal). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
DALI vendors its full ffmpeg stack under nvidia/dali/.libs — libavcodec plus the libsw*/libpostproc companions. The exception only matched libav*, so DALI's libswscale tripped the gate and failed the trtllm build. Waive the whole vendored dir instead, and cover it in the test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
The narrow in-tree ffmpeg protocol allowlist enabled only file,pipe. On ffmpeg 8.x, `ffmpeg -i -` (reading rawvideo frames from stdin, as the imageio encode path does) resolves stdin through the `fd:` protocol, not `pipe:`. With fd disabled, opening the stdin input fails immediately with "Error opening input: Protocol not found. Did you mean file:fd:?", breaking the video encode path. Add fd to the protocol allowlist. It is pure file-descriptor I/O and carries no codec implementation, so it does not widen the media-format surface. Reproduced and confirmed against a locally built allowlisted ffmpeg: file,pipe fails to open stdin; file,pipe,fd opens it cleanly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
Contributor
Member
Author
|
Superseded by #11852, which targets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dd29e8f8daafdprotocol needed by the sanctionedh264_nvencMP4 encode pathopencv-python-headlessfrom TensorRT-LLM, and add the final filesystem/SBOM compliance gaterelease/1.3.0NIXL refs and vLLM, SGLang, and TensorRT-LLM image/version pinsThe backport cherry-picks #11836's 13 feature commits and intentionally excludes its merge-only synchronization commits. Its 19-file net diff matches #11836 exactly: 738 additions and 61 deletions.
Validation
13 passed—container/compliance/tests/test_scan_codecs.pylinux/amd64andlinux/arm64docker buildx build --checkfor all three amd64 runtime Dockerfiles; each completed with only the existing manylinux platform warningruff checkandruff format --checkpassed for the new Python scanner/testspython3 -m py_compilepassed for the new Python scanner/testsgit diff --check github/release/1.3.0..HEADSource PR: #11836