Giter Club home page Giter Club logo

packer-plugin-veertu-anka's Introduction

Packer Plugin for Anka

This is a Packer Plugin for building images that work with Veertu's Anka macOS Virtualization tool.

Compatibility

Packer Version Anka Packer Plugin Version
below 1.7.0 < 1.8.0
1.7.0 and above >= 2.0.0
>= 1.11.0 >= v4.0.0
Packer Plugin Version Anka CLI Version
2.x 2.x
>= 3.x >= 3.0.0

Installing with packer init

  1. Add a packer block to your .pkr.hcl like this:

    packer {
      required_plugins {
        veertu-anka = {
          version = "= v4.0.0"
          source = "github.com/veertuinc/veertu-anka"
        }
      }
    }
    
  2. Then run packer init {HCL file name}

  3. Run your packer build command with your hcl template

Installing from Binary

  1. Install Packer v1.8 or newer.
  2. Install Veertu Anka.
  3. Download the latest release for your host environment.
  4. Unzip the plugin binaries to a location where Packer will detect them at run-time, such as any of the following:
    • The directory where the packer binary is.
    • The ~/.config/packer/plugins directory.
    • The current working directory.
  5. Rename the binary file to packer-plugin-veertu-anka.
  6. Run your packer build command with your hcl template.

Documentation

Builders Post Processors
[ veertu-anka-vm-create ] [ veertu-anka-registry-push ]
[ veertu-anka-vm-clone ]

Usage

Currently file provisioners do not support ~ or $HOME in the destination paths. Please use absolute or relative paths.

The most basic pkr.hcl file you can build from is:

source "veertu-anka-vm-create" "anka-packer-base-macos" {
  installer = "/Applications/Install macOS Big Sur.app/"
  vm_name = "anka-packer-base-macos"
}

build {
  sources = [
    "source.veertu-anka-vm-create.anka-packer-base-macos"
  ]

  post-processor "veertu-anka-registry-push" {
    tag = "veertu-registry-push-test"
  }
}

This will create a "base" VM template using the .app or .ipsw you specified in installer = "/Applications/Install macOS Big Sur.app/" with the name anka-packer-base-macos. Once the VM has been successfully created, it will push that VM to your default registry with the tag veertu-registry-push-test.

If you don't specify vm_name, we will obtain it from the installer and create a name like anka-packer-base-12.6-21G115.

However, hw_uuid, port_forwarding_rules, and several other configuration settings are ignored for the created "base" vm. We recommend using the veertu-anka-vm-clone builder to modify these values.

You can also skip the creation of the base VM template and use an existing VM template:

source "veertu-anka-vm-clone" "anka-packer-from-source" { 
  vm_name = "anka-packer-from-source"
  source_vm_name = "anka-packer-base-macos"
  always_fetch = true
}

build {
  sources = [
    "source.veertu-anka-vm-clone.anka-packer-from-source",
  ]
}

This will check to see if the VM template/tag exists locally, and if not, pull it from the registry:

❯ PKR_VAR_source_vm_tag="v1" PACKER_LOG=1 packer build -var 'source_vm_name=anka-packer-base-macos' examples/clone-existing-with-port-forwarding-rules.pkr.hcl
. . .
2021/04/07 14:11:52 packer-plugin-veertu-anka plugin: 2021/04/07 14:11:52 Searching for anka-packer-base-macos locally...
2021/04/07 14:11:52 packer-plugin-veertu-anka plugin: 2021/04/07 14:11:52 Executing anka --machine-readable show anka-packer-base-macos
2021/04/07 14:11:53 packer-plugin-veertu-anka plugin: 2021/04/07 14:11:53 Could not find anka-packer-base-macos locally, looking in anka registry...
2021/04/07 14:11:53 packer-plugin-veertu-anka plugin: 2021/04/07 14:11:53 Executing anka --machine-readable registry pull --tag v1 anka-packer-base-macos

Within your .pkrvars.hcl files, you can utilize variable blocks and then assign them values using the command line packer build -var 'foo=bar' or as environment variables PKR_VAR_foo=bar https://www.packer.io/docs/templates/hcl_templates/variables#assigning-values-to-build-variables

This will clone anka-packer-base-macos to a new VM and, if there are set configurations, make them.

Check out the examples directory to see how port-forwarding and other options are used.

Build Variables

Packer allows for the exposure of build variables which connects information related to the artifact that was built. Those variables can then be accessed by post-processors and provisioners.

The variables we expose are:

  • VMName: name of the artifact vm
  • OSVersion: OS version from which the artifact was created
    • eg. 10.15.7
  • DarwinVersion: Darwin version that is compatible with the current OS version
    • eg. 19.6.0
locals {
  source_vm_name = "anka-packer-base-11.2-16.4.06"
}

source "veertu-anka-vm-clone" "anka-macos-from-source" {
  "source_vm_name": "${local.source_vm_name}",
  "vm_name": "anka-macos-from-source"
}

build {
  sources = [
    "source.veertu-anka-vm-clone.anka-macos-from-source"
  ]

  provisioner "shell" {
    inline = [
      "echo vm_name is ${build.VMName}",
      "echo os_version is ${build.OSVersion}",
      "echo darwin_version is ${build.DarwinVersion}"
    ]
  }
}

Development

You will need a recent golang installed and setup. See go.mod for which version is expected.

We use gomock to quickly and reliably mock our interfaces for testing. This allows us to easily test when we expect logic to be called without having to rewrite golang standard library functions with custom mock logic. To generate one of these mocked interfaces, installed the mockgen binary by following the link provided and then run the make go.test.

  • You must install packer-sdc to generate docs and HCL2spec.

Run the plugin locally

go run -ldflags="-X main.version=$(cat VERSION) -X main.commit=$(git rev-parse HEAD)" main.go

Building, Linting, and Testing

make all && make install

When testing with an example HCL:

ANKA_LOG_LEVEL=debug ANKA_DELETE_LOGS=0 PACKER_LOG=1 packer build examples/create-from-installer.pkr.hcl

To test the post processor you will need an active vpn connection that can reach an anka registry. You can setup an anka registry by either adding the registry locally with:

anka registry add <registry_name> <registry_url>

-or-

You can setup the create-from-installer-with-post-processing.pkr.hcl with the correct registry values and update the make target anka.test to use that .pkr.hcl file and run:

make create-test

packer-plugin-veertu-anka's People

Contributors

