diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 142b4a099..74aff2184 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,14 +4,16 @@ name: CI on: push: branches: - - main + # TODO: revert to main on merge of windev branch with main + - windev paths-ignore: - '**.md' - 'contrib/**' - '.github/CODEOWNERS' pull_request: branches: - - main + # TODO: revert to main on merge of windev branch with main + - windev paths-ignore: - '**.md' - 'contrib/**' @@ -26,7 +28,10 @@ concurrency: jobs: gen-code-no-diff: - runs-on: ubuntu-latest + strategy: + matrix: + os: [macos-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 @@ -36,7 +41,11 @@ jobs: - run: make gen-code - run: git diff --exit-code unit-tests: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 @@ -48,18 +57,18 @@ jobs: - run: make test-unit # It's recommended to run golangci-lint in a job separate from other jobs (go test, etc) because different jobs run in parallel. go-linter: - strategy: - matrix: - os: [macos-latest, windows-latest] name: lint - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: go-version-file: go.mod - cache: true - - name: golangci-lint + cache: false # caching can result in tar errors that files already exist + - name: set GOOS env to windows + run: | + echo "GOOS=windows" >> $GITHUB_ENV + - name: golangci-lint - windows uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 with: # Pin the version in case all the builds start to fail at the same time. @@ -67,6 +76,17 @@ jobs: # so we will just update it manually whenever it makes sense (e.g., a feature that we want is added). version: v1.53.3 args: --fix=false --timeout=5m + - name: set GOOS env to darwin + run: | + echo "GOOS=darwin" >> $GITHUB_ENV + - name: golangci-lint - darwin + uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 + with: + # Pin the version in case all the builds start to fail at the same time. + # There may not be an automatic way (e.g., dependabot) to update a specific parameter of a GitHub Action, + # so we will just update it manually whenever it makes sense (e.g., a feature that we want is added). + version: v1.53.3 + args: --fix=false --timeout=5m --skip-dirs="(^|/)deps($|/)" shellcheck: name: ShellCheck runs-on: ubuntu-latest @@ -115,7 +135,7 @@ jobs: # We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail. fetch-depth: 0 persist-credentials: false - submodules: true + submodules: recursive - name: Set output variables id: vars run: | @@ -153,6 +173,67 @@ jobs: git clean -f -d REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} make test-e2e shell: zsh {0} + windows-e2e-tests: + strategy: + fail-fast: false + matrix: + os: + [ + [self-hosted, windows, amd64, test], + ] + runs-on: ${{ matrix.os }} + timeout-minutes: 180 + steps: + - name: Configure git CRLF settings + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - uses: actions/checkout@v4 + with: + # We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail. + fetch-depth: 0 + persist-credentials: false + submodules: recursive + - name: Set output variables + id: vars + run: | + $has_creds="${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}" + echo "has_creds=$has_creds" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + exit 0 # if $has_creds is false, powershell will exit with code 1 and this step will fail + - name: configure aws credentials + uses: aws-actions/configure-aws-credentials@v4 + if: env.has_creds == 'true' + with: + role-to-assume: ${{ secrets.ROLE }} + role-session-name: credhelper-test + aws-region: ${{ secrets.REGION }} + - name: Remove Finch VM + run: | + wsl --list --verbose + wsl --shutdown + wsl --unregister lima-finch + wsl --list --verbose + - name: Clean up previous files + run: | + Remove-Item C:\Users\Administrator\.finch -Recurse -ErrorAction Ignore + Remove-Item C:\Users\Administrator\AppData\Local\.finch -Recurse -ErrorAction Ignore + make clean + cd deps/finch-core && make clean + - name: Build project + run: | + make + - name: Run e2e tests + run: | + # set path to use newer ssh version + $newPath = (";C:\Program Files\Git\bin\;" + "C:\Program Files\Git\usr\bin\;" + "$env:Path") + $env:Path = $newPath + + # set networking config option to allow for VM/container -> host communication + echo "[experimental]`nnetworkingMode=mirrored`nhostAddressLoopback=true" > C:\Users\Administrator\.wslconfig + + git status + git clean -f -d + make test-e2e mdlint: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 24551ac23..953b958ff 100644 --- a/Makefile +++ b/Makefile @@ -336,15 +336,15 @@ test-e2e: test-e2e-vm-serial .PHONY: test-e2e-vm-serial test-e2e-vm-serial: test-e2e-container - go test -ldflags $(LDFLAGS) -timeout 45m ./e2e/vm -test.v -ginkgo.v --installed="$(INSTALLED)" + go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/vm -test.v -ginkgo.v -ginkgo.timeout=2h --installed="$(INSTALLED)" .PHONY: test-e2e-container test-e2e-container: - go test -ldflags $(LDFLAGS) -timeout 30m ./e2e/container -test.v -ginkgo.v --installed="$(INSTALLED)" + go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/container -test.v -ginkgo.v -ginkgo.timeout=2h --installed="$(INSTALLED)" .PHONY: test-e2e-vm test-e2e-vm: - go test -ldflags $(LDFLAGS) -timeout 45m ./e2e/vm -test.v -ginkgo.v --installed="$(INSTALLED)" --registry="$(REGISTRY)" + go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/vm -test.v -ginkgo.v -ginkgo.timeout=2h --installed="$(INSTALLED)" --registry="$(REGISTRY)" .PHONY: test-benchmark test-benchmark: @@ -367,8 +367,12 @@ gen-code: GOBIN = $(CURDIR)/tools_bin gen-code: GOBIN=$(GOBIN) go install github.com/golang/mock/mockgen GOBIN=$(GOBIN) go install golang.org/x/tools/cmd/stringer - # Make sure that we are using the tool binaries which are just built to generate code. + # Make sure that we are using the tool binaries which are just built to generate code. +ifeq ($(GOOS),windows) + powershell ./scripts/gen-code-windows.ps1 +else PATH=$(GOBIN):$(PATH) go generate ./... +endif .PHONY: lint # To run golangci-lint locally: https://golangci-lint.run/usage/install/#local-installation diff --git a/e2e/vm/config_darwin_test.go b/e2e/vm/config_darwin_test.go index 77aea3853..6b4bdf68e 100644 --- a/e2e/vm/config_darwin_test.go +++ b/e2e/vm/config_darwin_test.go @@ -21,7 +21,7 @@ import ( "github.com/runfinch/finch/pkg/config" ) -var finchConfigFilePath string = os.Getenv("HOME") + "/.finch/finch.yaml" +var finchConfigFilePath = os.Getenv("HOME") + "/.finch/finch.yaml" var testConfig = func(o *option.Option, installed bool) { ginkgo.Describe("Config (after init)", ginkgo.Serial, func() { diff --git a/e2e/vm/config_windows_test.go b/e2e/vm/config_windows_test.go new file mode 100644 index 000000000..57f19f4d5 --- /dev/null +++ b/e2e/vm/config_windows_test.go @@ -0,0 +1,9 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +//go:build windows + +package vm + +import "os" + +var finchConfigFilePath = os.Getenv("LOCALAPPDATA") + "/.finch/finch.yaml" diff --git a/e2e/vm/soci_test.go b/e2e/vm/soci_test.go index 8e8fb18a9..266d25ee5 100644 --- a/e2e/vm/soci_test.go +++ b/e2e/vm/soci_test.go @@ -8,6 +8,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "github.com/onsi/ginkgo/v2" @@ -28,7 +29,7 @@ const ( var testSoci = func(o *option.Option, installed bool) { ginkgo.Describe("SOCI", func() { var limactlO *option.Option - var fpath, realFinchPath, limactlPath, limaHomePathEnv, wd string + var fpath, realFinchPath, limactlPath, limaHomePathEnv, wd, vmType string var err error var port int @@ -52,13 +53,18 @@ var testSoci = func(o *option.Option, installed bool) { limactlO, err = option.New([]string{limactlPath}, option.Env([]string{limaHomePathEnv})) gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) + if runtime.GOOS == "windows" { + vmType = "wsl2" + } else { + vmType = "qemu" + } }) ginkgo.It("finch pull should have same mounts as nerdctl pull with SOCI", func() { resetVM(o, installed) resetDisks(o, installed) - writeFile(finchConfigFilePath, []byte("cpus: 6\nmemory: 4GiB\nsnapshotters:\n "+ - "- soci\nvmType: qemu\nrosetta: false")) + writeFile(finchConfigFilePath, []byte(fmt.Sprintf("cpus: 6\nmemory: 4GiB\nsnapshotters:\n "+ + "- soci\nvmType: %s\nrosetta: false", vmType))) command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(600).Run() command.New(o, "pull", "--snapshotter=soci", ffmpegSociImage).WithTimeoutInSeconds(30).Run() finchPullMounts := countMounts(limactlO) @@ -73,8 +79,8 @@ var testSoci = func(o *option.Option, installed bool) { ginkgo.It("finch run should have same mounts as nerdctl run with SOCI", func() { resetVM(o, installed) resetDisks(o, installed) - writeFile(finchConfigFilePath, []byte("cpus: 6\nmemory: 4GiB\nsnapshotters:\n "+ - "- soci\nvmType: qemu\nrosetta: false")) + writeFile(finchConfigFilePath, []byte(fmt.Sprintf("cpus: 6\nmemory: 4GiB\nsnapshotters:\n "+ + "- soci\nvmType: %s\nrosetta: false", vmType))) command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(600).Run() command.New(o, "run", "--snapshotter=soci", ffmpegSociImage).WithTimeoutInSeconds(30).Run() finchPullMounts := countMounts(limactlO) @@ -88,8 +94,8 @@ var testSoci = func(o *option.Option, installed bool) { ginkgo.It("finch push should work", func() { resetVM(o, installed) resetDisks(o, installed) - writeFile(finchConfigFilePath, []byte("cpus: 6\nmemory: 4GiB\nsnapshotters:\n "+ - "- soci\nvmType: qemu\nrosetta: false")) + writeFile(finchConfigFilePath, []byte(fmt.Sprintf("cpus: 6\nmemory: 4GiB\nsnapshotters:\n "+ + "- soci\nvmType: %s\nrosetta: false", vmType))) command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(600).Run() port = fnet.GetFreePort() command.New(o, "run", "-dp", fmt.Sprintf("%d:5000", port), "--name", "registry", registryImage). diff --git a/e2e/vm/vm_test.go b/e2e/vm/vm_test.go index 106a95573..8e8eca47b 100644 --- a/e2e/vm/vm_test.go +++ b/e2e/vm/vm_test.go @@ -38,6 +38,7 @@ var resetVM = func(o *option.Option, installed bool) string { command.New(o, virtualMachineRootCmd, "remove").WithTimeoutInSeconds(90).Run() if runtime.GOOS == "windows" { // clean up iptables + //nolint:lll // link to explanation // https://docs.rancherdesktop.io/troubleshooting-tips/#q-how-do-i-fix-fata0005-subnet-1040024-overlaps-with-other-one-on-this-address-space-when-running-a-container-using-nerdctl-run gomega.Expect(exec.Command("wsl", "--shutdown").Run()).Should(gomega.BeNil()) } diff --git a/go.mod b/go.mod index 8dc64e20c..266bdbc1c 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,11 @@ require ( github.com/golang/mock v1.6.0 github.com/google/go-licenses v1.6.0 github.com/lima-vm/lima v0.17.2 - github.com/onsi/ginkgo/v2 v2.12.1 + github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/gomega v1.28.0 github.com/pelletier/go-toml v1.9.5 github.com/pkg/sftp v1.13.6 - github.com/runfinch/common-tests v0.7.7 + github.com/runfinch/common-tests v0.7.8 github.com/shirou/gopsutil/v3 v3.23.8 github.com/sirupsen/logrus v1.9.3 github.com/spf13/afero v1.10.0 @@ -62,7 +62,7 @@ require ( github.com/emirpasic/gods v1.12.0 // indirect github.com/fatih/color v1.15.0 // indirect github.com/go-logr/logr v1.2.4 // indirect - github.com/goccy/go-yaml v1.11.0 // indirect + github.com/goccy/go-yaml v1.11.0 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/licenseclassifier v0.0.0-20210722185704-3043a050f148 // indirect diff --git a/go.sum b/go.sum index ca01d3c84..59c6a318b 100644 --- a/go.sum +++ b/go.sum @@ -284,8 +284,8 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA= -github.com/onsi/ginkgo/v2 v2.12.1/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -318,8 +318,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/runfinch/common-tests v0.7.7 h1:ZJjRI4fk02C1Qoj3A9Z+Jdkk2pUZiSqH5L/3peIN1Qs= -github.com/runfinch/common-tests v0.7.7/go.mod h1:3BP9a6r5HeILCy/0IiTeC0zwyAgkUI0X2WZWZIctPj4= +github.com/runfinch/common-tests v0.7.8 h1:uXskg7qUSLp+2H+BT3rsAn5RZ90XVTn8LYOOj6ODsUg= +github.com/runfinch/common-tests v0.7.8/go.mod h1:SiFfCOWo+b2SpA/MwEa3z3cFTCyuEJQJXBJ6ItH6G64= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= diff --git a/msi-builder/README.md b/msi-builder/README.md index bed8f98ff..eeb2023ba 100644 --- a/msi-builder/README.md +++ b/msi-builder/README.md @@ -1,8 +1,11 @@ # FinchWindowsMSI + Finch Windows MSI Tool to generate MSI installer from Finch build -## Instructions: +## Instructions + [1] Build finch: `make FINCH_ROOTFS_LOCATION_ROOT=/__INSTALLFOLDER__` + - It will inject the placeholder `__INSTALLFOLDER__` into `os\finch.yaml` for the rootfs location [2] Run the following command to generate the MSI installer: @@ -10,8 +13,8 @@ Finch Windows MSI Tool to generate MSI installer from Finch build **Parameters:** -- SourcePath: Refers to the finch build _output folder, e.g., C:\Users\\Repo\finch\_output\. It's an optional parameter. If not provided, the default path is finch's _output folder. (You need to build finch before running the MSI tool). +- SourcePath: Refers to the finch build `_output` folder, e.g., `C:\Users\\Repo\finch\_output\.` It's an optional parameter. If not provided, the default path is finch's _output folder. (You need to build finch before running the MSI tool). -- Version: A required parameter that should match the version format, e.g., 0.10.2. +- Version: A required parameter that should match the version format, e.g., `0.10.2`. -[3] The Finch-.msi will be generated to the `msi-builder\build` folder \ No newline at end of file +[3] The `Finch-.msi` will be generated to the `msi-builder\build` folder diff --git a/pkg/config/lima_config_applier.go b/pkg/config/lima_config_applier.go index f600d6f5e..abf2168ed 100644 --- a/pkg/config/lima_config_applier.go +++ b/pkg/config/lima_config_applier.go @@ -23,6 +23,7 @@ const ( sociInstallationProvisioningScriptHeader = "# soci installation and configuring" sociFileNameFormat = "soci-snapshotter-%s-linux-%s.tar.gz" sociDownloadURLFormat = "https://github.com/awslabs/soci-snapshotter/releases/download/v%s/%s" + sociServiceDownloadURLFormat = "https://raw.githubusercontent.com/awslabs/soci-snapshotter/v%s/soci-snapshotter.service" sociInstallationScriptFormat = `%s if [ ! -f /usr/local/bin/soci ]; then # download soci @@ -30,18 +31,23 @@ if [ ! -f /usr/local/bin/soci ]; then curl --retry 2 --retry-max-time 120 -OL "%s" # move to usr/local/bin tar -C /usr/local/bin -xvf %s soci soci-snapshotter-grpc -fi + # changing containerd config + echo " [proxy_plugins.soci] + type = \"snapshot\" + address = \"/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock\" " >> /etc/containerd/config.toml -# changing containerd config -export config=etc/containerd/config.toml -echo " [proxy_plugins.soci] - type = \"snapshot\" - address = \"/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock\" " >> $config + # install as a systemd service + curl --retry 2 --retry-max-time 120 -OL "%s" + mv soci-snapshotter.service /usr/local/lib/systemd/system/ + ln -s /usr/local/lib/systemd/system/soci-snapshotter.service /etc/systemd/system/multi-user.target.wants/ + restorecon -v /usr/local/lib/systemd/system/soci-snapshotter.service + systemctl daemon-reload + sudo systemctl add-requires soci-snapshotter.service containerd.service + systemctl enable --now soci-snapshotter +fi sudo systemctl restart containerd.service -sudo soci-snapshotter-grpc &> ~/soci-snapshotter-logs & - - ` +` userModeEmulationProvisioningScriptHeader = "# cross-arch tools" wslDiskFormatScriptHeader = "# wsl disk format script" ) @@ -188,7 +194,9 @@ func toggleSoci(limaCfg *limayaml.LimaYAML, enabled bool, isDefault bool, sociVe idx, hasScript := findSociInstallationScript(limaCfg) sociFileName := fmt.Sprintf(sociFileNameFormat, sociVersion, system.NewStdLib().Arch()) sociDownloadURL := fmt.Sprintf(sociDownloadURLFormat, sociVersion, sociFileName) - sociInstallationScript := fmt.Sprintf(sociInstallationScriptFormat, sociInstallationProvisioningScriptHeader, sociDownloadURL, sociFileName) + sociServiceDownloadURL := fmt.Sprintf(sociServiceDownloadURLFormat, sociVersion) + sociInstallationScript := fmt.Sprintf(sociInstallationScriptFormat, sociInstallationProvisioningScriptHeader, + sociDownloadURL, sociFileName, sociServiceDownloadURL) if !hasScript && enabled { limaCfg.Provision = append(limaCfg.Provision, limayaml.Provision{ Mode: "system", diff --git a/pkg/config/lima_config_applier_darwin_test.go b/pkg/config/lima_config_applier_darwin_test.go index 2bfe281f1..eaf578aca 100644 --- a/pkg/config/lima_config_applier_darwin_test.go +++ b/pkg/config/lima_config_applier_darwin_test.go @@ -119,10 +119,12 @@ fi sociFileName := fmt.Sprintf(sociFileNameFormat, sociVersion, system.NewStdLib().Arch()) sociDownloadURL := fmt.Sprintf(sociDownloadURLFormat, sociVersion, sociFileName) + sociServiceDownloadURL := fmt.Sprintf(sociServiceDownloadURLFormat, sociVersion) sociInstallationScript := fmt.Sprintf(sociInstallationScriptFormat, sociInstallationProvisioningScriptHeader, sociDownloadURL, - sociFileName) + sociFileName, + sociServiceDownloadURL) var limaCfg limayaml.LimaYAML err = yaml.Unmarshal(buf, &limaCfg) @@ -289,10 +291,12 @@ fi sociFileName := fmt.Sprintf(sociFileNameFormat, sociVersion, system.NewStdLib().Arch()) sociDownloadURL := fmt.Sprintf(sociDownloadURLFormat, sociVersion, sociFileName) + sociServiceDownloadURL := fmt.Sprintf(sociServiceDownloadURLFormat, sociVersion) sociInstallationScript := fmt.Sprintf(sociInstallationScriptFormat, sociInstallationProvisioningScriptHeader, sociDownloadURL, - sociFileName) + sociFileName, + sociServiceDownloadURL) var limaCfg limayaml.LimaYAML err = yaml.Unmarshal(buf, &limaCfg) @@ -351,10 +355,12 @@ fi sociFileName := fmt.Sprintf(sociFileNameFormat, sociVersion, system.NewStdLib().Arch()) sociDownloadURL := fmt.Sprintf(sociDownloadURLFormat, sociVersion, sociFileName) + sociServiceDownloadURL := fmt.Sprintf(sociServiceDownloadURLFormat, sociVersion) sociInstallationScript := fmt.Sprintf(sociInstallationScriptFormat, sociInstallationProvisioningScriptHeader, sociDownloadURL, - sociFileName) + sociFileName, + sociServiceDownloadURL) var limaCfg limayaml.LimaYAML err = yaml.Unmarshal(buf, &limaCfg) diff --git a/pkg/dependency/credhelper/cred_helper_binary.go b/pkg/dependency/credhelper/cred_helper_binary.go index 9f173e707..66a5cbc35 100644 --- a/pkg/dependency/credhelper/cred_helper_binary.go +++ b/pkg/dependency/credhelper/cred_helper_binary.go @@ -27,7 +27,6 @@ type credhelperbin struct { cmdCreator command.Creator l flog.Logger helper string - user string hcfg helperConfig } diff --git a/scripts/gen-code-windows.ps1 b/scripts/gen-code-windows.ps1 new file mode 100644 index 000000000..ef131c2aa --- /dev/null +++ b/scripts/gen-code-windows.ps1 @@ -0,0 +1,21 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# gen-code-windows.ps1 + +# existing logic for codegen installs codegen tools locally +# to "tools_bin" and prepends $PATH with "tools_bin". This syntax to +# specify a PATH= before command in Windows Make / git-bash is broken; +# this script is a workaround to perform the codegen. + +# tools_bin is created in root of finch project. +$GOBIN = Join-Path $PSScriptRoot "../tools_bin" +$env:GOBIN=$GOBIN + +# Install the required Go tools specifying GOBIN +go install github.com/golang/mock/mockgen +go install golang.org/x/tools/cmd/stringer + +# Update the PATH environment variable and then run 'go generate' +$env:PATH = "${GOBIN};${env:PATH}" +go generate ./... .