Commit Graph

382 Commits

Author SHA1 Message Date
Nikolay Edigaryev cc8201dee6
OCI: support insecure registries and custom ports (#174) 2022-08-12 16:24:14 +03:00
Fedor Korotkov 2cab49b3f1
Use Ventura APIs for recovery mode (#175) 2022-08-12 08:02:44 +03:00
Fedor Korotkov e2b7f12388
Support chunked uploads (#159)
* Support chunked uploads

* Rebase fixes

* Bump swift http client
2022-08-08 10:16:47 -04:00
Fedor Korotkov 617a5d02dc
Fixed potential infinity auth (#173)
Follow up to an attempt in #169
2022-08-08 16:50:13 +03:00
Nikolay Edigaryev b83bce4544
tart login: read whole stdin contents instead of just a line (#170) 2022-08-02 16:52:35 +03:00
Nikolay Edigaryev 7d16516b6a
OCI: gcr.io fixes (#169)
* Make sure we don't craft an URLComponents with an empty query items

* Prevent auth() infinite loop

* OCI: ignore invalid RFC 3339 formatted dates
2022-08-01 19:24:11 -04:00
Nikolay Edigaryev 56ddd8df75
OCI's HTTP client: prevent the usage of NIO Transport Services (#168) 2022-08-01 18:17:50 -04:00
Fedor Korotkov b1534a05d5
Configure audio devices to pass through the signal from/to the host (#163)
Fixes #161
2022-08-01 17:54:55 +03:00
Nikolay Edigaryev f54e7c2cab
tart login: only store one credential per registry (#162) 2022-08-01 09:55:37 +03:00
Nikolay Edigaryev 85dfa961c9
tart run: introduce --disk option (#156)
* tart run: introduce --disk option

* Document how to create disks using Disk Utility
2022-07-26 09:25:23 -04:00
Nikolay Edigaryev 3a74fc35e6
Introduce TART_HOME (#157) 2022-07-25 17:01:46 +03:00
Nikolay Edigaryev 7bf7f890c4
tart run: return exit status 2 when VM is already running (#155) 2022-07-21 07:53:47 -04:00
Nikolay Edigaryev 48cd4b47e4
Move full-fledged VNC support to --experimental-vnc (#154) 2022-07-21 12:37:43 +03:00
Nikolay Edigaryev c1dee4f9b2
Credentials: update Keychain entry if it already exists (#149) 2022-07-13 12:35:44 -04:00
Nikolay Edigaryev 52abb7589c
OCI: support Basic authentication scheme (#145)
* OCI: support Basic authentication scheme

* .isValid → .isValid()

* tart login: make --username optional
2022-07-08 16:36:00 +03:00
Nikolay Edigaryev 4386192161
tart login: introduce --username and --password-stdin flags (#143) 2022-07-05 16:32:20 +03:00
Nikolay Edigaryev 85429cea0a
Retrieve IP from DHCPD leases file instead of ARP cache (#141)
* Retrieve IP from DHCPD leases file instead of ARP cache

* Reference PLCache_read() from the retrieveRawLeases() parsing function
2022-06-30 17:58:52 +03:00
Nikolay Edigaryev 384abcd0bd
OCI: make sure annotations are sorted (#138) 2022-06-27 16:25:52 +03:00
Fedor Korotkov 92529afa23
Handle `tart run --no-graphics --vnc` properly (#137)
Let's start a VNC server but not force open Screen Sharing if `--no-graphics` is also passed.
2022-06-24 22:54:41 +03:00
Nikolay Edigaryev e12f95878e
Softnet: an alternative to built-in NAT with better isolation (#48)
* 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()
2022-06-21 19:17:02 +03:00
Fedor Korotkov 7efef28250
Allow VNC for Recovery mode (#134) 2022-06-20 20:08:31 +03:00
Nikolay Edigaryev 1e90752ded
Full-fledged VNC support (#126) 2022-06-20 18:53:17 +03:00
Fedor Korotkov 2020324ef5
Fixed --no-graphics (#132)
Followup to #129 which broke CLI integration because `--no-graphics` option didn't wait for anything.
2022-06-20 10:28:10 -04:00
Nikolay Edigaryev b581db5be4
OCI: make annotations optional (#130)
* OCI: make annotations optional

* Don't initialize annotations by default
2022-06-17 10:53:52 -04:00
Fedor Korotkov 89217c23a2
Fixes for Ventura (#129)
* 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
2022-06-17 10:04:57 -04:00
Nikolay Edigaryev f59ef2722d
OCI: store uncompressed disk size in manifest (#128) 2022-06-17 11:14:28 +03:00
Fedor Korotkov 7759c72a76
Don't use dispatchMain (#123) 2022-06-14 11:31:31 -04:00
Raymond 4cc8a9925a
accept larger disk size (#122) 2022-06-10 09:05:57 -04:00
Nikolay Edigaryev b16bbf587a
Registry: log upload location when encountering blob pushing error (#121) 2022-06-08 17:23:16 +03:00
Fedor Korotkov 87733290e7
Smaller icon (#116)
Initially it wasn't fully following the [guidelines](https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon/).

Fixes #112
2022-06-06 18:38:30 +03:00
Fedor Korotkov c14b46adc3
Make sure VM directory exists before moving (#111) 2022-06-03 23:22:11 +03:00
Nikolay Edigaryev 63329ef363
Atomic tart {create,clone,pull} operations using rename(2) (#109)
* 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
2022-06-01 11:02:31 -04:00
Nikolay Edigaryev 5446164a36
tart pull: introduce --populate-cache flag (#103)
* 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>
2022-05-28 23:20:24 -04:00
Nikolay Edigaryev f3068b9055
tart login: verify credentials (#102)
* tart login: verify credentials

* Make DictionaryCredentialsProvider fileprivate to Login.swift
2022-05-26 09:31:46 -04:00
Fedor Korotkov afa6b7b46c
Auto-detect screen DPI (#106)
* Auto-detect screen DPI

Fixes #104

* Added a comment
2022-05-26 12:23:13 +03:00
Fedor Korotkov d277fb2941
Added helpfull messages to run command (#100) 2022-05-23 11:29:35 -04:00
Fedor Korotkov 088cdc51a3
Option to run with VNC (#97)
* Option to run with VNC

So copy/paste is working. For example, `tart run --vnc latest`.

Related to 14

* Add VNC task first

* Indicate the wait
2022-05-23 16:49:15 +03:00
Fedor Korotkov afb23a3e3a
Init HTTP client only if Registry is used (#99) 2022-05-21 00:26:43 +03:00
Fedor Korotkov 35904dc637
Async http client for pull/push (#95)
* Use async http client for pull/push

* Don't update progress too frequently

* Removed unused variable

* Rebased after added tests
2022-05-20 11:04:21 -04:00
Nikolay Edigaryev fec803277d
Registry functional/integration tests (#96)
* Registry functional/integration tests

* Remove DockerClientSwift import

* Encodable, Decodable → Codable
2022-05-20 09:52:37 -04:00
Nikolay Edigaryev 54a321df7f
Sort "tart list" by default (#94) 2022-05-19 15:05:16 -04:00
Fedor Korotkov 0a257a1547
Option to run in recovery mode (#91)
* Option to run in recovery mode

* Fixed typo

* Use Dynamic package to call private APIs

* Improved comment

* Move options closer to invocation
2022-05-19 08:17:05 -04:00
Nikolay Edigaryev 60c15e3e49
tart list: fix heading order (#90) 2022-05-18 14:20:52 -04:00
Fedor Korotkov a1bcbdbf0b
Bump default CPU cores (#86)
To prevent frustrations like #68
2022-05-18 18:12:45 +03:00
Nikolay Edigaryev c2da3fd919
Support "tart --version" (#81)
* Support "tart --version"

* Move CI.swift patcher into a separate script

Otherwise it doesn't work in GoReleaser.
2022-05-17 10:40:21 -04:00
Fedor Korotkov 63a2793c32
Support upper case in remote names (#79) 2022-05-16 18:14:42 +03:00
Fedor Korotkov 0fc3d3d1f4
Add virtual sound devices (#78) 2022-05-16 17:21:21 +03:00
Nikolay Edigaryev 60b705478b
Handle Ctrl + C properly (#73)
* 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"
2022-05-16 09:56:30 -04:00
Nikolay Edigaryev fa9e3146c1
tart list: filter out uninitialized VM directories (#76) 2022-05-16 08:30:58 -04:00
Nikolay Edigaryev 3dfe8f870c
Provide more details when VM's network attachment disconnects (#74) 2022-05-16 08:23:34 -04:00
Fedor Korotkov 7afa446a73
Change default disk size upon creation (#71)
To help with frustrations like https://github.com/cirruslabs/tart/issues/44#issuecomment-1126831261

Experts will still use `--disk-size` flag to tailor disk size for their needs.
2022-05-16 09:44:31 +03:00
Nikolay Edigaryev d1bed25023
tart pull: be more liberal when accepting local image as argument (#70)
* tart pull: be more liberal when accepting local image as argument

* Update Sources/tart/Commands/Pull.swift

Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>

* Single sentence and consistent capitalization

Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
2022-05-15 18:03:15 -04:00
Nikolay Edigaryev 8554e56e4b
Registry: use issued_at field in the token response message (#65)
* Registry: use issued_at field in the token response message

* Configure JSONDecoder instead of the Decodable itself
2022-05-12 22:33:02 +03:00
Fedor Korotkov 24375c24f3
Print total size of compressed layers (#60)
Before pulling an image.
2022-05-10 16:20:52 -04:00
Fedor Korotkov 2f5a6790d8
Refactored registry token handling (#57)
* Refactored registry token handling

* Update Sources/tart/OCI/Registry.swift

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* Target our dedicated M1 Mini

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
2022-05-09 16:13:22 +03:00
Nikolay Edigaryev f6acbe8fe5
Registry: invalidate expired tokens (#55) 2022-05-08 19:46:11 -04:00
Fedor Korotkov efc9c74b6c
Report if an image already pulled (#52) 2022-05-06 17:06:28 -04:00
Nikolay Edigaryev 4a60c41dd3
Registry: provide response body on auth token request failure (#51)
* Registry: provide response body on auth token request failure

* Clone.swift: fix typo
2022-05-06 14:19:27 -04:00
Fedor Korotkov f20a98bf01
Smart generation of new MAC addresses (#45)
* Introduce --new-mac-address flag for Clone command

Related to https://github.com/cirruslabs/tart/issues/20#issuecomment-1116732505

* Smart generation of new MAC addresses
2022-05-06 20:38:56 +03:00
Nikolay Edigaryev d5e3a7718e
Registry: suport pulling public images (#50) 2022-05-06 20:30:04 +03:00
Nikolay Edigaryev a4db60d656
Registry: don't loose query parameters on URL absolutization (#47)
* Registry: don't loose query parameters on URL absolutization

* Registry: throw a proper exception when Location header parsing fails
2022-05-06 09:03:58 -04:00
Fedor Korotkov 29e08220e4
Get OCI credentials only when needed (#46)
So we don't even request them for a public image
2022-05-06 02:12:38 +03:00
Fedor Korotkov cdf4932aa3
Improved logging a bit (#43)
* Improved logging a bit

* Progress for all bytes
2022-05-05 10:43:09 -04:00
Nikolay Edigaryev 95316c0d67
Support pulling/pushing VMs to OCI-compatible registries (#32)
* Support pulling/pushing VMs to OCI-compatible registries

* Registry: rename request() to endpointRequest() for clarity

* Registry: include JSON details on HTTP status code mismatch errors

* .cirrus.yml: run tests

* Fix testDigest

* Registry: set Content-{Length,Type} headers when pushing blob

* Refactor Registry.auth() and enrich RegistryError.AuthFailed

* Remove useless comment

* Fix WWWAuthenticate a bit and add tests

* WWWAuthenticate: expect a Bearer scheme

* Registry.auth(): document the passing of ["scope", "service"] parameters

* Clarify unexpected HTTP code error when retrieving auth token

* Make RemoteName parser more relaxed for now

* tart clone: pull the VM if it's OCI-based first

* VMStorageOCI: ensure the old symbolic link is overwritten

* tart push: support multiple remote VM names

* Logging: push/pull progress

* Use 500 MB chunks (instead of 500 MiB) to evenly cut disk

...which also uses powers of 10.

* Credentials: only read credentials labeled "Tart Credentials"
2022-05-03 14:30:26 -04:00
Fedor Korotkov 4a5efefbc9
Embed AppIcon.png within binary (#30)
* Build product explicitly

Without it resources are not embedded in the executable

* Embed icon in code
2022-04-22 10:29:52 +03:00
Fedor Korotkov f07ffed6c8
--wait option for IP command (#29) 2022-04-19 19:56:59 +03:00
Fedor Korotkov d55e5457f9
Make the disk size configurable upon creation (#26)
* Make the disk size configurable upon creation

I haven't found a way to make a VM aware of a larger disk size. So I didn't add `--disk-size` option to `set` command.

* Fixed size so it's pretty in the UI

* Hidden option to resize disk for testing
2022-04-18 17:46:19 +03:00
Fedor Korotkov ad2db1461f
Update App Icon (#28) 2022-04-17 13:52:54 +03:00
Fedor Korotkov cc31388c1b
Renamed disk file (#24)
.img is a standard extension for disk images on macOS. With this extension clicking on the file in finder it will be open in Dick Utilities for inspection.
2022-04-14 22:49:38 +03:00
Fedor Korotkov e100cc0d7f
Add App Icon (#23) 2022-04-14 13:23:21 -04:00
Fedor Korotkov 75b5d63387
Refactored UI (#22)
* Simplified crafting of a VM config

* Configure display

* Propagate VM name to the title
2022-04-13 16:42:27 -04:00
Nikolay Edigaryev 466c3c568a
Add ability to modify VM's configuration (number of CPUs and memory size) (#16)
* VMConfig: store minimum CPU count and memory size separately

* Add ability to modify VM's configuration

* Enforce minimum CPU and memory requirements

* VMConfig: remove migration logic
2022-04-11 13:39:34 +03:00
Fedor Korotkov 9f8d3017d9
Handle incomplete MAC address (#15) 2022-03-29 12:07:03 -04:00
Fedor Korotkov 49d430b3c4
Update dependencies and styles (#12)
* Update deps and .editorconfig

* run config
2022-03-24 18:54:49 +03:00
Fedor Korotkov dc1e502404
Logger (#11)
* Log progress

* ProgressObserver

* Reverted run configuration

* Cache *.ipsw files

* Use fraction

* Use datatask and pre-create cache folder
2022-03-22 22:17:23 -04:00
Fedor Korotkov 483627904c
Swift package simplified (#7)
* Convert project to a Swift Package

* SwiftEntitlementsPlugin

* Include .swiftpm

* Removed plugin

* Run configuration to run signed binary

* Cirrus CI Configuration

* Fixed worker label
2022-03-07 11:46:49 -05:00
Nikolay Edigaryev 13f2366754
Add ability to clone VMs (#9) 2022-02-23 23:45:21 +03:00
Nikolay Edigaryev 7a67deab81
Introduce "tart ip" command to retrieve a VM's IP address (#8)
* Introduce "tart ip" command to retrieve a VM's IP address

* VM running hint
2022-02-22 23:11:33 +03:00
Nikolay Edigaryev 8375e3cf7a {cpuCount,memorySize}min → {cpuCount,memorySize} 2022-02-14 16:57:54 +03:00
Nikolay Edigaryev 6fc868e3ba VMDirectory: use file extensions for config, disk and nvram 2022-02-14 16:55:28 +03:00
Nikolay Edigaryev 348d977f09 VMConfig: save pretty-printed JSON 2022-02-14 16:54:36 +03:00
Nikolay Edigaryev 09a8109f4b Basic CLI implementation that wraps Virtualization.Framework 2022-02-11 17:38:31 +03:00