Skip to content

Commit

Permalink
fix: auto-build 3rd-party MFEs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
regisb committed Dec 7, 2023
1 parent ebf7ea7 commit 73b774e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions changelog.d/20231205_164707_regis_fix_3rd_party_build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Bugfix] Fix image build/pull/push when 3rd-party microfrontends are bind-mounted. (by @regisb)
26 changes: 14 additions & 12 deletions tutormfe/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,21 @@ def get_mfe(mfe_name: str) -> MFE_ATTRS_TYPE:


# Build, pull and push {mfe}-dev images
for mfe_name, mfe_attrs in iter_mfes():
name = f"{mfe_name}-dev"
tag = "{{ DOCKER_REGISTRY }}overhangio/openedx-" + name + ":{{ MFE_VERSION }}"
tutor_hooks.Filters.IMAGES_BUILD.add_item(
(
name,
os.path.join("plugins", "mfe", "build", "mfe"),
tag,
(f"--target={mfe_name}-dev",),
@tutor_hooks.Actions.PLUGINS_LOADED.add()
def _mounted_mfe_image_management() -> None:
for mfe_name, _mfe_attrs in iter_mfes():
name = f"{mfe_name}-dev"
tag = "{{ DOCKER_REGISTRY }}overhangio/openedx-" + name + ":{{ MFE_VERSION }}"
tutor_hooks.Filters.IMAGES_BUILD.add_item(
(
name,
os.path.join("plugins", "mfe", "build", "mfe"),
tag,
(f"--target={mfe_name}-dev",),
)
)
)
tutor_hooks.Filters.IMAGES_PULL.add_item((name, tag))
tutor_hooks.Filters.IMAGES_PUSH.add_item((name, tag))
tutor_hooks.Filters.IMAGES_PULL.add_item((name, tag))
tutor_hooks.Filters.IMAGES_PUSH.add_item((name, tag))


# init script
Expand Down

0 comments on commit 73b774e

Please sign in to comment.