asafg6 avatar catflight avatar esysc avatar jamesforsee avatar lbajolet-hashicorp avatar lox avatar nivkeidan avatar norsegaud avatar nywilken avatar omartrigui avatar scottarnette avatar tduffield avatar vizike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-plugin-veertu-anka's Issues

Choosing "abort without cleanup" after a cancelled build deletes the VM anyways

👋🏻 Hey, we've found an interesting issue

Description

When a build is cancelled for some reason (manual interrupt, or the build fails), the dialog offers CA / R actions to perform with the cancelled VM.
A = abort without cleanup
In case A is selected, the VM should be kept for inspection. Instead, choosing A results in the deletion of the VM.

Proof

veertu-anka-vm-clone: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)? a
2021-10-26T13:26:43Z:     veertu-anka-vm-clone:  [ERROR]: User interrupted execution
2021-10-26T13:26:43Z: ==> veertu-anka-vm-clone: Deleting VM baseAndroid-13.1-1635247832

Steps to reproduce

  1. start a build
  2. cancel the build
  3. choose option (a)
  4. check if the build VM was deleted

Misc

plugin version: 2.1.0
anka cli version: 2.5.3

Anka 3.x (ARM/M1) support

CREATE ✅

Now supported in 3.1! https://github.com/veertuinc/packer-plugin-veertu-anka/releases/tag/v3.0.0 + https://docs.veertu.com/anka/whats-new/anka-3.1.0/


CLONE ✅ ⚠️

In 3.0, cloning no longer shares underlying layers until a local commit/tag is created. #104

Configuration Reference

There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters.

Required Configuration

  • source_vm_name (String) ✅ Suspended is emulated, and doesn't work in Anka 3.0 but does allow this to pass

  • type (String) ✅

Must be veertu-anka-vm-clone.

Optional Configuration

  • vm_name (String) ✅

  • vcpu_count (String) ✅

  • ram_size (String) ✅

  • disk_size (String) ✅ (fixing in https://github.com/veertuinc/packer-plugin-veertu-anka/releases/tag/v3.0.0)

  • stop_vm (Boolean) ✅

  • display_controller (string) ⚠️ (PG is really the only option at the moment)

  • always_fetch (Boolean) ✅

  • boot_delay (String) ✅

  • cacert (String) ❌

  • cert (String) ❌

  • insecure (Boolean) ❌

  • key (String) ❌

  • hw_uuid (String) ❌

  • port_forwarding_rules (Struct) ✅

    • port_forwarding_guest_port (Int)
    • port_forwarding_host_port (Int)
    • port_forwarding_rule_name (String)
  • registry-path (String) ✅

  • remote (String) ✅

  • source_vm_tag (String) ✅

  • update_addons (Boolean) ✅

  • use_anka_cp (Boolean) ✅

Issue(s) running plugin against Big Sur VM

I am in the process of trying to use a manually built Big Sur VM as an input to this plugin. The packer config I am using works reliably on older versions of MacOS (10.13, 10.14, and 10.15).

I'm currently running into this issue:

2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Created temp dir in /Users/administrator/.packer.d/tmp287415760/packer-anka914651375/upload369410351
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Copying 1557 bytes from /Users/administrator/.packer.d/tmp287415760/packer-anka914651375/upload369410351 to /tmp/script_2902.sh
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Destination os /tmp/script_2902.sh
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Starting command: anka run -v /Users/administrator/.packer.d/tmp287415760/packer-anka914651375 macos-base-11.0-beta2-tom sh
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Executing on sh: cp upload369410351 /tmp/script_2902.sh
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Waiting for command to run
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: -anka: /Users/administrator/.packer.d/tmp287415760/packer-anka914651375: Permission denied
2020/07/09 14:12:24 packer-builder-veertu-anka plugin: 2020/07/09 14:12:24 Command finished in 474.943633ms with exit status 125
2020/07/09 14:12:24 packer-provisioner-shell plugin: Retryable error: Error uploading script: exit status 125
2020/07/09 14:12:26 packer-builder-veertu-anka plugin: 2020/07/09 14:12:26 Communicator Upload
2020/07/09 14:12:26 packer-provisioner-shell plugin: [INFO] 1557 bytes written for 'uploadData'

Followup: I was able to log into the VM and got this message:

The installed version of VTUFS is too old for the operating system. Please upgrade your VTUFS installation to one that is compatible with the currently running version of macOS.

inaccessible tmp directory

I've discovered a bug when running Ansible, and it doesn't happen all the time, so took some finding.
It may relate to certain loops when copying up a script. I don't know if this is an ansible issue or a packer one.

packer --version
1.6.2

veertu plugin version: 1.5.0

Ansible version:

ansible --version
ansible 2.9.11
  config file = /Users/administrator/macos-bootstrap/packer/ansible.cfg
  configured module search path = ['/var/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.9.11/libexec/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]

ansible.cfg

[defaults]
callback_whitelist = profile_tasks
stdout_callback = dense
display_failed_stderr = yes
remote_tmp = /var/tmp/.ansible/tmp
local_tmp = /var/tmp/.ansible/tmp
allow_world_readable_tmpfiles = True

[ssh_connection]
pipeline = True

Here's the failure, you can see that it's creating the remote dir as /var/root/.packer.d/ and I would expect this to be /var/tmp/.ansible

2020/10/22 08:19:38 packer-provisioner-ansible plugin: [INFO] 115499 bytes written for 'uploadData'
2020/10/22 08:19:38 [INFO] 115499 bytes written for 'uploadData'
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Created temp dir in /var/root/.packer.d/tmp363158528/packer-anka715083103/upload522762138
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Copying 115499 bytes from /var/root/.packer.d/tmp363158528/packer-anka715083103/upload522762138 to /var/tmp/.ansible/tmp/ansible-tmp-1603354777.00609-25537-48696169329600/AnsiballZ_gem.py
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Destination os /var/tmp/.ansible/tmp/ansible-tmp-1603354777.00609-25537-48696169329600/AnsiballZ_gem.py
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Starting command: anka run -v /var/root/.packer.d/tmp363158528/packer-anka715083103 baseStack-11.6-1603353753 sh
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Executing on sh: cp upload522762138 /var/tmp/.ansible/tmp/ansible-tmp-1603354777.00609-25537-48696169329600/AnsiballZ_gem.py
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Waiting for command to run
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: -anka: /var/root/.packer.d/tmp363158528/packer-anka715083103: Operation not supported by device
2020/10/22 08:19:38 packer-builder-veertu-anka plugin: 2020/10/22 08:19:38 Command finished in 181.015203ms with exit status 125
2020/10/22 08:19:38 packer-provisioner-ansible plugin: exit status 125

I'm running anka as root and the remote user is vagrant

Make anka user that VM has match `anka config default_user` setting

With plugin 1.2.0, I see that the anka user is created Anka. My anka flow is configured to suggest that it will be anka, note lowercase.

This means that if I try to use anka (via looking it up via anka config default_user), ssh fails against [email protected] compared to succeeding against [email protected].

Can the plugin use the anka config default_user value, matching case, by default when creating the user inside the VM, when installer_app is specified? For both the user's human readable name and system-identifier name?

Alternatively, is there something else I could look into to figure out why this isn't working as I expected?

Upper-case:

Screen Shot 2020-04-08 at 14 26 09

vs lower-case:

$ anka run macos_10.15.4 dscl . list /Users | grep -v "^_"
anka
daemon
nobody
root

and

$ anka run macos_10.15.4 ls -al /Users/
total 0
drwxr-xr-x   5 root  admin  160 Apr  7 03:37 .
drwxr-xr-x  22 root  admin  704 Apr  7 03:34 ..
-rw-r--r--   1 root  wheel    0 Feb 28 22:21 .localized
drwxrwxrwt   4 root  wheel  128 Apr  7 03:39 Shared
drwxr-xr-x  10 anka  staff  320 Apr  8 06:29 anka

CLOUD-925 | Improvement: Ensure local commit of source before clone so layers are shared for Anka 3.0

Starting in Anka 3.0, sharing of the underlying ank images does not happen if there is no local commit (tag) for the source VM. We need to modify the code so that it:

  • check for an already existing tag on the source VM
    • IF a tag exists, proceed with the normal clone process
    • IF a tag DOES NOT exist, tag the source VM and then proceed with a normal clone process
      • Remove the tag from the source VM if it fails or is successful

~ and $HOME are not expanded to the user's home directory inside the VM

Neither json nor hcl provisioner can expand ~ or $HOME to the user's home directory.

  • Json example:
        {
            "type": "file",
            "direction": "upload",
            "source": "/Users/admin/v-mitim/test.file",
            "destination": "~/test1.file"
        }
  • Hcl example
  provisioner "file" {
    destination = "~/test1.file"
    source      = "/Users/admin/v-mitim/test.file"
  }

This functionality works fine in other builders like https://www.packer.io/docs/builders/vsphere/vsphere-clone:
https://github.com/actions/virtual-environments/blob/main/images/macos/templates/macOS-11.json

Feature Request: Add option to distribute after push

Hi I'd like to request adding an option to the veertu-anka-registry-push plugin that tells the controller to distribute the template to the nodes.

This would help us automate distributing templates to our nodes after packer builds, which is something that we manually take advantage of to speed up builds.

Some options:
distribute: distribute the template to all nodes
node-ids: specific nodes to distribute to
group-ids: specific groups to distribute to

setup failed: Bad file descriptor

Not sure where to start with troubleshooting, but I keep getting this setup failed: Bad file descriptor error.

==> veertu-anka-vm-create.anka-packer-base-macos: Creating a temporary directory for sharing data...
==> veertu-anka-vm-create.anka-packer-base-macos: Creating a new VM Template (anka-packer-base-13.0-22A380) from installer, this will take a while
==> veertu-anka-vm-create.anka-packer-base-macos: 3157e76e-8a13-4997-8475-053a067ea5c0: setup failed: Bad file descriptor
==> veertu-anka-vm-create.anka-packer-base-macos: Deleting VM anka-packer-base-13.0-22A380
Build 'veertu-anka-vm-create.anka-packer-base-macos' errored after 3 minutes 38 seconds: 3157e76e-8a13-4997-8475-053a067ea5c0: setup failed: Bad file descriptor
packer {
  required_plugins {
    veertu-anka = {
      version = ">= v3.0.0"
      source = "github.com/veertuinc/veertu-anka"
    }
  }
}

source "veertu-anka-vm-create" "anka-packer-base-macos" {
  installer = "/Users/Shared/Mist/Install_macOS_13.0-22A380.ipsw"
}

build {
  sources = [
    "source.veertu-anka-vm-create.anka-packer-base-macos"
  ]
}
% packer -v
1.8.3
% packer plugins installed
[snip]/github.com/veertuinc/veertu-anka/packer-plugin-veertu-anka_v3.0.0_x5.0_darwin_arm64
% anka version
Anka Build Enterprise version 3.1.1 (build 152)
% sw_vers 
ProductName:		macOS
ProductVersion:		13.0
BuildVersion:		22A380

[security integrity] SHASUM for v1.5.0 is wrong

hello,
according to https://github.com/veertuinc/packer-builder-veertu-anka/releases/download/v1.5.0/packer-builder-veertu-anka_1.5.0_checksums.txt:

476ee2873e6274ed6610f405eef247d99079f7257331514d8972c5109e955096  packer-builder-veertu-anka_v1.5.0_darwin_amd64.zip

But it is actually:

shasum -a 256 packer-builder-veertu-anka_v1.5.0_darwin_amd64.zip
e899a04c6977ba693305b8062bdda31674e6079459854fa9590dbbd0127fdd5b  packer-builder-veertu-anka_v1.5.0_darwin_amd64.zip

Feature Request: suspend_delay

Sometimes packer suspended the VM while it's performing action and then corrupts the suspended state (frozen VM on start). We should have a suspend_delay, like boot_delay, that waits a bit before suspending.

Update to packer-sdc command for validating plugin compatibility

👋 Fellow Packer maintainer here, reaching out to inform you about an upcoming breaking change that will affect your goreleaser release pipeline. In Packer 1.8.0 we will remove the packer-plugin-check command in Packer core in favor of the packer-sdc plugin-check command from the Packer Plugin SDK. So calling go install github.com/hashicorp/packer/cmd/packer-plugins-check@latest will result in an error.

To avoid potential issues I recommend either pinning the packer-plugins-check command to the current version of Packer until you can move to the packer-sdc command

go install github.com/hashicorp/packer/cmd/[email protected]

Or you can update your release configuration to use the packer-sdc command, which is the preferred long-term solution.

I'v provided a link to the updates that were made to the Packer Plugin Scaffolding for using the packer-sdc command here

Please let me know if you have any questions.

Anka 3: Post-processor failed: json: cannot unmarshal array into Go value of type map[string]client.RegistryRemote

On Anka 3.0, we see

2022/03/23 14:48:41 [INFO] (telemetry) Starting post-processor veertu-anka-registry-push
 2022/03/23 14:48:41 packer-plugin-veertu-anka_v2.3.0_x5.0_darwin_arm64 plugin: 2022/03/23 14:48:41 Executing anka --machine-readable registry list-repos
 veertu-anka-vm-clone.anka_worker_monterey_tester_arm64: Running post-processor:  (type veertu-anka-registry-push)
 Build 'veertu-anka-vm-clone.anka_worker_monterey_tester_arm64' errored after 7 minutes 26 seconds: 1 error(s) occurred:
 Post-processor failed: json: cannot unmarshal array into Go value of type map[string]client.RegistryRemote

Feature Request: Add support for enabling hyper-threading via user parameter

In order to enable hyper-threading (considered the best practice when running 1:1 vm-to-host) the following actions need to occur in this order:

packer build template.json
anka stop <vm>
anka modify <vm> set hyper-threading 1
anka start <vm>
anka suspend <vm>

I propose performing these actions within the builder and adding a user parameter to enable this behavior such that something similar to packer build -var enable_ht=1 anka.json is sufficient to produce a machine with hyper-threading enabled in a suspended state ready for registry upload.

VM fails to reboot

I'm using 1.6.0 packer plugin, with Anka 2.3.0 (Build Lite on mac mini, Flow on macbook pro). I'm using packer to build from a known-good installer.app for macOS 10.15.7.

When I run a packer build on my laptop in this context, it passes.

When I run a packer build on the mac mini in this context, it fails with an error (apologies for screenshot!) error on reboot after it finishes with the Converting to anka format step. The VM is then deleted, so I cannot inspect it.

WhatsApp Image 2020-11-30 at 16 32 10 (1)

Feature Request: Remote Builds

Please add support for building an image remotely. Connecting to a controller would be the most scalable method, but directly to a node would also work. This will help users that do not use mac hardware locally.

Can't build Go plugin on macOS High Sierra

While running

                $ go build -o ~/.packer.d/plugins/packer-builder-veertu-anka

Throws following error, I am not go user, am I missing something

main.go:4:2: cannot find package "github.com/lox/packer-builder-veertu-anka/builder/anka" in any of:
	/usr/local/opt/go/libexec/src/github.com/lox/packer-builder-veertu-anka/builder/anka (from $GOROOT)
	/Users/shashi/golang/src/github.com/lox/packer-builder-veertu-anka/builder/anka (from $GOPATH)
main.go:5:2: cannot find package "github.com/mitchellh/packer/packer/plugin" in any of:
	/usr/local/opt/go/libexec/src/github.com/mitchellh/packer/packer/plugin (from $GOROOT)
	/Users/shashi/golang/src/github.com/mitchellh/packer/packer/plugin (from $GOPATH)

packer build should fail if VM fails to suspend

I'm using the following:

packer 1.3.5
packer-builder-veertu-anka 1.0.1
Anka Build version 1.4 (build 98)

My packer build succeeded even though the VM failed to suspend at the end.

2019/03/28 06:33:09 packer-builder-veertu-anka: 2019/03/28 06:33:09 Executing anka --machine-readable suspend macos-base-10.12
2019/03/28 06:33:09 packer-builder-veertu-anka: 2019/03/28 06:33:09 Failed with an error of exit status 1
2019/03/28 06:33:09 packer-builder-veertu-anka: 2019/03/28 06:33:09 {"status": "ERROR", "body": {}, "message": "macos-base-10.12 failed to pause"}
2019/03/28 06:33:09 packer-builder-veertu-anka: 2019/03/28 06:33:09 macos-base-10.12 failed to pause
2019/03/28 06:33:09 packer-builder-veertu-anka: 2019/03/28 06:33:09 Executing anka --machine-readable describe macos-base-10.12
2019/03/28 06:33:10 packer-builder-veertu-anka: 2019/03/28 06:33:10 {"status": "OK", "body": {"firmware": {"type": "uefi"}, "usb": {"host": null, "pci_slot": 7, "location": null, "tablet": 1}, "memory_prefetch": false, "display": {"frame_buffer": {"pci_slot": 29, "vnc_port": 0, "height": 768, "width": 1024, "vnc_ip": "0.0.0.0", "password": "admin"}}, "ram": "4G", "uuid": "da37fe19-515c-11e9-8fca-003ee1cd520b", "nested": false, "nvram": true, "hard_drives": [{"controller": "ablk", "pci_slot": 4, "file": "da33f30f-515c-11e9-9412-003ee1cd520b.ank"}], "network_cards": [{"port_forwarding_rules": [], "pci_slot": 28, "type": "anet", "mode": "shared", "mac_address": "56:45:45:ad:43:0f"}], "hardware_variables": {}, "optical_drives": [], "smbios": {"type": "generated"}, "hyper_threading": false, "smc": {"type": "generated"}, "cpu": {"cores": 2}, "name": "macos-base-10.12"}, "message": ""}
2019/03/28 06:33:10 [INFO] (telemetry) ending veertu-anka
2019/03/28 06:33:10 Builds completed. Waiting on interrupt barrier...
Build 'veertu-anka' finished.

==> Builds finished. The artifacts of successful builds are:
2019/03/28 06:33:10 machine readable: veertu-anka,artifact-count []string{"1"}
==> Builds finished. The artifacts of successful builds are:
2019/03/28 06:33:10 machine readable: veertu-anka,artifact []string{"0", "builder-id", "packer.veertu-anka"}
2019/03/28 06:33:10 machine readable: veertu-anka,artifact []string{"0", "id", "da37fe19-515c-11e9-8fca-003ee1cd520b"}
2019/03/28 06:33:10 machine readable: veertu-anka,artifact []string{"0", "string", "macos-base-10.12"}
2019/03/28 06:33:10 machine readable: veertu-anka,artifact []string{"0", "files-count", "0"}
2019/03/28 06:33:10 machine readable: veertu-anka,artifact []string{"0", "end"}
2019/03/28 06:33:10 [INFO] (telemetry) Finalizing.
--> veertu-anka: macos-base-10.12
2019/03/28 06:33:11 waiting for all plugin processes to complete...
2019/03/28 06:33:11 /Users/administrator/.packer.d/plugins/packer-builder-veertu-anka: plugin process exited
2019/03/28 06:33:11 /usr/local/bin/packer: plugin process exited

Feature-request: Upgrade to use the new RPC server

As of Packer 1.7.0, Packer now has the ability to pull required plugins using the "packer init" command.

Plugins must upgrade by following this guide in order to take advantage of the tooling.

This upgrade will require renaming the repository to the new "packer-plugin-*" convention and switch to using a semantic versioning system without the prefacing "v", so it may be a non-starter but I wanted to put it on the radar.

Apple M1 / ARM Support

On Apple M1 / ARM I'm getting
invalid remote binary packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64.zip: wrong system, expected darwin_arm64
when installing the plugin using packer init.

Please create a release for Apple M1 / ARM.

Enhancement: redact secrets from console output

A successful build outputs as below. The vnc_connection_string contains a secret.

This will leak the password, allowing access into the VM.

Build 'default' finished after 6 minutes 13 seconds.

==> Wait completed after 6 minutes 13 seconds

==> Builds finished. The artifacts of successful builds are:
--> default: bk-macos-v4-1602606002-9dcb3d2f-d
+-----------------------+----------------------------------------------------+
| uuid                  | 4e31f906-9f35-4ffe-ad90-dbbdd3a907b3               |
+-----------------------+----------------------------------------------------+
| name                  | bk-macos-v4-1602606002-9dcb3d2f-d                  |
+-----------------------+----------------------------------------------------+
| created               | 6 minutes ago                                      |
+-----------------------+----------------------------------------------------+
| cpu_cores             | 2                                                  |
+-----------------------+----------------------------------------------------+
| ram                   | 8G                                                 |
+-----------------------+----------------------------------------------------+
| display               | 1                                                  |
+-----------------------+----------------------------------------------------+
| hard_drive            | 100Gi (19.2Gi on disk)                             |
+-----------------------+----------------------------------------------------+
| addons_version        | 2.2.3.118                                          |
+-----------------------+----------------------------------------------------+
| status                | running                                            |
+-----------------------+----------------------------------------------------+
| vnc_connection_string | vnc://:[email protected]:5903 |
+-----------------------+----------------------------------------------------+

[2.0.0] Uploading files throws an error

==> veertu-anka-vm-clone.test: Uploading /Users/nathanpierce/v-mitim/test.file => /private/tmp/test1.file
2021/07/26 09:40:28 Error in ProgressTrackingClient.Read RPC call: unexpected EOF
2021/07/26 09:40:28 Error in Ui.Error RPC call: connection is shut down
2021/07/26 09:40:28 Error in ProgressTrackingClient.Read RPC call: connection is shut down
2021/07/26 09:40:28 packer-provisioner-file plugin: closing
2021/07/26 09:40:28 packer-provisioner-file plugin: [INFO] 4 bytes written for 'uploadData'
2021/07/26 09:40:28 closing
2021/07/26 09:40:28 Error in ProgressTrackingClient.Close RPC call: connection is shut down
2021/07/26 09:40:28 [INFO] (telemetry) ending file
==> veertu-anka-vm-clone.test: Provisioning step had errors: Running the cleanup provisioner, if present...
2021/07/26 09:40:28 packer-plugin-veertu-anka plugin: 2021/07/26 09:40:28 Cleaning up clone VM step
2021/07/26 09:40:28 packer-plugin-veertu-anka plugin: 2021/07/26 09:40:28 Executing anka --machine-readable delete --yes anka-packer-from-source
==> veertu-anka-vm-clone.test: Deleting VM anka-packer-from-source
    veertu-anka-vm-clone.test: test.file 0 B / 4 B [---------------------------------------------------------------------------------]   0.00%
2021/07/26 09:40:29 [INFO] (telemetry) ending
==> Wait completed after 27 seconds 391 milliseconds
2021/07/26 09:40:29 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2021/07/26 09:40:29 machine readable: veertu-anka-vm-clone.test,error []string{"[pos 301]: readContainerLen: Unrecognized descriptor byte: hex: d7, decimal: 215"}
==> Builds finished but no artifacts were created.
2021/07/26 09:40:29 [INFO] (telemetry) Finalizing.
Build 'veertu-anka-vm-clone.test' errored after 27 seconds 391 milliseconds: [pos 301]: readContainerLen: Unrecognized descriptor byte: hex: d7, decimal: 215
  • I tried different versions of 1.7.X and nothing changes it.
  • We have a CI test for this, so how did it pass there? (improvement needed in tests)
  • 2.1.0 branch I'm working on doesn't have this issue.

Binary

Is there a binary one can download and use directly, rather than compiling with Go?

Cannot install Big Sur from .app

I get the following when I try to use the packer builder to build a Big Sur VM:

Build 'veertu-anka' errored: Bad or unsupported macOS installer

Is this expected, given the relative "newness" of Big Sur? I'm running packer 1.6.0 and plugin v1.3.0

Error when upgrading packer plugin

When I upgrade the packer plugin using the command packer init -upgrade I always get the following error:

❯ packer init -upgrade build-vm.pkr.hcl
Failed getting the "github.com/veertuinc/veertu-anka" plugin:
1 error occurred:
        * could not get sha256 checksum file for github.com/veertuinc/veertu-anka version 2.3.2. Is the file present on the release and correctly named ? GET https://github.com/veertuinc/packer-plugin-veertu-anka/releases/download/v2.3.2/packer-plugin-veertu-anka_v2.3.2_SHA256SUMS: 404  []

After checking the Release page, I saw that the latest packer release has some difference between the previous one.
Bildschirm­foto 2022-08-08 um 10 43 31

Could you maybe change the name of the latest release and remove the x5.0 in the shasums ?

Feature request: update hw.UUID

customers currently

   {
      "inline": [
        "anka stop {{user `vm_name`}} --force",
        "anka modify {{user `vm_name`}} set custom-variable hw.UUID $(uuidgen)"
      ],
      "type": "shell-local"
    },

need to add an option for this in the json

disk_size is ignored when using source_vm_name

I have an image catalina-base with disk size 25G. I want to build a second image based on the first one, but with a larger disk size. I tried the following config file:

{
  "builders": [{
    "type": "veertu-anka",
    "disk_size": "50G",
    "source_vm_name": "catalina-base",
    "vm_name": "larger-catalina"
  }]
}

I would expect the new image to have disk_size 50G, but it is the same size as the previous image (25G)

$ anka show larger-catalina
+----------------+--------------------------------------+
| uuid           | 43112be1-302a-4598-86f7-60bfef72a6a1 |
+----------------+--------------------------------------+
| name           | larger-catalina                      |
+----------------+--------------------------------------+
| created        | 30 seconds ago                       |
+----------------+--------------------------------------+
| cpu_cores      | 2                                    |
+----------------+--------------------------------------+
| ram            | 2G                                   |
+----------------+--------------------------------------+
| display        | 1                                    |
+----------------+--------------------------------------+
| hard_drive     | 25Gi (23.7Gi on disk)                |
+----------------+--------------------------------------+
| addons_version | 2.2.2.116                            |
+----------------+--------------------------------------+
| status         | suspended 24 seconds ago             |
+----------------+--------------------------------------+

This is intended or it's a bug?

Support for --force for the registry push post processor

Add support for forcefully pushing a VM and tag to the registry. This should be enabled by using a force field in the post processor, like so.

post-processor "veertu-anka-registry-push" {
      tag = "1.0.0"
      remote = "prod"
      force = true
}

macOS cannot handle lots of anka run/mount/umount operations: need to use anka mount and anka run -n

Related to #37

No matter the OS version, anka run's mount/umount operations eventually overwhelm and crash FUSE inside of the VM. This happens after 250 consecutive anka run attempts.

Goal: Use anka mount before anka run and then anka umount right after + anka run -n

dd if=/dev/zero of=foo bs=512 count=6000
for i in {1..1000}; do sudo anka run 10.15.6 bash -c "cp -v foo /var/tmp; ls /var/tmp" sleep 2; done
filesystemui.socket
foo
foo -> /var/tmp/foo
ankafs.0
filesystemui.socket
foo
... (RUNS FINE FOR ~250 times) ...
-anka: /Users/nathanpierce: Permission denied
-anka: /Users/nathanpierce: Permission denied
-anka: /Users/nathanpierce: Operation not supported by device
-anka: /Users/nathanpierce: Permission denied
-anka: /Users/nathanpierce: Permission denied

Feature request: Add worked example that enables ssh connectivity into the VM

We use packer in combination with the ansible packer provisioner to provision the VMs before capturing them as images.

It would be really handy to see a worked example of how to achieve this. I imagine the options we have look like

  • find a way for the existing packer ansible provisioner's temporary keys to be used (this would be our preference)
  • find a way to poke a public key into the authorized_keys file of the anka user

Feature Request: Add verbose output during provisioning of base vm

I'm not sure if this is possible with the method packer-builder-veertu-anka is using to install macOS but it would be helpful if a user were able to monitor the progress during macOS installation. As designed currently, the time elapsed between line 2 and line 3 is about 45 minutes.

01| ==> veertu-anka: Creating a temporary directory for sharing data...
02| ==> veertu-anka: Creating a new vm from installer, this will take a while
03| ==> veertu-anka: VM anka-base-KoueizFgPi was created (12f760f5-68ad-11e8-98dd-f200014b19c5)
04| ==> veertu-anka: Cloning source VM anka-base-KoueizFgPi into a new virtual machine macpro-master-45364cb
05| ==> veertu-anka: Waiting for 2s for clone to boot

cURL Host not found

When running the make macos-xcode-10.x command, the scripts/macos/xcode.sh always seems to time out with curl -sL -O https://github.com/neonichu/ruby-domain_name/releases/download/v0.5.99999999/domain_name-0.5.99999999.gem with:

Build 'veertu-anka' errored: Script exited with non-zero exit status: 6

Im modified the scripts to run on High Sierra, but I cannot figure out when networking is not available. If I were to use anka run vmname scripts/macos/xcode.sh it appears to work fine.

Support reboots

When I try to reboot a node after installing software updates I get the the following error

Build 'veertu-anka' errored: Script exited with non-zero exit status: 125

Here is the packer config I am using

{
  "variables": {
    "macos_installer": "/Applications/Install macOS Sierra.app",
    "disk_size": "100G",
    "ram": "4G",
    "cpu_count": "4",
    "source_vm_name": "MacOS1012-Sierra-Bare",
    "vm_name": "MacOS1012-Sierra-Patched",
    "version_tag": "{{isotime \"20060102-1504\"}}",
  },
  "builders":[{
      "type": "veertu-anka",
      "installer_app": "{{user `macos_installer`}}",
      "disk_size": "{{user `macos_disk_size`}}",
      "ram_size": "{{user `ram`}}",
      "cpu_count": "{{user `cpu_count`}}",
      "source_vm_name": "{{user `source_vm_name`}}",
      "vm_name": "{{user `vm_name`}}"
    }
  ],
  "provisioners": [
    {
      "type": "shell-local",
      "command": "echo Starting software updates: $(date +%T)"
    },
    {
      "type": "shell",
      "expect_disconnect": "true",
      "inline": [
        "set -v",
        "sudo rm -rf /Applications/Photos.app /Applications/iBooks.app",
        "sudo softwareupdate --ignore iTunes iTunesX iTunesXPatch RemoteDesktopClient ThunderboltFirmwareUpdate1.2 Safari11.1Sierra 'Command Line Tools (macOS High Sierra version 10.13) for Xcode'",
        "touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress",
        "sudo softwareupdate -i -a",
        "sudo reboot"
      ]
    },
    {
      "pause_before": "2m",
      "type": "shell-local",
      "command": "echo 'Patching done'"
    }
  ]
}

and the output I see is

veertu-anka output will be in this color.

==> veertu-anka: Creating a temporary directory for sharing data...
==> veertu-anka: Cloning source VM MacOS1012-Sierra-Bare into a new virtual machine MacOS1012-Sierra-Patched
==> veertu-anka: Waiting for 2s for clone to boot
==> veertu-anka: Executing local command: echo Starting software updates: $(date +%T)
    veertu-anka: Starting software updates: 17:48:41
==> veertu-anka: Provisioning with shell script: /var/folders/m3/ms_y_t7n07qdnxlpnd0g8bwm0000gn/T/packer-shell300269587
    veertu-anka: sudo rm -rf /Applications/Photos.app /Applications/iBooks.app
    veertu-anka: sudo softwareupdate --ignore iTunes iTunesX iTunesXPatch RemoteDesktopClient ThunderboltFirmwareUpdate1.2 Safari11.1Sierra 'Command Line Tools (macOS High Sierra version 10.13) for Xcode'
    veertu-anka: Ignored updates:
    veertu-anka: (
    veertu-anka:     iTunes,
    veertu-anka: touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
    veertu-anka:     "Command Line Tools (macOS High Sierra version 10.13) for Xcode",
    veertu-anka:     iTunesX,
    veertu-anka:     "ThunderboltFirmwareUpdate1.2",
    veertu-anka:     "Safari11.1Sierra",
    veertu-anka:     iTunesXPatch,
    veertu-anka:     RemoteDesktopClient
    veertu-anka: )
    veertu-anka: sudo softwareupdate -i -a
    veertu-anka: Software Update Tool
    veertu-anka:
    veertu-anka: Finding available software
    veertu-anka:
    veertu-anka: Downloading Security Update 2018-002
    veertu-anka: Downloading Command Line Tools (macOS Sierra version 10.12) for Xcode
    veertu-anka: Downloaded Command Line Tools (macOS Sierra version 10.12) for Xcode
    veertu-anka: Downloaded Security Update 2018-002
    veertu-anka: Installing Security Update 2018-002, Command Line Tools (macOS Sierra version 10.12) for Xcode
    veertu-anka: Done with Security Update 2018-002
    veertu-anka: Done with Command Line Tools (macOS Sierra version 10.12) for Xcode
    veertu-anka: Done.
    veertu-anka:
    veertu-anka: You have installed one or more updates that requires that you restart your
    veertu-anka: computer.  Please restart immediately.
    veertu-anka: sudo reboot
    veertu-anka: -anka: communication broken
Build 'veertu-anka' errored: Script exited with non-zero exit status: 125

Feature Request: Add user mechanism for suspending vm to create a snapshot

Some of the scripts that the shell provisioner runs take a long time (installing xcode for instance) and it would be great if the user could arbitrarily yield to the packer builder at points to create a snapshot for which a later invocation could use as a source VM.

packer build template.json

Where template.json has a shell provisioner along the lines of of:

...
{
      "type": "shell",
      "execute_command": "chmod +x {{ .Path }}; sudo -u {{user `sudo_user`}} {{ .Vars }} {{ .Path }}",
      "scripts": [
        "scripts/10-install-xcode.sh",            # snapshot after this step
        "scripts/20-install-ios-simulators.sh",   # snapshot after this step
        "scripts/30-install-buildkite-agent.sh",  # snapshot after this step

      ],
},
...

To achieve something like this currently, packer has to be called several times with several different templates with shell provisioner excerpts. This is of course sub-optimal because splitting configuration across multiple files is difficult to maintain.

Not super familiar with the packer builder API but it seems like this might be possible as the provisioner currently snapshots and then clones after a base macOS install which happens without a separate packer invocation.

CLOUD-905: Using stop_vm in config results in push post-processor failure

When using stop_vm = true in our packer we encounter an error when pushing the VM using the post-processor. Removing stop_vm = true results in a successful push to our registry. We are using v2.2.0 of the plugin and the included post-processor.

The post-processor error:

==> veertu-anka-vm-clone.bambooagent: Stopping VM bambooagent-11.6-dsalib-MACBA-185-stop-cha-templates
2021/12/08 22:33:21 packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64 plugin: 2021/12/08 22:33:21 Executing anka --machine-readable show bambooagent-11.6-dsalib-MACBA-185-stop-cha-templates
2021/12/08 22:33:21 packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64 plugin: 2021/12/08 22:33:21 Executing anka --machine-readable stop bambooagent-11.6-dsalib-MACBA-185-stop-cha-templates
==> veertu-anka-vm-clone.bambooagent: Running post-processor:  (type veertu-anka-registry-push)
2021/12/08 22:35:03 [INFO] (telemetry) ending veertu-anka-vm-clone.bambooagent
2021/12/08 22:35:03 [INFO] (telemetry) Starting post-processor veertu-anka-registry-push
2021/12/08 22:35:03 packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64 plugin: 2021/12/08 22:35:03 Executing anka --machine-readable registry list-repos
2021/12/08 22:35:03 packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64 plugin: 2021/12/08 22:35:03 Executing anka --machine-readable registry --remote stg --registry-path https://anka-build-registry.internal.shared-stg.us-west-2.kitt-inf.net: list
==> veertu-anka-vm-clone.bambooagent (veertu-anka-registry-push): Pushing template to Anka Registry as bambooagent-11.6-dsalib-MACBA-185-stop-cha-templates with tag latest
2021/12/08 22:35:04 packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64 plugin: 2021/12/08 22:35:04 Executing anka --machine-readable registry --remote stg --registry-path https://anka-build-registry.internal.shared-stg.us-west-2.kitt-inf.net: push --tag latest --description macOS 11.6 Bambooagent --remote-vm bambooagent-11.6-dsalib-MACBA-185-stop-cha-templates --force bambooagent-11.6-dsalib-MACBA-185-stop-cha-templates
2021/12/08 22:47:01 packer-plugin-veertu-anka_v2.2.0_x5.0_darwin_amd64 plugin: 2021/12/08 22:47:01 error: missing machine readable output
2021/12/08 22:47:01 [INFO] (telemetry) ending veertu-anka-registry-push
2021/12/08 22:47:01 Deleting original artifact for build 'veertu-anka-vm-clone.bambooagent'
* Post-processor failed: missing machine readable output
* Error destroying builder artifact: reading body msgpack decode error [pos 854]: reflect.Set: value of type map[interface {}]interface {} is not assignable to type error; bad artifact: []string(nil)
==> Wait completed after 2 hours 31 minutes
2021/12/08 22:47:01 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2021/12/08 22:47:01 machine readable: veertu-anka-vm-clone.bambooagent,error []string{"2 error(s) occurred:\n\n* Post-processor failed: missing machine readable output\n* Error destroying builder artifact: reading body msgpack decode error [pos 854]: reflect.Set: value of type map[interface {}]interface {} is not assignable to type error; bad artifact: []string(nil)"}
* Post-processor failed: missing machine readable output
Build 'veertu-anka-vm-clone.bambooagent' errored after 2 hours 31 minutes: 2 error(s) occurred:

Our packer source block:

source "veertu-anka-vm-clone" "bambooagent" { 
  vm_name = var.branch_name == "master" ? "bambooagent-11.6" : "bambooagent-11.6-${var.branch_name}"
  registry_name = "prod"
  source_vm_name = "base-11.6"
  source_vm_tag = "latest"
  always_fetch = true
  stop_vm = true
  vcpu_count = "6"
  ram_size = "15G"
  disk_size = "150G"
  boot_delay = "60s"
  port_forwarding_rules {
    port_forwarding_guest_port = 22
    port_forwarding_rule_name = "ssh"
  }
}

Plugin is incompatible with Packer 1.7

Please update the README file to make this more clear.

% packer build base.json
packer build base.json
Error: Failed to initialize build "veertu-anka"

error initializing builder 'veertu-anka': The protocol of this plugin (protocol
version 4 and lower) was deprecated, please use a newer version of this
plugin.Or use an older version of Packer (pre 1.7) with this plugin.

It seems that there are some plugin API changes in Packer 1.7, see https://github.com/hashicorp/packer/blob/master/CHANGELOG.md#backwards-incompatibilities.

is it possible to shorten output ?

========================== Starting Command Output ===========================
/bin/bash /Users/maccloud/Agents/_work/_temp/51a20eb3-1f31-49b1-a2cd-b49639fabcaf.sh
Installed plugin github.com/veertuinc/veertu-anka v3.2.0 in "/Users/maccloud/.config/packer/plugins/github.com/veertuinc/veertu-anka/packer-plugin-veertu-anka_v3.2.0_x5.0_darwin_amd64"
==> veertu-anka-vm-clone.template: Creating a temporary directory for sharing data...
==> veertu-anka-vm-clone.template: Cloning source VM clean_macos_12_300gb into a new virtual machine: macOS-12_20230808.3
==> veertu-anka-vm-clone.template: Modifying VM macOS-12_20230808.3 RAM to 24G
==> veertu-anka-vm-clone.template: Waiting for 7s for clone to boot
==> veertu-anka-vm-clone.template: Provisioning with shell script: /var/folders/hf/ykkt1wd11411j24px1jrb_780000gn/T/packer-shell1771702458
==> veertu-anka-vm-clone.template: Uploading ./provision/assets => image-generation/
==> veertu-anka-vm-clone.template: Uploading ./tests => image-generation/
==> veertu-anka-vm-clone.template: Uploading ./software-report => image-generation/
==> veertu-anka-vm-clone.template: Uploading ./helpers => image-generation/
==> veertu-anka-vm-clone.template: Uploading ../../helpers/software-report-base => image-generation/software-report/
==> veertu-anka-vm-clone.template: Uploading ./provision/configuration/add-certificate.swift => image-generation/add-certificate.swift
==> veertu-anka-vm-clone.template: Uploading ./provision/configuration/environment/bashrc => .bashrc
==> veertu-anka-vm-clone.template: Uploading ./provision/configuration/environment/bashprofile => .bash_profile
==> veertu-anka-vm-clone.template: Uploading ./provision/utils => 

we observer ==> veertu-anka-vm-clone.template: on each line. can we make it shorter ?

Feature Request: Option to delete base VM after building

For my team's use case, we only need to use packer to create a single vm for each version of macOS. The base vm that gets created is unnecessary and means I have to go in manually and delete it. Not a very high priority request, but would be nice to have.

Feature request: re-use a base VM if installer_app is specified.

At present, creating a VM by starting with from a macOS installer has a long iteration time because of the time it takes to create the base VM from the installer.

Since the installer should create mostly-the-same base VM each time it's run (modulo software updates of the moment at the time of run), cache it.

There should be a simple way to clear this cache to force a from-scratch VM.

(PR incoming)

Bug: packer 1.5.1 fails to run plugin 1.0.2 and 1.1.0

I have the plugin inside ~/.packer.d/plugins, it's +x, and when I try a packer build I get a permission-denied error.

If I revert from packer 1.5.1 to packer 1.4.5 my builds work as before.

+ packer build -color=false -var ansible_debug_output=true -var ansible_diff_mode=always -var ansible_verbosity=-v -var cpu_count=2 -var disk_size=256G -var image_platform=macos -var imp_private_key_path=/var/folders/w2/jd7cgbj92n9b3xbzkp5rft740000gn/T/tmp.z4afaiDk/private_key -var installer_app=/Users/petermounce/.cache/bakery/mojave/10.14.06/install-macos-mojave-10.14.06.app -var ram_size=8G -var ssh_config_path=/var/folders/w2/jd7cgbj92n9b3xbzkp5rft740000gn/T/tmp.hapl2FYG -var version=14.6.06 -var vm_name=macos_14.6.06ssh9 ./macos_bare.packer.json
Failed to initialize build 'veertu-anka': error initializing builder 'veertu-anka': fork/exec /usr/local/bin: permission denied

Error uploading script

Hello there,

I'm trying to build a Big Sur 11.1 template using the plugin. Here is the repository with templates but what I essentially doing is the following:

  1. Converting installation into an Anka template
anka create --ram-size 8G --cpu-count 2 --disk-size 80G --app /Applications/Install\ macOS\ Big\ Sur.app big-sur-vanilla
  1. Running
packer build templates/big-sur-base.json

To build a template with some basic utils.

Here I'm getting the following error:

% sudo packer build templates/big-sur-base.json
veertu-anka: output will be in this color.

==> veertu-anka: Creating a temporary directory for sharing data...
==> veertu-anka: Cloning source VM big-sure-vanila into a new virtual machine: big-sur-base
==> veertu-anka: Waiting for 30s for clone to boot
==> veertu-anka: Provisioning with shell script: /tmp/packer-shell311022696
==> veertu-anka: Provisioning step had errors: Running the cleanup provisioner, if present...
==> veertu-anka: Deleting VM big-sur-base
Build 'veertu-anka' errored after 5 minutes 34 seconds: Error uploading script: exit status 124

==> Wait completed after 5 minutes 34 seconds

==> Some builds didn't complete successfully and had errors:
--> veertu-anka: Error uploading script: exit status 124

==> Builds finished but no artifacts were created.

My packer version is 1.6.5 and I'm using the latest Packer builder 1.6.0. Anka version is 2.3.0 (build 122).

Add the ability to handle "expect_disconnect" in provisioner

Packer supports the ability to handle "expect_disconnect". This is useful to restart macOS catalina during a build of packer.

As of today, when I attempt to shutdown macOS in a packer template for anka I get this:


veertu-anka: -anka: communication broken
--
  | veertu-anka: Shutdown NOW!
  | veertu-anka:
  | veertu-anka: System shutdown time has arrived��

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.