Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alephao/macos-packer-anka

Packer templates for building macOS images with Anka
https://github.com/alephao/macos-packer-anka

anka ci macos packer

Last synced: 2 days ago
JSON representation

Packer templates for building macOS images with Anka

Awesome Lists containing this project

README

        

## What's in this repo?

This repo contains the [Packer](packer.io) templates for building images for a macOS build environment.

This repo uses [Anka](https://veertu.com/anka-build-page/) to build the macOS images. For packer to work with anka, we need to install a the packer-anka plugin as well. Follow the installation instructions are below.

## Getting started

To start building macOS images, first you need to install a few tools:

1. Anka
2. Packer v1.4.5 (anka plugin don't work in greater versions at the moment)
3. Packer Builder for Veertu Anka

Clone this repo, cd to this folder and follow the instructions:

**Install Packer**

To install packer 1.4.5, open terminal, cd to this foler and run the command below:

```shell
make install-packer
```

Verify if the installation was successful by running `packer version`

**Installing Anka**

To install Anka, open terminal, cd to this folder and run the command below:

```shell
# Note: it runs a sudo command so you might need to type your password
make install-anka
```

After installing anka, you'll need to activate your license and accept eula. [You can get a trial license here](https://veertu.com/anka-build-trial/).

Once you have your license, run:

```shell
sudo anka license activate
sudo anka license accept-eula
```

**Install Packer Builder for Veertu Anka**

To install packer builder for anka, open terminal, cd to this folder and run the command below:

```shell
make install-packer-anka-plugin
```

**Download a macOS installer**

To create an image from scratch you need a macOS installer.

You can download catalina installer from the appstore [here](https://apps.apple.com/au/app/macos-catalina/id1466841314?mt=12). The installer will be dowloaded to the `/Applications` folder.

## How to use

Now that you have all the tools necessary, run packer commands to build the images.

There are a couple of template files inside the `templates/` directory.

**01-ruby.json**

The `01-ruby.json` template creates an image containing homebrew, ruby and bundler. The versions are defined on `templates/variables.json`.

The first time you build this template, it will create a new image on anka called `catalina-base`. Then it will copy the `catalina-base` image and install the software defined inside this template.

To build this image run:

```shell
packer build -var-file templates/variables.json templates/01-ruby.json
```

**02-xcode.json**

The `02-xcode.json` template creates an image containing xcode-install and xcode. You need to provide an apple developer account without 2FA, the version of xcode installed is defined on `templates/variables.json`.

If you don't have an apple developer account without 2FA, just create one. If your e-mail provider accepts aliases, you can use your current apple id e-mail with an alias, for example, if your apple id is [email protected] you can create a new account using [email protected], this way you don't need to create a new e-mail account.

This image depends on the image generated by the `01-ruby.json` template, so you'll need to build the ruby image before building this one.

To build this image run:

```shell
packer build -var-file templates/variables.json \
-var XCODE_INSTALL_USER= \
-var XCODE_INSTALL_PASSWORD= \
templates/02-xcode.json
```

**complete.json**

The `complete.json` template will generate everything in one go.

```
packer build -var-file templates/variables.json \
-var anka_license= \
-var XCODE_INSTALL_USER= \
-var XCODE_INSTALL_PASSWORD= \
templates/complete.json
```

## Contributing

Feel free to open issues if you want to propose an enhancement or if you find a bug.

## Attributions

Took inspiration from

* [travis-ci/packer-templates-mac](https://github.com/travis-ci/packer-templates-mac)
* [Shopify Engineering: Scaling iOS CI with Anka](https://engineering.shopify.com/blogs/engineering/scaling-ios-ci-with-anka)
* [MacStadium's Customers Stories](https://www.macstadium.com/company/customers)