overhangio / tutor-mfe

This plugin makes it possible to easily add micro frontend (MFE) applications on top of an Open edX platform that runs with Tutor.
GNU Affero General Public License v3.0
22 stars 95 forks source link

Custom MFE repo url is incorrect in README #180

Closed FatemeKhodayari closed 10 months ago

FatemeKhodayari commented 11 months ago

Hi. I recently upgraded from palm (tutor v16.1.7) to quince(tutor 17.0.0). As I have some custom MFEs, added as tutor plugins, I tried building the MFE image but I faced the following error:

 => ERROR [learning-common 1/8] COPY --from=learning-src /package.json /openedx/app/package.json                                                           0.0s
 => ERROR [learning-common 2/8] COPY --from=learning-src /package-lock.json /openedx/app/package-lock.json                                                 0.0s
------
 > [learning-common 1/8] COPY --from=learning-src /package.json /openedx/app/package.json:
------
------
 > [learning-common 2/8] COPY --from=learning-src /package-lock.json /openedx/app/package-lock.json:
------
Dockerfile:470
--------------------
 468 |     FROM base AS learning-common
 469 |     COPY --from=learning-src /package.json /openedx/app/package.json
 470 | >>> COPY --from=learning-src /package-lock.json /openedx/app/package-lock.json
 471 |     ARG NPM_REGISTRY=https://registry.npmjs.org/
 472 |     
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 26a26b81-847e-4f0a-86b0-de26d9415222::rody1bdm8rxl29aqd1wjwjypc: "/package-lock.json": not found
Error: Command failed with status 1: docker buildx build --tag=docker.io/overhangio/openedx-mfe:17.0.0 --output=type=docker --cache-from=type=registry,ref=docker.io/overhangio/openedx-mfe:17.0.0-cache /home/fateme/.local/share/tutor/env/plugins/mfe/build/mfe

As I have both package.json and package-lock.json in my repository, I took a look at the MFE Dockerfile, where this line (the git clone stage) caught my eye:

ADD --keep-git-dir=true https://github.com/openedx/frontend-app-learning.git#open-release/quince.1 .

The line above is what originally exists in the dockerfile of v17.0.0 but as you add custom MFEs, this line gets changed to something like this:

ADD --keep-git-dir=true https://github.com/openedx/frontend-app-learning/#<custom-branch-or-tag> .

The difference is that, as the readme says as well, people have used their repository URL in the plugin, so no .git exists at the end of the repository key of the MFE plugin, making this line to fail and the mentioned error to occur.

The script looked like this before this change:

RUN git clone {{ app["repository"] }} --branch {{ app.get("version", MFE_COMMON_VERSION) }} --depth 1 .

So shall we change the readme and ask for URLs with .git or shall we fix the script?

regisb commented 10 months ago

Very good point. Yes, we should update the README such that repo URLs include a ".git" suffix. Would you like to open a PR?

FatemeKhodayari commented 10 months ago

Very good point. Yes, we should update the README such that repo URLs include a ".git" suffix. Would you like to open a PR?

Done. Also while doing the PR, I found this PR and this forum topic. Wish I'd seen them sooner :))

waza-ari commented 10 months ago

Thanks for figuring this out, I was banging my head against the wall for the past couple of hours. @regisb, would it be possible to add this to the Release Notes here on GitHub? I was going through them and didn't find anything relevant.

regisb commented 10 months ago

@waza-ari sure thing https://github.com/overhangio/tutor-mfe/releases/tag/v17.0.0