AppVeyor BYOC allows connecting an existing Mac computer (your workstation, cloud VM or the server in your LAN) and running builds in isolated Parallels Desktop VMs.
In Parallels Control Center GUI click “+” button to create a new VM. Browse Free Systems and click on “Install MacOS Using the recovery Partition”. It will create VM and start MacOS Recovery. It will show “MacOS Utilities” window first. Click Reinstall MacOS and follow further instructions. During installation of Mac OS configure appveyor
user.
When MacOS is installed login as appveyor
user and continue with the following steps:
sudo bash
to get root privilegesappveyor
to sudoers with NOPASSWD
: echo -e 'appveyor\tALL=(ALL)\tNOPASSWD: ALL\nDefaults:appveyor !requiretty' > /etc/sudoers.d/appveyor
sudo systemsetup -setcomputersleep Never
appveyor
user.prlctl set <VMNAME> --pause-idle off --faster-vm on --nested-virt on --auto-compress off --adaptive-hypervisor on --isolate-vm on
Now its time to run Packer to install software into build image.
On host machine’s terminal window while in user’s Home directory:
/usr/local/bin
(or any other directory in your PATH variable): cp packer /usr/local/bin/packer
.git clone https://github.com/appveyor/build-images.git
, change current directory to the repository e.g. cd build-repository
prlctl unregister <VMNAME>
$HOME/Parallels/<VMNAME>.pvm
. Copy to clipboard full path to the VM’s folder for the next step.Prepare var-file for Packer named vault.json
with sensitive values:
{
"pvm_path": "VM's Location on host's disk",
"appVeyorUrl": "https://ci.appveyor.com or URL to Appveyor Server",
"hostAuthorizationToken": "Host agent authorization token",
"appleIdUser": "YOUR APPLE ID",
"appleIdPasswd": "YOUR APPLE ID Password"
}
packer build --only=parallels-pvm --var-file=vault.json macos.json
. Packer will create another PVM in output-parallels-pvm subfolder. Packer will name that PVM according to pattern packer--
e.g. packer-catalina-201911280809
~/Parallels
folder: mv output-parallels-pvm/packer--.pvm ~/Parallels
prlctl register ~/Parallels/packer--.pvm
macos-_prod
: prlctl set packer-- --name macos_prod
. Note, this command will rename VM’s name and Vm’s subfoler in ~/Parallels
.In AppVeyor web portal:
Mike's computer
and generate Host agent authorization token (or provide your own - it’s basically AppVeyor Host Agent identifier and the password it connects to AppVeyor with);macOS
as Name and choose macOS
in OS type dropdown;AppVeyor Host Agent is a lightweight service running on your macOS machine that connects to AppVeyor and runs your builds.
Using brew
tool install the latest AppVeyor Host Agent with your <host-authorization-token>
and AppVeyor URL (if connecting to a self-hosted AppVeyor Server installation):
HOMEBREW_HOST_AUTH_TKN=<host-authorization-token> HOMEBREW_APPVEYOR_URL=https://ci.appveyor.com brew install appveyor/brew/appveyor-host-agent
Start Host Agent service:
brew services start appveyor-host-agent
Make sure the service is running:
brew services list
If you need to change Host Agent authorization token to connect the agent to a different cloud you can update its value in /usr/local/etc/opt/appveyor/host-agent/appsettings.json
file.
After changing authorization token stop Host Agent service:
brew services stop appveyor-host-agent
delete Host Agent database file host-agent.db
in /usr/local/var/opt/appveyor/host-agent
directory and start Host Agent service again:
brew services start appveyor-host-agent