From 4bbeb4b84f1e3962092b9467494c97d01767b9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 16 May 2022 16:04:02 +0200 Subject: [PATCH 1/2] feat: pinned nodejs requirements with `npm ci` Contrary to what we might expect, `npm install` does not install pinned requirements from a project's package-lock.json. That's the responsibility of `npm ci`: https://docs.npmjs.com/cli/v8/commands/npm-ci Running `npm ci` is also *much* faster than `npm install`, so that's a huge win. See this issue for reference: https://github.com/openedx/frontend-wg/issues/100 --- CHANGELOG.md | 1 + docs/dev.rst | 2 +- tutor/templates/build/openedx/Dockerfile | 6 ++---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ffaf1..c6022a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Every user-facing change should have an entry in this changelog. Please respect ## Unreleased +- [Improvement] Faster and more reliable builds with `npm clean-install` instead of `npm install`. (by @regisb. Thanks @ghassanmas!) - [Fix] Fix 500 error during studio login. (by @regisb) - [Fix] Fix updates for the Caddy deployment in multi-node Kubernetes clusters (#660). Previously, Caddy configuration updates might fail if the Kubernetes cluster had more than one worker node. (by @fghaas) diff --git a/docs/dev.rst b/docs/dev.rst index 33162a0..e599933 100644 --- a/docs/dev.rst +++ b/docs/dev.rst @@ -233,7 +233,7 @@ Then, you should run the following commands:: pip install --requirement requirements/edx/development.txt # Install nodejs packages in node_modules/ - npm install + npm clean-install # Rebuild static assets openedx-assets build --env=dev diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index 08def3d..6c3d809 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -56,9 +56,6 @@ RUN git fetch --depth=2 https://github.com/overhangio/edx-platform/ 3b985f207853 # Rate limiting security fix # https://github.com/overhangio/edx-platform/tree/overhangio/sec-rate-limiting RUN git fetch --depth=2 https://github.com/overhangio/edx-platform/ b5723e416e628cac4fa84392ca13e1b72817674f && git cherry-pick b5723e416e628cac4fa84392ca13e1b72817674f -# Fix studio-frontend by pinning the installed version -# https://github.com/openedx/edx-platform/pull/30309 -RUN git fetch --depth=2 https://github.com/uetuluk/edx-platform/ 53ea60eee86e094f35815ac1c4114d6811f4d458 && git cherry-pick 53ea60eee86e094f35815ac1c4114d6811f4d458 {%- endif %} {# Example: RUN git fetch --depth=2 https://github.com/openedx/edx-platform && git cherry-pick #} @@ -121,8 +118,9 @@ RUN nodeenv /openedx/nodeenv --node=12.13.0 --prebuilt # Install nodejs requirements ARG NPM_REGISTRY={{ NPM_REGISTRY }} COPY --from=code /openedx/edx-platform/package.json /openedx/edx-platform/package.json +COPY --from=code /openedx/edx-platform/package-lock.json /openedx/edx-platform/package-lock.json WORKDIR /openedx/edx-platform -RUN npm install --verbose --registry=$NPM_REGISTRY +RUN npm clean-install --verbose --registry=$NPM_REGISTRY ###### Production image with system and python requirements FROM minimal as production From 6fb0a6b855cad5410d13548b21bc0ecfbabf5c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 24 May 2022 11:09:54 +0200 Subject: [PATCH 2/2] fix: ignore plugins that cannot be loaded When running multiple concurrent versions of a plugin there are sometimes version conflicts that prevent the plugin from being loaded. Prior to v1, Tutor was correctly ignoring plugins that could not be loaded. During the transition to v1 we lost that feature because we only captured TutorErrors. --- CHANGELOG.md | 1 + tutor/plugins/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6022a7..e6c85f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Every user-facing change should have an entry in this changelog. Please respect ## Unreleased +- [Fix] Ignore Python plugins that cannot be loaded. (by @regisb) - [Improvement] Faster and more reliable builds with `npm clean-install` instead of `npm install`. (by @regisb. Thanks @ghassanmas!) - [Fix] Fix 500 error during studio login. (by @regisb) - [Fix] Fix updates for the Caddy deployment in multi-node Kubernetes clusters (#660). Previously, Caddy configuration updates might fail if the Kubernetes cluster had more than one worker node. (by @fghaas) diff --git a/tutor/plugins/__init__.py b/tutor/plugins/__init__.py index cf662e0..40ba0a3 100644 --- a/tutor/plugins/__init__.py +++ b/tutor/plugins/__init__.py @@ -72,8 +72,8 @@ def load_all(names: t.Iterable[str]) -> None: for name in names: try: load(name) - except exceptions.TutorError as e: - fmt.echo_alert(f"Failed to enable plugin '{name}': {e.args[0]}") + except Exception as e: + fmt.echo_alert(f"Failed to enable plugin '{name}': {e}") hooks.Actions.PLUGINS_LOADED.do()