BlueGit

timfa bluegit

Files

bluegit / internal / ci / model.go

model.go

feat: merge-request-pipelines en merge na een geslaagde run
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
Failed 24b281c4 History
model.go 2.3 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}
18
19// Job is één containerstap.
20type Job struct {
21 Name string
22 Stage string
23 Image string
24 Before []string
25 Script []string
26 After []string
27 Needs []string
28 Optional []string
29 NeedsSet bool
30 Variables map[string]string
31 Artifacts Artifacts
32 Rules []Rule
33 AllowFailure bool
34 When string
35 Timeout time.Duration
36 Tags []string
37 Cache Cache
38 ResourceGroup string
39 Only []string
40 Except []string
41}
42
43// Artifacts zijn paden die na een geslaagde job bewaard blijven.
44type Artifacts struct {
45 Paths []string
46 ExpireIn time.Duration
47}
48
49// Cache is een map die tussen jobs van één repository gedeeld wordt.
50type Cache struct {
51 Key string
52 Paths []string
53}
54
55// Rule is één voorwaarde. De eerste rule die klopt wint.
56// Zonder rules draait de job, tenzij only of except dat tegenhoudt.
57type Rule struct {
58 If string
59 Changes []string
60 Exists []string
61 When string
62}
63
64// Issue is een fout of een waarschuwing met een regelnummer.
65type Issue struct {
66 Line int
67 Key string
68 Args []any
69 Warning bool
70}
71
72// Eval is de context waarin rules worden beoordeeld.
73// Changed == nil betekent dat de diff onbekend is; changes klopt dan.
74// Files == nil betekent dat de boom onbekend is; exists klopt dan.
75type Eval struct {
76 Env map[string]string
77 Changed []string
78 Files []string
79}
80
81// MRInfo is de merge request waar een pipeline bij hoort.
82// Leeg betekent een gewone branch- of tag-pipeline.
83type MRInfo struct {
84 ID int64
85 IID int64
86 Title string
87 SourceBranch string
88 TargetBranch string
89 ProjectPath string
90 ProjectURL string
91 TargetSHA string
92}
93
94// Ref beschrijft de commit waarvoor voorgedefinieerde variabelen gelden.
95type Ref struct {
96 SHA string
97 FullRef string
98 Name string
99 Kind string
100 Title string
101 DefaultBranch string
102 Source string
103 ProjectPath string
104 ProjectURL string
105 APIURL string
106 PipelineID int64
107 MR *MRInfo
108}