How to create a CosyVerif-like build system
In order to create a build system similar to the one CosyVerif has, you'll first have to clone the following git repository, where is located all the scripts and files you need to create a Jenkins slave and a debian repository properly configured : https://github.com/CosyVerif/images
Then, you have to download a package that is located in the CosyVerif repository. The name of this package is genvm. Here's how to download packages from the said repository.
Before executing anything, there are some files you need to edit in order to create the jenkins slave and the repository you want.
1. The authorized_keys files
There are two authorized_keys files. The first, which is located in data/home/jenkins/.ssh/authorized_keys, is intended for the jenkins slave that you want to create. This is where you should put the public ssh key of the machine where Jenkins is installed, and others, if you want to.
The second file is located in data/home/repo/.ssh/authorized_keys, and is for the repository that will be created.
2. The repository file (apache)
Coming soon ...
3. The .dput.cf file
Coming soon ...
4. The .mini-dinstall.conf file
Coming soon ...
5. The gpg-keygen.conf file
Coming soon ...
Creating the VMs
Now that all the above configuration files have been filled, you can use the script create_buildcosy to create the virtual machines that will contains the repository and the jenkins slave. Although this script does not require any argument, you might want to use some. Here is a list of all the options of that script :
-
-a <arch>, --architecture=ARCH, --arch=ARCH
Architecture of the virtual machines that will be created. It can either be amd64 or i386. Default: amd64. -
-d <dir>, --directory=DIR, --dockerfiles-dir=DIR
Directory where all the dockerfiles are located. Default: dockerfiles/. -
-D, --debug-mode
Debug Mode -
-f <format>, --format=FORMAT, --vm-format=FORMAT, --format-vm=FORMAT
Format of the virtual disk images that will be created. It have to be one of these values : vmdk, qcow, qcow2, raw. Default: vmdk. -
--slave-name=NAME, --jenkins-slave=NAME
Name of the virtual disk image that will contain the jenkins slave. Default: jenkins-slave.<format> -
--repository-name=NAME, --repo-name=NAME
Name of the virtual disk image that will contain the repository. Default: repository.<format> -
-s <size>, --size=SIZE, --vmsize=SIZE, --sizevm=SIZE
Maximum size of the two virtual disk images. Default: 5G. -
-v <version>, --version=VERSION, --debian-version=VERSION, --release=VERSION
Debian version on which both the jenkins slave and the repository will run. It must either be a release code name (squeeze, wheezy, ...) or a symbolic name (stable, testing, unstable, ...). Default: jessie. -
-V, --verbose, --verbose-mode
Verbose mode.
Once the script has finished its execution (it may takes some time ...), you should have two virtual disk images. There's still some things you have to do. You have to launch the virtual machine which contains the jenkins slave and generate its ssh key. In order to do so, you have to execute the following command:
This command will ask you in which directory you want to put the key that will be generated. Choose the default value, which is something like /home/jenkins/.ssh.
When this is done, you have to put the content of the file named id_rsa.pub in the authorized_keys file of the repository (located in /home/repo/.ssh/). Then, you have to launch the jenkins slave, and connect to the repository via ssh. It's mandatory to do so, because during the first connection, ssh will ask you if the machine you want to connect to is the right one. And you don't want that to happen during a build.