aboutsummaryrefslogtreecommitdiff
path: root/deploy/continuous_integration_and_deployment_system.org
blob: c02ae5c04face2d788fc968b06f7b7470a83fc09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#+STARTUP: contents inlineimages shrink
#+OPTIONS: ^:{}
#+TITLE: Continuous Integration and Deployment System

* Overview

The continuous integration (CI) and continuous deployment (CD) system is dependent on the following:

- [[https://guix.gnu.org/][GNU Guix]]: used to define the machine (VM, container, etc) within which the CI/CD system will run
- [[https://guix-forge.systemreboot.net/][Guix Forge]]: does the main ochestration that enables the CI/CD system to function
- [[https://laminar.ohwg.net/][Laminar]]: Runs the CI jobs

In the sections that follow, we shall dive deeper into how the CI/CD system is put together

** CI/CD Flow
- Developer writes some code and pushes it to the /main/ branch in the GeneNetwork(2/3) repositories
- A webhook triggers the CI system
- The CI system runs the unit tests, linting and type checks mostly concurrently
- If *ALL* the unit tests pass, the application is redeployed

* Guix Forge and G-Expressions

The CI/CD used for GeneNetwork makes heavy use of
[[https://guix.gnu.org/manual/en/html_node/G_002dExpressions.html][Guix G-Expressions]] (also known as *gexps*) written for guix-forge.

The CI system begins by defining a data structure to hold the development server's configuration

#+BEGIN_SRC scheme
(define-record-type* <development-server-configuration>
  development-server-configuration make-development-server-configuration
  development-server-configuration?
  (name development-server-configuration-name)
  (git-repository development-server-configuration-git-repository)
  (git-branch development-server-configuration-git-branch)
  (executable-path development-server-configuration-executable-path)
  (runner development-server-configuration-runner)
  (port development-server-configuration-port
        (default 8080)))
#+END_SRC

The ~define-record-type~ macro is defined in the ~(guix records)~ module.

The server configuration has the following values:

- *name*: The name of the server configuration
- *git-repository*: The git repository relating to the server configuration
- *git-branch*: The branch to run the CI against
- *executable-path*: something to do with laminar?
- *runner*: A gexp that runs the service under ...
- *port*: The port to run the service under CI/CD on

**** TODO Identify what 'executable-path' above is about :genenetwork:CI:CD:
**** TODO Find out under what conditions the gexp runs :genenetwork:CI:CD:

* TODO Figure out how to organise these notes             :genenetwork:CI:CD:
- The system uses webhook to trigger the builds on each commit
- There is some use of ~development-server-configuration~ objects

* TODO Maybe do a deep dive into at least one of the service definitions, explaining what each "thing" is and how it works :genenetwork:CI:CD: