Commit 20719128 authored by Michał Kępień's avatar Michał Kępień
Browse files

Add support for building FreeBSD QCOW2 images

parent ee452069
......@@ -363,6 +363,34 @@ website_rsync_ssh_curl:
- amd64
<<: *docker_image_job
freebsd_11.3_amd64:
stage: images
variables:
DISTROS: freebsd
VERSIONS: "11.3"
ARCHS: amd64
ISO_URL: http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/11.3/FreeBSD-11.3-RELEASE-amd64-disc1.iso
ISO_CHECKSUM: d268db365e26305ec3d51b29211caad903749c33a4a8f2cf661d671f8e0ba0b0
tags:
- linux
- docker
- amd64
<<: *kvm_image_job
freebsd_12.1_amd64:
stage: images
variables:
DISTROS: freebsd
VERSIONS: "12.1"
ARCHS: amd64
ISO_URL: http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-amd64-disc1.iso
ISO_CHECKSUM: aa9d34b458826486999ed3e872436b6712ae38cede5ea41de4ab923e3419d461
tags:
- linux
- docker
- amd64
<<: *kvm_image_job
openbsd_6.6_amd64:
stage: images
variables:
......
CI_REGISTRY_IMAGE ?= registry.gitlab.isc.org/isc-projects/images
DISTROS ?= centos openbsd
DISTROS ?= centos freebsd openbsd
default_centos_VERSIONS := 6 7 8
default_freebsd_VERSIONS := 11.3 12.1
default_openbsd_VERSIONS := 6.6
ifneq (,$(VERSIONS))
centos_VERSIONS = $(filter $(VERSIONS),$(default_centos_VERSIONS))
freebsd_VERSIONS = $(filter $(VERSIONS),$(default_freebsd_VERSIONS))
openbsd_VERSIONS = $(filter $(VERSIONS),$(default_openbsd_VERSIONS))
else
centos_VERSIONS ?= $(default_centos_VERSIONS)
freebsd_VERSIONS ?= $(default_freebsd_VERSIONS)
openbsd_VERSIONS ?= $(default_openbsd_VERSIONS)
endif
......
QCOW2_IMAGE ?= freebsd-12.1-x86_64
.PHONY: prepare
prepare:
mkdir -p "$(QCOW2_IMAGE)"
cp installerconfig packer.json post-install.sh "$(QCOW2_IMAGE)/"
PARTITIONS="vtbd0"
#!/bin/sh -e
echo "vagrant" | pw usermod root -h 0
chsh -s /bin/sh root
sed -i -e "s|^#\(PermitRootLogin\) .*|\1 yes|" /etc/ssh/sshd_config
sysrc -f /boot/loader.conf autoboot_delay="-1"
sysrc -f /boot/loader.conf console=comconsole
sysrc ifconfig_DEFAULT="DHCP"
sysrc sshd_enable="YES"
reboot
{
"variables": {
"iso_url": "{{env `ISO_URL`}}",
"iso_checksum": "{{env `ISO_CHECKSUM`}}",
"qcow2_image": "{{env `QCOW2_IMAGE`}}"
},
"provisioners": [
{
"type": "shell",
"script": "post-install.sh"
}
],
"builders": [
{
"type": "qemu",
"headless": true,
"iso_url": "{{user `iso_url`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"vm_name": "{{user `qcow2_image`}}.qcow2",
"cpus": 2,
"memory": 2048,
"disk_size": 4096,
"disk_compression": true,
"disk_cache": "unsafe",
"http_directory": ".",
"boot_wait": "30s",
"boot_command": [
"S",
"dhclient vtnet0<enter>",
"fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/installerconfig<enter>",
"bsdinstall script /tmp/installerconfig<enter>"
],
"ssh_username": "root",
"ssh_password": "vagrant",
"ssh_wait_timeout": "5m",
"shutdown_command": "shutdown -p now"
}
]
}
#!/bin/sh
set -e -v
sysrc hostname="freebsd"
ASSUME_ALWAYS_YES=yes pkg install bash cmocka fstrm git json-c kyua libmaxminddb libuv libxml2 p5-Net-DNS pkgconf protobuf-c py37-dnspython py37-ply sudo
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244493
ASSUME_ALWAYS_YES=yes pkg install gmake
curl -sSL "https://github.com/LMDB/lmdb/archive/LMDB_0.9.24.tar.gz" | tar -C /usr/src -xzf -
cd /usr/src/lmdb-LMDB_0.9.24/libraries/liblmdb
gmake CC=clang && gmake install
pw group add -n gitlab-runner
echo "vagrant" | pw user add -n gitlab-runner -g gitlab-runner -s /usr/local/bin/bash -h 0
mkdir -p /home/gitlab-runner
chown gitlab-runner:gitlab-runner /home/gitlab-runner
echo "gitlab-runner ALL=(ALL) NOPASSWD: ALL" >> /usr/local/etc/sudoers
fetch -o /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-freebsd-amd64
chmod +x /usr/local/bin/gitlab-runner
mkdir /builds
chmod 1777 /builds
# Fill all available disk space with a file containing zero bytes so that the
# parts of the QCOW2 image taken up by deleted files are replaced with zero
# bytes. This significantly improves the compression ratio of the resulting
# QCOW2 image.
dd if=/dev/zero of=/EMPTY bs=1M || :
rm -f /EMPTY
sync
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment