cuddly-jelly-27016
04/18/2025, 8:36 PMbuilder specific options to Image Spec.
from flytekit import ImageSpec, task
image = ImageSpec(
base_image="localhost30000/flytekit0.1.5",
builder_options={"option": "custom_build_option"}
)
@task(container_image=image)
def main() -> int:
return 10
In a more realistic example, Union image builder is looking the ability to configure and set registry credentials through this attribute.
from flytekit import ImageSpec, task
# Assume we uploaded credentials
# union create secret --type imagepullsecrets --value-file /path/to/credentials.json my-custom-credentials
image = ImageSpec(
base_image="myprivateregistry.com/flytekit:0.1.5",
builder_options={"imagepull_secret_name": "my-custom-credentials"}
)
@task(container_image=image, secret_requests=[Secret(key="my-custom-credentials""))
def main() -> int:
return 10
## What changes were proposed in this pull request?
This PR adds:
• The ability to specify 'builder_options` dictionary to image spec
• A imagespec.with_builder_options to additively accumulate builder_options
## How was this patch tested?
Additional unit tests
### Summary by Bito
This PR enhances ImageSpec functionality by enabling dictionary-based builder-specific options with type validation and clearer error messages. It improves error handling in image_spec.py and updates docstring formatting to meet pydoclint standards, reducing discrepancies between documented and actual attributes. New test cases verify proper handling of invalid builder_options inputs, strengthening the robustness, reliability and clarity of the image specification API.
Unit tests added: True
Estimated effort to review (1-5, lower is better): 1
flyteorg/flytekitcuddly-jelly-27016
04/22/2025, 5:15 PM