Skip to content
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

exp: make finch work on windows with wsl2 #649

Merged
merged 73 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
362e656
rebase makefile
vsiravar Sep 27, 2023
07af36a
Add path conversions to nerdctl commands and vm commands
vsiravar Sep 1, 2023
2245bd2
Add license
vsiravar Sep 1, 2023
b466e18
Add unit tests for nerdctl windows arg parsing
Sep 18, 2023
c60b3ad
feat: add handling for nerdctl commands and options (#581)
vsiravar Sep 27, 2023
9c0c20c
fix lint errors
vsiravar Sep 27, 2023
19e270c
build: update submodules (#585)
ginglis13 Sep 28, 2023
94f250e
update submodules
Sep 28, 2023
c601152
fix: lint errors (#586)
vsiravar Sep 29, 2023
3e4f232
fix: use correct URL for rootfs (#589)
ginglis13 Oct 2, 2023
8c0ca15
build: update submodules (#590)
ginglis13 Oct 2, 2023
614e3b4
ci: add GOOS to golangci-lint (#592)
vsiravar Oct 3, 2023
005f400
feat: windows persistent disk and other misc fixes/refactors (#594)
pendo324 Oct 4, 2023
590b2cb
fix: update run test windows (#587)
vsiravar Oct 4, 2023
6444938
fix: fix path in nerdctl config test (#595)
vsiravar Oct 4, 2023
a2c5a93
fix: fix darwin tests (#596)
vsiravar Oct 4, 2023
39c8e7c
chore: go mod tidy (#597)
ginglis13 Oct 4, 2023
37918c5
fix: fix finch config test (#598)
vsiravar Oct 5, 2023
268ba17
fix: fix support bundle code (#600)
vsiravar Oct 5, 2023
aee92f2
chore: update submodules (#603)
ginglis13 Oct 5, 2023
706fda6
ci: pin actions (#605)
pendo324 Oct 5, 2023
cf33c0e
fix: update support bundle e2e tests (#606)
vsiravar Oct 6, 2023
407711a
docs(contributing): add note to fetch all tags (#608)
ginglis13 Oct 6, 2023
de9b304
chore: address fix linter findings (#607)
ginglis13 Oct 6, 2023
d625420
chore: bump common-tests (#611)
vsiravar Oct 6, 2023
aac6ca8
fix: fix file perm (#604)
vsiravar Oct 6, 2023
f5d8321
fix: cred helper refactor for windows (#612)
vsiravar Oct 6, 2023
9a528b8
fix: unmarshal additional disks (#613)
ginglis13 Oct 6, 2023
286db47
fix: refactor reset disk and finch config test (#599)
vsiravar Oct 6, 2023
6e37176
build(deps): update finch core sub mod (#618)
vsiravar Oct 10, 2023
baa3514
chore: add rootfs location root to be 1:1 with mac (#620)
ginglis13 Oct 11, 2023
1552fc0
fix: wsl custom ip mapping (#619)
vsiravar Oct 11, 2023
1a4eabf
ci: Change the root path to fit placeholder __INSTALLFOLDER__ injecti…
KevinLiAWS Oct 12, 2023
9f6ae34
ci: Finch Windows MSI tool (#624)
KevinLiAWS Oct 12, 2023
225cd1b
ci: Auto build MSI github action (#625)
KevinLiAWS Oct 12, 2023
d1b7513
chore: fix flaky tests (#623)
vsiravar Oct 12, 2023
5389714
fix: properly replace PATH instead of appending a new PATH (#626)
pendo324 Oct 12, 2023
f8cf34e
ci: Automate signing and upload to installer bucket (#628)
KevinLiAWS Oct 12, 2023
23f786c
ci: add e2e test step for windows, lint fixes, e2e corrections (#584)
ginglis13 Oct 12, 2023
134704c
chore: bump submodules (#630)
pendo324 Oct 12, 2023
39422a4
ci: Update wxs template for dependency executables (#633)
KevinLiAWS Oct 12, 2023
3771499
chore: more deflake (#629)
vsiravar Oct 12, 2023
a2d03cc
chore: update finch-core submodules (#634)
vsiravar Oct 12, 2023
a1c17be
ci: Make unsigned MSI has timestamp in its name to easily unique fetc…
KevinLiAWS Oct 13, 2023
fa194b8
ci: MSI e2e test automation and upload MSI to release (#640)
KevinLiAWS Oct 13, 2023
412714a
chore: fix lint (#642)
vsiravar Oct 13, 2023
1bb92d6
fix: remove diskpart success message validation (#641)
pendo324 Oct 13, 2023
8c91313
fix: finch exe icon and description (#645)
pendo324 Oct 13, 2023
a1bf540
fix: better handling of windows paths (#646)
pendo324 Oct 13, 2023
dc2d072
ci: Update msi name to include the branch/tag name instead of the ver…
KevinLiAWS Oct 13, 2023
e4acbe6
docs: Update readme windows (#635)
vsiravar Oct 13, 2023
0542968
ci(windows): always cleanup after build or test (#644)
ginglis13 Oct 13, 2023
19c0c33
docs: disable md24 for duplicate non sibling header (#648)
vsiravar Oct 16, 2023
4d79a43
Update submodules to finch-core main
vsiravar Oct 17, 2023
5229326
add siblings_only parameter to mdlint
vsiravar Oct 23, 2023
009cd26
remove MD024 ignore block from README
vsiravar Oct 23, 2023
998989a
Merge branch 'main' into windev
KevinLiAWS Oct 24, 2023
568fdf0
add additional path validation and test
pendo324 Nov 2, 2023
ec53bee
make validation stricter and fix test
pendo324 Nov 2, 2023
eb384de
remove cmd.exe, execute dispart.exe directly
pendo324 Nov 28, 2023
5e25cec
remove need for diskpart
pendo324 Dec 6, 2023
c16d64e
Merge remote-tracking branch 'origin/main' into windev
pendo324 Jan 4, 2024
74f0ebb
Merge branch 'main' into windev
pendo324 Jan 4, 2024
a40c5b5
fix linting after merge
pendo324 Jan 4, 2024
a40eab2
add missing configs to fix unit tests
pendo324 Jan 4, 2024
7c0f0ff
fix linebreaks for unit tests
pendo324 Jan 4, 2024
faae2e6
update finch-core and common-tests
pendo324 Jan 5, 2024
9c2f182
bump finch-core, common-tests, and rootfs
pendo324 Jan 9, 2024
9846ff3
update finch-core
pendo324 Jan 9, 2024
0c39cc2
Cleanup previous checkouts to make sure latest code is pulled every time
pendo324 Jan 9, 2024
ad55803
bump finch-core
pendo324 Jan 9, 2024
4483ffc
add git status to debug version test
pendo324 Jan 9, 2024
c5373a7
update makefile to properly detect if git is dirty
pendo324 Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
weikequ marked this conversation as resolved.
Show resolved Hide resolved
with:
# We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
fetch-depth: 0
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
echo "OS_VERSION=$(sw_vers -productVersion | cut -d '.' -f 1)" >> $GITHUB_ENV
echo "ARCH=$(uname -m)" >> $GITHUB_ENV
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
uses: benchmark-action/github-action-benchmark@70405016b032d44f409e4b1b451c40215cbe2393 # v1.18.0
with:
name: Finch Benchmark
tool: 'go'
Expand Down
251 changes: 251 additions & 0 deletions .github/workflows/build-and-test-msi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
name: Build, test and upload .msi to S3

# TODO: add scheduler and tests
on:
workflow_dispatch:
workflow_call:
inputs:
ref_name:
required: true
type: string
env:
GO111MODULE: on

permissions:
# This is required for configure-aws-credentials to request an OIDC JWT ID token to access AWS resources later on.
# More info: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
id-token: write
contents: read # This is required for actions/checkout

jobs:
get-tag-name:
name: Get tag name
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.check-tag.outputs.tag }}
version: ${{ steps.check-tag.outputs.version }}
steps:
- name: Check tag from workflow input and github ref
id: check-tag
run: |
if [ -n "${{ inputs.ref_name }}" ]; then
tag=${{ inputs.ref_name }}
else
tag=${{ github.ref_name }}
fi
echo "tag=$tag" >> ${GITHUB_OUTPUT}

version=${tag#v}
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version matches format: $version"
else
echo "Version $version doesn't match format. Using test version: 0.0.1"
version="0.0.1"
fi
echo "version=$version" >> ${GITHUB_OUTPUT}

windows-msi-build:
needs: get-tag-name
runs-on: [self-hosted, windows, amd64, release]
timeout-minutes: 100
steps:
- name: Configure git CRLF settings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
weikequ marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: '3.x'
- name: Install AWS CLI
run: |
python -m pip install --upgrade pip
pip install awscli
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ needs.get-tag-name.outputs.tag }}
fetch-depth: 0
persist-credentials: false
submodules: recursive
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ secrets.WINDOWS_ROLE }}
role-session-name: windows-msi
aws-region: ${{ secrets.WINDOWS_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 FINCH_ROOTFS_LOCATION_ROOT=/__INSTALLFOLDER__
- name: generate and download signed msi
run: |
$version="${{ needs.get-tag-name.outputs.version }}"
$tag="${{ needs.get-tag-name.outputs.tag }}"
powershell .\msi-builder\BuildFinchMSI.ps1 -Version $version
$timestamp=[math]::truncate((Get-Date (Get-Date).ToUniversalTime() -UFormat "%s"))
$unsignedMSI="Finch-$tag-$timestamp.msi"
Write-Host "Upload unsigned MSI: $unsignedMSI"

aws s3 cp "./msi-builder/build/Finch-$version.msi" "${{ secrets.WINDOWS_UNSIGNED_BUCKET }}$unsignedMSI" --acl bucket-owner-full-control --no-progress
New-Item -Path "./msi-builder/build/signed/" -ItemType Directory -Force

Write-Host "Attemp to download signed MSI"
$retryCount = 0
$maxRetries = 20
$delay = 5

while ($retryCount -lt $maxRetries) {
Start-Sleep -Seconds $delay
$signedMSI = aws s3 ls ${{ secrets.WINDOWS_SIGNED_BUCKET }} 2>&1 | Where-Object { $_ -match "$unsignedMSI" } | Sort-Object -Descending | Select-Object -First 1 | ForEach-Object { ($_ -split '\s+')[-1] }
if ($signedMSI -and ($signedMSI -notlike "*An error occurred (404) when calling the HeadObject operation*")) {
try {
aws s3 cp "${{ secrets.WINDOWS_SIGNED_BUCKET }}$signedMSI" "./msi-builder/build/signed/Finch-$tag.msi"
break
} catch {
Write-Host "Error during copy: $_"
}
} else {
$retryCount++
Write-Host "Unable to find the signed MSI or encountered an error. Retry $retryCount/$maxRetries..."
}
}

if ($retryCount -eq $maxRetries) {
throw "Failed after $maxRetries attempts."
}
- name: configure aws credentials for upload signed MSI to installer bucket
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: windows-msi
aws-region: ${{ secrets.REGION }}
- name: upload signed MSI to S3
run: |
$tag="${{ needs.get-tag-name.outputs.tag }}"
aws s3 cp "./msi-builder/build/signed/Finch-$tag.msi" "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$tag.msi" --no-progress
- name: Remove Finch VM and Clean Up Previous Environment
if: ${{ always() }}
run: |
# We want these cleanup commands to always run, ignore errors so the step completes.
$ErrorActionPreference = 'Ignore'
wsl --list --verbose
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Remove-Item C:\Users\Administrator\AppData\Local\.finch -Recurse
make clean
cd deps/finch-core && make clean
exit 0 # Cleanup may set the exit code e.g. if a file doesn't exist; just ignore

msi-e2e-tests:
needs:
- get-tag-name
- windows-msi-build
strategy:
fail-fast: false
runs-on: [self-hosted, windows, amd64, release]
timeout-minutes: 180
steps:
- name: Configure git CRLF settings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: '3.x'
- name: Install AWS CLI
run: |
python -m pip install --upgrade pip
pip install awscli
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ needs.get-tag-name.outputs.tag }}
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
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: msi-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: Uninstall Finch silently
run: |
$productCode = (Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*Finch*" } | Select-Object -ExpandProperty IdentifyingNumber)
if ($productCode) {
msiexec /x $productCode /qn
} else {
Write-Output "Finch not found or it wasn't installed using MSI."
}
- name: Download MSI from S3
run: |
$tag="${{ needs.get-tag-name.outputs.tag }}"
aws s3 cp "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$tag.msi" ./Finch.msi
- name: Install MSI silently
run: |
Start-Process 'Finch.msi' -ArgumentList '/quiet' -Wait
echo "C:\Program Files\Finch\bin" >> $env:GITHUB_PATH
- 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
$env:INSTALLED="true"
make test-e2e
- name: Uninstall Finch silently
if: ${{ always() }}
run: |
$productCode = (Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*Finch*" } | Select-Object -ExpandProperty IdentifyingNumber)
if ($productCode) {
msiexec /x $productCode /qn
} else {
Write-Output "Finch not found or it wasn't installed using MSI."
}
- name: Remove Finch VM and Clean Up Previous Environment
if: ${{ always() }}
run: |
# We want these cleanup commands to always run, ignore errors so the step completes.
$ErrorActionPreference = 'Ignore'
wsl --list --verbose
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Remove-Item C:\Users\Administrator\AppData\Local\.finch -Recurse
make clean
cd deps/finch-core && make clean
exit 0 # Cleanup may set the exit code e.g. if a file doesn't exist; just ignore
28 changes: 14 additions & 14 deletions .github/workflows/build-and-test-pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ jobs:
runs-on: [self-hosted, macos, arm64, 11, release]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ needs.get-tag-name.outputs.tag }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -63,7 +63,7 @@ jobs:
shell: zsh {0}

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: dependency-upload-session
Expand All @@ -79,13 +79,13 @@ jobs:
runs-on: [self-hosted, macos, amd64, 11, release]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ needs.get-tag-name.outputs.tag }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -101,7 +101,7 @@ jobs:
shell: zsh {0}

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: dependency-upload-session
Expand Down Expand Up @@ -130,13 +130,13 @@ jobs:
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
steps:
- name: Checkout the tag
uses: actions/checkout@v4
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ needs.get-tag-name.outputs.tag }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -152,7 +152,7 @@ jobs:
sudo pkill '^socket_vmnet'
fi
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: download-installer-session
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
# Example workflow run https://github.com/runfinch/finch/actions/runs/4367457552/jobs/7638794529
sudo installer -pkg Finch-${{ needs.get-tag-name.outputs.tag }}-aarch64.pkg -target /
- name: Run e2e tests
uses: nick-fields/retry@v2
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
timeout_minutes: 180
max_attempts: 3
Expand Down Expand Up @@ -241,13 +241,13 @@ jobs:
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
steps:
- name: Checkout the tag
uses: actions/checkout@v4
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ needs.get-tag-name.outputs.tag }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -263,7 +263,7 @@ jobs:
sudo pkill '^socket_vmnet'
fi
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: download-installer-session
Expand Down Expand Up @@ -319,7 +319,7 @@ jobs:
echo 'y' | sudo bash /Applications/Finch/uninstall.sh
sudo installer -pkg Finch-${{ needs.get-tag-name.outputs.tag }}-x86_64.pkg -target /
- name: Run e2e tests
uses: nick-fields/retry@v2
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
timeout_minutes: 180
max_attempts: 3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
mdlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: avto-dev/markdown-lint@v1
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0
with:
args: '**/*.md'
# CHANGELOG.md is only updated by release-please bot.
Expand Down
Loading
Loading