An automated VM template builder for the CSC cloud
Go to file
Max Erenberg a903d9ba0c Install systemd-resolved for NetworkManager
Workaround for cloud-init bug until this fix gets shipped to the
2024-01-13 22:04:54 -05:00
pkg Install systemd-resolved for NetworkManager 2024-01-13 22:04:54 -05:00
scripts add libssh-4 as a build dependency 2024-01-13 17:10:32 -05:00
.gitignore first commit 2022-06-21 02:36:42 -04:00
Makefile add libssh-4 as a build dependency 2024-01-13 17:10:32 -05:00 update SSH_KEY_PATH documentation in README 2022-11-19 06:57:50 +00:00
go.mod first commit 2022-06-21 02:36:42 -04:00
go.sum first commit 2022-06-21 02:36:42 -04:00
main.go verify VMs and delete old templates 2022-07-16 18:30:36 -04:00


cloudbuild downloads, modifies and uploads VM templates for the CSC cloud (CloudStack) using publicly available images for common Linux distros.

Installing dependencies

Run the following in a Debian Docker/Podman container.

apt install golang-guestfs-dev

Optional dependencies

If you are developing cloudbuild, you may wish to install guestfish, an interactive shell for guestfs:

apt install libguestfs-tools

To run:

make guestfish

><fs> add /path/to/your/template.img
><fs> run
><fs> inspect-os
><fs> # use the output from inspect-os to find the root partition
><fs> mount /dev/sda4 /

Creating the appliance

Next you need an appliance, which is a kernel + initrd + rootfs used by the VM created by guestfs. You have two options:

  1. Download an appliance:
    make appliance-download


  1. Create an appliance using the host's kernel:
    make supermin-download
    make appliance

Building the program


Running the program

Make sure the following environment variables are set:

# these values must be obtained from the CloudStack web UI
export CLOUDSTACK_API_KEY=secret
# set these to the distros for which cloudbuild will create templates
export DISTROS_TO_CHECK=ubuntu,fedora
# the modified templates will be temporarily moved here so that CloudStack
# can download them
export UPLOAD_DIRECTORY=/var/www/csc-cloud-images
# the modified templates (in the UPLOAD_DIRECTORY) must be downloadable
# from this base URL
# notification emails will be sent here
# path of SSH key used to SSH into VMs created in CloudStack
export SSH_KEY_PATH=~/.ssh/id_rsa_cloudstack


make run