BlueGit

timfa bluegit

Files

bluegit / internal / ci / model.go

model.go

feat: breid rules en de ingebouwde runner uit
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
5fec96f0 History
model.go 3.1 KiB Download Raw
1package ci
2
3import "time"
4
5// Pipeline is een geparset blue-ci-cd.yml.
6type Pipeline struct {
7 Stages []string
8 Variables map[string]string
9 Image string
10 Before []string
11 After []string
12 Cache Cache
13 Timeout time.Duration
14 Tags []string
15 Jobs []Job
16 Warnings []Issue
17 Workflow []Rule
18}
19
20// Job is één containerstap.
21type Job struct {
22 Name string
23 Stage string
24 Image string
25 Before []string
26 Script []string
27 After []string
28 Needs []string
29 Optional []string
30 NeedsSet bool
31 Variables map[string]string
32 Artifacts Artifacts
33 Rules []Rule
34 AllowFailure bool
35 When string
36 Timeout time.Duration
37 Tags []string
38 Cache Cache
39 ResourceGroup string
40 Only []string
41 Except []string
42 Retry Retry
43 Parallel int
44 Matrix []MatrixSpec
45 Services []Service
46 Environment Environment
47 Interruptible bool
48}
49
50// Retry is het aantal extra pogingen na een mislukking. Max is hoogstens 2.
51// Een lege When betekent elke mislukking behalve een annulering.
52type Retry struct {
53 Max int
54 When []string
55}
56
57// MatrixSpec is één item uit parallel:matrix. Keys staan in YAML-volgorde.
58type MatrixSpec struct {
59 Keys []string
60 Vals [][]string
61}
62
63// Service is een sidecar-container op hetzelfde Docker-netwerk als de job.
64type Service struct {
65 Name string
66 Alias string
67 Command []string
68 Entrypoint []string
69 Variables map[string]string
70}
71
72// Environment is de naam en een optionele URL. Er is geen deployment.
73type Environment struct {
74 Name string
75 URL string
76}
77
78// Artifacts zijn paden die na een geslaagde job bewaard blijven.
79type Artifacts struct {
80 Paths []string
81 ExpireIn time.Duration
82}
83
84// Cache is een map die tussen jobs van één repository gedeeld wordt.
85type Cache struct {
86 Key string
87 Paths []string
88}
89
90// Rule is één voorwaarde. De eerste rule die klopt wint.
91// Zonder rules draait de job, tenzij only of except dat tegenhoudt.
92type Rule struct {
93 If string
94 Changes []string
95 Exists []string
96 When string
97}
98
99// Issue is een fout of een waarschuwing met een regelnummer.
100type Issue struct {
101 Line int
102 Key string
103 Args []any
104 Warning bool
105}
106
107// Eval is de context waarin rules worden beoordeeld.
108// Changed == nil betekent dat de diff onbekend is; changes klopt dan.
109// Files == nil betekent dat de boom onbekend is; exists klopt dan.
110type Eval struct {
111 Env map[string]string
112 Changed []string
113 Files []string
114}
115
116// MRInfo is de merge request waar een pipeline bij hoort.
117// Leeg betekent een gewone branch- of tag-pipeline.
118type MRInfo struct {
119 ID int64
120 IID int64
121 Title string
122 SourceBranch string
123 TargetBranch string
124 ProjectPath string
125 ProjectURL string
126 TargetSHA string
127}
128
129// Ref beschrijft de commit waarvoor voorgedefinieerde variabelen gelden.
130type Ref struct {
131 SHA string
132 FullRef string
133 Name string
134 Kind string
135 Title string
136 DefaultBranch string
137 Source string
138 ProjectPath string
139 ProjectURL string
140 APIURL string
141 PipelineID int64
142 MR *MRInfo
143}