summaryrefslogtreecommitdiffstats
path: root/doc/datamodel.md
blob: ff7e3aa8ca755c07e9a59822be6808d3aff90e6d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
## The data model used for the database


(Note that this part of the documentation is not relevant for users of butido,
but only developers)


The following visualization _only_ shows the entities we need to store.
The tables extracted from this visualization are listed below.

```no_run
+------+ 1             N +---+ 1          1 +-----------------------+
|Submit|<--------------->|Job|-------+----->|Endpoint *             |
+--+---+                 +---+       |    1 +-----------------------+
   |                                 +----->|Package *              |
   |                                 |    1 +-----------------------+
   |                                 +----->|Log                    |
   |  1  +-----------------------+   |    1 +-----------------------+
   +---->|Config Repository HEAD |   +----->|OutputPath             |
   |  1  +-----------------------+   |  N:M +-----------------------+
   +---->|Requested Package      |   +----->|Input Files            |
   |  1  +-----------------------+   |  N:M +-----------------------+
   +---->|Requested Image Name   |   +----->|ENV                    |
   | M:N +-----------------------+   |    1 +-----------------------+
   +---->|Additional ENV         |   +----->|Script *               |
   |  1  +-----------------------+          +-----------------------+
   +---->|Timestamp              |
   |  1  +-----------------------+
   +---->|Unique Build Request ID|
   |  1  +-----------------------+
   +---->|Package Tree (JSON)    |
   |  1  +-----------------------+
   +---->|Build Plan (JSON)      |
         +-----------------------+
```


NOTIZEN:
    * "Input files" müssen nachvollziehbarsein, da diese sich ändern könnten
    * ENV im Job ist im Package "encodiert"

* Because we track the commit hash a "Submit" was submitted with,
  we can reduce the amount of data we store for "Endpoint", "Package" and
  "Script", because we can find all this information in the repository already.


## Inferred Tables

These are the tables extracted from the above visualization,
with some comments on what they are supposed to store.

* "envvar"
    A Key-Value list of environment variables.
    columns:
        - name: String
        - value: String

* "git hash"
    Simply a recording of relevant git hashes
    columns:
        - hash: String

* "package"
    A package from the package repository.
    All information we need is the name and the version.
    Because we store the git hash of the request, we can reconstruct everything
    else.

    columns:
        - name: String
        - version: String

* "image"
    A list of (docker) image names

    columns:
        - name: String

* "submit"
    The submitted request.
    This gets a unique identifier for easy referencing and a timestamp for easy
    filtering things.
    The repository hash for the submit is stored as well as the requested image
    to build on and the additional environment.

    The generated package tree (JSON) is also stored

    columns:
        - uuid: UUID
        - timestamp: Timestamp
        - envvar: (foreign "submitenvs")
        - requested_image: (foreign "image")
        - requested_package: (foreign "package")
        - repo_hash: (forgein "git hash")
        - tree: JSON
        - buildplan: JSON


* "endpoint"
    The names of the used endpoints.
    Because we track the git commit hash, we can find out the endpoint configuration from
    the repository.

    columns:
        - name: String


* "job":
    A single job which is run somewhere.

    columns:
        - submit: (foreign "submit")
        - endpoint: (foreign "endpoint")
        - package: (foreign "package")
        - image name: (foreign "image")
        - container hash: String
        - script: Text
        - output: (foreign "artifact")
        - log: Text

* "job_input_artifacts":
    N:M resolution table between jobs and input artifacts (artifacts that are
    copied into the container)

    columns:
        - job (foreign "job")
        - artifact (foreign "artifact")

* "artifact":
    A Path to a artifact generated from a build job or required as an input for
    a build job.

    columns:
        - path: Path

* "jobenvs":
    N:M resolution table between jobs and environment variables.

    columns:
        - job (foreign "job")
        - env (foreign "env")

* "submitenvs":
    N:M resolution table between submits and environment variables.

    columns:
        - submit (foreign "submit")
        - env (foreign "env")