Automattic / hostmgr

A tool for managing macOS VM hosts
Mozilla Public License 2.0
9 stars 3 forks source link

hostmgr

What is it?

This tool suite is used to create and manage VMs on our Buildkite CI Mac hosts:

Installation

Those tools are installed in our macOS CI hosts when those are deployed, using the Ansible playbook

When you need to install those tools on your local machine—typically to create new OS templates or Xcode VMs—follow the below instructions:

(We can potentially automate this step, but for now this is still manual)

  1. Run sudo mkdir -p /opt/ci/ && sudo chown <your-mac-user-name> /opt/ci.
  2. Create a few directories: mkdir -p /opt/ci/bin /opt/ci/vm-images /opt/ci/working-vm-images.
  3. Download hostmgr and hostmgr-helper from the latest release and move them to /opt/ci/bin.
  4. Give the downloaded binaries executable permission: chmod u+x /opt/ci/bin/hostmgr /opt/ci/bin/hostmgr-helper.
  5. You might also need to remove the quanrantine flag from downloaded executables so they can run from Terminal:
    • Either by right-clicking the executable in the Finder, selecting "Open" in the context menu, and click "Open" button.
    • Or by running xattr -d com.apple.quarantine /opt/ci/bin/hostmgr /opt/ci/bin/hostmgr-helper.
  6. Add /opt/ci/bin to your PATH so that the VM tools will be able to use hostmgr and hostmgr-helper
  7. Create a config file in /opt/ci/hostmgr.json. You can copy the file we use to provision our macOS CI hosts directly there.
  8. Open a Terminal and run hostmgr-helper to launch the "hostmgr-helper" macOS app, which needs to be running during building VM images.

Release

  1. Create a PR to update the version property.
  2. After the PR is merged, create a tag named same as the updated version,
  3. Once the tag is pushed up to this repo, a CI job will be automatically kicked off to create a GitHub release for the tag.