Skip to content

CLI: --no-repo still initializes default virtual repo #4316

Description

@sachintandon

Summary

In dstack CLI 0.22.0/0.22.1, dstack apply --no-repo still initializes the default virtual repository and calls POST /api/project/{project}/repos/init.

Reproduction

Run a repo-free task with dstack apply -f task.yml --no-repo -y. The CLI still calls /repos/init; on a project where the caller cannot initialize repositories, apply fails with 403.

Cause

In src/dstack/_internal/cli/services/configurators/run.py, get_repo() returns None when configurator_args.no_repo is set, but get_plan() unconditionally creates the default virtual repo:

repo = self.get_repo(conf, configuration_path, configurator_args)
if repo is None:
    repo = init_default_virtual_repo(api=self.api)

Proposed fix

repo = self.get_repo(conf, configuration_path, configurator_args)
if repo is None and not configurator_args.no_repo:
    repo = init_default_virtual_repo(api=self.api)

Expected behavior

  • With --no-repo, do not call /repos/init and submit the run without a repo.
  • Without --no-repo, preserve the current default virtual repo behavior.
  • Add a CLI regression test asserting init_default_virtual_repo() is not called when no_repo=True.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions