diff --git a/.github/bin/update-os-image.sh b/.github/bin/update-os-image.sh new file mode 100755 index 000000000..295d64efe --- /dev/null +++ b/.github/bin/update-os-image.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -euxo pipefail +# Set OS hash directory in finch-core as base directory for searching latest OS images. +OS_BASE_IMAGE_HASH_DIR="./deps/finch-core/hashes/" + +OS_AARCH64_FILENAME_PATTERN="Fedora-Cloud-Base-.*-.*.aarch64-.*.qcow2" + +OS_X86_64_FILENAME_PATTERN="Fedora-Cloud-Base-.*-.*.x86_64-.*.qcow2" + + +# Use wildcard patterns to search for the two files and assign their paths to variables +AARCH64_FILEPATH=$(find "$OS_BASE_IMAGE_HASH_DIR" -name "Fedora-Cloud-Base-*-*.aarch64-*.qcow2.sha512" -print -quit) +X86_64_FILEPATH=$(find "$OS_BASE_IMAGE_HASH_DIR" -name "Fedora-Cloud-Base-*-*.x86_64-*.qcow2.sha512" -print -quit) + +# Extract the file names without the path and remove the ".sha512" extension +AARCH64_OS_BASE_IMAGE=$(basename "$AARCH64_FILEPATH" .sha512) +X86_64_OS_BASE_IMAGE=$(basename "$X86_64_FILEPATH" .sha512) + +echo "AARCH64 base image: ${AARCH64_OS_BASE_IMAGE}" +echo "X86_64 base image: ${X86_64_OS_BASE_IMAGE}" + +# Replace occurrences of FINCH_OS_BASENAME in the Makefile with the file names +sed -E -i.bak 's|^([[:blank:]]*FINCH_OS_BASENAME[[:blank:]]*\?=[[:blank:]]*)('"${OS_AARCH64_FILENAME_PATTERN}"')|\1'"$AARCH64_OS_BASE_IMAGE"'|' Makefile +sed -E -i.bak 's|^([[:blank:]]*FINCH_OS_BASENAME[[:blank:]]*\?=[[:blank:]]*)('"${OS_X86_64_FILENAME_PATTERN}"')|\1'"$X86_64_OS_BASE_IMAGE"'|' Makefile diff --git a/.github/workflows/release-homebrew.yaml b/.github/workflows/release-homebrew.yaml index 5ef2df351..9b72de138 100644 --- a/.github/workflows/release-homebrew.yaml +++ b/.github/workflows/release-homebrew.yaml @@ -59,6 +59,9 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ env.FINCH_TAG }} + fetch-depth: 0 + persist-credentials: false + submodules: true - name: Clean up previous files run: | sudo rm -rf /opt/finch @@ -85,8 +88,36 @@ jobs: brew bump-cask-pr --write-only -f --version=$FINCH_VERSION finch - name: Silently install run: | + export HOMEBREW_NO_INSTALL_FROM_API=1 cd $(brew --repo homebrew/cask) brew install --cask ./Casks/finch.rb + - name: Build project + run: | + brew install go lz4 automake autoconf libtool + export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" + make + - 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 + # 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/finch.rb - name: Run e2e tests run: INSTALLED=true make test-e2e - name: Silently uninstall @@ -124,6 +155,9 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ env.FINCH_TAG }} + fetch-depth: 0 + persist-credentials: false + submodules: true - name: Clean up previous files run: | sudo rm -rf /opt/finch @@ -148,8 +182,33 @@ jobs: brew bump-cask-pr --write-only -f --version=$FINCH_VERSION finch - name: Silently install run: | + export HOMEBREW_NO_INSTALL_FROM_API=1 cd $(brew --repo homebrew/cask) brew install --cask ./Casks/finch.rb + - name: Build project + run: | + brew install go lz4 automake autoconf libtool + export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" + make + - 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 + # 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/finch.rb - name: Run e2e tests run: INSTALLED=true make test-e2e - name: Silently uninstall @@ -161,7 +220,7 @@ jobs: echo ERROR: Finch is not uninstalled exit 1 fi - + pr-to-homebrew: needs: [get-latest-tag, macos-arm64-test-installer, macos-amd64-test-installer] runs-on: macos-latest diff --git a/.github/workflows/release-installer.yaml b/.github/workflows/release-installer.yaml index 8a81606fa..2703500f5 100644 --- a/.github/workflows/release-installer.yaml +++ b/.github/workflows/release-installer.yaml @@ -41,12 +41,20 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19.x - - uses: actions/checkout@v3 + go-version-file: go.mod + cache: true + - name: Checkout the tag + uses: actions/checkout@v3 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 + persist-credentials: false + submodules: true - name: Clean up previous files run: | sudo rm -rf /opt/finch sudo rm -rf ~/.finch + sudo rm -rf ./_output if pgrep '^qemu-system'; then sudo pkill '^qemu-system' fi @@ -64,6 +72,41 @@ jobs: aws s3 cp s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-${GITHUB_REF_NAME}-aarch64.pkg Finch-${GITHUB_REF_NAME}-aarch64.pkg - name: Silently install run: sudo installer -pkg Finch-${GITHUB_REF_NAME}-aarch64.pkg -target / + - name: Build project + run: | + brew install go lz4 automake autoconf libtool + export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" + make + - 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" + exit 1 + fi + if ! finch ps -a | grep 'test-ctr2'; then + echo "ERROR: The container test-ctr2 doesn't exist" + 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 + echo 'y' | sudo bash /Applications/Finch/uninstall.sh + # 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 + sudo installer -pkg Finch-${GITHUB_REF_NAME}-aarch64.pkg -target / - name: Run e2e tests run: INSTALLED=true make test-e2e - name: Silently uninstall @@ -88,12 +131,20 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19.x - - uses: actions/checkout@v3 + go-version-file: go.mod + cache: true + - name: Checkout the tag + uses: actions/checkout@v3 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 + persist-credentials: false + submodules: true - name: Clean up previous files run: | sudo rm -rf /opt/finch sudo rm -rf ~/.finch + sudo rm -rf ./_output if pgrep '^qemu-system'; then sudo pkill '^qemu-system' fi @@ -112,6 +163,38 @@ jobs: - name: Silently install run: | sudo installer -pkg Finch-${GITHUB_REF_NAME}-x86_64.pkg -target / + - name: Build project + run: | + brew install go lz4 automake autoconf libtool + export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" + make + - 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" + exit 1 + fi + if ! finch ps -a | grep 'test-ctr2'; then + echo "ERROR: The container test-ctr2 doesn't exist" + 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 + echo 'y' | sudo bash /Applications/Finch/uninstall.sh + sudo installer -pkg Finch-${GITHUB_REF_NAME}-x86_64.pkg -target / - name: Run e2e tests run: INSTALLED=true make test-e2e - name: Silently uninstall diff --git a/.github/workflows/sync-submodules.yaml b/.github/workflows/sync-submodules.yaml new file mode 100644 index 000000000..44b0c37c5 --- /dev/null +++ b/.github/workflows/sync-submodules.yaml @@ -0,0 +1,27 @@ +name: Sync Submodules + +# Pulls changes from the main branch of submodules daily at 9:00 UTC and opens a PR. +on: + schedule: + - cron: '0 9 * * *' + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + token: ${{ secrets.GITHUB_TOKEN }} + - name: Update sub modules + run: | + git submodule update --remote + ./.github/bin/update-os-image.sh + - name: Create PR + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + signoff: true + title: 'build(deps): Bump submodules' diff --git a/.github/workflows/update-deps.yaml b/.github/workflows/update-deps.yaml index 27e0aed6e..90aa7bb0b 100644 --- a/.github/workflows/update-deps.yaml +++ b/.github/workflows/update-deps.yaml @@ -1,5 +1,7 @@ name: Update dependencies on: + schedule: + - cron: '0 11 * * 2' workflow_dispatch: permissions: diff --git a/CHANGELOG.md b/CHANGELOG.md index c3043e92a..16c943cc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,99 @@ # Changelog +## [0.5.0](https://github.com/vsiravar/finch-public/compare/v0.4.1...v0.5.0) (2023-03-19) + + +### ⚠ BREAKING CHANGES + +* persists nerdctl user data ([#182](https://github.com/vsiravar/finch-public/issues/182)) +* changes persistent disk path to prevent collisions + +### Features + +* add `finch cp` command ([#135](https://github.com/vsiravar/finch-public/issues/135)) ([5989361](https://github.com/vsiravar/finch-public/commit/598936166c6fd4a6999e4d3e8d074447e122aea7)) +* add `finch vm status` command ([#83](https://github.com/vsiravar/finch-public/issues/83)) ([37d74d0](https://github.com/vsiravar/finch-public/commit/37d74d0b82c41f439715d0a07e723fd5e5a9a617)) +* add config to support additional directories ([#128](https://github.com/vsiravar/finch-public/issues/128)) ([0ceb060](https://github.com/vsiravar/finch-public/commit/0ceb0602c6e1b90b25fa9de19303ea6ccdece6d7)) +* adds a --force flag to vm stop and remove ([#178](https://github.com/vsiravar/finch-public/issues/178)) ([d499a7d](https://github.com/vsiravar/finch-public/commit/d499a7d712bcc726f331ff07f0e0855ddc9046fa)) +* Print version with Client and Server ([#108](https://github.com/vsiravar/finch-public/issues/108)) ([7f7cdda](https://github.com/vsiravar/finch-public/commit/7f7cdda1d21e430c259eb24a82c6b5784606cbac)) +* saves containerd user data to a persistent disk ([#133](https://github.com/vsiravar/finch-public/issues/133)) ([fccb4f3](https://github.com/vsiravar/finch-public/commit/fccb4f3530b5abc7943db921c25c4f01ea76d725)) +* Support special IP host-gateway in --add-host flag ([#216](https://github.com/vsiravar/finch-public/issues/216)) ([9a38c8e](https://github.com/vsiravar/finch-public/commit/9a38c8e6bc8aa155cda0cdc5b4d80bb12bac8eb8)) + + +### Bug Fixes + +* changes persistent disk path to prevent collisions ([3eb66a2](https://github.com/vsiravar/finch-public/commit/3eb66a21bcbf56dd8e4465bfc3ed840903b069d9)) +* Configure Buildkit Namespace as Env Variable ([#129](https://github.com/vsiravar/finch-public/issues/129)) ([ffb90be](https://github.com/vsiravar/finch-public/commit/ffb90beeeeef7cb8db5706f9198e06d6e111f53f)) +* correctly handle local environment value pass-through ([#158](https://github.com/vsiravar/finch-public/issues/158)) ([e138f10](https://github.com/vsiravar/finch-public/commit/e138f1053fe9219ae6584e49d38c43f306b75e6b)) +* error readable by using the right placeholder ([#39](https://github.com/vsiravar/finch-public/issues/39)) ([8e5f38d](https://github.com/vsiravar/finch-public/commit/8e5f38d2b994dadf53f57430eaa0a59b8cafd2f8)) +* fix the misleading log when applying invalid config ([#119](https://github.com/vsiravar/finch-public/issues/119)) ([b4f74c5](https://github.com/vsiravar/finch-public/commit/b4f74c5a61f78034cc761ea3977b17e36a624692)) +* ignore .ssh pub keys ([#109](https://github.com/vsiravar/finch-public/issues/109)) ([0b74597](https://github.com/vsiravar/finch-public/commit/0b745979ae142c73e3ef5be8d6fd31f142a5d6cd)) +* parse --add-host special ip with equal sign ([#229](https://github.com/vsiravar/finch-public/issues/229)) ([fb4b62b](https://github.com/vsiravar/finch-public/commit/fb4b62bc6987ed786da8f1a351ea8200206be941)) +* persists nerdctl user data ([#182](https://github.com/vsiravar/finch-public/issues/182)) ([59f372c](https://github.com/vsiravar/finch-public/commit/59f372cb0875f800015abe989d4eba6b8df92e42)) +* persists network user data ([#211](https://github.com/vsiravar/finch-public/issues/211)) ([f6baf82](https://github.com/vsiravar/finch-public/commit/f6baf82171d6c487efb21bc0eb45d772124e04b2)) +* print debug logs after newline ([#273](https://github.com/vsiravar/finch-public/issues/273)) ([8faa7de](https://github.com/vsiravar/finch-public/commit/8faa7de81bbb5eb222c5abb4b1239ef8b27e15cb)) +* print debug logs when lima disk command fails ([#270](https://github.com/vsiravar/finch-public/issues/270)) ([78a3f50](https://github.com/vsiravar/finch-public/commit/78a3f5002e10442bf818015de55b940cd4bcf19d)) +* switch from rootless containers to rootful containers ([#232](https://github.com/vsiravar/finch-public/issues/232)) ([ae43a07](https://github.com/vsiravar/finch-public/commit/ae43a0779c778cc3656724f84b5cdfd8ab087798)) + + +### Build System or External Dependencies + +* **deps:** bump finch-core to 0.1.1 ([#93](https://github.com/vsiravar/finch-public/issues/93)) ([3f3bce5](https://github.com/vsiravar/finch-public/commit/3f3bce568ede67c8c54dd92212ec5882443c966f)) +* **deps:** Bump github.com/containerd/containerd from 1.6.14 to 1.6.18 ([#223](https://github.com/vsiravar/finch-public/issues/223)) ([7480222](https://github.com/vsiravar/finch-public/commit/748022258bcdb9f25b41d64cdffdee250c9e6274)) +* **deps:** Bump github.com/google/go-licenses from 1.5.0 to 1.6.0 ([#168](https://github.com/vsiravar/finch-public/issues/168)) ([bb5674c](https://github.com/vsiravar/finch-public/commit/bb5674c846a094d06203449c83a90bd4eaf71a53)) +* **deps:** Bump github.com/lima-vm/lima from 0.12.0 to 0.13.0 ([#40](https://github.com/vsiravar/finch-public/issues/40)) ([520cc7f](https://github.com/vsiravar/finch-public/commit/520cc7f06f9a98652fb077822f1a752da26f7bb9)) +* **deps:** Bump github.com/lima-vm/lima from 0.13.0 to 0.14.0 ([#113](https://github.com/vsiravar/finch-public/issues/113)) ([9b275bc](https://github.com/vsiravar/finch-public/commit/9b275bc807ef6498c8bf38f49e8347b6e0f0b99b)) +* **deps:** Bump github.com/lima-vm/lima from 0.14.0 to 0.14.1 ([#120](https://github.com/vsiravar/finch-public/issues/120)) ([9dea794](https://github.com/vsiravar/finch-public/commit/9dea79434e800cf72fa511195011f8fa04fc87d6)) +* **deps:** Bump github.com/lima-vm/lima from 0.14.1 to 0.14.2 ([#130](https://github.com/vsiravar/finch-public/issues/130)) ([26b7b09](https://github.com/vsiravar/finch-public/commit/26b7b094814db88d500621b581ba8d6f676a21bc)) +* **deps:** bump github.com/lima-vm/lima from 0.14.2 to 0.15.0 ([#247](https://github.com/vsiravar/finch-public/issues/247)) ([007081e](https://github.com/vsiravar/finch-public/commit/007081e6f1d07071b3e0535a87009f985702b2ee)) +* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.5.0 to 2.5.1 ([#50](https://github.com/vsiravar/finch-public/issues/50)) ([fa108fd](https://github.com/vsiravar/finch-public/commit/fa108fd958649578d08b20725ead6ce7a5a190db)) +* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.5.1 to 2.6.0 ([#114](https://github.com/vsiravar/finch-public/issues/114)) ([934521c](https://github.com/vsiravar/finch-public/commit/934521c9bf763c0c4106394b40b158c89390b022)) +* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.6.0 to 2.6.1 ([#121](https://github.com/vsiravar/finch-public/issues/121)) ([becbc44](https://github.com/vsiravar/finch-public/commit/becbc443a5084ad15e916b41f8aa0f28791b4973)) +* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.7.0 to 2.7.1 ([#193](https://github.com/vsiravar/finch-public/issues/193)) ([7aaa381](https://github.com/vsiravar/finch-public/commit/7aaa381cebc0e5306fc78f0de576f4065eb89cd8)) +* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.7.1 to 2.8.0 ([#200](https://github.com/vsiravar/finch-public/issues/200)) ([596ed33](https://github.com/vsiravar/finch-public/commit/596ed337f03a4a1f861aceaa6844b1acc55355aa)) +* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.8.0 to 2.8.3 ([#233](https://github.com/vsiravar/finch-public/issues/233)) ([1185372](https://github.com/vsiravar/finch-public/commit/1185372b672e76373e4b7e798de9725bf6ecba50)) +* **deps:** bump github.com/onsi/ginkgo/v2 from 2.8.3 to 2.8.4 ([#245](https://github.com/vsiravar/finch-public/issues/245)) ([5e64716](https://github.com/vsiravar/finch-public/commit/5e647165f7dfccd185d2c0fa94c565309a5a54b0)) +* **deps:** bump github.com/onsi/ginkgo/v2 from 2.8.4 to 2.9.0 ([#265](https://github.com/vsiravar/finch-public/issues/265)) ([7e2d49e](https://github.com/vsiravar/finch-public/commit/7e2d49e8b09c4167a6e3ad5df4a6f6d9ab9ca728)) +* **deps:** bump github.com/onsi/ginkgo/v2 from 2.9.0 to 2.9.1 ([#285](https://github.com/vsiravar/finch-public/issues/285)) ([d741a03](https://github.com/vsiravar/finch-public/commit/d741a03ac368673432a29f45f5fdaa6f6580fbc9)) +* **deps:** Bump github.com/onsi/gomega from 1.24.1 to 1.24.2 ([#122](https://github.com/vsiravar/finch-public/issues/122)) ([d8174ff](https://github.com/vsiravar/finch-public/commit/d8174ff773f0f92ec94d6d97c753a872a98f74a0)) +* **deps:** Bump github.com/onsi/gomega from 1.24.2 to 1.25.0 ([#165](https://github.com/vsiravar/finch-public/issues/165)) ([e4b9e96](https://github.com/vsiravar/finch-public/commit/e4b9e96713feac19bc73dfc2dd788a80c28a064f)) +* **deps:** Bump github.com/onsi/gomega from 1.25.0 to 1.26.0 ([#183](https://github.com/vsiravar/finch-public/issues/183)) ([12661b7](https://github.com/vsiravar/finch-public/commit/12661b789f6b9162392d698f07a69e34ae391ab8)) +* **deps:** Bump github.com/onsi/gomega from 1.26.0 to 1.27.1 ([#234](https://github.com/vsiravar/finch-public/issues/234)) ([cd43781](https://github.com/vsiravar/finch-public/commit/cd43781b37750579905fc4e32d63f17ad1ec678f)) +* **deps:** bump github.com/onsi/gomega from 1.27.1 to 1.27.2 ([#246](https://github.com/vsiravar/finch-public/issues/246)) ([863c51e](https://github.com/vsiravar/finch-public/commit/863c51e7262e720a93cfea90cf01b0477fd1a2d2)) +* **deps:** Bump github.com/runfinch/common-tests from 0.1.1 to 0.2.0 ([#125](https://github.com/vsiravar/finch-public/issues/125)) ([1bac92a](https://github.com/vsiravar/finch-public/commit/1bac92a99f2e031792018dedfb6425488af51f1e)) +* **deps:** Bump github.com/runfinch/common-tests from 0.2.0 to 0.3.0 ([#151](https://github.com/vsiravar/finch-public/issues/151)) ([79df04e](https://github.com/vsiravar/finch-public/commit/79df04ef62df615c19070e607a060769ab09e7a0)) +* **deps:** Bump github.com/runfinch/common-tests from 0.5.0 to 0.6.0 ([#235](https://github.com/vsiravar/finch-public/issues/235)) ([4a33a2e](https://github.com/vsiravar/finch-public/commit/4a33a2e63c72e687030c70b13dcc5c5748606b86)) +* **deps:** bump github.com/runfinch/common-tests from 0.6.1 to 0.6.2 ([#300](https://github.com/vsiravar/finch-public/issues/300)) ([dd626a0](https://github.com/vsiravar/finch-public/commit/dd626a024203ec28bba46bf1e1c65b1b6644334d)) +* **deps:** Bump github.com/runfinch/common-tests version from v0.1.0 to v0.1.1 ([#76](https://github.com/vsiravar/finch-public/issues/76)) ([fd22d4a](https://github.com/vsiravar/finch-public/commit/fd22d4afafd387eda404a7286952f85c80fa5418)) +* **deps:** Bump github.com/runfinch/common-tests version from v0.3.0 to v0.3.1 ([#169](https://github.com/vsiravar/finch-public/issues/169)) ([16157fe](https://github.com/vsiravar/finch-public/commit/16157fe3adfc8be19899700ae3f1cd5c1a848304)) +* **deps:** Bump github.com/spf13/afero from 1.9.2 to 1.9.3 ([#43](https://github.com/vsiravar/finch-public/issues/43)) ([bf0ad84](https://github.com/vsiravar/finch-public/commit/bf0ad849a90ded53b66b01031e1960bd7803b224)) +* **deps:** Bump github.com/spf13/afero from 1.9.3 to 1.9.4 ([#241](https://github.com/vsiravar/finch-public/issues/241)) ([58f26e6](https://github.com/vsiravar/finch-public/commit/58f26e66be84cc6e566960fd81276fff5ee124c0)) +* **deps:** bump github.com/spf13/afero from 1.9.4 to 1.9.5 ([#263](https://github.com/vsiravar/finch-public/issues/263)) ([a0e277f](https://github.com/vsiravar/finch-public/commit/a0e277f8cba008e2422d11fac26f33640a2ab160)) +* **deps:** Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 ([#44](https://github.com/vsiravar/finch-public/issues/44)) ([31c6d70](https://github.com/vsiravar/finch-public/commit/31c6d70748b9346c9468e3f2882f7e6b8b27bd6b)) +* **deps:** bump github.com/stretchr/testify from 1.8.1 to 1.8.2 ([#244](https://github.com/vsiravar/finch-public/issues/244)) ([984af70](https://github.com/vsiravar/finch-public/commit/984af7008db46eb9e4eecac3050d05f6f76ebcca)) +* **deps:** Bump github.com/xorcare/pointer from 1.2.1 to 1.2.2 ([#42](https://github.com/vsiravar/finch-public/issues/42)) ([8e83137](https://github.com/vsiravar/finch-public/commit/8e83137a1cd12fe1d47187bb96e362ec8d34ca4b)) +* **deps:** Bump golang.org/x/crypto from 0.1.0 to 0.3.0 ([#49](https://github.com/vsiravar/finch-public/issues/49)) ([89826cf](https://github.com/vsiravar/finch-public/commit/89826cf141253746395259438788bb6150410727)) +* **deps:** Bump golang.org/x/crypto from 0.3.0 to 0.4.0 ([#102](https://github.com/vsiravar/finch-public/issues/102)) ([d2778e3](https://github.com/vsiravar/finch-public/commit/d2778e3b2b123f1e7882920f16c4d91f9f96304e)) +* **deps:** Bump golang.org/x/crypto from 0.4.0 to 0.5.0 ([#138](https://github.com/vsiravar/finch-public/issues/138)) ([8d06eec](https://github.com/vsiravar/finch-public/commit/8d06eecdc94fb284da6f6587ba031a898d30ba5f)) +* **deps:** Bump golang.org/x/crypto from 0.4.0 to 0.5.0 ([#144](https://github.com/vsiravar/finch-public/issues/144)) ([603419a](https://github.com/vsiravar/finch-public/commit/603419a703154e8a8eac404da2b9aeb76c5b3333)) +* **deps:** Bump golang.org/x/crypto from 0.5.0 to 0.6.0 ([#212](https://github.com/vsiravar/finch-public/issues/212)) ([e1a36cf](https://github.com/vsiravar/finch-public/commit/e1a36cf9ff39c1273761ca810e357e6200f31de8)) +* **deps:** bump golang.org/x/crypto from 0.6.0 to 0.7.0 ([#264](https://github.com/vsiravar/finch-public/issues/264)) ([ec1c07f](https://github.com/vsiravar/finch-public/commit/ec1c07ff3567396fb0f5a461ece2b048133cce68)) +* **deps:** Bump golang.org/x/tools from 0.2.0 to 0.3.0 ([#52](https://github.com/vsiravar/finch-public/issues/52)) ([27c8f24](https://github.com/vsiravar/finch-public/commit/27c8f24aa1219d397e67f264a45cdcd96e5a23a5)) +* **deps:** Bump golang.org/x/tools from 0.3.0 to 0.4.0 ([#101](https://github.com/vsiravar/finch-public/issues/101)) ([b3c4df1](https://github.com/vsiravar/finch-public/commit/b3c4df1e65bfc95b120b243c2c10463436994d06)) +* **deps:** Bump golang.org/x/tools from 0.4.0 to 0.5.0 ([#139](https://github.com/vsiravar/finch-public/issues/139)) ([89194dc](https://github.com/vsiravar/finch-public/commit/89194dc52757d8f30a8fe8621115e184299bf3e7)) +* **deps:** Bump golang.org/x/tools from 0.5.0 to 0.6.0 ([#215](https://github.com/vsiravar/finch-public/issues/215)) ([decf250](https://github.com/vsiravar/finch-public/commit/decf250bae9e1cce8c0cb78daee62e7160fc0027)) +* **deps:** bump golang.org/x/tools from 0.6.0 to 0.7.0 ([#268](https://github.com/vsiravar/finch-public/issues/268)) ([8072e39](https://github.com/vsiravar/finch-public/commit/8072e39172831c8f3c18b8d17b186ec4a421d830)) +* **deps:** Bump k8s.io/apimachinery from 0.25.2 to 0.25.4 ([#51](https://github.com/vsiravar/finch-public/issues/51)) ([8f15779](https://github.com/vsiravar/finch-public/commit/8f157797cdfedda17cca36fe0a5458a582e7b4a2)) +* **deps:** Bump k8s.io/apimachinery from 0.25.4 to 0.26.0 ([#115](https://github.com/vsiravar/finch-public/issues/115)) ([e9084a4](https://github.com/vsiravar/finch-public/commit/e9084a413330799ed01da94f826518f30f33a83b)) +* **deps:** Bump k8s.io/apimachinery from 0.26.0 to 0.26.1 ([#174](https://github.com/vsiravar/finch-public/issues/174)) ([829b0bc](https://github.com/vsiravar/finch-public/commit/829b0bc05824203e60609264c18d075c1eea845b)) +* **deps:** bump k8s.io/apimachinery from 0.26.1 to 0.26.2 ([#251](https://github.com/vsiravar/finch-public/issues/251)) ([4a7268e](https://github.com/vsiravar/finch-public/commit/4a7268ede5d6f9d2fc3e30f167d2a4ebc91bb5f2)) +* **deps:** Bump lima version ([#141](https://github.com/vsiravar/finch-public/issues/141)) ([35da07d](https://github.com/vsiravar/finch-public/commit/35da07d7cc65fe5749a7eb665413824cf3115a08)) +* **deps:** Bump lima version ([#302](https://github.com/vsiravar/finch-public/issues/302)) ([0269743](https://github.com/vsiravar/finch-public/commit/026974314254df1e4047ea5130ba50464608bb1d)) +* **deps:** Bump lima version ([#75](https://github.com/vsiravar/finch-public/issues/75)) ([cfaa4f6](https://github.com/vsiravar/finch-public/commit/cfaa4f6b79af2eba3cfceff0b0e65f44329d1e78)) +* **deps:** Bump submodules ([#281](https://github.com/vsiravar/finch-public/issues/281)) ([d4fd1f6](https://github.com/vsiravar/finch-public/commit/d4fd1f6902d51985c829808c65738e38f7e2cdd1)) +* **deps:** Bump submodules ([#304](https://github.com/vsiravar/finch-public/issues/304)) ([b38af9f](https://github.com/vsiravar/finch-public/commit/b38af9fe0e5c4ffb3eb94641d70dd16e3fe7c833)) +* make finch-core a submodule instead of downloading archives ([#188](https://github.com/vsiravar/finch-public/issues/188)) ([b08f588](https://github.com/vsiravar/finch-public/commit/b08f588cd13b7a1a7c457f279b74489e9df09fb5)) +* update os image versions ([#255](https://github.com/vsiravar/finch-public/issues/255)) ([576765b](https://github.com/vsiravar/finch-public/commit/576765b2913b714d274bc1ab8b418f9ce9421b9d)) + ## [0.4.1](https://github.com/runfinch/finch/compare/v0.4.0...v0.4.1) (2023-03-02) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50e451daa..9a727ada5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -139,9 +139,13 @@ If the repo is already cloned, but the submodules are not pulled yet, the follow git submodule update --init --recursive ``` -After cloning the repo, run `make` to build the binary. +After cloning the repo, run the following command to make subsequent `git pull` to also update submodules to the versions specified in the upstream branch. -The binary in `_output` can be directly used. E.g. initializing the vm and display the version +```shell +git config submodule.recurse true +``` + +Then run `make` to build the binary. The binary in `_output` can be directly used. E.g. initializing the vm and display the version ```sh ./_output/bin/finch vm init diff --git a/Makefile b/Makefile index ad1302560..fe5b5320b 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,14 @@ ifneq (,$(findstring arm64,$(ARCH))) SUPPORTED_ARCH = true LIMA_ARCH = aarch64 # From https://dl.fedoraproject.org/pub/fedora/linux/releases/37/Cloud/aarch64/images/ - FINCH_OS_BASENAME ?= Fedora-Cloud-Base-37-1.7.aarch64-20230302174539.qcow2 - LIMA_URL ?= https://deps.runfinch.com/aarch64/lima-and-qemu.macos-aarch64.1673290784.tar.gz + FINCH_OS_BASENAME ?= Fedora-Cloud-Base-37-1.7.aarch64-20230317205128.qcow2 + LIMA_URL ?= https://deps.runfinch.com/aarch64/lima-and-qemu.macos-aarch64.1678826933.tar.gz else ifneq (,$(findstring x86_64,$(ARCH))) SUPPORTED_ARCH = true LIMA_ARCH = x86_64 # From https://dl.fedoraproject.org/pub/fedora/linux/releases/37/Cloud/x86_64/images/ - FINCH_OS_BASENAME ?= Fedora-Cloud-Base-37-1.7.x86_64-20230302173518.qcow2 - LIMA_URL ?= https://deps.runfinch.com/x86-64/lima-and-qemu.macos-x86_64.1673290501.tar.gz + FINCH_OS_BASENAME ?= Fedora-Cloud-Base-37-1.7.x86_64-20230317204632.qcow2 + LIMA_URL ?= https://deps.runfinch.com/x86-64/lima-and-qemu.macos-x86_64.1678817277.tar.gz endif FINCH_OS_HASH := `shasum -a 256 $(OUTDIR)/os/$(FINCH_OS_BASENAME) | cut -d ' ' -f 1` diff --git a/cmd/finch/main.go b/cmd/finch/main.go index a93cf811b..3905c5e17 100644 --- a/cmd/finch/main.go +++ b/cmd/finch/main.go @@ -28,7 +28,39 @@ import ( const finchRootCmd = "finch" +type Shape interface { + Area() float64 +} + +type Rectangle struct { + Width float64 + Height float64 +} + +func (r Rectangle) Area() float64 { + return 0 +} + +type Square struct { + Width float64 +} + +func (r Square) Area() float64 { + return 1 +} + +func computeArea(shape Shape) float64 { + return shape.Area() +} + func main() { + println(computeArea(&Rectangle{ + Width: 0, + Height: 0, + })) + println(computeArea(&Square{ + Width: 1, + })) logger := flog.NewLogrus() stdLib := system.NewStdLib() fs := afero.NewOsFs() diff --git a/cmd/finch/virtual_machine_init.go b/cmd/finch/virtual_machine_init.go index 4a83f2d5d..0c691b864 100644 --- a/cmd/finch/virtual_machine_init.go +++ b/cmd/finch/virtual_machine_init.go @@ -96,7 +96,7 @@ func (iva *initVMAction) run() error { iva.logger.Info("Initializing and starting Finch virtual machine...") logs, err := limaCmd.CombinedOutput() if err != nil { - iva.logger.Errorf("Finch virtual machine failed to start, debug logs: %s", logs) + iva.logger.Errorf("Finch virtual machine failed to start, debug logs:\n%s", logs) return err } iva.logger.Info("Finch virtual machine started successfully") diff --git a/cmd/finch/virtual_machine_init_test.go b/cmd/finch/virtual_machine_init_test.go index 9777d46be..cf73bf1f5 100644 --- a/cmd/finch/virtual_machine_init_test.go +++ b/cmd/finch/virtual_machine_init_test.go @@ -289,7 +289,7 @@ func TestInitVMAction_run(t *testing.T) { mockBaseYamlFilePath, "--tty=false").Return(command) logger.EXPECT().Info("Initializing and starting Finch virtual machine...") - logger.EXPECT().Errorf("Finch virtual machine failed to start, debug logs: %s", logs) + logger.EXPECT().Errorf("Finch virtual machine failed to start, debug logs:\n%s", logs) }, }, } diff --git a/cmd/finch/virtual_machine_remove.go b/cmd/finch/virtual_machine_remove.go index bca27aad2..16e47f4d5 100644 --- a/cmd/finch/virtual_machine_remove.go +++ b/cmd/finch/virtual_machine_remove.go @@ -81,7 +81,7 @@ func (rva *removeVMAction) removeVM(force bool) error { } logs, err := limaCmd.CombinedOutput() if err != nil { - rva.logger.Errorf("Finch virtual machine failed to remove, debug logs: %s", logs) + rva.logger.Errorf("Finch virtual machine failed to remove, debug logs:\n%s", logs) return err } rva.logger.Info("Finch virtual machine removed successfully") diff --git a/cmd/finch/virtual_machine_remove_test.go b/cmd/finch/virtual_machine_remove_test.go index e77fdfbbe..8b43bd5f2 100644 --- a/cmd/finch/virtual_machine_remove_test.go +++ b/cmd/finch/virtual_machine_remove_test.go @@ -159,7 +159,7 @@ func TestRemoveVMAction_run(t *testing.T) { command.EXPECT().CombinedOutput().Return(logs, errors.New("failed to remove instance")) creator.EXPECT().CreateWithoutStdio("remove", limaInstanceName).Return(command) logger.EXPECT().Info("Removing existing Finch virtual machine...") - logger.EXPECT().Errorf("Finch virtual machine failed to remove, debug logs: %s", logs) + logger.EXPECT().Errorf("Finch virtual machine failed to remove, debug logs:\n%s", logs) }, force: false, }, diff --git a/cmd/finch/virtual_machine_start.go b/cmd/finch/virtual_machine_start.go index d46c7635b..0edb893f6 100644 --- a/cmd/finch/virtual_machine_start.go +++ b/cmd/finch/virtual_machine_start.go @@ -88,7 +88,7 @@ func (sva *startVMAction) run() error { sva.logger.Info("Starting existing Finch virtual machine...") logs, err := limaCmd.CombinedOutput() if err != nil { - sva.logger.Errorf("Finch virtual machine failed to start, debug logs: %s", logs) + sva.logger.Errorf("Finch virtual machine failed to start, debug logs:\n%s", logs) return err } sva.logger.Info("Finch virtual machine started successfully") diff --git a/cmd/finch/virtual_machine_start_test.go b/cmd/finch/virtual_machine_start_test.go index 6b4458aa6..1b65543c2 100644 --- a/cmd/finch/virtual_machine_start_test.go +++ b/cmd/finch/virtual_machine_start_test.go @@ -305,7 +305,7 @@ func TestStartVMAction_run(t *testing.T) { lcc.EXPECT().CreateWithoutStdio("start", limaInstanceName).Return(command) logger.EXPECT().Info("Starting existing Finch virtual machine...") - logger.EXPECT().Errorf("Finch virtual machine failed to start, debug logs: %s", logs) + logger.EXPECT().Errorf("Finch virtual machine failed to start, debug logs:\n%s", logs) }, }, } diff --git a/cmd/finch/virtual_machine_stop.go b/cmd/finch/virtual_machine_stop.go index 4bece4c89..7b5c75f53 100644 --- a/cmd/finch/virtual_machine_stop.go +++ b/cmd/finch/virtual_machine_stop.go @@ -79,7 +79,7 @@ func (sva *stopVMAction) stopVM(force bool) error { } logs, err := limaCmd.CombinedOutput() if err != nil { - sva.logger.Errorf("Finch virtual machine failed to stop, debug logs: %s", logs) + sva.logger.Errorf("Finch virtual machine failed to stop, debug logs:\n%s", logs) return err } sva.logger.Info("Finch virtual machine stopped successfully") diff --git a/cmd/finch/virtual_machine_stop_test.go b/cmd/finch/virtual_machine_stop_test.go index 8134e7b0b..5eec80209 100644 --- a/cmd/finch/virtual_machine_stop_test.go +++ b/cmd/finch/virtual_machine_stop_test.go @@ -158,7 +158,7 @@ func TestStopVMAction_run(t *testing.T) { command.EXPECT().CombinedOutput().Return(logs, errors.New("error")) creator.EXPECT().CreateWithoutStdio("stop", limaInstanceName).Return(command) logger.EXPECT().Info("Stopping existing Finch virtual machine...") - logger.EXPECT().Errorf("Finch virtual machine failed to stop, debug logs: %s", logs) + logger.EXPECT().Errorf("Finch virtual machine failed to stop, debug logs:\n%s", logs) }, force: false, }, diff --git a/deps/finch-core b/deps/finch-core index eef21029b..31067f9e3 160000 --- a/deps/finch-core +++ b/deps/finch-core @@ -1 +1 @@ -Subproject commit eef21029b89d7db00bddc6e426e4405c920b13ed +Subproject commit 31067f9e328bb05543c547b3aad728a31db236f9 diff --git a/e2e/vm/additional_disk_test.go b/e2e/vm/additional_disk_test.go index ecb3fd48e..56dc777b5 100644 --- a/e2e/vm/additional_disk_test.go +++ b/e2e/vm/additional_disk_test.go @@ -4,6 +4,8 @@ package vm import ( + "fmt" + "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" "github.com/runfinch/common-tests/command" @@ -12,32 +14,46 @@ import ( const ( savedImage = "public.ecr.aws/docker/library/alpine:latest" - containerName = "userDataTest" + containerName = "test-ctr" + volumeName = "test-volume" + networkName = "test-network" ) var testAdditionalDisk = func(o *option.Option) { ginkgo.Describe("Additional disk", ginkgo.Serial, func() { ginkgo.It("Retains container user data after the VM is deleted", func() { - command.Run(o, "pull", savedImage) + command.Run(o, "volume", "create", volumeName) + ginkgo.DeferCleanup(command.Run, o, "volume", "rm", volumeName) + command.Run(o, "network", "create", networkName) + ginkgo.DeferCleanup(command.Run, o, "network", "rm", networkName) + + command.Run(o, "run", "-d", "--name", containerName, "-v", fmt.Sprintf("%s:/tmp", volumeName), + savedImage, "sh", "-c", "sleep infinity") + command.Run(o, "exec", containerName, "sh", "-c", "echo foo > /tmp/test.txt") ginkgo.DeferCleanup(command.Run, o, "rmi", savedImage) - oldImagesOutput := command.StdoutStr(o, "images", "--format", "{{.Name}}") - gomega.Expect(oldImagesOutput).Should(gomega.ContainSubstring(savedImage)) + ginkgo.DeferCleanup(command.Run, o, "rm", "-f", containerName) - command.Run(o, "run", "--name", containerName, savedImage) - ginkgo.DeferCleanup(command.Run, o, "rm", containerName) - oldPsOutput := command.StdoutStr(o, "ps", "--all", "--format", "{{.Names}}") - gomega.Expect(oldPsOutput).Should(gomega.ContainSubstring(containerName)) + command.Run(o, "kill", containerName) command.New(o, virtualMachineRootCmd, "stop").WithoutCheckingExitCode().WithTimeoutInSeconds(90).Run() command.Run(o, virtualMachineRootCmd, "remove") - command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(240).Run() - newImagesOutput := command.StdoutStr(o, "images", "--format", "{{.Name}}") - gomega.Expect(newImagesOutput).Should(gomega.Equal(oldImagesOutput)) + imageOutput := command.StdoutAsLines(o, "images", "--format", "{{.Name}}") + gomega.Expect(imageOutput).Should(gomega.ContainElement(savedImage)) + + psOutput := command.StdoutAsLines(o, "ps", "--all", "--format", "{{.Names}}") + gomega.Expect(psOutput).Should(gomega.ContainElement(containerName)) + + volumeOutput := command.StdoutAsLines(o, "volume", "ls", "--format", "{{.Name}}") + gomega.Expect(volumeOutput).Should(gomega.ContainElement(volumeName)) + + networkOutput := command.StdoutAsLines(o, "network", "ls", "--format", "{{.Name}}") + gomega.Expect(networkOutput).Should(gomega.ContainElement(networkName)) - newPsOutput := command.StdoutStr(o, "ps", "--all", "--format", "{{.Names}}") - gomega.Expect(newPsOutput).Should(gomega.Equal(oldPsOutput)) + command.Run(o, "start", containerName) + gomega.Expect(command.StdoutStr(o, "exec", containerName, "cat", "/tmp/test.txt")). + Should(gomega.Equal("foo")) }) }) } diff --git a/go.mod b/go.mod index 34965cecc..20e4af197 100644 --- a/go.mod +++ b/go.mod @@ -7,11 +7,11 @@ require ( github.com/golang/mock v1.6.0 github.com/google/go-licenses v1.6.0 github.com/lima-vm/lima v0.15.0 - github.com/onsi/ginkgo/v2 v2.9.0 - github.com/onsi/gomega v1.27.2 + github.com/onsi/ginkgo/v2 v2.9.1 + github.com/onsi/gomega v1.27.3 github.com/pelletier/go-toml v1.9.5 github.com/pkg/sftp v1.13.5 - github.com/runfinch/common-tests v0.6.1 + github.com/runfinch/common-tests v0.6.2 github.com/sirupsen/logrus v1.9.0 github.com/spf13/afero v1.9.5 github.com/spf13/cobra v1.6.1 @@ -31,7 +31,7 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.0.1 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect diff --git a/go.sum b/go.sum index 18c6a4939..636233095 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,9 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -307,10 +308,10 @@ github.com/miekg/dns v1.1.51/go.mod h1:2Z9d3CP1LQWihRZUf29mQ19yDThaI4DAYzte2CaQW github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo/v2 v2.9.0 h1:Tugw2BKlNHTMfG+CheOITkYvk4LAh6MFOvikhGVnhE8= -github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk= -github.com/onsi/gomega v1.27.2 h1:SKU0CXeKE/WVgIV1T61kSa3+IRE8Ekrv9rdXDwwTqnY= -github.com/onsi/gomega v1.27.2/go.mod h1:5mR3phAHpkAVIDkHEUBY6HGVsU+cpcEscrGPB4oPlZI= +github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= +github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= +github.com/onsi/gomega v1.27.3 h1:5VwIwnBY3vbBDOJrNtA4rVdiTZCsq9B5F12pvy1Drmk= +github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= @@ -338,8 +339,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 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/runfinch/common-tests v0.6.1 h1:seHaiuhpsbty7eDI1HU503xIMu29Tc0vuGrtgQfTL7A= -github.com/runfinch/common-tests v0.6.1/go.mod h1:kEouVzij+txCzHvD1Cue8DqSQT06ZOhoBPaSCyQyQdE= +github.com/runfinch/common-tests v0.6.2 h1:dTuWhwvh4angzIM+Dci+gE4MiWrgOf7H68lmlP8P5Aw= +github.com/runfinch/common-tests v0.6.2/go.mod h1:cqid4oyin7anOS0mR8MYt3fzUL14YnIaDgcM9wBMwro= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= diff --git a/pkg/disk/disk.go b/pkg/disk/disk.go index 3ee51dbeb..d7a2d6f31 100644 --- a/pkg/disk/disk.go +++ b/pkg/disk/disk.go @@ -116,7 +116,10 @@ func (m *userDataDiskManager) limaDiskExists() bool { func (m *userDataDiskManager) createLimaDisk() error { cmd := m.lcc.CreateWithoutStdio("disk", "create", diskName, "--size", diskSize) - return cmd.Run() + if logs, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("failed to create disk, debug logs:\n%s", logs) + } + return nil } func (m *userDataDiskManager) attachPersistentDiskToLimaDisk() error { @@ -165,5 +168,8 @@ func (m *userDataDiskManager) limaDiskIsLocked() bool { func (m *userDataDiskManager) unlockLimaDisk() error { cmd := m.lcc.CreateWithoutStdio("disk", "unlock", diskName) - return cmd.Run() + if logs, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("failed to unlock disk, debug logs:\n%s", logs) + } + return nil } diff --git a/pkg/disk/disk_test.go b/pkg/disk/disk_test.go index 4dcf2a501..fbf4cdf68 100644 --- a/pkg/disk/disk_test.go +++ b/pkg/disk/disk_test.go @@ -55,7 +55,7 @@ func TestUserDataDiskManager_InitializeUserDataDisk(t *testing.T) { cmd.EXPECT().Output().Return([]byte(""), nil) lcc.EXPECT().CreateWithoutStdio(mockCreateArgs).Return(cmd) - cmd.EXPECT().Run().Return(nil) + cmd.EXPECT().CombinedOutput().Return(nil, nil) dfs.EXPECT().Stat(finch.UserDataDiskPath(homeDir)).Return(nil, fs.ErrNotExist) dfs.EXPECT().Stat(path.Dir(finch.UserDataDiskPath(homeDir))).Return(nil, nil) @@ -107,7 +107,7 @@ func TestUserDataDiskManager_InitializeUserDataDisk(t *testing.T) { cmd.EXPECT().Output().Return([]byte(""), nil) lcc.EXPECT().CreateWithoutStdio(mockCreateArgs).Return(cmd) - cmd.EXPECT().Run().Return(nil) + cmd.EXPECT().CombinedOutput().Return(nil, nil) dfs.EXPECT().Stat(finch.UserDataDiskPath(homeDir)).Return(nil, nil) @@ -130,7 +130,7 @@ func TestUserDataDiskManager_InitializeUserDataDisk(t *testing.T) { dfs.EXPECT().Stat(lockPath).Return(nil, nil) lcc.EXPECT().CreateWithoutStdio(mockUnlockArgs).Return(cmd) - cmd.EXPECT().Run().Return(nil) + cmd.EXPECT().CombinedOutput().Return(nil, nil) }, }, }