File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed
tests/flytekit/unit/core/image_spec Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 8686 id=micromamba \
8787 --mount=from=micromamba,source=/usr/bin/micromamba,target=/usr/bin/micromamba \
8888 micromamba config set use_lockfiles False && \
89- micromamba create -n runtime --root-prefix /opt/micromamba \
89+ ( micromamba create -n runtime --root-prefix /opt/micromamba \
9090 -c conda-forge $CONDA_CHANNELS \
91- python=$PYTHON_VERSION $CONDA_PACKAGES
91+ python=$PYTHON_VERSION $CONDA_PACKAGES \
92+ || micromamba install -n runtime --root-prefix /opt/micromamba \
93+ -c conda-forge $CONDA_CHANNELS \
94+ python=$PYTHON_VERSION $CONDA_PACKAGES )
9295""" )
9396
9497DOCKER_FILE_TEMPLATE = Template ("""\
98101
99102FROM $BASE_IMAGE
100103
104+ WORKDIR /
101105USER root
102106$APT_INSTALL_COMMAND
103107RUN --mount=from=micromamba,source=/etc/ssl/certs/ca-certificates.crt,target=/tmp/ca-certificates.crt \
104108 [ -f /etc/ssl/certs/ca-certificates.crt ] || \
105109 mkdir -p /etc/ssl/certs/ && cp /tmp/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
106110
107111RUN id -u flytekit || useradd --create-home --shell /bin/bash flytekit
108- RUN chown -R flytekit /root && chown -R flytekit /home
112+ RUN chown flytekit /root && chown -R flytekit /home
109113
110114$INSTALL_PYTHON_TEMPLATE
111115
Original file line number Diff line number Diff line change @@ -93,6 +93,29 @@ def test_image_spec(mock_image_spec_builder, monkeypatch):
9393 assert image_spec .commands == ["echo hello" ]
9494
9595
96+ @pytest .mark .skipif (
97+ os .environ .get ("_FLYTEKIT_TEST_IMAGE_BUILD_ENGINE" , "0" ) == "0" ,
98+ reason = "Set _FLYTEKIT_TEST_IMAGE_BUILD_ENGINE=1 to run this test" ,
99+ )
100+ def test_nested_build (monkeypatch ):
101+ monkeypatch .setenv ("FLYTE_PUSH_IMAGE_SPEC" , "0" )
102+ base_image = ImageSpec (
103+ name = "base" ,
104+ packages = ["torch" ],
105+ python_version = "3.11"
106+ )
107+
108+ image_spec = ImageSpec (
109+ name = "final" ,
110+ packages = ["pandas" ],
111+ python_version = "3.11" ,
112+ base_image = base_image ,
113+ )
114+ assert image_spec ._is_force_push is False
115+
116+ ImageBuildEngine .build (image_spec )
117+
118+
96119def test_image_spec_engine_priority ():
97120 new_image_name = "fqn.xyz/flytekit"
98121 mock_image_builder_10 = Mock ()
You can’t perform that action at this time.
0 commit comments