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

Refactor lima and qemu #2

Merged
merged 5 commits into from
Nov 14, 2024

Conversation

jandubois
Copy link
Member

@jandubois jandubois commented Nov 13, 2024

  • Build qemu on macOS with an empty brew install, and then archive the cache directory to provide the sources used in the build.

  • Include the tag/version string in the artifact tarballs.

  • On Linux set LD_LIBRARY_PATH for appdir-qemu.sh to make sure we capture all the libs

  • Provide an alternative USE_OTOOL to collect files on macOS. That turned out not to be necessary, but let's keep it in case `filemonitor will at some point require disabling SIP or something like that.

The aarch64 version no longer collected the qemu libraries. That's why it was
re-implemented by parsing the `otool -L` output. It eventually turned out that
the Homebrew had switched to Lima 1.0.0, which uses `--vm-type vz` by default
(when available).

The FileMonitor version does not collect kvmvapic.bin and vgabios-virtio.bin.
They may not be needed when the VM is run without a display, but it for now
it seems safer to keep them in the tarball.

The script has also been changed to re-analyze an existing filemonitor.log.
This makes no difference on CI but helps debugging the script.

Signed-off-by: Jan Dubois <[email protected]>
@jandubois jandubois marked this pull request as ready for review November 13, 2024 21:51
run: |
version=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
echo "VERSION=${version#v}" >>"$GITHUB_OUTPUT"
- name: Uninstall all brew packages and clear cache
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be easier to just provide a different homebrew prefix? I'm wary of randomly uninstalling things that the rest of the stuff might need.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, what is "the rest of the stuff"? This job just builds QEMU from source and then runs lima-and-qemu.pl. There is nothing else. And we explicitly install every other tool needed to do these.

I also don't think something like having multiple homebrew installations are going to work. Especially since we are running on a macOS version that homebrew really doesn't want to run on anymore, so each experiment takes hours.

Given that I've spent several days battling with homebrew about this, I'm kind of unwilling to spend extra effort on this unless there is an actual problem.

run: |
set -o xtrace
brew tap-new rd/tap
cp qemu.rb "$(brew --repo rd/tap)/Formula/qemu.rb"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to checkout into the directory instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the question. This step is creating a new tap, that will be inside the homebrew-managed directory structure. Do you want to create a separate repo to store a tap on GitHub? That seems like overkill compared to copying a single file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a actions/checkout step, and here we copy the qemu.rb into the tap directory. I was wondering if calling actions/checkout directly into …/Formula would be useful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then everything else from this repo would be inside the new tap too. And directory doesn't even exist yet. I don't know how this would be simpler; it feels more complicated, and having to call the lima-and-qemu.pl script like this looks just wrong to me:

perl "$(brew --repo rd/tap)/Formula/lima-and-qemu.pl"

I'm sorry, I must be missing something.

.github/workflows/build.yaml Show resolved Hide resolved
.github/workflows/build.yaml Outdated Show resolved Hide resolved
.github/workflows/build.yaml Outdated Show resolved Hide resolved
appdir-qemu.sh Outdated Show resolved Hide resolved
Signed-off-by: Jan Dubois <[email protected]>
Copy link
Collaborator

@mook-as mook-as left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still wary of uninstalling random things from homebrew (since that might break the GitHub runner), but if that seems to work, 🤷

@jandubois jandubois merged commit 198aca9 into rancher-sandbox:main Nov 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants