I'm trying to build vagrant boxes with concourse. I'm using the concourse/buildbox-ci
image which is used in concourse's own build pipeline to build the concourse-lite vagrant box.
Before running packer I'm creating the virtualbox devices so they match the hosts devices. Nevertheless the packer build fails with:
==> virtualbox-iso: Error starting VM: VBoxManage error: VBoxManage: error: The virtual machine 'packer-virtualbox-iso-1488205144' has terminated unexpectedly during startup with exit code 1 (0x1)
==> virtualbox-iso: VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
- Has somebody got this working?
- Is the concourse
hetzner
worker configuration accessible anywhere?
Additional configuration info:
in the concourse job container:
# ls -al /dev/vboxdrv /dev/vboxdrvu /dev/vboxnetctl
crw------- 1 root root 10, 53 Feb 27 14:19 /dev/vboxdrv
crw------- 1 root root 10, 52 Feb 27 14:19 /dev/vboxdrvu
crw------- 1 root root 10, 51 Feb 27 14:19 /dev/vboxnetctl
on the worker host:
# ls -al /dev/vbox*
crw------- 1 root root 10, 53 Feb 24 09:40 /dev/vboxdrv
crw------- 1 root root 10, 52 Feb 24 09:40 /dev/vboxdrvu
crw------- 1 root root 10, 51 Feb 24 09:40 /dev/vboxnetctl
concourse job:
jobs:
- name: mpf
serial_groups: [build]
plan:
- get: vagrant
trigger: true
- get: version
resource: version-mpf
- task: build
privileged: true
file: vagrant/ci/tasks/build.yml
tags: [vm-builder]
params:
TEMPLATE_FILE: virtualbox-mpf.json
vagrant/ci/scripts/build.sh:
#!/bin/bash -ex
mknod -m 0600 /dev/vboxdrv c 10 53
mknod -m 0600 /dev/vboxdrvu c 10 52
mknod -m 0600 /dev/vboxnetctl c 10 51
for name in $(VBoxManage list hostonlyifs | grep '^Name:' | awk '{print $NF}'); do
VBoxManage hostonlyif remove $name
done
VERSION=$(cat version/version)
packer build -var 'version=${VERSION}' vagrant/packer/${TEMPLATE_FILE}
vagrant/ci/tasks/build.yml:
---
platform: linux
image_resource:
type: docker-image
source: {repository: concourse/buildbox-ci}
inputs:
- name: vagrant
- name: version
outputs:
- name: build
run:
path: vagrant/ci/scripts/build.sh