-
Notifications
You must be signed in to change notification settings - Fork 94
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
[Draft] feat: add Windows support #553
Conversation
Signed-off-by: Vishwas Siravara <[email protected]>
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.
Looks great to me, just left some minor comments
cmd/finch/main_darwin.go
Outdated
optionalDepGroups := []*dependency.Group{ | ||
credhelper.NewDependencyGroup(ecc, fs, fp, logger, fc, system.NewStdLib().Env("USER"), | ||
system.NewStdLib().Arch()), | ||
} | ||
|
||
optionalDepGroups = append(optionalDepGroups, vmnet.NewDependencyGroup(ecc, lcc, fs, fp, logger)) |
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.
Is it possible to only extract the depGroups into a new platform specific file? Seems like everything else is the same
@@ -79,6 +79,7 @@ func (sva *startVMAction) run() error { | |||
return err | |||
} | |||
|
|||
// TODO: don't run this on Windows |
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.
Working on implementing that in Lima now, so hopefully only a temporary todo
cpuDefault(cfg, deps) | ||
|
||
memoryDefault(cfg, mem) |
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.
These settings actually aren't configurable with current versions of WSL2
pkg/disk/disk_unix.go
Outdated
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.
Once disks are implemented for Windows in Lima, we'll need this to be back to an all-platform file
.PHONY: finch-core-local | ||
finch-core-local: |
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.
TODO on removing this rule. IIRC we added this to make lima.exe and the guestagent sourcing the WSL PR to lima:
- https://github.com/vsiravar/finch-core-public/blob/windev/Makefile#L87
- https://github.com/vsiravar/finch-core-public/blob/windev/Makefile#L152-L156
But once lima is released with WSL support, we should source similar to how we do on macOS via LIMA_URL: https://github.com/vsiravar/finch-core-public/blob/b82c007d22d4d99f8a78a3db7c6252ce9c5afcc8/Makefile#L36C14-L36C14
FINCH_ROOTFS_URL ?= https://deps.runfinch.com/common/x86-64/finch-rootfs-production-amd64-1690920103.tar.zst | ||
FINCH_ROOTFS_BASENAME := $(notdir $(FINCH_ROOTFS_URL)) | ||
FINCH_ROOTFS_BASENAME := $(subst .zst,,$(FINCH_ROOTFS_BASENAME)) | ||
# TODO ROOTFS 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.
nit: can remove
FINCH_ROOTFS_URL ?= https://deps.runfinch.com/common/aarch64/finch-rootfs-production-arm64-1690920104.tar.zst | ||
FINCH_ROOTFS_BASENAME := $(notdir $(FINCH_ROOTFS_URL)) | ||
FINCH_ROOTFS_BASENAME := $(subst .zst,,$(FINCH_ROOTFS_BASENAME)) | ||
# TODO ROOTFS 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.
nit: can remove
sed -i.bak -e "s/<finch_image_digest>/$(FINCH_IMAGE_DIGEST)/g" $(OUTDIR)/os/finch.yaml | ||
|
||
# TODO: Windows PoC - clean this up / consolidate | ||
.PHONY: finch.yaml |
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.
nit: finch.windows.yaml
finch.yaml: finch-core | ||
mkdir -p $(OUTDIR)/os | ||
cp finch.yaml $(OUTDIR)/os | ||
# using -i.bak is very intentional, it allows the following commands to succeed for both GNU / BSD sed | ||
# this sed command uses the alternative separator of "|" because the image location uses "/" | ||
sed -i.bak -e "s|<finch_image_location>|$(FINCH_OS_IMAGE_LOCATION)|g" $(OUTDIR)/os/finch.yaml | ||
sed -i.bak -e "s|<finch_image_location>|$(FINCH_IMAGE_LOCATION)|g" $(OUTDIR)/os/finch.yaml | ||
sed -i.bak -e "s/<finch_image_arch>/$(LIMA_ARCH)/g" $(OUTDIR)/os/finch.yaml | ||
sed -i.bak -e "s/<finch_image_digest>/$(FINCH_IMAGE_DIGEST)/g" $(OUTDIR)/os/finch.yaml |
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.
maybe we can consolidate finch.yaml
and finch.windows.yaml
rules to be something like:
WINDOWS ?=
CONF_FILE ?=
ifeq ($(GOOS),windows)
WINDOWS=.windows
CONF_FILE=finch.windows.yaml
else
CONF_FILE=finch.yaml
endif
finch$(WINDOWS).yaml: finch-core
mkdir -p $(OUTDIR)/os
cp $(CONF_FILE) $(OUTDIR)/os
# using -i.bak is very intentional, it allows the following commands to succeed for both GNU / BSD sed
# this sed command uses the alternative separator of "|" because the image location uses "/"
sed -i.bak -e "s|<finch_image_location>|$(FINCH_IMAGE_LOCATION)|g" $(OUTDIR)/os/finch.yaml
sed -i.bak -e "s/<finch_image_arch>/$(LIMA_ARCH)/g" $(OUTDIR)/os/finch.yaml
sed -i.bak -e "s/<finch_image_digest>/$(FINCH_IMAGE_DIGEST)/g" $(OUTDIR)/os/finch.yaml
@@ -254,7 +311,7 @@ check-licenses: | |||
|
|||
.PHONY: test-unit | |||
test-unit: | |||
go test $(shell go list ./... | grep -v e2e) -shuffle on -race | |||
go test $(shell go list ./... | grep -v e2e) -shuffle on |
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.
why remove race condition checks?
"strings" | ||
) | ||
|
||
func convertToWSLPath(systemDeps NerdctlCommandSystemDeps, winPath string) (string, error) { |
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.
Could you add a comment here with an example or two of what this conversion looks like?
@@ -5,6 +5,8 @@ | |||
# Default values in this YAML file are specified by `null` instead of Lima's "builtin default" values, | |||
# so they can be overridden by the $LIMA_HOME/_config/default.yaml mechanism documented at the end of this file. | |||
|
|||
#vmType: null |
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.
nit: uncomment - this was leftover from my poc :)
@@ -1,6 +1,9 @@ | |||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | |||
// SPDX-License-Identifier: Apache-2.0 | |||
|
|||
//go:build darwin | |||
// +build darwin |
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.
nit: // +build <tag>
tags obsolete after Go 1.18 https://tip.golang.org/doc/go1.18 . this applies to a few other places in this PR. go fix
should remove them automatically for you
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
install packages * qemu-user-static-aarch64 * qemu-user-static-arm * qemu-user-static-x86 * iptables * fuse-sshfs depended on by lima to decrease boot time of Finch VM on Windows Issue #, if available: *Description of changes:* *Testing done:* * EC2 Windows dev instance * build rootfs locally, scp up * run Finch w/ changes in runfinch/finch#553 * basic commands tests -> `finch vm init`, `finch vm pull alpine:latest`, etc. - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Signed-off-by: Gavin Inglis <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
# The vmType can be specified only on creating the instance. | ||
# The vmType of existing instances cannot be changed. | ||
# 🟢 Builtin default: "qemu" | ||
vmType: wsl2 |
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.
Closed by merging #649 |
Draft
Issue #, if available:
#492
Description of changes:
Finch changes to support finch on windows using WSL2.
TODO
nerdctl_test.go
Testing done:
Yes, e2e tests have errors related to copy command.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.