Components needed for a smooth experience*:
Kevin
: Main daemonFalk
: Container provider daemonChantal
: In-container agent to run the jobMandy
: Webinterface
* Disclaimer: The experience may not actually be smooth and likely more components are needed.
- Install
kevin
on a server - Create/edit
kevin.conf
,falk.conf
and add a config for all your projects to be built - Set up a VM or container and add it to
falk.conf
- Add
kevin-ci
as github webhook - Run
kevin
andfalk
(e.g. assystemd
service) - Add the
kevinfile
control file to your project repo - Pull requests are built inside a temporary container copy
- Set up a webserver to serve the
mandy
webinterface and your build output folder
-
kevin
interacts with the outside world (your git hoster). It gets notified by pull requests. You need a server for it. -
kevin
contactsfalk
to start a VM. You need a server forfalk
again, but it can be the same machine wherekevin
is running on. There can be multiplefalk
s. -
falk
launches a container/virtual machine provided by you. You create the machine template (just set up a debian...) or use docker, etc. Your pull request is then built inside that container bychantal
. -
After the job was run, the machine is reverted back to the template.
-
mandy
presents the build progress in your browser in real-time.
You are responsible for managing and updating the container 😄.
Which is one of the main reasons we created kevin
.
kevin
is designed in a way that arbitrary code can be executed in the
container and will not harm your host system, apart from the usual virtual
machine/container exit exploits that we can't prevent.
Our code is of course 100% bugfree, we even have created a program to verify that kevin can never hang up. Hrr hrr...
Kevin supports hosting multiple projects. Each project can spawn as many "jobs" as you like to have.
- Build: Equal to a commit hash. Spawns jobs which must succeed.
- Job: Performed by chantal inside a container.
- Step: One step in a job, as defined in the in-repo
kevinfile
control file. - Command: Each step runs one or more commands.
At the moment, only a qemu
VM is supported.
Look inside falk/vm/
to add more container types.
- Install
python >=3.6
tornado >=5.1
aiohttp >=2.0
- Create user
kevin
(you can, of course, change that)- Add
kevin
to groupkvm
- Create
/etc/kevin/kevin.conf
fromkevin.conf.example
- Create a password-less SSH key with
ssh-keygen -t rsa -b 4096
for the userkevin
- Add
- Install the
kevin
Python module (ideally, as a systemd unit or whatever)
-
Install
python >=3.6
- your container system of choice:
qemu
, ...
-
Create
/etc/kevin/falk.conf
fromfalk.conf.example
-
Register this
falk
by adding it to thekevin.conf
[falk]
section.-
If this
falk
is on the same machine askevin
:- add
falk_name=userid@/run/kevin/falk
andkevin
will use this Unix socket to contactfalk
- add
-
If this
falk
is a different physical machine than the host forkevin
:- Create user
falk
on thefalk
host - In
kevin.conf
, section[falk]
, add[email protected]
,kevin
will then contact falk via SSH - In
~falk/.ssh/authorized_keys
, force the ssh command tocommand="python3 -m falk.shell useridentifier" ssh-rsa kevinkeyblabla...
This sets up password-less SSH access (ssh-copy-id
..) forkevin
to[email protected]
and forces the falk shell.
- Create user
-
-
optional: create firewall rules to prevent the VMs launched by
falk
from talking to internals of your network
- Setup the OS
- Install
python >=3.4
git
ssh
daemonsudo
- In the VM, create user
chantal
- In
visudo
, giveNOPASSWD: ALL
permissions tochantal
- That way,
chantal
easily gets root permissions in the machine
- That way,
- Enable and run the
sshd
service - Setup password-less SSH access (
ssh-copy-id
) for abovekevin
user tochantal@container_vm
- Add
kevin
'sid_rsa.pub
into~chantal/.ssh/authorized_keys
- Add
- Store the contents of the container's
/etc/ssh/ssh_host_ed25519_key.pub
to thefalk.conf
so the key for this VM can be verified - Set up the container in the way you'd like to test your project
- If your build involves graphical things, you could set up
tigervnc
orx11vnc
- If your build involves graphical things, you could set up
-
On the
kevin
machine, create a folder where project configurations reside in/etc/kevin/projects/
may be a good location- In there, create
lolmyproject.conf
from theetc/project.conf.example
file - For each project, create a file with a suitable name in
/etc/kevin/projects/
-
For the project you want to test, create kevin control file
kevinfile
in the project repo root (e.g.~/dev/openage/kevinfile
)- You can change the name to anything you want, even
kartoffelsalat
- If you change it, set the name in the
lolmyproject.conf
- You can change the name to anything you want, even
-
- Settings > Webhooks and Services > Add Webhook
- content type: JSON, URL:
http://your-kevin-host:webhook_port/hook-github
- Create a secret with e.g.
pwgen 1 30
and save it in the github webhook and yourprojects/yourproject.conf
section[github_webhook]
- Select events: Pull Request and Push
- Just serve the
mandy
folder on any machine in the world. - Use
nginx
orlighttpd
orapache
, it does not matter. - Enter the location where
mandy
can be reached inkevin.conf
- To allow output file downloads, you have to serve your static folder with another (or the same) webserver.
- You can directly run Chantal without all the other fuzz.
- Kevin would do the same thing in the container/VM.
- To test, invoke
python3 -m chantal --help
and be enlightnened.-
You can run Chantal inside your project without cloning it:
-
python3 -m chantal --folder /your/project/repo $jobname
-
$jobname
is used for evaluating conditions in thekevinfile
. Later, thejobname
passed to Chantal will be taken from the job name you set up for a project in the its config filelolmyproject.conf
. -
The same test can be done within your VM/container:
-
python3 -m chantal --folder /tmp/clonedest --clone $clone_url --checkout $branchname_or_hashname $jobname
-
-
Persistent storage for
kevin
is done in the[web]
folder
-
systemd setup
- copy and adjust
etc/kevin.service
to/etc/systemd/system/kevin.service
- copy and adjust
etc/falk.service
to/etc/systemd/system/falk.service
- copy and adjust
etc/tmpfiles.d/kevin.conf
to/etc/tmpfiles.d/kevin.conf
- enable the service with
systemctl enable $name.service
- start them with
systemctl start $name.service
- copy and adjust
-
Non-daemon launch
- Run
kevin
withpython3 -m kevin
- Run
falk
withpython3 -m falk
- Run
-
After setup, manage a container with
python3 -m falk.manage
- For example:
python3 -m falk.manage unix:///run/kevin/falk your_vm_id
- For example:
-
We recommend to first test with a dummy repository that just contains a simple
kevinfile
, instead of the "real" project. -
Test without
github
: Try using the Kevin Simulator -
Test with
github
: Just make a pull request!
If you encounter any problem, please contact us and ask!
If things crash, bug, or whatever, create an issue!
If you think this guide or anything else in this project is crap and sucks, just do better!