diff --git a/.github/workflows/build-and-test-msi.yaml b/.github/workflows/build-and-test-msi.yaml index 99404e48d..d59f18523 100644 --- a/.github/workflows/build-and-test-msi.yaml +++ b/.github/workflows/build-and-test-msi.yaml @@ -198,6 +198,9 @@ jobs: aws-region: ${{ secrets.REGION }} - name: Remove Finch VM run: | + # We want these cleanup commands to always run, ignore errors so the step completes. + $ErrorActionPreference = 'Ignore' + taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0" wsl --list --verbose wsl --shutdown wsl --unregister lima-finch @@ -240,6 +243,9 @@ jobs: make test-e2e-vm - name: Remove Finch VM run: | + # We want these cleanup commands to always run, ignore errors so the step completes. + $ErrorActionPreference = 'Ignore' + taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0" wsl --list --verbose wsl --shutdown Start-Sleep -s 10 diff --git a/.github/workflows/build-and-test-pkg.yaml b/.github/workflows/build-and-test-pkg.yaml index c9b76a41e..1e5fe3f4c 100644 --- a/.github/workflows/build-and-test-pkg.yaml +++ b/.github/workflows/build-and-test-pkg.yaml @@ -56,7 +56,7 @@ jobs: strategy: fail-fast: false matrix: - version: [11, 13, 14] + version: [13, 14] needs: - get-tag-name - macos-aarch64-pkg-build @@ -73,7 +73,7 @@ jobs: strategy: fail-fast: false matrix: - version: [11, 13, 14] + version: [13, 14] needs: - get-tag-name - macos-x86-64-pkg-build diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b2a917b1e..ce96740f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -240,6 +240,9 @@ jobs: aws-region: ${{ secrets.REGION }} - name: Remove Finch VM run: | + # We want these cleanup commands to always run, ignore errors so the step completes. + $ErrorActionPreference = 'Ignore' + taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0" wsl --list --verbose wsl --shutdown wsl --unregister lima-finch diff --git a/.github/workflows/release-automation.yaml b/.github/workflows/release-automation.yaml index 73fee8fa3..51e4e06fc 100644 --- a/.github/workflows/release-automation.yaml +++ b/.github/workflows/release-automation.yaml @@ -35,11 +35,6 @@ jobs: with: ref_name: ${{ needs.get-latest-tag.outputs.tag }} - release-homebrew: - needs: upload-pkg-and-dependency-source-code-to-release - secrets: inherit - uses: ./.github/workflows/release-homebrew.yaml - build-and-test-finch-msi: needs: get-latest-tag uses: ./.github/workflows/build-and-test-msi.yaml diff --git a/.github/workflows/release-homebrew.yaml b/.github/workflows/release-homebrew.yaml deleted file mode 100644 index f93d72f06..000000000 --- a/.github/workflows/release-homebrew.yaml +++ /dev/null @@ -1,293 +0,0 @@ -# "release" runner tag is to make target hosts deterministic for easy clean up. -# TODO: Remove the "release" runner tag when installer tests are stable. -name: Release Homebrew -on: - workflow_dispatch: - workflow_call: - -jobs: - get-latest-tag: - name: Get the latest release tag - runs-on: ubuntu-latest - outputs: - tag: ${{ steps.latesttag.outputs.tag }} - version: ${{ steps.latestversion.outputs.version }} - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - fetch-depth: 0 - - name: 'Get the latest tag' - id: latesttag - uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0 - - name: 'Convert tag to version' - id: latestversion - run: | - version=${{ steps.latesttag.outputs.tag }} - if [ -z $version ]; then - echo ERROR: Failed to get the latest tag - exit 1 - fi - if [[ $version == v* ]]; then - version="${version:1}" - fi - echo "version=$version" >> ${GITHUB_OUTPUT} - - # TODO: fix the arm64 test installer. - # Currently the first time of calling any Finch command in arm64 hosts triggered by Github action will fail by - # the error "Error: Process completed with exit code 137." So the arm64 job will fail. - # We temporarily use follow-up manual steps to complete and clean up it. - macos-arm64-test-installer: - needs: get-latest-tag - strategy: - fail-fast: false - matrix: - os: - [ - [self-hosted, macos, arm64, 11, release], - [self-hosted, macos, arm64, 14, release], - [self-hosted, macos, arm64, 13, release], - ] - runs-on: ${{ matrix.os }} - timeout-minutes: 180 - env: - FINCH_TAG: ${{ needs.get-latest-tag.outputs.tag }} - FINCH_VERSION: ${{ needs.get-latest-tag.outputs.version }} - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ env.FINCH_TAG }} - fetch-depth: 0 - persist-credentials: false - submodules: true - - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 - with: - go-version-file: go.mod - cache: true - - name: Clean up previous files - run: | - sudo rm -rf /opt/finch - sudo rm -rf ~/.finch - if pgrep '^qemu-system'; then - sudo pkill '^qemu-system' - fi - if pgrep '^socket_vmnet'; then - sudo pkill '^socket_vmnet' - fi - cd $(brew --repo homebrew/cask) - brew uninstall --cask ./Casks/f/finch.rb || true - shell: zsh {0} - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@40a8596d17543401e57ee60f640c2a5df7c88904 # master - - name: Bump local cask version - run: | - brew update-reset - # disable the default behaviour of downloading JSON files from formulae.brew.sh for pacakge installation since Homebrew 4.0.0 - # Ref. https://brew.sh/2023/02/16/homebrew-4.0.0/ - export HOMEBREW_NO_INSTALL_FROM_API=1 - cd $(brew --repo homebrew/cask) - echo "Update the local Finch cask with version $FINCH_VERSION" - brew bump-cask-pr --write-only --version=$FINCH_VERSION finch - shell: zsh {0} - - name: Silently install - run: | - export HOMEBREW_NO_INSTALL_FROM_API=1 - cd $(brew --repo homebrew/cask) - brew install --cask ./Casks/f/finch.rb - shell: zsh {0} - - name: Install Rosetta 2 - run: echo "A" | softwareupdate --install-rosetta || true - - name: Build project - run: | - brew install lz4 automake autoconf libtool yq - export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" - make - shell: zsh {0} - - name: Multiple instances of Finch test - run: | - # start two Finch VM instances - ./_output/bin/finch vm init - finch vm init - # start a container in each VM instance - ./_output/bin/finch pull alpine - finch pull alpine - ./_output/bin/finch run --name test-ctr1 alpine - finch run --name test-ctr2 alpine - # check whether containers exist - if ! ./_output/bin/finch ps -a | grep 'test-ctr1'; then - echo "ERROR: The container test-ctr1 doesn't exist in the built finch VM" - exit 1 - fi - if ./_output/bin/finch ps -a | grep 'test-ctr2'; then - echo "ERROR: The container test-ctr2 shoudn't exist in the built finch VM" - exit 1 - fi - if ! finch ps -a | grep 'test-ctr2'; then - echo "ERROR: The container test-ctr2 doesn't exist in the installed finch VM" - exit 1 - fi - if finch ps -a | grep 'test-ctr1'; then - echo "ERROR: The container test-ctr1 shoudn't exist in the installed finch VM" - exit 1 - fi - # clean up the VMs - ./_output/bin/finch vm stop && ./_output/bin/finch vm remove - finch vm stop && finch vm remove - - name: Clean up multiple instance test - run: | - sudo rm -rf ./_output - export HOMEBREW_NO_INSTALL_FROM_API=1 - cd $(brew --repo homebrew/cask) - # Need to reinstall because there were errors on arm64 11.7 and arm64 12.6 hosts after running multiple instances tests, - # that caused the VM initialization failure in the e2e test. - # Example workflow run https://github.com/runfinch/finch/actions/runs/4367457552/jobs/7638794529 - brew reinstall --cask ./Casks/f/finch.rb - shell: zsh {0} - - name: Run e2e tests - uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 - with: - timeout_minutes: 180 - max_attempts: 3 - command: INSTALLED=true make test-e2e - - name: Silently uninstall - if: ${{ always() }} - run: | - cd $(brew --repo homebrew/cask) - brew uninstall --zap --cask ./Casks/f/finch.rb - if [ -d "/Applications/Finch" ]; then - echo ERROR: Finch is not uninstalled - exit 1 - fi - shell: zsh {0} - macos-amd64-test-installer: - needs: get-latest-tag - strategy: - fail-fast: false - matrix: - os: - [ - [self-hosted, macos, amd64, 11, release], - [self-hosted, macos, amd64, 14, release], - [self-hosted, macos, amd64, 13, release], - ] - runs-on: ${{ matrix.os }} - timeout-minutes: 180 - env: - FINCH_TAG: ${{ needs.get-latest-tag.outputs.tag }} - FINCH_VERSION: ${{ needs.get-latest-tag.outputs.version }} - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ env.FINCH_TAG }} - fetch-depth: 0 - persist-credentials: false - submodules: true - - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 - with: - go-version-file: go.mod - cache: true - - name: Clean up previous files - run: | - sudo rm -rf /opt/finch - sudo rm -rf ~/.finch - if pgrep '^qemu-system'; then - sudo pkill '^qemu-system' - fi - if pgrep '^socket_vmnet'; then - sudo pkill '^socket_vmnet' - fi - cd $(brew --repo homebrew/cask) - brew uninstall --cask ./Casks/f/finch.rb || true - shell: zsh {0} - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@40a8596d17543401e57ee60f640c2a5df7c88904 # master - - name: Bump local cask version - run: | - brew update-reset - export HOMEBREW_NO_INSTALL_FROM_API=1 - cd $(brew --repo homebrew/cask) - echo "Update the local Finch cask with version $FINCH_VERSION" - brew bump-cask-pr --write-only --version=$FINCH_VERSION finch - shell: zsh {0} - - name: Silently install - run: | - export HOMEBREW_NO_INSTALL_FROM_API=1 - cd $(brew --repo homebrew/cask) - brew install --cask ./Casks/f/finch.rb - shell: zsh {0} - - name: Install Rosetta 2 - run: echo "A" | softwareupdate --install-rosetta || true - - name: Build project - run: | - brew install lz4 automake autoconf libtool yq - export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" - make - shell: zsh {0} - - name: Multiple instances of Finch test - run: | - # start two Finch VM instances - ./_output/bin/finch vm init - finch vm init - # start a container in each VM instance - ./_output/bin/finch pull alpine - finch pull alpine - ./_output/bin/finch run --name test-ctr1 alpine - finch run --name test-ctr2 alpine - # check whether containers exist - if ! ./_output/bin/finch ps -a | grep 'test-ctr1'; then - echo "ERROR: The container test-ctr1 doesn't exist in the built finch VM" - exit 1 - fi - if ./_output/bin/finch ps -a | grep 'test-ctr2'; then - echo "ERROR: The container test-ctr2 shoudn't exist in the built finch VM" - exit 1 - fi - if ! finch ps -a | grep 'test-ctr2'; then - echo "ERROR: The container test-ctr2 doesn't exist in the installed finch VM" - exit 1 - fi - if finch ps -a | grep 'test-ctr1'; then - echo "ERROR: The container test-ctr1 shoudn't exist in the installed finch VM" - exit 1 - fi - # clean up the VMs - ./_output/bin/finch vm stop && ./_output/bin/finch vm remove - finch vm stop && finch vm remove - - name: Clean up multiple instance test - run: | - sudo rm -rf ./_output - export HOMEBREW_NO_INSTALL_FROM_API=1 - cd $(brew --repo homebrew/cask) - brew reinstall --cask ./Casks/f/finch.rb - shell: zsh {0} - - name: Run e2e tests - uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 - with: - timeout_minutes: 180 - max_attempts: 3 - command: INSTALLED=true make test-e2e - - name: Silently uninstall - if: ${{ always() }} - run: | - cd $(brew --repo homebrew/cask) - brew uninstall --zap --cask ./Casks/f/finch.rb - if [ -d "/Applications/Finch" ]; then - echo ERROR: Finch is not uninstalled - exit 1 - fi - shell: zsh {0} - pr-to-homebrew: - needs: [get-latest-tag, macos-arm64-test-installer, macos-amd64-test-installer] - runs-on: macos-latest - steps: - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@40a8596d17543401e57ee60f640c2a5df7c88904 # master - - name: Open a pull request to homebrwe-cask - run: brew bump-cask-pr --version=${FINCH_VERSION} finch - shell: zsh {0} - env: - FINCH_VERSION: ${{ needs.get-latest-tag.outputs.version }} - HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} - diff --git a/go.mod b/go.mod index e965b11e0..08d424631 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/runfinch/finch go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2 v1.30.0 + github.com/aws/aws-sdk-go-v2 v1.30.1 github.com/docker/cli v27.0.3+incompatible github.com/docker/docker v27.0.3+incompatible github.com/golang/mock v1.6.0 @@ -29,7 +29,7 @@ require ( ) require ( - github.com/aws/smithy-go v1.20.2 // indirect + github.com/aws/smithy-go v1.20.3 // indirect github.com/containerd/containerd v1.7.16 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect diff --git a/go.sum b/go.sum index 20352df24..6d513110e 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,9 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/aws/aws-sdk-go-v2 v1.30.0 h1:6qAwtzlfcTtcL8NHtbDQAqgM5s6NDipQTkPxyH/6kAA= -github.com/aws/aws-sdk-go-v2 v1.30.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= -github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= -github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/aws-sdk-go-v2 v1.30.1 h1:4y/5Dvfrhd1MxRDD77SrfsDaj8kUkkljU7XE83NPV+o= +github.com/aws/aws-sdk-go-v2 v1.30.1/go.mod h1:nIQjQVp5sfpQcTc9mPSr1B0PaWK5ByX9MOoDadSN4lc= +github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE= +github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=