diff --git a/CHANGELOG.md b/CHANGELOG.md index 269475c..f32b1a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥". ## 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] 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``. diff --git a/tutor/commands/k8s.py b/tutor/commands/k8s.py index 0c0283d..d01b169 100644 --- a/tutor/commands/k8s.py +++ b/tutor/commands/k8s.py @@ -162,6 +162,7 @@ def quickstart(context: click.Context, non_interactive: bool) -> None: context.invoke( upgrade, from_version=tutor_env.current_release(context.obj.root), + non_interactive=non_interactive, ) click.echo(fmt.title("Interactive platform configuration")) @@ -448,8 +449,9 @@ def wait(context: Context, name: str) -> None: default="lilac", type=click.Choice(["ironwood", "juniper", "koa", "lilac"]), ) +@click.option("-I", "--non-interactive", is_flag=True, help="Run non-interactively") @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) running_version = from_version @@ -469,6 +471,23 @@ def upgrade(context: Context, from_version: str) -> None: upgrade_from_lilac(config) 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: if not config["RUN_MONGODB"]: diff --git a/tutor/commands/local.py b/tutor/commands/local.py index 49da6d9..0b30634 100644 --- a/tutor/commands/local.py +++ b/tutor/commands/local.py @@ -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.pass_context 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: 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 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: 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