-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mounting remote archives #620
Conversation
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.
Sources/tart/Commands/Run.swift
Outdated
@@ -598,13 +599,71 @@ struct VMView: NSViewRepresentable { | |||
} | |||
} | |||
|
|||
func sanitizeDirectoryShareConfiguration(createFrom: String) throws -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think sanitizeDirectoryShareConfiguration()
's is a bit overloaded and it name seems to be misleading because what it really does is:
Parse()
Fetch()
Unarchive()
What do you think about:
- Keeping the
DirectoryShare()
call as it was before - Moving the
Parse()
part ofsanitizeDirectoryShareConfiguration()
intoDirectoryShare()
- we could also preserve
:ro
there (e.g.http://127.0.0.1:8080/archive.tar.gz:ro
would setreadOnly
totrue
)
- we could also preserve
- Calling
Fetch()
andUnarchive()
fromDirectoryShare()
if we're dealing with an URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a bit different and moved the logic to DirectoryShare#createConfiguration
method. See 8c0f8f4.
* Fix URLCache caching files in memory instead of on-disk * Fix disk capacity typo
Fixed tests in d70fff2. @edigaryev PTAL |
@ruimarinho FYI with Tart 2.1.0 you can mount a remote archives, for example: tart clone ghcr.io/cirruslabs/macos-sonoma-base:latest sonoma-base
tart run --dir=ghar:https://github.com/actions/runner/releases/download/v2.309.0/actions-runner-osx-arm64-2.309.0.tar.gz sonoma-base This way your Tart VM will have the latest GHA Runner mounted to |
@fkorotkov Have you got this working with the Github Action runner. I seem to have a problem where any it seems like the runner can't be in directory whose path has spaces in it. If I change the workflow to:
Then it all works. The default is without the quotes as specified here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell |
Yeah, seems GHA runner is not happy with such paths. Most actions can handle it though! You can change the mount point by running the following commands: sudo umount "/Volumes/My Shared Files"
mkdir ~/workspace
mount_virtiofs com.apple.virtio-fs.automount ~/workspace Then your runner will be in |
Thanks! I'll try that. I added a PR to the runner, but it seems it's a deliberate choice to not have the argument in quotes. |
@fkorotkov this is very cool! In theory with orchard we just need to do |
Yep, should work with Orchard as well. I've also created this discussion so maybe GotHub folks will remove version number from the archive so it's easy to always point to the latest one. https://github.com/orgs/community/discussions/68788 |
@fkorotkov seems like Orchard has a stricter host dir policy. I've created a ticket to look into it. |
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.