feat: make flyte build the supported CI image build path#792
Draft
feat: make flyte build the supported CI image build path#792
Conversation
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 <[email protected]>
Signed-off-by: Jeev B <[email protected]>
Signed-off-by: Jeev B <[email protected]>
Signed-off-by: Jeev B <[email protected]>
… → _build_image_bg Signed-off-by: Jeev B <[email protected]>
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 <[email protected]>
…ools Signed-off-by: Jeev B <[email protected]>
Signed-off-by: Jeev B <[email protected]>
Signed-off-by: Jeev B <[email protected]>
Signed-off-by: Jeev B <[email protected]>
…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 <[email protected]>
Contributor
Author
|
Thinking we should support bare images, not wrapped in |
Remove the deprecation header and rewrite the module docstring to clearly describe when to use this script (re-tagging a pre-built image) versus `flyte build` (building images from Environment definitions). Also replace the fragile object.__setattr__(image, "tag", tag) mutation with clone(tag=tag), using the proper public API. Signed-off-by: Jeev B <[email protected]>
…ample Replace the argparse CLI with a minimal Environment definition that users can build and push with `flyte build examples/image/ci_build_image.py env`. Signed-off-by: Jeev B <[email protected]>
Member
+1 |
When a user derives from Image.from_debian_base() — via .clone(name=...)
or any with_*() chain — the clone inherited _BASE_REGISTRY
("ghcr.io/flyteorg"), a registry the user doesn't own. The clone should
have registry=None: a user-owned derivative whose push target is
determined by the build system, not by the SDK's registry constant.
clone() rule (condition 3 only):
parent_registry = None if self.registry == _BASE_REGISTRY else self.registry
registry = registry or parent_registry
This is clean because _get_default_image_for() now builds the base image
with registry=None during construction (so internal clone() calls never
trigger the strip), then stamps _BASE_REGISTRY explicitly at the end —
consistent with the existing object.__setattr__ pattern used for `tag`.
Result:
from_debian_base() → registry=_BASE_REGISTRY (unchanged)
from_debian_base().with_pip_packages() → registry=None
from_debian_base().clone(name="ci") → registry=None
.clone(registry="myreg", name="x") → registry="myreg" (explicit wins)
Signed-off-by: Jeev B <[email protected]>
Remove tag= from from_debian_base(), from_dockerfile(), and from_uv_script() — clone(tag=...) covers all cases and is the cleaner, consistent API for pinning an explicit tag.
Dockerfile-based images are non-extendable so clone(tag=...) feels awkward as the only way to pin a tag. Restore tag= directly on from_dockerfile() as the natural place to set it.
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
tag: Optional[str] = NonetoImage.clone(),from_dockerfile(),from_debian_base(), andfrom_uv_script()— placed immediately afternamein every signature, consistent withregistryandnameImage._tagfield with a publicImage.tagattribute, consistent withregistryandname; constructors now passtag=directly to_new()instead of using post-constructionobject.__setattr__force: bool = Falsethroughbuild_images→_build_images→_build_image_bg→build.aioso the existingImageBuildEngine.build(force=)param is reachable from the public API--forceflag toflyte buildCLI viaBuildArguments, wired intoBuildEnvCommand.invokeexamples/image/ci_build_image.pywith a comment pointing toflyte buildUsage
Pattern A — retag + rebuild via remote builder:
Pattern B — Dockerfile-based build:
# CI step — always rebuild and push flyte build images.py my_image --forceTest Plan
uv run pytest tests/flyte/test_image.py tests/flyte/test_deploy.py tests/cli/test_build.py -v— 70 tests, all passuv run flyte build --help—--forceappears in output