* Print put errors from Docker Helpers
* Update Sources/tart/Credentials/DockerConfigCredentialsProvider.swift
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* Check output data is not empty
---------
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* Package tart binary into app bundle when running via run-signed.sh
This is what happens when installing the tart application package
as built by CI. We should stay as close as possible to the install
situation during development, so that we get bug/behavior parity.
For example, an app bundle behaves differently than a standalone
executable when it comes to bringing up a Dock icon for the app.
* Set activation policy to prohibited when starting in no graphics mode
This ensures that the Dock icon is hidden.
* Support mounting remote archives
Allow to pass an HTTPS link instead of a local path to `tart run --dir` argument. HTTPS link should point to a gzipped Tar archive aka `*.tar.gz` file.
In this situation Tart will download an archive by the link if necessary, will cache it and will unarchive it into a temporary folder inside `$TART_HOME` to be mounted to the VM.
This use case is useful for mounting something external that updates faster than the VM itself. For example, GitHub Actions Runner installation.
* Don't use async/await APIs to prevent from deadlocks because of the MainActor thing
* Prefer cached data
* Moved comment
* Fix URLCache caching files in memory instead of on-disk (#622)
* Fix URLCache caching files in memory instead of on-disk
* Fix disk capacity typo
* Moved log
* Moved fetching logic to `DirectoryShare#createConfiguration` method
---------
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* Improved format for fast and efficient pulls from remote OCI-registry
* Tests: introduce fileWithRandomData() helper function
* Remove useless continuation
* --concurrency should be an option, not an argument
* --v2-disk-format → --old-disk-format and use the new V2 by default
* Reduce LZ4 buffer size from 64 to 4 MiB
* --old-disk-format → --disk-format=...
* Support wildcards in `credHelpers`
With #591 `tart pull` fails when for example you have `ecr-login` set as the default `credsStore` but you try to pull our images from `ghcr.io`.
This change reverts #591 and instead supports regex in `credHelpers`. This is not supported by Docker itself but highly demanded in https://github.com/docker/cli/issues/2928
I think it's fine to support it for Tart.
Additionally this change bumps the minimum host macOS version to Ventura in order to bring `Regex`. Yes, `Regex` only supported in Swift for macOS 13+ 🤦♂️I think it's fine in the light of Sonoma release and Tart 2.0.0.
* Removed Monterey mentions from docs
This way for #581 we don't need to specify a fully quialified URL and can simply use the following `~/.docker/config.json`:
```json
{
"credsStore": "ecr-login"
}
```
Related to https://github.com/docker/cli/issues/2928
* GC avoidance and tmpDeterminstic
* change tmpDeterministic to use hashing
- temporaryDeterministic() now takes in a key and hashes it
- creates directory with the hash
* Update Sources/tart/VMStorageOCI.swift
Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
---------
Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
* Don't delete an initiator of pruning
Sometimes people have an image that is greater than half of the disk itself. In that case such image will be pulled and prunned right away.
This change makes sure that an image that is being cloned from is not pruned right away.
* Resolve symbolic links
* Allow mounting a single directory without a name
To utilize `VZSingleDirectoryShare` which seems more stable than `VZMultipleDirectoryShare`.
We've been having reports from users that mounted directories occasionally return "no such file" errors when building large projects. I took a stab at reproducing the issue by running https://github.com/devMEremenko/XcodeBenchmark in a mounted directory:
```bash
tart run --dir=workdir-test:~/workspace-temp/XcodeBenchmark ventura-xcode
```
And I was able to reproduce the "no such file" error on the first try! After looking into the issue I decided to try `VZSingleDirectoryShare` as this PR changes and to my pleasant surprise it all worked like a charm the next run. So it seems there is a bug in `VZMultipleDirectoryShare` integration with virtiofs. Since in most cases users only mount a single directory it makes sense to allow doing it wihtout providing a `name`.
So now it will be possible to run the following command:
```bash
tart run --dir=~/workspace-temp/XcodeBenchmark ventura-xcode
```
Which will make `~/workspace-temp/XcodeBenchmark` available under `/Volumes/My Shared Files/` without any intermediate directories.
* Reformat
* Updated description
* Suspend/resume support
* Use RuntimeError.SuspendFailed for consistency's sake
* Add a comment about "Running" field deprecation
* Use compute credits
* Use Mac-specific input devices and remove --no-{audio,entropy}
* Suspend the VM when closing window and running with --suspendable
* Snapshotting Improvements (#539)
* Don't use static field for arguments
It throws a runtime error
* Fixed suspendability
* Lazy generation of new MAC addresses
To support cloning on suspended VMs
* Refactored
* formatted
* Configurable signal for window closing
* reformatted
* Don't generate MAC only for suspended VMs
* Removed misleading comment
* Reverted
* Lock while a suspendable VM is starting
* Lock on TART_HOME
---------
Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
* Optimistically check if we need to do anything on a pull
Right now on a pull we always acquire a lock for a registry host. This is problematic because, for example, host can be pulling `ghcr.io/cirruslabs/macos-ventura-xcode:15-beta-2` image when a new request will come to pull `ghcr.io/cirruslabs/macos-ventura-xcode:latest` if needed.
In this situation, even though `ghcr.io/cirruslabs/macos-ventura-xcode:latest` is already cached and linked, `tart pull` will wait for a lock.
This change optimistically check if there is something to do at all before acquiring a lock.
* Fix linter errors
---------
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* tart push: allow pushing OCI VMs from the cache too
* Check for RemoteName earlier
* Refactored pushing of OCI images under new tag (#466)
* Refactored pushing of OCI images under new tag
* Fixed compilation
---------
Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
* tart list: show if the VM is running or not
* Boolean "running" field instead of "state", similarly to "tart get"
* Re-use VMDirectory.running() in "tart get"
* Option to pass externally created serial console
See https://github.com/cirruslabs/tart/pull/364#issuecomment-1472111742 for details
* Fixed compilation
* Apply suggestions from code review
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
---------
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* support ZVirtioConsoleDevice for linux vm, user can control the vm via serial port with screen command
* cleanup code, fix indent
* add --serial option to tart
* remove serial in vmconfig, fix Serial.swift
---------
Co-authored-by: peternguyen93 <peternguyen9321@gmail.com>
Co-authored-by: peter <peter@starlabs.sg>
* JSON output for `get` and `list` commands
In the light of the upcoming `1.0.0` release and stabilizing of the API, let's introduce some breaking changes for the good.
Removed all the `--cpu`, `--memory`, `--disk` and `--display` flags and replaced with a single `--json` flag for machine-readable output.
Added `--json` option to the `list` command to output a single JSON list. Notably removed `--quite` flag since it seemed unnecessary.
Fixes#297
* Added Size to `list` output
Fixes#379
* Added running state to `get`
Fixes#393
* Better signature
* Updated tests
* More test fixes
* Introduce "tart import" and "tart export" commands
* Use AppleArchive instead of ZIP and simply {ar,un}chive the VM dir
* Fix formatting
* Link to Apple's docs
* Print "importing..." and "exporting..." lines
* Ditch Foundation.exit()'s where feasible
* Sentry integration
* SwiftFormat
* Upload symbols and sources to Sentry
* Use Sentry Releases
* Do not use ExitCode exceptions
* Clarify why we need CustomNSError extension
* Adds Option to filter VMs by 'source'
* Tidy up columns for table on some Terminals
* Don't show headers if there's an error.
* Fixes linting errors.
* Update Sources/tart/Commands/List.swift
- removing the short name for now, as we don't know if we may need -s in the future
- removing the capitalization for the word "source" and adding an example instead
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* source should be an Optional flag. Reverts header change.
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* OCI: pull blobs via file
* Explain why we delete the downloaded file after opening a handle to it
* Further abstract away ways to fetch a URLRequest
* No need to cast HTTPURLResponse to HTTPURLResponse
* Fetcher: no need to be a delegate anymore
* Fetcher.fetch() can be made static
* Improve RemoteName parser
* Remove Parsing import
* Permit namespace components to contain separators, but no more than one
* Add testNoPathTraversal
* Set line-buffered output for stdout
* tart run: introduce --graphics
* Update Sources/tart/Commands/Run.swift
Co-authored-by: Pete Goldsmith <peter.n.goldsmith@gmail.com>
* Update Sources/tart/Commands/Run.swift
Co-authored-by: Pete Goldsmith <peter.n.goldsmith@gmail.com>
Co-authored-by: Pete Goldsmith <peter.n.goldsmith@gmail.com>
* tart clone: clone VM and generate MAC under a file lock
* Lock concurrent "tart pull"'s for the same host
* Config: ensure Tart's home and cache directories always exist
* Improve RemoteName parser
* Remove Parsing import
* Permit namespace components to contain separators, but no more than one
* Add testNoPathTraversal
* OCI blob compression: fix Data memory leak when using InputFilter
* Rename mappedDiskOffset to mappedDiskReadOffset
* Update progress.completedUnitCount differently
* Do not include Content-Range for monolithic uploads
Some registries still assumes it's a chunked upload and verifies the "chunk" size which is too big.
* Update Sources/tart/OCI/Registry.swift
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* Softnet: an alternative to built-in NAT with better isolation
* Softnet: increase socketpair(2) socket buffer sizes to 1 MiB
* Pass VM's FD and MAC address to the Softnet
* Softnet: implement graceful shutdown
* Bring back the dispatchMain() and task cancellation
* tart pull: check for cancellation when pulling response body
* Don't dispatchMain() in withTaskCancellationHandler()
* Move VNC URL opening logic into VNCWrapper.open()
* Fixes for Ventura
Still a noob in SwiftUI and Swift concurrency, but it seems on Ventura a task group is not actually running on main or something. Either way I think this change simplifies things but launching a VM in a task and then just continuing with either VNC or built-in graphics.
* Check VM's state
* tart clone: always re-generate MAC-address
This is not really an issue for non-enterprise users[1].
[1]: https://github.com/cirruslabs/tart/issues/20#issuecomment-1136944455
* Atomic tart {create,clone,pull} operations using rename(2)
* Print a nicer error message when attempting to double-run a VM
* tart clone: bring back the old MAC-address generation logic
* Ensure VMDirectory.temporary() will be deleted on failure
* tart pull: introduce --populate-cache flag
* VMStorageOCI: introduce cache() method
* Review comments (#107)
* Rename SetCommand back to Set
Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
* Terminate when Ctrl+C is encountered when entering credentials
* Handle Ctrl+C by catching SIGINT and converting it to task cancellation
* maxCharacters instead of (buf.count - 2)
* readStdinCredential: fix maxCharacters to be 255
* "user" variable should be named "credential"