Skip to content

[Bug]: Cannot use relative paths in dstack apply --local --repo <path> #2731

Closed
@jvstme

Description

@jvstme

Steps to reproduce

dstack apply --local --repo .

Actual behaviour

Traceback (most recent call last):
  File "/dstack/venv/bin/dstack", line 10, in <module>
    sys.exit(main())
  File "/dstack/src/dstack/_internal/cli/main.py", line 89, in main
    args.func(args)
  File "/dstack/src/dstack/_internal/cli/commands/apply.py", line 128, in _command
    configurator.apply_configuration(
  File "/dstack/src/dstack/_internal/cli/services/configurators/run.py", line 156, in apply_configuration
    run = self.api.runs.apply_plan(
  File "/dstack/src/dstack/api/_public/runs.py", line 475, in apply_plan
    run_plan.run_spec.repo_code_hash = repo.write_code_file(fp)
  File "/dstack/src/dstack/_internal/core/models/repos/local.py", line 87, in write_code_file
    path = entry.path().relative_to(repo_path.absolute())
  File "/usr/lib64/python3.10/pathlib.py", line 818, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '.' is not in the subpath of '/tmp/repo' OR one path is relative and the other is absolute.

Expected behaviour

Starts a run with the specified local repo.

dstack version

master

Server logs

Additional information

Introduced in #2695

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions