Skip to content

build.py setting docker build args for secrets even when build-secret flag is not present #7992

@BenjaminBraunDev

Description

@BenjaminBraunDev

Description
While trying to build tritonserver with the build.py script, I am getting this error:

+ docker build --secret id=req,src= --build-arg VLLM_INDEX_URL= --build-arg PYTORCH_TRITON_URL= --build-arg BUILD_PUBLIC_VLLM=true -t tritonserver -f /home/benjaminbraun_google_com/server-fork-orca-header/build/Dockerfile .
[+] Building 0.0s (0/0)                                                                                                                                                              docker:default
ERROR: failed to stat req: stat req: no such file or directory
error: build failed

After looking into it, it looks like #7983 that was merged recently added a new build-secret flag

it is checked in main here

    secrets = dict(getattr(FLAGS, "build_secret", []))
    if secrets is not None:
        requirements = secrets.get("req", "")
        vllm_index_url = secrets.get("vllm_index_url", "")
        pytorch_triton_url = secrets.get("pytorch_triton_url", "")
        build_public_vllm = secrets.get("build_public_vllm", "true")
        log('Build Arg for BUILD_PUBLIC_VLLM: "{}"'.format(build_public_vllm))

The values are referenced to make a docker build command here.

        if secrets != "":
            finalargs += [
                f"--secret id=req,src={requirements}",
                f"--build-arg VLLM_INDEX_URL={vllm_index_url}",
                f"--build-arg PYTORCH_TRITON_URL={pytorch_triton_url}",
                f"--build-arg BUILD_PUBLIC_VLLM={build_public_vllm}",
            ]

The issue here is that is that secrets = dict(getattr(FLAGS, "build_secret", [])) will never set secrets to None since getattr defaults to [] and dict([]) returns an empty dictionary, which is not None. Therefore requirements, vllm_index_url, and pytorch_triton_url will be set to "".

Furthermore, secrets != "" will always be true since secrets is not a string, so these flags will always be put into docker build command regardless of whether they're set, resulting in the error.

Triton Information
What version of Triton are you using?
2.55.0dev

Are you using the Triton container or did you build it yourself?
I am attempting to build the container myself using build.py.

To Reproduce
I am running the following command to build from inside the server repo:

./build.py -v --no-container-interactive --enable-logging --enable-stats --enable-tracing \
              --enable-metrics --enable-gpu-metrics --enable-cpu-metrics \
              --filesystem=gcs \
              --endpoint=http --endpoint=grpc --endpoint=sagemaker --endpoint=vertex-ai \
              --backend=ensemble --enable-gpu --no-container-pull \
              --repoagent=checksum --cache=local --cache=redis

Expected behavior
I expected the build to succeed.

Metadata

Metadata

Assignees

Labels

buildIssues pertaining to builds

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions