Skip to content

Commit fdd8646

Browse files
authored
Fix client compatibility with pre-0.19.27 servers (#3063)
Fixes: #3062
1 parent be36bde commit fdd8646

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

  • src/dstack/_internal

src/dstack/_internal/cli/services/configurators/run.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def apply_configuration(
9797
# is not set (emulate pre-0.19.27 JobConfigutor logic), otherwise fall back to
9898
# `/workflow`.
9999
if isinstance(conf, DevEnvironmentConfiguration) or conf.commands:
100-
conf.working_dir = LEGACY_REPO_DIR
100+
# relative path for compatibility with pre-0.19.27 servers
101+
conf.working_dir = "."
101102
warn(
102103
"[code]working_dir[/code] is not set."
103104
f" Using legacy working directory [code]{LEGACY_REPO_DIR}[/code]\n\n"
@@ -117,6 +118,12 @@ def apply_configuration(
117118
f"To keep using legacy working directory, set"
118119
f" [code]working_dir[/code] to [code]{legacy_working_dir}[/code]\n"
119120
)
121+
else:
122+
# relative path for compatibility with pre-0.19.27 servers
123+
try:
124+
conf.working_dir = str(PurePosixPath(working_dir).relative_to(LEGACY_REPO_DIR))
125+
except ValueError:
126+
pass
120127

121128
if conf.repos and conf.repos[0].path is None:
122129
warn(

src/dstack/_internal/core/compatibility/runs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def get_run_spec_excludes(run_spec: RunSpec) -> IncludeExcludeDictType:
104104

105105
if run_spec.repo_dir in [None, LEGACY_REPO_DIR]:
106106
spec_excludes["repo_dir"] = True
107+
elif run_spec.repo_dir == "." and configuration.working_dir in [None, LEGACY_REPO_DIR, "."]:
108+
spec_excludes["repo_dir"] = True
107109

108110
if configuration.fleets is None:
109111
configuration_excludes["fleets"] = True

0 commit comments

Comments
 (0)