Skip to content

Commit 398ec2e

Browse files
authored
fix(svc): fix migration not working with old template metadata (#3687)
1 parent a98a23c commit 398ec2e

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

renku/core/migration/migrate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ def migrate_project(
142142
except Exception as e:
143143
raise TemplateUpdateError("Couldn't update from template.") from e
144144

145-
if not skip_docker_update:
145+
if (
146+
not skip_docker_update
147+
and project
148+
and hasattr(project, "template_metadata")
149+
and isinstance(project.template_metadata, ProjectTemplateMetadata)
150+
):
146151
try:
147152
docker_updated, _, _ = update_dockerfile()
148153
except DockerfileUpdateError:

renku/ui/service/controllers/cache_migrate_project.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,27 @@ def execute_migration(
3030
project_path, force_template_update, skip_template_update, skip_docker_update, skip_migrations, commit_message
3131
):
3232
"""Execute project migrations."""
33-
from renku.command.migrate import migrate_project_command
33+
from renku.command.migrate import (
34+
AUTOMATED_TEMPLATE_UPDATE_SUPPORTED,
35+
DOCKERFILE_UPDATE_POSSIBLE,
36+
TEMPLATE_UPDATE_POSSIBLE,
37+
check_project,
38+
migrate_project_command,
39+
)
3440

3541
worker_log.debug(f"migrating {project_path}")
3642

3743
communicator = ServiceCallback()
3844

3945
with renku_project_context(project_path):
46+
status = check_project().build().execute().output
47+
48+
template_update_possible = status & TEMPLATE_UPDATE_POSSIBLE and status & AUTOMATED_TEMPLATE_UPDATE_SUPPORTED
49+
docker_update_possible = status & DOCKERFILE_UPDATE_POSSIBLE
50+
51+
skip_docker_update = skip_docker_update or not docker_update_possible
52+
skip_template_update = skip_template_update or not template_update_possible
53+
4054
result = (
4155
migrate_project_command()
4256
.with_commit(message=commit_message)

0 commit comments

Comments
 (0)