Skip to content

Commit 73b774e

Browse files
committed
fix: auto-build 3rd-party MFEs
When a 3rd party develops an MFE and bind-mounts it, it is expected that the dev image will be automatically built on `dev launch`. Also, author should be able to build it with `tutor images build mymfe-dev`. This was not the case for plugins that were loaded after the "mfe" plugin. For instance: "partners" is loaded after "mfe". See discussion: https://discuss.openedx.org/t/issues-developing-a-non-core-mfe-using-tutor/11855
1 parent ebf7ea7 commit 73b774e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [Bugfix] Fix image build/pull/push when 3rd-party microfrontends are bind-mounted. (by @regisb)

tutormfe/plugin.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,21 @@ def get_mfe(mfe_name: str) -> MFE_ATTRS_TYPE:
160160

161161

162162
# Build, pull and push {mfe}-dev images
163-
for mfe_name, mfe_attrs in iter_mfes():
164-
name = f"{mfe_name}-dev"
165-
tag = "{{ DOCKER_REGISTRY }}overhangio/openedx-" + name + ":{{ MFE_VERSION }}"
166-
tutor_hooks.Filters.IMAGES_BUILD.add_item(
167-
(
168-
name,
169-
os.path.join("plugins", "mfe", "build", "mfe"),
170-
tag,
171-
(f"--target={mfe_name}-dev",),
163+
@tutor_hooks.Actions.PLUGINS_LOADED.add()
164+
def _mounted_mfe_image_management() -> None:
165+
for mfe_name, _mfe_attrs in iter_mfes():
166+
name = f"{mfe_name}-dev"
167+
tag = "{{ DOCKER_REGISTRY }}overhangio/openedx-" + name + ":{{ MFE_VERSION }}"
168+
tutor_hooks.Filters.IMAGES_BUILD.add_item(
169+
(
170+
name,
171+
os.path.join("plugins", "mfe", "build", "mfe"),
172+
tag,
173+
(f"--target={mfe_name}-dev",),
174+
)
172175
)
173-
)
174-
tutor_hooks.Filters.IMAGES_PULL.add_item((name, tag))
175-
tutor_hooks.Filters.IMAGES_PUSH.add_item((name, tag))
176+
tutor_hooks.Filters.IMAGES_PULL.add_item((name, tag))
177+
tutor_hooks.Filters.IMAGES_PUSH.add_item((name, tag))
176178

177179

178180
# init script

0 commit comments

Comments
 (0)