Skip to content

feat: make flyte build the supported CI image build path#792

Draft
jeevb wants to merge 11 commits intomainfrom
jeev/flyte-build
Draft

feat: make flyte build the supported CI image build path#792
jeevb wants to merge 11 commits intomainfrom
jeev/flyte-build

Conversation

@jeevb
Copy link
Contributor

@jeevb jeevb commented Mar 13, 2026

Summary

  • Add tag: Optional[str] = None to Image.clone(), from_dockerfile(), from_debian_base(), and from_uv_script() — placed immediately after name in every signature, consistent with registry and name
  • Replace the private Image._tag field with a public Image.tag attribute, consistent with registry and name; constructors now pass tag= directly to _new() instead of using post-construction object.__setattr__
  • Thread force: bool = False through build_images_build_images_build_image_bgbuild.aio so the existing ImageBuildEngine.build(force=) param is reachable from the public API
  • Add --force flag to flyte build CLI via BuildArguments, wired into BuildEnvCommand.invoke
  • Deprecate examples/image/ci_build_image.py with a comment pointing to flyte build

Usage

Pattern A — retag + rebuild via remote builder:

# images.py
env = flyte.Environment(
    name="my_image",
    image=flyte.Image.from_base("ghcr.io/flyteorg/flyte:py3.12-v2.0.0b56").clone(
        registry="123456789.dkr.ecr.us-west-2.amazonaws.com/myorg",
        name="my-image",
        tag=os.environ.get("VERSION"),
    ),
)

Pattern B — Dockerfile-based build:

env = flyte.Environment(
    name="my_image",
    image=flyte.Image.from_dockerfile(
        Path(__file__).parent / "Dockerfile",
        registry="123456789.dkr.ecr.us-west-2.amazonaws.com/myorg",
        name="my-image",
        tag=os.environ.get("VERSION"),
    ),
)
# CI step — always rebuild and push
flyte build images.py my_image --force

Test Plan

  • uv run pytest tests/flyte/test_image.py tests/flyte/test_deploy.py tests/cli/test_build.py -v — 70 tests, all pass
  • uv run flyte build --help--force appears in output

@jeevb jeevb marked this pull request as draft March 13, 2026 17:55
jeevb added 10 commits March 13, 2026 19:08
Add tag: Optional[str] = None parameter to clone() method, allowing users to override the content-hash-based tag with an explicit tag. Empty strings are normalized to None to fall back to content-hash-based tagging.

Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
… → _build_image_bg

Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Adds a --force group-level option to the `flyte build` command that is
forwarded to `flyte.build_images` to skip image existence checks and
always rebuild. Tests verify the flag is passed correctly when set and
defaults to False when omitted.

Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
…ools

Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
@jeevb jeevb force-pushed the jeev/flyte-build branch from 5ea38c4 to 6bc897f Compare March 14, 2026 02:08
…osition

The *-separator changes made tag and other parameters keyword-only,
which risks breaking existing user code. Roll back those changes and
instead append tag= as the last positional argument in each factory
method and clone() for consistency without imposing keyword-only
constraints on callers.

from_uv_script retains its pre-existing *-separator (it was keyword-only
on main already); tag= is appended after secret_mounts.

Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
@jeevb
Copy link
Contributor Author

jeevb commented Mar 14, 2026

Thinking we should support bare images, not wrapped in Environment as well. Environment feels extraneous for this purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant