Repository navigation
[CI] Add HAProxy to serve CI build image - #60879
Conversation
Build HAProxy 2.8.12 from source in the serve CI image so that HAProxy integration tests can run. Creates a dedicated haproxy user and configures sudoers for the ray user. Part of Ray Serve HAProxy support (ray-project#60586). Signed-off-by: Seiji Eicher <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request adds HAProxy to the serve CI Docker image by building it from source. The changes are straightforward, but I've identified a critical security vulnerability in the way sudo permissions are granted to the ray user. The current configuration is overly permissive and could be exploited for privilege escalation. I've provided a detailed comment with a suggested fix that uses group permissions for file access and a more restrictive sudoers entry, which is a more secure and standard practice for managing permissions in a containerized environment.
Move HAProxy compilation to a separate builder stage so that build dependencies (build-essential, libpcre3-dev, libssl-dev, etc.) are never installed in the final CI image. Only the compiled binary is copied via COPY --from, and only runtime deps (socat, liblua5.3-0) are installed in the main stage. Signed-off-by: Seiji Eicher <[email protected]>
Use the same base image for the builder stage instead of hardcoding ubuntu:22.04, ensuring ABI compatibility if the base image changes. Signed-off-by: Seiji Eicher <[email protected]>
Signed-off-by: Seiji Eicher <[email protected]>
Signed-off-by: Seiji Eicher <[email protected]>
Signed-off-by: Seiji Eicher <[email protected]>
Signed-off-by: Seiji Eicher <[email protected]>
| wget -O "${HAPROXY_BUILD_DIR}/haproxy.tar.gz" "https://www.haproxy.org/download/2.8/src/haproxy-${HAPROXY_VERSION}.tar.gz" | ||
| tar -xzf "${HAPROXY_BUILD_DIR}/haproxy.tar.gz" -C "${HAPROXY_BUILD_DIR}" --strip-components=1 | ||
| make -C "${HAPROXY_BUILD_DIR}" TARGET=linux-glibc USE_OPENSSL=1 USE_ZLIB=1 USE_PCRE=1 USE_LUA=1 USE_PROMEX=1 -j$(nproc) | ||
| make -C "${HAPROXY_BUILD_DIR}" install |
There was a problem hiding this comment.
HAProxy installed to wrong path in CI image
Medium Severity
The make install on line 27 is missing SBINDIR=/usr/local/bin, causing HAProxy to be installed to /usr/local/sbin/haproxy instead of /usr/local/bin/haproxy. Both production Dockerfiles (docker/base-extra/Dockerfile and docker/base-slim/Dockerfile) explicitly set SBINDIR=/usr/local/bin. This means CI tests run with HAProxy at a different path than production, potentially masking path-related failures or causing CI-only issues since /usr/local/sbin may not be in non-root users' PATH.
Additional Locations (1)
## Summary - Build HAProxy 2.8.12 from source in the serve CI Docker image (`ci/docker/serve.build.Dockerfile`) ## Context Needed for ray-project#60586 (Ray Serve HAProxy support) ## Test plan - [ ] Verify serve CI image builds successfully --------- Signed-off-by: Seiji Eicher <[email protected]> Signed-off-by: Adel Nour <[email protected]>
## Summary - Build HAProxy 2.8.12 from source in the serve CI Docker image (`ci/docker/serve.build.Dockerfile`) ## Context Needed for ray-project#60586 (Ray Serve HAProxy support) ## Test plan - [ ] Verify serve CI image builds successfully --------- Signed-off-by: Seiji Eicher <[email protected]>


Summary
ci/docker/serve.build.Dockerfile)Context
Needed for #60586 (Ray Serve HAProxy support)
Test plan