cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.67k stars 103 forks source link

Do not magically set `--no-graphics` when `--vnc` is passed #732

Closed fkorotkov closed 5 months ago

fkorotkov commented 5 months ago

From a discussion in #728 it appeared that having both --graphics and --no-graphics is a bit confusing.

--graphics was introduced in #248 to support having both VNC and UI for debugging Packer plugin in cirruslabs/packer-plugin-tart#21. This is because --vnc flag has a side effect of hiding UI which I think was wrong in retrospective. One can run tart run --vnc --no-graphics. In most of the cases this is automated via Alfred or something like that.

Now we have so many arguments that IMO it's worth to remove --graphics for overall consistency in arguments: everything is enabled by default and can be disabled via --no-* flags.

torarnv commented 4 months ago

I noticed this new behavior today when trying the --vnc and --vnc-experimental options.

The command line documentation still says "Use screen sharing instead of the built-in UI." and "Use Virtualization.Framework's VNC server instead of the build-in UI.". While in fact the built-in UI is now still run. Should we update these?

Another complication is that we use --no-graphics to determine whether the VNC connection should be automatically opened or not:

         if noGraphics || ProcessInfo.processInfo.environment["CI"] != nil {
            print("VNC server is running at \(vncURL)")
          } else {
            print("Opening \(vncURL)...")
            NSWorkspace.shared.open(vncURL)
          }

Deprecating --graphics makes sense, but perhaps we should reconsider the behavior of --vnc and --vnc-experimental in terms of opening the default UI?

Ie, --vnc and --vnc-experimental shouldn't set noGraphics, because we're still running with graphics (non-headless), but we are using a different way to provide the graphics, so we skip the call to runUI.

torarnv commented 4 months ago

Ie, right now using --vnc-experimental I have to choose between:

  1. Getting two UI windows for each VM, one for the built in UI and one for Screen Sharing
  2. Passing --no-graphics and losing out on Tart automatically opening Screen Sharing with the right address and password

Restoring the previous behavior allows the choice of headless or not (--no-graphics), to be independent of how the graphics are provided (default vs --vnc vs --vnc-experimental).

torarnv commented 4 months ago

Proposed fix in https://github.com/cirruslabs/tart/pull/758