6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 22:27:47 +00:00

fix: update env prior to rebuilding images during upgrade

The fact that the environment was not up-to-date was causing errors and
confusion:
https://discuss.overhang.io/t/install-maple-importerror-cannot-import-name-removedindjango40warning/2255/6
This commit is contained in:
Régis Behmo 2022-01-04 09:13:44 +01:00 committed by Régis Behmo
parent 59291eed52
commit 9fc928a711
3 changed files with 27 additions and 3 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased ## Unreleased
- [Bugfix] During upgrade, make sure that environment is up-to-date prior to prompting to rebuild the custom images.
- [Bugfix] Fix ownership of mysql data, in particular when upgrading a Kubernetes cluster to Maple. - [Bugfix] Fix ownership of mysql data, in particular when upgrading a Kubernetes cluster to Maple.
- [Bugfix] Ensure that ``tutor k8s upgrade`` is run during ``tutor k8s quickstart``, when necessary. - [Bugfix] Ensure that ``tutor k8s upgrade`` is run during ``tutor k8s quickstart``, when necessary.
- [Bugfix] By default, upgrade from Lilac and not Koa during ``tutor k8s upgrade``. - [Bugfix] By default, upgrade from Lilac and not Koa during ``tutor k8s upgrade``.

View File

@ -162,6 +162,7 @@ def quickstart(context: click.Context, non_interactive: bool) -> None:
context.invoke( context.invoke(
upgrade, upgrade,
from_version=tutor_env.current_release(context.obj.root), from_version=tutor_env.current_release(context.obj.root),
non_interactive=non_interactive,
) )
click.echo(fmt.title("Interactive platform configuration")) click.echo(fmt.title("Interactive platform configuration"))
@ -448,8 +449,9 @@ def wait(context: Context, name: str) -> None:
default="lilac", default="lilac",
type=click.Choice(["ironwood", "juniper", "koa", "lilac"]), type=click.Choice(["ironwood", "juniper", "koa", "lilac"]),
) )
@click.option("-I", "--non-interactive", is_flag=True, help="Run non-interactively")
@click.pass_obj @click.pass_obj
def upgrade(context: Context, from_version: str) -> None: def upgrade(context: Context, from_version: str, non_interactive: bool) -> None:
config = tutor_config.load(context.root) config = tutor_config.load(context.root)
running_version = from_version running_version = from_version
@ -469,6 +471,23 @@ def upgrade(context: Context, from_version: str) -> None:
upgrade_from_lilac(config) upgrade_from_lilac(config)
running_version = "maple" running_version = "maple"
# Update env such that the build environment is up-to-date
tutor_env.save(context.root, config)
if not non_interactive:
question = f"""
Your platform was successfuly upgraded from {from_version} to {running_version}.
Depending on your setup, you might have to rebuild some of your Docker images
and push them to your private registry (if any). You can do this now by running
the following command in a different shell:
tutor images build openedx # add your custom images here
tutor images push openedx
Press enter when you are ready to continue"""
click.confirm(
fmt.question(question), default=True, abort=True, prompt_suffix=" "
)
def upgrade_from_ironwood(config: Config) -> None: def upgrade_from_ironwood(config: Config) -> None:
if not config["RUN_MONGODB"]: if not config["RUN_MONGODB"]:

View File

@ -105,7 +105,7 @@ Your Open edX platform is ready and can be accessed at the following urls:
@click.option("-I", "--non-interactive", is_flag=True, help="Run non-interactively") @click.option("-I", "--non-interactive", is_flag=True, help="Run non-interactively")
@click.pass_context @click.pass_context
def upgrade(context: click.Context, from_version: str, non_interactive: bool) -> None: def upgrade(context: click.Context, from_version: str, non_interactive: bool) -> None:
config = tutor_config.load_full(context.obj.root) config = tutor_config.load(context.obj.root)
if not non_interactive: if not non_interactive:
question = """You are about to upgrade your Open edX platform. It is strongly recommended to make a backup before upgrading. To do so, run: question = """You are about to upgrade your Open edX platform. It is strongly recommended to make a backup before upgrading. To do so, run:
@ -137,9 +137,13 @@ Are you sure you want to continue?"""
# Nothing to do here # Nothing to do here
running_version = "maple" running_version = "maple"
# Update env such that the build environment is up-to-date
tutor_env.save(context.obj.root, config)
if not non_interactive: if not non_interactive:
question = f""" question = f"""
Your platform was successfuly upgraded from {from_version} to {running_version}. Depending on your setup, you might have to rebuild some of your Docker images. You can do this now by running the following command in a different shell: Your platform was successfuly upgraded from {from_version} to {running_version}.
Depending on your setup, you might have to rebuild some of your Docker images.
You can do this now by running the following command in a different shell:
tutor images build openedx # add your custom images here tutor images build openedx # add your custom images here