diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4e48bd584..b4d3c4c14 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,6 +7,7 @@ on: paths: - '.github/workflows/publish.yml' - 'maint_tools/build_default_image.py' + - 'maint_tools/build_plugin_image.py' jobs: flyte-pypi: @@ -89,6 +90,17 @@ jobs: uses: actions/setup-python@v1 with: python-version: "3.13" + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io/flyteorg + username: "${{ secrets.FLYTE_BOT_USERNAME }}" + password: "${{ secrets.FLYTE_BOT_PAT }}" - name: Install uv uses: astral-sh/setup-uv@v6 id: setup-uv @@ -97,7 +109,7 @@ jobs: run: | uv venv uv pip install build twine setuptools wheel - - name: Build and publish + - name: Build working-directory: ${{ matrix.workdir }} run: | uv run --prerelease allow python -m build --wheel --installer uv diff --git a/maint_tools/build_plugin_image.py b/maint_tools/build_plugin_image.py index 84f4bfb61..ded887a32 100644 --- a/maint_tools/build_plugin_image.py +++ b/maint_tools/build_plugin_image.py @@ -8,11 +8,10 @@ async def build_flyte_vllm_image(registry: str | None = None, name: str | None = None, builder: str | None = "local"): """ Build the SDK default Debian-based image, optionally overriding - the container registry and image name. + the container registry name. Args: registry: e.g. "ghcr.io/my-org" or "123456789012.dkr.ecr.us-west-2.amazonaws.com". - name: e.g. "my-flyte-image". builder: e.g. "local" or "remote". """ import flyteplugins.vllm @@ -24,7 +23,7 @@ async def build_flyte_vllm_image(registry: str | None = None, name: str | None = async def build_flyte_sglang_image(registry: str | None = None, name: str | None = None, builder: str | None = "local"): """ Build the SDK default Debian-based image, optionally overriding - the container registry and image name. + the container registry name. """ import flyteplugins.sglang @@ -32,31 +31,37 @@ async def build_flyte_sglang_image(registry: str | None = None, name: str | None await ImageBuildEngine.build(default_image, builder=builder) -async def build_all(registry: str | None = None, name: str | None = None, builder: str | None = "local"): - await asyncio.gather( - build_flyte_vllm_image(registry=registry, name=name, builder=builder), - build_flyte_sglang_image(registry=registry, name=name, builder=builder), - ) - - if __name__ == "__main__": + import os + parser = argparse.ArgumentParser(description="Build the default Flyte image.") parser.add_argument("--registry", help="Docker registry to push to") - parser.add_argument("--name", help="Custom image name (without tag)") - parser.add_argument("--type", choices=["vllm", "sglang", "all"], help="Type of image to build") + parser.add_argument("--type", choices=["vllm", "sglang"], help="Type of image to build") parser.add_argument("--builder", choices=["local", "remote"], default="local", help="Image builder to use") args = parser.parse_args() - # can remove this and only specify one in the future - assert (args.registry and args.name) or (not args.registry and not args.name) - flyte.init_from_config() + if os.getenv("GITHUB_ACTIONS", "") == "true": + flyte.init( + endpoint=os.getenv("FLYTE_ENDPOINT", "dns:///playground.canary.unionai.cloud"), + auth_type="ClientSecret", + client_id="flyte-sdk-ci", + client_credentials_secret=os.getenv("FLYTE_SDK_CI_TOKEN"), + insecure=False, + image_builder="remote", + project=os.getenv("FLYTE_PROJECT", "flyte-sdk"), + domain=os.getenv("FLYTE_DOMAIN", "development"), + ) + builder = "remote" + else: + flyte.init_from_config() + builder = args.builder + if args.type == "vllm": print("Building vllm image...") - asyncio.run(build_flyte_vllm_image(registry=args.registry, name=args.name, builder=args.builder)) + asyncio.run(build_flyte_vllm_image(registry=args.registry, builder=builder)) elif args.type == "sglang": print("Building sglang image...") - asyncio.run(build_flyte_sglang_image(registry=args.registry, name=args.name, builder=args.builder)) + asyncio.run(build_flyte_sglang_image(registry=args.registry, builder=builder)) else: - print("Building all images...") - asyncio.run(build_all(registry=args.registry, name=args.name, builder=args.builder)) + raise ValueError(f"Invalid type: {args.type}. Valid types are: [vllm, sglang].") diff --git a/plugins/sglang/src/flyteplugins/sglang/_app_environment.py b/plugins/sglang/src/flyteplugins/sglang/_app_environment.py index abe8facf1..a128b3369 100644 --- a/plugins/sglang/src/flyteplugins/sglang/_app_environment.py +++ b/plugins/sglang/src/flyteplugins/sglang/_app_environment.py @@ -14,7 +14,7 @@ from flyteplugins.sglang._constants import SGLANG_MIN_VERSION_STR DEFAULT_SGLANG_IMAGE = ( - flyte.Image.from_debian_base(name="sglang-app-image") + flyte.Image.from_debian_base(name="sglang-app-image", python_version=(3, 13)) # install system dependencies, including CUDA toolkit, which is needed by sglang for compiling the model # and rust and cargo for installing sglang .with_apt_packages("libnuma-dev", "wget", "curl", "openssl", "pkg-config", "libssl-dev", "build-essential") diff --git a/plugins/vllm/src/flyteplugins/vllm/_app_environment.py b/plugins/vllm/src/flyteplugins/vllm/_app_environment.py index 3394a6ffe..06f659dd8 100644 --- a/plugins/vllm/src/flyteplugins/vllm/_app_environment.py +++ b/plugins/vllm/src/flyteplugins/vllm/_app_environment.py @@ -14,7 +14,7 @@ from flyteplugins.vllm._constants import VLLM_MIN_VERSION_STR DEFAULT_VLLM_IMAGE = ( - flyte.Image.from_debian_base(name="vllm-app-image") + flyte.Image.from_debian_base(name="vllm-app-image", python_version=(3, 13)) # install flashinfer and vllm .with_pip_packages("flashinfer-python", "flashinfer-cubin") .with_pip_packages("flashinfer-jit-cache", index_url="https://flashinfer.ai/whl/cu129")