Container like ‘anka run’ interface for Anka macOS VM

Anka run command line interface enables command execution inside Anka macOS VMs directly from the host. It’s very similar to container docker run.



Why is this interesting – It allows Devops to take their existing container based Linux CI workflow automation, repurpose it for macOS and use it on Anka Build macOS Cloud infrastructure for iOS CI.



anka run --help



Usage: anka run [OPTIONS] VM_NAME COMMAND [ARGS]...



Run commands inside VM environment



Options:


-w, --workdir PATH Working directory inside the VM [optional]


-v, --volumes-from, --volume PATH
Mount host directory (current directory by
default) into VM . '--volumes-from' is
deprecated form [optional]


-n, --no-volumes-from, --no-volume
Use this flag to prevent implicit mounting
of current folder (see --volume option).
'--no-volumes-from' is deprecated form
[optional]


-E, -e, --env Inherit environment variables. '-e' is
deprecated form [optional]


-f, --env-file PATH Provide environment variables from file
[optional]


-N, --wait-network Wait till guest network interface up
[optional]



‘anka run’ by default mounts the current folder from the host into the Anka macOS VM and executes commands on this mount point as the current directory. Upon completion of command execution, the mount directory is automatically released.
As a developer, this can be quite useful to be able to execute operations inside the VM environment in an isolated manner using artifacts/code residing on the developer machine.
Example,




anka run xcodebuild -sdk iphonesimulator -scheme Kickstarter-iOS build



–volume (-v) – Mount directory into VM. Mountpoint could be specified explicitly in this form:–volume /host/dir:/mountpoint, or assigned dynamically: –volume /host/dir. If no –workdir option is specified, mountpoint will be selected as working directory for running command.



Example :
anka run -v ~/Projects/anka:/tmp/anka run build



–no-volume (-n) – By default anka run command mounts current directory into VM, (implicit –volume $PWD option). Specify this option to disable implicit mounting. If no –workdir option is specified, working directory will be set to VM user’s home directory.



Example :



anka run -n xcodebuild -sdk iphonesimulator -scheme Kickstarter-iOS build - Will not mount the current host directory and execute build in the VM current directory.



–workdir (-w) – Specify working directory inside the VM



Example :



anka run -n -w /tmp/workspace/project git clone ${URL} src




anka run -n -w /tmp/workspace/project/src xcodebuild



–env (-E) – Inherit host environment variables in non-overriding mode.
Example :
CFLAGS=-O2 CC=clang anka run -E ${VM} make test.c



–env-file (-f) – Provide environment variables in overriding mode from file specified. Format of the environment file can be:



VAR=VALUE



VAR2=VALUE2



–wait-network (-N) – Resumed VMs require some time to reconfigure networking interface, so scripts which use networking immediately (e.g: git clone) could fail on network inaccessibility. This option postpones execution of the command till network is up. Incorporate it in your VM bootstrapping automation before starting to access network from inside the VM.

Share this post

networking-performancev1
Unlocking Superior macOS VM Network Performance: Introducing Anka's new networking mode for Apple Silicon
Large and complex enterprises using Anka have many different demands, and we have worked to continue to develop innovative technology to meet these demands. Enterprise infrastructure hardware is often on the cutting edge, and they need advanced capabilities...
Read More
gitlab-with-anka
Anka Cloud Gitlab Executor
Veertu’s Anka and the new Anka Cloud Gitlab Executor Veertu’s Anka is a suite of software tools built on the macOS virtualization platform. It enables the execution of single or multi-use macOS virtual machines (VMs) in a manner similar to Docker....
Read More
mac-scan-v1
Real-Time CVE Scanning of your macOS Build Systems
It’s common that an organization’s macOS build system will download thousands, sometimes tens of thousands of third-party dependencies every hour. When building and testing iOS applications, it typically downloads and installs third-party...
Read More
anka-on-silicon-v1
The ONLY Fully Automated Apple Silicon macOS VM Creation Solution
Starting in Anka 3.1 we announced that Anka is now able to fully automate the macOS installation processes, disabling SIP, and enabling VNC — all previously manual steps users had to perform inside o the VM. At the time of writing this article,...
Read More
anka_click
Scripting macOS UI User Actions With Anka Click
Starting in Anka 3.2, we’ve introduced a solution for scripting macOS UI user actions. You may ask, “Why would I want to do that?”. Well, often macOS configuration and applications do not have a CLI allowing you to perform certain actions...
Read More
mac-scan-fullscan-shells-v3
Real-time, continuous scan of file downloads on macOS for security vulnerabilities
Today, we are announcing the Beta availability of the Mac Scan solution. Mac Scan software runs on macOS systems (bare metal, virtual, EC2 Mac) and scans downloads in real time for security vulnerabilities. There are multiple scenarios why you would...
Read More
Screen Shot 2022-10-17 at 10.13
Anka 3.1- Fully automated VM macOS installation & The Behavior-Driven macOS UI Automation Framework
We are very happy to announce the General Availability of Anka 3.1 for Apple Silicon / ARM macs. In this release, we are taking our approach to iOS CI automation one step further by introducing a Behavior-Driven macOS UI Automation Framework in Anka,...
Read More
ankam1v2
Migrating from Anka on Intel to Anka on M1 Mac for iOS CI
In this blog, we will cover the key topics for migrating from Anka on Intel to Anka on M1/M2 Macs. Anka is an IaaC solution from Veertu to set up an agile Container like CI for iOS CI using macOS VMs. Anka for Intel uses Apple’s Hypervisor.Framework virtualization...
Read More
ami-scanner-featured-v2
World's first Security Vulnerability scanner for EC2 Mac AMIs
We are excited to announce the General Availability of the world’s first security vulnerability scanner for EC2 Mac AMIs. EC2 Mac AMI Scan scans Intel and Apple Silicon macOS EC2 AMIs, detects security vulnerabilities in third-party packages, dependencies,...
Read More
esxi-to-anka
It's time to migrate your iOS CI from ESXi Virtual Mac Infrastructure to native macOS Virtualization
When VMWare ESXi started officially supporting Apple macOS Virtualization on Mac hardware in late 2012, it opened the doors for the possibility of iOS development to move to a Linux-like, agile, scalable CI infrastructure. Soon enough, many iOS enterprise...
Read More