feat: voeg image-presets en een CI-infopagina toe
Steve bouwt bluegit/base en de andere aliassen lokaal. De specificatie en de presets komen uit één bron, op /-/info en via /api/v1/ci/spec. Co-authored-by: tim <tim@timfalken.com>
@@ -113,7 +113,7 @@ func serve(args []string) error {
113
113
Store: st, GitBin: cfg.Git.Binary, Docker: cfg.CI.Docker, Storage: dataPath,
114
114
BaseURL: cfg.BaseURL, Network: cfg.CI.Network, Name: cfg.Runner.Name,
115
115
Timeout: time.Duration(cfg.CI.TimeoutSec) * time.Second,
116
Log: log, OnEvent: srv.Dispatch,
116
Log: log, OnEvent: srv.Dispatch, Presets: cfg.CI.ImageOverrides(),
117
117
}
118
118
srv.Runner = rn
119
119
go rn.Loop(ctx, cfg.CI.Concurrency)
@@ -113,7 +113,7 @@ func serve(args []string) error {113
Store: st, GitBin: cfg.Git.Binary, Docker: cfg.CI.Docker, Storage: dataPath,113
Store: st, GitBin: cfg.Git.Binary, Docker: cfg.CI.Docker, Storage: dataPath,114
BaseURL: cfg.BaseURL, Network: cfg.CI.Network, Name: cfg.Runner.Name,114
BaseURL: cfg.BaseURL, Network: cfg.CI.Network, Name: cfg.Runner.Name,115
Timeout: time.Duration(cfg.CI.TimeoutSec) * time.Second,115
Timeout: time.Duration(cfg.CI.TimeoutSec) * time.Second,116
Log: log, OnEvent: srv.Dispatch,116
Log: log, OnEvent: srv.Dispatch, Presets: cfg.CI.ImageOverrides(),117
}117
}118
srv.Runner = rn118
srv.Runner = rn119
go rn.Loop(ctx, cfg.CI.Concurrency)119
go rn.Loop(ctx, cfg.CI.Concurrency)@@ -32,7 +32,7 @@ jobs:
32
32
| Veld | Betekenis |
33
33
| --- | --- |
34
34
| `stages` | Volgorde. Weggelaten: de stages in de volgorde waarin de jobs ze noemen. Een job zonder stage valt in `test`. |
35
| `image` | Standaardimage, als tekst of als `name:`. `default.image` wint als die gezet is. |
35
| `image` | Standaardimage, als tekst of als `name:`. `default.image` wint als die gezet is. Een preset zoals `bluegit/base` mag. `node:22` blijft een gewoon image. |
36
36
| `default` | `image`, `before_script`, `after_script`, `tags`, `timeout`, `cache` voor jobs die het zelf niet zetten. |
37
37
| `include` | Alleen `local`. Een job met dezelfde naam wordt samengevoegd; het buitenste bestand wint per veld. |
38
38
| `variables` | Tekst, of `{value: ...}`. Een job overschrijft dezelfde naam. |
@@ -80,7 +80,25 @@ Een merge-request-pipeline start bij het openen van de merge request, bij elke p
80
80
81
81
## Bewust niet
82
82
83
`pages`, `spec`, een include van een ander project of van een URL, trigger- en child-pipelines, `coverage`, `id_tokens`, `inherit` en `hooks`. Die sleutels geven een waarschuwing in de editor en houden de rest van het bestand niet tegen. Er is één runner, in het BlueGit-proces, die Docker op dezelfde host aanroept. Zijn naam is `runner.name` in de configuratie, standaard Steve. In `Preparing the docker executor` staat altijd `Using docker image …`, en de image-id met digest als het image al lokaal aanwezig is. In `Preparing environment` staan de runnernaam, de host, de werkmap `/workspace` en het pipeline- en jobnummer. Die naam staat bij de runner op de jobpagina, op de pipelinedetails en boven het joblog. `tags` kiezen die runner niet. `services` delen één netwerk met de job; er is geen healthcheck verder dan een gestarte container.
83
`pages`, `spec`, een include van een ander project of van een URL, trigger- en child-pipelines, `coverage`, `id_tokens`, `inherit` en `hooks`. Die sleutels geven een waarschuwing in de editor en houden de rest van het bestand niet tegen. Er is één runner, in het BlueGit-proces, die Docker op dezelfde host aanroept. Zijn naam is `runner.name` in de configuratie, standaard Steve. In `Preparing the docker executor` staat altijd `Using docker image …`, en de image-id met digest als het image al lokaal aanwezig is. Een preset schrijft daar ook `Using image preset … based on …` en, na een bouw, `Underlying image … with digest …`. In `Preparing environment` staan de runnernaam, de host, de werkmap `/workspace` en het pipeline- en jobnummer. Die naam staat bij de runner op de jobpagina, op de pipelinedetails en boven het joblog. `tags` kiezen die runner niet. `services` delen één netwerk met de job; er is geen healthcheck verder dan een gestarte container.
84
85
## Image-presets
86
87
Steve heeft geen aparte runners per taal. `image: bluegit/base` en de andere aliassen zijn Dockerfiles in deze repository. Bij het eerste gebruik bouwt Steve ze lokaal en hergebruikt hij het resultaat zolang de Dockerfile hetzelfde blijft.
88
89
| Preset | Basis |
90
| --- | --- |
91
| `bluegit/base` | Alpine 3.20, met git, curl en bash |
92
| `bluegit/node` | Node.js 22 |
93
| `bluegit/python` | Python 3.12 |
94
| `bluegit/go` | Go 1.22 |
95
| `bluegit/rust` | Rust 1.81 |
96
| `bluegit/java` | Java 21 (Temurin) |
97
| `bluegit/dotnet` | .NET SDK 8 |
98
99
Elk image krijgt daar bash, ca-certificates, curl en git bij. `ci.presets` in `config.yml` voegt een alias toe of vervangt een ingebouwde: `image` mapt direct, `dockerfile` wijst naar een bestand, `from` herschrijft de eerste `FROM`.
100
101
`/-/info` toont deze specificatie en de presets. `GET /api/v1/ci/spec` geeft dezelfde inhoud als JSON. De pagina zet die JSON ook in `<script type="application/json" id="bluegit-ci-spec">`.
84
102
85
103
## Editor
86
104
@@ -32,7 +32,7 @@ jobs:32
| Veld | Betekenis |32
| Veld | Betekenis |33
| --- | --- |33
| --- | --- |34
| `stages` | Volgorde. Weggelaten: de stages in de volgorde waarin de jobs ze noemen. Een job zonder stage valt in `test`. |34
| `stages` | Volgorde. Weggelaten: de stages in de volgorde waarin de jobs ze noemen. Een job zonder stage valt in `test`. |35
| `image` | Standaardimage, als tekst of als `name:`. `default.image` wint als die gezet is. |35
| `image` | Standaardimage, als tekst of als `name:`. `default.image` wint als die gezet is. Een preset zoals `bluegit/base` mag. `node:22` blijft een gewoon image. |36
| `default` | `image`, `before_script`, `after_script`, `tags`, `timeout`, `cache` voor jobs die het zelf niet zetten. |36
| `default` | `image`, `before_script`, `after_script`, `tags`, `timeout`, `cache` voor jobs die het zelf niet zetten. |37
| `include` | Alleen `local`. Een job met dezelfde naam wordt samengevoegd; het buitenste bestand wint per veld. |37
| `include` | Alleen `local`. Een job met dezelfde naam wordt samengevoegd; het buitenste bestand wint per veld. |38
| `variables` | Tekst, of `{value: ...}`. Een job overschrijft dezelfde naam. |38
| `variables` | Tekst, of `{value: ...}`. Een job overschrijft dezelfde naam. |@@ -80,7 +80,25 @@ Een merge-request-pipeline start bij het openen van de merge request, bij elke p80
80
81
## Bewust niet81
## Bewust niet82
82
83
`pages`, `spec`, een include van een ander project of van een URL, trigger- en child-pipelines, `coverage`, `id_tokens`, `inherit` en `hooks`. Die sleutels geven een waarschuwing in de editor en houden de rest van het bestand niet tegen. Er is één runner, in het BlueGit-proces, die Docker op dezelfde host aanroept. Zijn naam is `runner.name` in de configuratie, standaard Steve. In `Preparing the docker executor` staat altijd `Using docker image …`, en de image-id met digest als het image al lokaal aanwezig is. In `Preparing environment` staan de runnernaam, de host, de werkmap `/workspace` en het pipeline- en jobnummer. Die naam staat bij de runner op de jobpagina, op de pipelinedetails en boven het joblog. `tags` kiezen die runner niet. `services` delen één netwerk met de job; er is geen healthcheck verder dan een gestarte container.83
`pages`, `spec`, een include van een ander project of van een URL, trigger- en child-pipelines, `coverage`, `id_tokens`, `inherit` en `hooks`. Die sleutels geven een waarschuwing in de editor en houden de rest van het bestand niet tegen. Er is één runner, in het BlueGit-proces, die Docker op dezelfde host aanroept. Zijn naam is `runner.name` in de configuratie, standaard Steve. In `Preparing the docker executor` staat altijd `Using docker image …`, en de image-id met digest als het image al lokaal aanwezig is. Een preset schrijft daar ook `Using image preset … based on …` en, na een bouw, `Underlying image … with digest …`. In `Preparing environment` staan de runnernaam, de host, de werkmap `/workspace` en het pipeline- en jobnummer. Die naam staat bij de runner op de jobpagina, op de pipelinedetails en boven het joblog. `tags` kiezen die runner niet. `services` delen één netwerk met de job; er is geen healthcheck verder dan een gestarte container.84
85
## Image-presets86
87
Steve heeft geen aparte runners per taal. `image: bluegit/base` en de andere aliassen zijn Dockerfiles in deze repository. Bij het eerste gebruik bouwt Steve ze lokaal en hergebruikt hij het resultaat zolang de Dockerfile hetzelfde blijft.88
89
| Preset | Basis |90
| --- | --- |91
| `bluegit/base` | Alpine 3.20, met git, curl en bash |92
| `bluegit/node` | Node.js 22 |93
| `bluegit/python` | Python 3.12 |94
| `bluegit/go` | Go 1.22 |95
| `bluegit/rust` | Rust 1.81 |96
| `bluegit/java` | Java 21 (Temurin) |97
| `bluegit/dotnet` | .NET SDK 8 |98
99
Elk image krijgt daar bash, ca-certificates, curl en git bij. `ci.presets` in `config.yml` voegt een alias toe of vervangt een ingebouwde: `image` mapt direct, `dockerfile` wijst naar een bestand, `from` herschrijft de eerste `FROM`.100
101
`/-/info` toont deze specificatie en de presets. `GET /api/v1/ci/spec` geeft dezelfde inhoud als JSON. De pagina zet die JSON ook in `<script type="application/json" id="bluegit-ci-spec">`.84
102
85
## Editor103
## Editor86
104
@@ -0,0 +1,236 @@
1
// Package cispec is de blue-ci-cd.yml-specificatie.
2
// De infopagina en GET /api/v1/ci/spec gebruiken allebei Build, zodat de
3
// tekst en de presets niet uit elkaar lopen.
4
package cispec
5
6
import (
7
"bytes"
8
"encoding/json"
9
10
"gitlab.com/Timfa/bluegit/internal/i18n"
11
"gitlab.com/Timfa/bluegit/internal/images"
12
)
13
14
// Doc is het document dat de pagina tekent en de API teruggeeft.
15
type Doc struct {
16
File string `json:"file"`
17
Example string `json:"example"`
18
Sections []Section `json:"sections"`
19
}
20
21
// Section is één blok: sleutelwoorden, variabelen, verschillen of presets.
22
type Section struct {
23
ID string `json:"id"`
24
Title string `json:"title"`
25
Intro string `json:"intro,omitempty"`
26
Kind string `json:"kind"`
27
Items []Item `json:"items,omitempty"`
28
Variables []Variable `json:"variables,omitempty"`
29
Lines []string `json:"lines,omitempty"`
30
Presets []Preset `json:"presets,omitempty"`
31
}
32
33
// Item is één sleutelwoord.
34
type Item struct {
35
Name string `json:"name"`
36
Summary string `json:"summary"`
37
}
38
39
// Variable is een voorgedefinieerde CI_-variabele.
40
// Scope is both, container of mr en blijft in het Engels, ook als de pagina vertaald is.
41
type Variable struct {
42
Name string `json:"name"`
43
Scope string `json:"scope"`
44
Where string `json:"where"`
45
Summary string `json:"summary"`
46
}
47
48
// Preset is één image-alias zoals Steve die bouwt of mapt.
49
type Preset struct {
50
Name string `json:"name"`
51
Runtime string `json:"runtime"`
52
From string `json:"from"`
53
Tools []string `json:"tools"`
54
Mode string `json:"mode"`
55
}
56
57
const example = `image: bluegit/base
58
unit:
59
stage: test
60
image: bluegit/node
61
script:
62
- node --version
63
plain:
64
stage: test
65
image: node:22
66
script:
67
- node --version
68
`
69
70
// Build maakt het document in lang. presets nil gebruikt de ingebouwde lijst.
71
func Build(lang i18n.Lang, presets []images.Preset) Doc {
72
if presets == nil {
73
presets = images.Builtin()
74
}
75
t := func(key string) string { return i18n.T(lang, key) }
76
kw := func(name, key string) Item { return Item{Name: name, Summary: t(key)} }
77
where := map[string]string{
78
"both": t("info.where.both"),
79
"container": t("info.where.container"),
80
"mr": t("info.where.mr"),
81
}
82
variable := func(name, scope string) Variable {
83
return Variable{Name: name, Scope: scope, Where: where[scope], Summary: t("info.var." + name)}
84
}
85
doc := Doc{
86
File: "blue-ci-cd.yml",
87
Example: example,
88
Sections: []Section{
89
{
90
ID: "pipeline", Title: t("info.sec.pipeline"), Kind: "keywords",
91
Items: []Item{
92
kw("stages", "info.kw.stages"),
93
kw("variables", "info.kw.variables"),
94
kw("image", "info.kw.image"),
95
kw("default", "info.kw.default"),
96
kw("include", "info.kw.include"),
97
kw("before_script", "info.kw.before_script"),
98
kw("after_script", "info.kw.after_script"),
99
kw("cache", "info.kw.cache"),
100
kw("workflow", "info.kw.workflow"),
101
kw("jobs", "info.kw.jobs"),
102
},
103
},
104
{
105
ID: "jobs", Title: t("info.sec.job"), Kind: "keywords",
106
Items: []Item{
107
kw("stage", "info.kw.stage"),
108
kw("image", "info.kw.image"),
109
kw("before_script", "info.kw.before_script"),
110
kw("script", "info.kw.script"),
111
kw("after_script", "info.kw.after_script"),
112
kw("needs", "info.kw.needs"),
113
kw("rules", "info.kw.rules"),
114
kw("only", "info.kw.only"),
115
kw("except", "info.kw.except"),
116
kw("when", "info.kw.when"),
117
kw("allow_failure", "info.kw.allow_failure"),
118
kw("artifacts", "info.kw.artifacts"),
119
kw("cache", "info.kw.cache"),
120
kw("resource_group", "info.kw.resource_group"),
121
kw("timeout", "info.kw.timeout"),
122
kw("retry", "info.kw.retry"),
123
kw("parallel", "info.kw.parallel"),
124
kw("services", "info.kw.services"),
125
kw("environment", "info.kw.environment"),
126
kw("interruptible", "info.kw.interruptible"),
127
kw("tags", "info.kw.tags"),
128
kw("extends", "info.kw.extends"),
129
},
130
},
131
{
132
ID: "rules", Title: t("info.sec.rules"), Kind: "keywords",
133
Intro: t("info.rules.intro"),
134
Items: []Item{
135
kw("if", "info.kw.if"),
136
kw("changes", "info.kw.changes"),
137
kw("exists", "info.kw.exists"),
138
kw("when", "info.kw.when"),
139
},
140
},
141
{
142
ID: "variables", Title: t("info.sec.variables"), Kind: "variables",
143
Variables: []Variable{
144
variable("CI", "both"),
145
variable("CI_CONFIG_PATH", "both"),
146
variable("CI_SERVER_NAME", "both"),
147
variable("CI_COMMIT_SHA", "both"),
148
variable("CI_COMMIT_SHORT_SHA", "both"),
149
variable("CI_COMMIT_REF", "both"),
150
variable("CI_COMMIT_REF_NAME", "both"),
151
variable("CI_COMMIT_REF_SLUG", "both"),
152
variable("CI_COMMIT_TITLE", "both"),
153
variable("CI_COMMIT_BRANCH", "both"),
154
variable("CI_COMMIT_TAG", "both"),
155
variable("CI_DEFAULT_BRANCH", "both"),
156
variable("CI_PIPELINE_ID", "both"),
157
variable("CI_PIPELINE_SOURCE", "both"),
158
variable("CI_PIPELINE_URL", "both"),
159
variable("CI_PROJECT_PATH", "both"),
160
variable("CI_PROJECT_NAME", "both"),
161
variable("CI_PROJECT_NAMESPACE", "both"),
162
variable("CI_PROJECT_URL", "both"),
163
variable("CI_API_URL", "both"),
164
variable("CI_JOB_ID", "container"),
165
variable("CI_JOB_NAME", "container"),
166
variable("CI_JOB_STAGE", "container"),
167
variable("CI_JOB_URL", "container"),
168
variable("CI_JOB_TOKEN", "container"),
169
variable("CI_NODE_INDEX", "container"),
170
variable("CI_NODE_TOTAL", "container"),
171
variable("CI_ENVIRONMENT_NAME", "container"),
172
variable("CI_ENVIRONMENT_URL", "container"),
173
variable("CI_MERGE_REQUEST_ID", "mr"),
174
variable("CI_MERGE_REQUEST_IID", "mr"),
175
variable("CI_MERGE_REQUEST_TITLE", "mr"),
176
variable("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME", "mr"),
177
variable("CI_MERGE_REQUEST_SOURCE_BRANCH_SHA", "mr"),
178
variable("CI_MERGE_REQUEST_TARGET_BRANCH_NAME", "mr"),
179
variable("CI_MERGE_REQUEST_TARGET_BRANCH_SHA", "mr"),
180
variable("CI_MERGE_REQUEST_PROJECT_PATH", "mr"),
181
variable("CI_MERGE_REQUEST_PROJECT_URL", "mr"),
182
},
183
},
184
{
185
ID: "differences", Title: t("info.sec.diff"), Kind: "list",
186
Lines: []string{
187
t("info.diff.file"),
188
t("info.diff.runner"),
189
t("info.diff.include"),
190
t("info.diff.unsupported"),
191
t("info.diff.services"),
192
t("info.diff.env"),
193
t("info.diff.retry"),
194
t("info.diff.parallel"),
195
t("info.diff.rules"),
196
t("info.diff.mr"),
197
t("info.diff.cache"),
198
t("info.diff.images"),
199
},
200
},
201
{
202
ID: "presets", Title: t("info.sec.presets"), Kind: "presets",
203
Intro: t("info.presets.intro") + " " + t("info.presets.config"),
204
Presets: presetDocs(presets),
205
},
206
},
207
}
208
return doc
209
}
210
211
func presetDocs(in []images.Preset) []Preset {
212
out := make([]Preset, 0, len(in))
213
for _, p := range in {
214
mode := "dockerfile"
215
if p.Direct != "" {
216
mode = "image"
217
}
218
tools := p.Tools
219
if tools == nil {
220
tools = []string{}
221
}
222
out = append(out, Preset{
223
Name: p.Name, Runtime: p.Runtime, From: p.From, Tools: tools, Mode: mode,
224
})
225
}
226
return out
227
}
228
229
// Marshal is de JSON die de pagina in het scriptblok zet en de API schrijft.
230
func Marshal(doc Doc) []byte {
231
var buf bytes.Buffer
232
enc := json.NewEncoder(&buf)
233
enc.SetEscapeHTML(true)
234
_ = enc.Encode(doc)
235
return buf.Bytes()
236
}
@@ -0,0 +1,236 @@1
// Package cispec is de blue-ci-cd.yml-specificatie.2
// De infopagina en GET /api/v1/ci/spec gebruiken allebei Build, zodat de3
// tekst en de presets niet uit elkaar lopen.4
package cispec5
6
import (7
"bytes"8
"encoding/json"9
10
"gitlab.com/Timfa/bluegit/internal/i18n"11
"gitlab.com/Timfa/bluegit/internal/images"12
)13
14
// Doc is het document dat de pagina tekent en de API teruggeeft.15
type Doc struct {16
File string `json:"file"`17
Example string `json:"example"`18
Sections []Section `json:"sections"`19
}20
21
// Section is één blok: sleutelwoorden, variabelen, verschillen of presets.22
type Section struct {23
ID string `json:"id"`24
Title string `json:"title"`25
Intro string `json:"intro,omitempty"`26
Kind string `json:"kind"`27
Items []Item `json:"items,omitempty"`28
Variables []Variable `json:"variables,omitempty"`29
Lines []string `json:"lines,omitempty"`30
Presets []Preset `json:"presets,omitempty"`31
}32
33
// Item is één sleutelwoord.34
type Item struct {35
Name string `json:"name"`36
Summary string `json:"summary"`37
}38
39
// Variable is een voorgedefinieerde CI_-variabele.40
// Scope is both, container of mr en blijft in het Engels, ook als de pagina vertaald is.41
type Variable struct {42
Name string `json:"name"`43
Scope string `json:"scope"`44
Where string `json:"where"`45
Summary string `json:"summary"`46
}47
48
// Preset is één image-alias zoals Steve die bouwt of mapt.49
type Preset struct {50
Name string `json:"name"`51
Runtime string `json:"runtime"`52
From string `json:"from"`53
Tools []string `json:"tools"`54
Mode string `json:"mode"`55
}56
57
const example = `image: bluegit/base58
unit:59
stage: test60
image: bluegit/node61
script:62
- node --version63
plain:64
stage: test65
image: node:2266
script:67
- node --version68
`69
70
// Build maakt het document in lang. presets nil gebruikt de ingebouwde lijst.71
func Build(lang i18n.Lang, presets []images.Preset) Doc {72
if presets == nil {73
presets = images.Builtin()74
}75
t := func(key string) string { return i18n.T(lang, key) }76
kw := func(name, key string) Item { return Item{Name: name, Summary: t(key)} }77
where := map[string]string{78
"both": t("info.where.both"),79
"container": t("info.where.container"),80
"mr": t("info.where.mr"),81
}82
variable := func(name, scope string) Variable {83
return Variable{Name: name, Scope: scope, Where: where[scope], Summary: t("info.var." + name)}84
}85
doc := Doc{86
File: "blue-ci-cd.yml",87
Example: example,88
Sections: []Section{89
{90
ID: "pipeline", Title: t("info.sec.pipeline"), Kind: "keywords",91
Items: []Item{92
kw("stages", "info.kw.stages"),93
kw("variables", "info.kw.variables"),94
kw("image", "info.kw.image"),95
kw("default", "info.kw.default"),96
kw("include", "info.kw.include"),97
kw("before_script", "info.kw.before_script"),98
kw("after_script", "info.kw.after_script"),99
kw("cache", "info.kw.cache"),100
kw("workflow", "info.kw.workflow"),101
kw("jobs", "info.kw.jobs"),102
},103
},104
{105
ID: "jobs", Title: t("info.sec.job"), Kind: "keywords",106
Items: []Item{107
kw("stage", "info.kw.stage"),108
kw("image", "info.kw.image"),109
kw("before_script", "info.kw.before_script"),110
kw("script", "info.kw.script"),111
kw("after_script", "info.kw.after_script"),112
kw("needs", "info.kw.needs"),113
kw("rules", "info.kw.rules"),114
kw("only", "info.kw.only"),115
kw("except", "info.kw.except"),116
kw("when", "info.kw.when"),117
kw("allow_failure", "info.kw.allow_failure"),118
kw("artifacts", "info.kw.artifacts"),119
kw("cache", "info.kw.cache"),120
kw("resource_group", "info.kw.resource_group"),121
kw("timeout", "info.kw.timeout"),122
kw("retry", "info.kw.retry"),123
kw("parallel", "info.kw.parallel"),124
kw("services", "info.kw.services"),125
kw("environment", "info.kw.environment"),126
kw("interruptible", "info.kw.interruptible"),127
kw("tags", "info.kw.tags"),128
kw("extends", "info.kw.extends"),129
},130
},131
{132
ID: "rules", Title: t("info.sec.rules"), Kind: "keywords",133
Intro: t("info.rules.intro"),134
Items: []Item{135
kw("if", "info.kw.if"),136
kw("changes", "info.kw.changes"),137
kw("exists", "info.kw.exists"),138
kw("when", "info.kw.when"),139
},140
},141
{142
ID: "variables", Title: t("info.sec.variables"), Kind: "variables",143
Variables: []Variable{144
variable("CI", "both"),145
variable("CI_CONFIG_PATH", "both"),146
variable("CI_SERVER_NAME", "both"),147
variable("CI_COMMIT_SHA", "both"),148
variable("CI_COMMIT_SHORT_SHA", "both"),149
variable("CI_COMMIT_REF", "both"),150
variable("CI_COMMIT_REF_NAME", "both"),151
variable("CI_COMMIT_REF_SLUG", "both"),152
variable("CI_COMMIT_TITLE", "both"),153
variable("CI_COMMIT_BRANCH", "both"),154
variable("CI_COMMIT_TAG", "both"),155
variable("CI_DEFAULT_BRANCH", "both"),156
variable("CI_PIPELINE_ID", "both"),157
variable("CI_PIPELINE_SOURCE", "both"),158
variable("CI_PIPELINE_URL", "both"),159
variable("CI_PROJECT_PATH", "both"),160
variable("CI_PROJECT_NAME", "both"),161
variable("CI_PROJECT_NAMESPACE", "both"),162
variable("CI_PROJECT_URL", "both"),163
variable("CI_API_URL", "both"),164
variable("CI_JOB_ID", "container"),165
variable("CI_JOB_NAME", "container"),166
variable("CI_JOB_STAGE", "container"),167
variable("CI_JOB_URL", "container"),168
variable("CI_JOB_TOKEN", "container"),169
variable("CI_NODE_INDEX", "container"),170
variable("CI_NODE_TOTAL", "container"),171
variable("CI_ENVIRONMENT_NAME", "container"),172
variable("CI_ENVIRONMENT_URL", "container"),173
variable("CI_MERGE_REQUEST_ID", "mr"),174
variable("CI_MERGE_REQUEST_IID", "mr"),175
variable("CI_MERGE_REQUEST_TITLE", "mr"),176
variable("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME", "mr"),177
variable("CI_MERGE_REQUEST_SOURCE_BRANCH_SHA", "mr"),178
variable("CI_MERGE_REQUEST_TARGET_BRANCH_NAME", "mr"),179
variable("CI_MERGE_REQUEST_TARGET_BRANCH_SHA", "mr"),180
variable("CI_MERGE_REQUEST_PROJECT_PATH", "mr"),181
variable("CI_MERGE_REQUEST_PROJECT_URL", "mr"),182
},183
},184
{185
ID: "differences", Title: t("info.sec.diff"), Kind: "list",186
Lines: []string{187
t("info.diff.file"),188
t("info.diff.runner"),189
t("info.diff.include"),190
t("info.diff.unsupported"),191
t("info.diff.services"),192
t("info.diff.env"),193
t("info.diff.retry"),194
t("info.diff.parallel"),195
t("info.diff.rules"),196
t("info.diff.mr"),197
t("info.diff.cache"),198
t("info.diff.images"),199
},200
},201
{202
ID: "presets", Title: t("info.sec.presets"), Kind: "presets",203
Intro: t("info.presets.intro") + " " + t("info.presets.config"),204
Presets: presetDocs(presets),205
},206
},207
}208
return doc209
}210
211
func presetDocs(in []images.Preset) []Preset {212
out := make([]Preset, 0, len(in))213
for _, p := range in {214
mode := "dockerfile"215
if p.Direct != "" {216
mode = "image"217
}218
tools := p.Tools219
if tools == nil {220
tools = []string{}221
}222
out = append(out, Preset{223
Name: p.Name, Runtime: p.Runtime, From: p.From, Tools: tools, Mode: mode,224
})225
}226
return out227
}228
229
// Marshal is de JSON die de pagina in het scriptblok zet en de API schrijft.230
func Marshal(doc Doc) []byte {231
var buf bytes.Buffer232
enc := json.NewEncoder(&buf)233
enc.SetEscapeHTML(true)234
_ = enc.Encode(doc)235
return buf.Bytes()236
}@@ -0,0 +1,68 @@
1
package cispec
2
3
import (
4
"encoding/json"
5
"strings"
6
"testing"
7
8
"gitlab.com/Timfa/bluegit/internal/i18n"
9
"gitlab.com/Timfa/bluegit/internal/images"
10
)
11
12
func TestDocumentListsSpecAndPresets(t *testing.T) {
13
doc := Build(i18n.EN, nil)
14
raw := Marshal(doc)
15
var again Doc
16
if err := json.Unmarshal(raw, &again); err != nil {
17
t.Fatal(err)
18
}
19
if string(Marshal(again)) != string(raw) {
20
t.Fatal("marshal loopt uiteen")
21
}
22
names := map[string]bool{}
23
for _, sec := range doc.Sections {
24
for _, item := range sec.Items {
25
names[item.Name] = true
26
if item.Summary == "" || item.Summary == "info.kw."+strings.ReplaceAll(item.Name, ".", "") {
27
t.Fatalf("lege tekst %s", item.Name)
28
}
29
}
30
}
31
for _, name := range []string{"stages", "workflow", "rules", "retry", "parallel", "services", "environment", "interruptible", "artifacts", "cache", "needs", "extends", "if", "changes", "exists"} {
32
if !names[name] {
33
t.Fatalf("mist %s", name)
34
}
35
}
36
var presets []Preset
37
var variables []Variable
38
for _, sec := range doc.Sections {
39
presets = append(presets, sec.Presets...)
40
variables = append(variables, sec.Variables...)
41
}
42
if len(presets) != 7 || presets[0].Name != "bluegit/base" || presets[0].From != "alpine:3.20" || presets[0].Mode != "dockerfile" {
43
t.Fatalf("presets %+v", presets)
44
}
45
found := map[string]Variable{}
46
for _, v := range variables {
47
found[v.Name] = v
48
}
49
if found["CI_JOB_TOKEN"].Scope != "container" || found["CI_PIPELINE_ID"].Scope != "both" || found["CI_MERGE_REQUEST_IID"].Scope != "mr" {
50
t.Fatalf("scopes %+v %+v %+v", found["CI_JOB_TOKEN"], found["CI_PIPELINE_ID"], found["CI_MERGE_REQUEST_IID"])
51
}
52
nl := Build(i18n.NL, nil)
53
if nl.Sections[0].Title == doc.Sections[0].Title && nl.Sections[0].Items[0].Summary == doc.Sections[0].Items[0].Summary {
54
t.Fatal("Nederlands valt terug op Engels")
55
}
56
cu := Build(i18n.Cuneiform, images.Builtin())
57
if cu.Sections[0].Items[0].Name != "stages" {
58
t.Fatal(cu.Sections[0].Items[0].Name)
59
}
60
for _, r := range cu.Sections[0].Title {
61
if r == ' ' {
62
continue
63
}
64
if r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z' {
65
t.Fatalf("Latijn in de titel %s", cu.Sections[0].Title)
66
}
67
}
68
}
@@ -0,0 +1,68 @@1
package cispec2
3
import (4
"encoding/json"5
"strings"6
"testing"7
8
"gitlab.com/Timfa/bluegit/internal/i18n"9
"gitlab.com/Timfa/bluegit/internal/images"10
)11
12
func TestDocumentListsSpecAndPresets(t *testing.T) {13
doc := Build(i18n.EN, nil)14
raw := Marshal(doc)15
var again Doc16
if err := json.Unmarshal(raw, &again); err != nil {17
t.Fatal(err)18
}19
if string(Marshal(again)) != string(raw) {20
t.Fatal("marshal loopt uiteen")21
}22
names := map[string]bool{}23
for _, sec := range doc.Sections {24
for _, item := range sec.Items {25
names[item.Name] = true26
if item.Summary == "" || item.Summary == "info.kw."+strings.ReplaceAll(item.Name, ".", "") {27
t.Fatalf("lege tekst %s", item.Name)28
}29
}30
}31
for _, name := range []string{"stages", "workflow", "rules", "retry", "parallel", "services", "environment", "interruptible", "artifacts", "cache", "needs", "extends", "if", "changes", "exists"} {32
if !names[name] {33
t.Fatalf("mist %s", name)34
}35
}36
var presets []Preset37
var variables []Variable38
for _, sec := range doc.Sections {39
presets = append(presets, sec.Presets...)40
variables = append(variables, sec.Variables...)41
}42
if len(presets) != 7 || presets[0].Name != "bluegit/base" || presets[0].From != "alpine:3.20" || presets[0].Mode != "dockerfile" {43
t.Fatalf("presets %+v", presets)44
}45
found := map[string]Variable{}46
for _, v := range variables {47
found[v.Name] = v48
}49
if found["CI_JOB_TOKEN"].Scope != "container" || found["CI_PIPELINE_ID"].Scope != "both" || found["CI_MERGE_REQUEST_IID"].Scope != "mr" {50
t.Fatalf("scopes %+v %+v %+v", found["CI_JOB_TOKEN"], found["CI_PIPELINE_ID"], found["CI_MERGE_REQUEST_IID"])51
}52
nl := Build(i18n.NL, nil)53
if nl.Sections[0].Title == doc.Sections[0].Title && nl.Sections[0].Items[0].Summary == doc.Sections[0].Items[0].Summary {54
t.Fatal("Nederlands valt terug op Engels")55
}56
cu := Build(i18n.Cuneiform, images.Builtin())57
if cu.Sections[0].Items[0].Name != "stages" {58
t.Fatal(cu.Sections[0].Items[0].Name)59
}60
for _, r := range cu.Sections[0].Title {61
if r == ' ' {62
continue63
}64
if r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z' {65
t.Fatalf("Latijn in de titel %s", cu.Sections[0].Title)66
}67
}68
}@@ -6,9 +6,11 @@ import (
6
6
"net"
7
7
"net/url"
8
8
"os"
9
"path/filepath"
9
10
"strconv"
10
11
"strings"
11
12
13
"gitlab.com/Timfa/bluegit/internal/images"
12
14
"gitlab.com/Timfa/bluegit/internal/realip"
13
15
"gopkg.in/yaml.v3"
14
16
)
@@ -73,11 +75,32 @@ type Runner struct {
73
75
74
76
// CI stuurt de Docker-runner.
75
77
type CI struct {
76
Enabled bool `yaml:"enabled"`
77
Docker string `yaml:"docker_binary"`
78
Concurrency int `yaml:"concurrency"`
79
Network string `yaml:"network"`
80
TimeoutSec int `yaml:"timeout_seconds"`
78
Enabled bool `yaml:"enabled"`
79
Docker string `yaml:"docker_binary"`
80
Concurrency int `yaml:"concurrency"`
81
Network string `yaml:"network"`
82
TimeoutSec int `yaml:"timeout_seconds"`
83
Presets map[string]PresetConfig `yaml:"presets"`
84
}
85
86
// PresetConfig is één image-alias. image mapt direct. dockerfile wordt
87
// door Steve gebouwd. from herschrijft de eerste FROM van een Dockerfile.
88
type PresetConfig struct {
89
Image string `yaml:"image"`
90
Dockerfile string `yaml:"dockerfile"`
91
From string `yaml:"from"`
92
}
93
94
// ImageOverrides is de vorm die de runner en de infopagina lezen.
95
func (c CI) ImageOverrides() map[string]images.Override {
96
if len(c.Presets) == 0 {
97
return nil
98
}
99
out := make(map[string]images.Override, len(c.Presets))
100
for name, p := range c.Presets {
101
out[name] = images.Override{Image: p.Image, Dockerfile: p.Dockerfile, From: p.From}
102
}
103
return out
81
104
}
82
105
83
106
// Load leest path en vult ontbrekende waarden aan.
@@ -110,12 +133,26 @@ func Load(path string) (Config, error) {
110
133
}
111
134
c.Auth.ClientSecret = strings.TrimSpace(string(b))
112
135
}
136
c.resolvePresetPaths(path)
113
137
if err := c.Validate(); err != nil {
114
138
return Config{}, err
115
139
}
116
140
return c, nil
117
141
}
118
142
143
func (c *Config) resolvePresetPaths(configFile string) {
144
if len(c.CI.Presets) == 0 {
145
return
146
}
147
base := filepath.Dir(configFile)
148
for name, p := range c.CI.Presets {
149
if p.Dockerfile != "" && !filepath.IsAbs(p.Dockerfile) {
150
p.Dockerfile = filepath.Join(base, p.Dockerfile)
151
c.CI.Presets[name] = p
152
}
153
}
154
}
155
119
156
func (c *Config) applyDefaults() {
120
157
if c.Listen == "" {
121
158
c.Listen = "127.0.0.1:8080"
@@ -220,6 +257,9 @@ func (c *Config) Validate() error {
220
257
if _, _, err := net.SplitHostPort(c.SSH.Listen); err != nil {
221
258
return fmt.Errorf("ssh.listen moet host:poort zijn")
222
259
}
260
if _, err := images.Effective(c.CI.ImageOverrides()); err != nil {
261
return err
262
}
223
263
return nil
224
264
}
225
265
@@ -321,5 +361,15 @@ ci:
321
361
concurrency: 1
322
362
network: bridge
323
363
timeout_seconds: 1800
364
# Image-aliassen voor jobs. bluegit/base, bluegit/node, bluegit/python,
365
# bluegit/go, bluegit/rust, bluegit/java en bluegit/dotnet zijn ingebouwd.
366
# Een eigen alias wijst naar een Dockerfile of naar een kant-en-klaar image.
367
# presets:
368
# team/tools:
369
# image: alpine:3.20
370
# team/build:
371
# dockerfile: /etc/bluegit/images/build/Dockerfile
372
# bluegit/node:
373
# from: node:22-bookworm
324
374
`
325
375
}
@@ -6,9 +6,11 @@ import (6
"net"6
"net"7
"net/url"7
"net/url"8
"os"8
"os"9
"path/filepath"9
"strconv"10
"strconv"10
"strings"11
"strings"11
12
13
"gitlab.com/Timfa/bluegit/internal/images"12
"gitlab.com/Timfa/bluegit/internal/realip"14
"gitlab.com/Timfa/bluegit/internal/realip"13
"gopkg.in/yaml.v3"15
"gopkg.in/yaml.v3"14
)16
)@@ -73,11 +75,32 @@ type Runner struct {73
75
74
// CI stuurt de Docker-runner.76
// CI stuurt de Docker-runner.75
type CI struct {77
type CI struct {76
Enabled bool `yaml:"enabled"`78
Enabled bool `yaml:"enabled"`77
Docker string `yaml:"docker_binary"`79
Docker string `yaml:"docker_binary"`78
Concurrency int `yaml:"concurrency"`80
Concurrency int `yaml:"concurrency"`79
Network string `yaml:"network"`81
Network string `yaml:"network"`80
TimeoutSec int `yaml:"timeout_seconds"`82
TimeoutSec int `yaml:"timeout_seconds"`83
Presets map[string]PresetConfig `yaml:"presets"`84
}85
86
// PresetConfig is één image-alias. image mapt direct. dockerfile wordt87
// door Steve gebouwd. from herschrijft de eerste FROM van een Dockerfile.88
type PresetConfig struct {89
Image string `yaml:"image"`90
Dockerfile string `yaml:"dockerfile"`91
From string `yaml:"from"`92
}93
94
// ImageOverrides is de vorm die de runner en de infopagina lezen.95
func (c CI) ImageOverrides() map[string]images.Override {96
if len(c.Presets) == 0 {97
return nil98
}99
out := make(map[string]images.Override, len(c.Presets))100
for name, p := range c.Presets {101
out[name] = images.Override{Image: p.Image, Dockerfile: p.Dockerfile, From: p.From}102
}103
return out81
}104
}82
105
83
// Load leest path en vult ontbrekende waarden aan.106
// Load leest path en vult ontbrekende waarden aan.@@ -110,12 +133,26 @@ func Load(path string) (Config, error) {110
}133
}111
c.Auth.ClientSecret = strings.TrimSpace(string(b))134
c.Auth.ClientSecret = strings.TrimSpace(string(b))112
}135
}136
c.resolvePresetPaths(path)113
if err := c.Validate(); err != nil {137
if err := c.Validate(); err != nil {114
return Config{}, err138
return Config{}, err115
}139
}116
return c, nil140
return c, nil117
}141
}118
142
143
func (c *Config) resolvePresetPaths(configFile string) {144
if len(c.CI.Presets) == 0 {145
return146
}147
base := filepath.Dir(configFile)148
for name, p := range c.CI.Presets {149
if p.Dockerfile != "" && !filepath.IsAbs(p.Dockerfile) {150
p.Dockerfile = filepath.Join(base, p.Dockerfile)151
c.CI.Presets[name] = p152
}153
}154
}155
119
func (c *Config) applyDefaults() {156
func (c *Config) applyDefaults() {120
if c.Listen == "" {157
if c.Listen == "" {121
c.Listen = "127.0.0.1:8080"158
c.Listen = "127.0.0.1:8080"@@ -220,6 +257,9 @@ func (c *Config) Validate() error {220
if _, _, err := net.SplitHostPort(c.SSH.Listen); err != nil {257
if _, _, err := net.SplitHostPort(c.SSH.Listen); err != nil {221
return fmt.Errorf("ssh.listen moet host:poort zijn")258
return fmt.Errorf("ssh.listen moet host:poort zijn")222
}259
}260
if _, err := images.Effective(c.CI.ImageOverrides()); err != nil {261
return err262
}223
return nil263
return nil224
}264
}225
265
@@ -321,5 +361,15 @@ ci:321
concurrency: 1361
concurrency: 1322
network: bridge362
network: bridge323
timeout_seconds: 1800363
timeout_seconds: 1800364
# Image-aliassen voor jobs. bluegit/base, bluegit/node, bluegit/python,365
# bluegit/go, bluegit/rust, bluegit/java en bluegit/dotnet zijn ingebouwd.366
# Een eigen alias wijst naar een Dockerfile of naar een kant-en-klaar image.367
# presets:368
# team/tools:369
# image: alpine:3.20370
# team/build:371
# dockerfile: /etc/bluegit/images/build/Dockerfile372
# bluegit/node:373
# from: node:22-bookworm324
`374
`325
}375
}@@ -7,6 +7,37 @@ import (
7
7
"testing"
8
8
)
9
9
10
func TestPresetConfig(t *testing.T) {
11
dir := t.TempDir()
12
path := filepath.Join(dir, "config.yml")
13
docker := filepath.Join(dir, "Dockerfile")
14
if err := os.WriteFile(docker, []byte("FROM alpine:3.20\nRUN apk add --no-cache git\n"), 0o644); err != nil {
15
t.Fatal(err)
16
}
17
body := []byte("base_url: https://git.example.test\nauth:\n mode: oauth\n client_id: git.example.test\nci:\n presets:\n bluegit/node:\n from: node:22-bookworm\n team/tools:\n dockerfile: Dockerfile\n team/plain:\n image: alpine:3.20\n")
18
if err := os.WriteFile(path, body, 0o600); err != nil {
19
t.Fatal(err)
20
}
21
t.Setenv("BLUEGIT_AUTH_CLIENT_SECRET", "geheim")
22
cfg, err := Load(path)
23
if err != nil {
24
t.Fatal(err)
25
}
26
if cfg.CI.Presets["team/tools"].Dockerfile != docker {
27
t.Fatalf("pad %s", cfg.CI.Presets["team/tools"].Dockerfile)
28
}
29
if cfg.CI.Presets["bluegit/node"].From != "node:22-bookworm" || cfg.CI.Presets["team/plain"].Image != "alpine:3.20" {
30
t.Fatalf("%+v", cfg.CI.Presets)
31
}
32
bad := []byte("base_url: https://git.example.test\nauth:\n mode: oauth\n client_id: git.example.test\nci:\n presets:\n node:22:\n image: alpine\n")
33
if err := os.WriteFile(path, bad, 0o600); err != nil {
34
t.Fatal(err)
35
}
36
if _, err := Load(path); err == nil {
37
t.Fatal("een tag in de aliasnaam hoort te falen")
38
}
39
}
40
10
41
func TestRunnerName(t *testing.T) {
11
42
dir := t.TempDir()
12
43
path := filepath.Join(dir, "config.yml")
@@ -7,6 +7,37 @@ import (7
"testing"7
"testing"8
)8
)9
9
10
func TestPresetConfig(t *testing.T) {11
dir := t.TempDir()12
path := filepath.Join(dir, "config.yml")13
docker := filepath.Join(dir, "Dockerfile")14
if err := os.WriteFile(docker, []byte("FROM alpine:3.20\nRUN apk add --no-cache git\n"), 0o644); err != nil {15
t.Fatal(err)16
}17
body := []byte("base_url: https://git.example.test\nauth:\n mode: oauth\n client_id: git.example.test\nci:\n presets:\n bluegit/node:\n from: node:22-bookworm\n team/tools:\n dockerfile: Dockerfile\n team/plain:\n image: alpine:3.20\n")18
if err := os.WriteFile(path, body, 0o600); err != nil {19
t.Fatal(err)20
}21
t.Setenv("BLUEGIT_AUTH_CLIENT_SECRET", "geheim")22
cfg, err := Load(path)23
if err != nil {24
t.Fatal(err)25
}26
if cfg.CI.Presets["team/tools"].Dockerfile != docker {27
t.Fatalf("pad %s", cfg.CI.Presets["team/tools"].Dockerfile)28
}29
if cfg.CI.Presets["bluegit/node"].From != "node:22-bookworm" || cfg.CI.Presets["team/plain"].Image != "alpine:3.20" {30
t.Fatalf("%+v", cfg.CI.Presets)31
}32
bad := []byte("base_url: https://git.example.test\nauth:\n mode: oauth\n client_id: git.example.test\nci:\n presets:\n node:22:\n image: alpine\n")33
if err := os.WriteFile(path, bad, 0o600); err != nil {34
t.Fatal(err)35
}36
if _, err := Load(path); err == nil {37
t.Fatal("een tag in de aliasnaam hoort te falen")38
}39
}40
10
func TestRunnerName(t *testing.T) {41
func TestRunnerName(t *testing.T) {11
dir := t.TempDir()42
dir := t.TempDir()12
path := filepath.Join(dir, "config.yml")43
path := filepath.Join(dir, "config.yml")@@ -0,0 +1,467 @@
1
package i18n
2
3
// De infopagina staat apart, zodat de grote catalogi niet opnieuw uitgelijnd worden.
4
func init() {
5
addCatalog(en, infoEN)
6
addCatalog(nl, infoNL)
7
addCatalog(de, infoDE)
8
addCatalog(fr, infoFR)
9
}
10
11
func addCatalog(dst, src map[string]string) {
12
for k, v := range src {
13
dst[k] = v
14
}
15
}
16
17
var infoEN = map[string]string{
18
"nav.info": "Info",
19
"title.info": "CI/CD",
20
"info.lead": "Reference for blue-ci-cd.yml and the image presets Steve builds.",
21
22
"info.col.keyword": "Keyword",
23
"info.col.meaning": "Meaning",
24
"info.col.name": "Preset",
25
"info.col.base": "Image",
26
"info.col.tools": "Contents",
27
"info.col.where": "Available",
28
29
"info.sec.pipeline": "Pipeline",
30
"info.sec.job": "Jobs",
31
"info.sec.rules": "Rules",
32
"info.sec.variables": "Variables",
33
"info.sec.diff": "Differences with GitLab",
34
"info.sec.presets": "Image presets",
35
36
"info.where.both": "Rules and container",
37
"info.where.container": "Container only",
38
"info.where.mr": "Merge request",
39
40
"info.rules.intro": "The first matching rule wins. && binds more tightly than ||. Parentheses group an expression. An empty variable is null. == and != compare. =~ and !~ match a RE2 pattern. A slash in a pattern is escaped with a backslash. The flag i sits right after the closing slash. A pattern stored in a variable must be valid when the rule runs.",
41
"info.presets.intro": "A job picks a preset with its image keyword. Steve builds that Dockerfile on first use and reuses the result. Any other name, such as node:22, stays a normal Docker image.",
42
"info.presets.config": "Add or replace a preset under ci.presets in config.yml with image, dockerfile or from.",
43
"info.presets.mapped": "Uses this image as it is.",
44
45
"info.kw.stages": "Stage order. When omitted, stages follow the order in which jobs name them. A job without a stage uses test.",
46
"info.kw.variables": "A string, or a value field. A job overrides the same name. Available in rules and in the container.",
47
"info.kw.image": "Default image, as text or as a name field. default.image wins when that is set. A preset such as bluegit/base is allowed.",
48
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry and interruptible for jobs that do not set them.",
49
"info.kw.include": "Only a local path. A job with the same name is merged and the outer file wins each field.",
50
"info.kw.before_script": "Shell lines that run before script.",
51
"info.kw.after_script": "Shell lines that run after script, also when script fails.",
52
"info.kw.cache": "paths and a text key. Kept on this machine for one repository.",
53
"info.kw.workflow": "rules, like a job. No match, or when never, creates no pipeline.",
54
"info.kw.jobs": "Optional older map of jobs. Jobs may also sit at the top level, but not in both places.",
55
"info.kw.stage": "Stage name. Omitted means test.",
56
"info.kw.script": "Shell lines. The job fails when a line fails.",
57
"info.kw.needs": "Job names, or job and optional. An empty list starts at once. Omitted, the job waits for earlier stages. A need on a parallel job waits for every copy.",
58
"info.kw.rules": "The first match wins. Fields are if, changes, exists and when. Without rules, only and except decide.",
59
"info.kw.only": "A branch name, branches, tags, merge_requests, or a regex between slashes.",
60
"info.kw.except": "The opposite of only.",
61
"info.kw.when": "on_success is the default, also on_failure, always and manual. A rule may say never.",
62
"info.kw.allow_failure": "A failure does not stop the rest. The job itself becomes a warning.",
63
"info.kw.artifacts": "paths and expire_in. Units are seconds, minutes, hours, days, weeks, or never.",
64
"info.kw.resource_group": "Jobs that share this name in one repository do not run at the same time.",
65
"info.kw.timeout": "Replaces the server timeout for this job. The runner stops the container when the time is up.",
66
"info.kw.retry": "A number, or max and when. max runs from 0 to 2 and a higher number is cut off. when names script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure or always.",
67
"info.kw.parallel": "A number up to 50, or a matrix. Numbered jobs are called name 1/N and receive CI_NODE_INDEX and CI_NODE_TOTAL. A matrix is the product of each list, then those products joined. Keys become variables.",
68
"info.kw.services": "Sidecar containers on one network with the job. Text, or name, alias, command, entrypoint and variables. Without an alias the name drops the registry and the tag. There is no health check beyond a started container.",
69
"info.kw.environment": "A name, or name and url. Sets the environment variables. There is no deployment and no stop job.",
70
"info.kw.interruptible": "Off by default. A newer pipeline on the same ref cancels older jobs that set this and are still queued or running.",
71
"info.kw.tags": "Stored on the job. Steve runs every job. Tags do not choose a runner.",
72
"info.kw.extends": "One name or a list. A job whose name starts with a dot is a template and does not run.",
73
"info.kw.if": "An expression. The first rule whose if, changes and exists all match is the winner.",
74
"info.kw.changes": "Paths in the push diff. When that diff cannot be known, the condition matches.",
75
"info.kw.exists": "Every listed path must be in the commit. When the tree is unknown, the condition matches.",
76
77
"info.var.CI": "Always true.",
78
"info.var.CI_CONFIG_PATH": "Path of the pipeline file.",
79
"info.var.CI_SERVER_NAME": "Always BlueGit.",
80
"info.var.CI_COMMIT_SHA": "Full commit id.",
81
"info.var.CI_COMMIT_SHORT_SHA": "First eight characters of the commit id.",
82
"info.var.CI_COMMIT_REF": "Full git ref.",
83
"info.var.CI_COMMIT_REF_NAME": "Branch or tag name.",
84
"info.var.CI_COMMIT_REF_SLUG": "Ref name made safe for a URL.",
85
"info.var.CI_COMMIT_TITLE": "Commit subject.",
86
"info.var.CI_COMMIT_BRANCH": "Branch name. Empty on a tag.",
87
"info.var.CI_COMMIT_TAG": "Tag name. Empty on a branch.",
88
"info.var.CI_DEFAULT_BRANCH": "Default branch of the repository.",
89
"info.var.CI_PIPELINE_ID": "Pipeline number. Zero while rules are evaluated.",
90
"info.var.CI_PIPELINE_SOURCE": "push, web, or merge_request_event.",
91
"info.var.CI_PIPELINE_URL": "Link to the pipeline.",
92
"info.var.CI_PROJECT_PATH": "Owner and repository.",
93
"info.var.CI_PROJECT_NAME": "Repository name.",
94
"info.var.CI_PROJECT_NAMESPACE": "Owner path.",
95
"info.var.CI_PROJECT_URL": "Link to the repository.",
96
"info.var.CI_API_URL": "Root of the API.",
97
"info.var.CI_JOB_ID": "Job number.",
98
"info.var.CI_JOB_NAME": "Job name.",
99
"info.var.CI_JOB_STAGE": "Stage name.",
100
"info.var.CI_JOB_URL": "Link to the job.",
101
"info.var.CI_JOB_TOKEN": "Token for this job. It is masked in the log.",
102
"info.var.CI_NODE_INDEX": "Index of this parallel or matrix job.",
103
"info.var.CI_NODE_TOTAL": "How many parallel or matrix jobs there are.",
104
"info.var.CI_ENVIRONMENT_NAME": "Environment name.",
105
"info.var.CI_ENVIRONMENT_URL": "Environment address.",
106
"info.var.CI_MERGE_REQUEST_ID": "Internal id of the merge request.",
107
"info.var.CI_MERGE_REQUEST_IID": "Number of the merge request in the project.",
108
"info.var.CI_MERGE_REQUEST_TITLE": "Title of the merge request.",
109
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Source branch.",
110
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit of the source branch.",
111
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Target branch.",
112
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Tip of the target branch.",
113
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Project path of the merge request.",
114
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Link to that project.",
115
116
"info.diff.file": "The file is blue-ci-cd.yml, not the GitLab filename.",
117
"info.diff.runner": "There is one runner. Its name is runner.name and the default is Steve. tags do not select another runner.",
118
"info.diff.include": "include only reads a local file. A project, remote or template include is ignored.",
119
"info.diff.unsupported": "pages, spec, trigger pipelines, child pipelines, coverage, id_tokens, inherit and hooks are ignored with a warning.",
120
"info.diff.services": "services at the top level is ignored. Job services share a network and have no health check beyond a started container.",
121
"info.diff.env": "environment only sets variables. There is no deployment and no stop job.",
122
"info.diff.retry": "retry max is capped at 2.",
123
"info.diff.parallel": "parallel is capped at 50.",
124
"info.diff.rules": "The pipeline number is zero while rules run. Job, node and environment variables exist only in the container.",
125
"info.diff.mr": "A merge request pipeline runs on the source commit, not a merged tree. It starts when the request opens, on every push to the source, and again when someone pushes the target.",
126
"info.diff.cache": "cache stays on this machine and is not shared.",
127
"info.diff.images": "An image name that matches a preset is built locally. Every other name is a normal Docker image.",
128
}
129
130
var infoNL = map[string]string{
131
"nav.info": "Info",
132
"title.info": "CI/CD",
133
"info.lead": "Naslag voor blue-ci-cd.yml en de image-presets die Steve bouwt.",
134
135
"info.col.keyword": "Sleutelwoord",
136
"info.col.meaning": "Betekenis",
137
"info.col.name": "Preset",
138
"info.col.base": "Image",
139
"info.col.tools": "Inhoud",
140
"info.col.where": "Beschikbaar",
141
142
"info.sec.pipeline": "Pipeline",
143
"info.sec.job": "Jobs",
144
"info.sec.rules": "Rules",
145
"info.sec.variables": "Variabelen",
146
"info.sec.diff": "Verschillen met GitLab",
147
"info.sec.presets": "Image-presets",
148
149
"info.where.both": "Rules en container",
150
"info.where.container": "Alleen in de container",
151
"info.where.mr": "Merge request",
152
153
"info.rules.intro": "De eerste rule die klopt wint. && bindt sterker dan ||. Haakjes groeperen. Een lege variabele is null. == en != vergelijken. =~ en !~ passen op een RE2-patroon. Een slash in een patroon schrijf je met een backslash. De vlag i staat direct achter de sluithaak. Een patroon in een variabele moet geldig zijn op het moment dat de rule draait.",
154
"info.presets.intro": "Een job kiest een preset met het sleutelwoord image. Steve bouwt die Dockerfile bij het eerste gebruik en hergebruikt het resultaat. Elke andere naam, zoals node:22, blijft een gewoon Docker-image.",
155
"info.presets.config": "Een preset toevoegen of vervangen doe je onder ci.presets in config.yml, met image, dockerfile of from.",
156
"info.presets.mapped": "Gebruikt dit image zoals het is.",
157
158
"info.kw.stages": "Volgorde van de stages. Weggelaten volgen de stages de volgorde waarin jobs ze noemen. Een job zonder stage gebruikt test.",
159
"info.kw.variables": "Een tekst, of een veld value. Een job overschrijft dezelfde naam. Beschikbaar in rules en in de container.",
160
"info.kw.image": "Standaardimage, als tekst of als veld name. default.image wint als dat gezet is. Een preset zoals bluegit/base mag.",
161
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry en interruptible voor jobs die ze zelf niet zetten.",
162
"info.kw.include": "Alleen een lokaal pad. Een job met dezelfde naam wordt samengevoegd en het buitenste bestand wint per veld.",
163
"info.kw.before_script": "Shellregels die voor script draaien.",
164
"info.kw.after_script": "Shellregels die na script draaien, ook als script mislukt.",
165
"info.kw.cache": "paths en een tekstuele key. Blijft op deze machine voor één repository.",
166
"info.kw.workflow": "rules, zoals bij een job. Geen treffer, of when never, maakt geen pipeline.",
167
"info.kw.jobs": "Optionele oudere map van jobs. Jobs mogen ook op het hoogste niveau staan, maar niet op beide plekken.",
168
"info.kw.stage": "Naam van de stage. Weggelaten betekent test.",
169
"info.kw.script": "Shellregels. De job faalt als een regel faalt.",
170
"info.kw.needs": "Jobnamen, of job en optional. Een lege lijst start meteen. Weggelaten wacht de job op eerdere stages. Een need op een parallel-job wacht op elk exemplaar.",
171
"info.kw.rules": "De eerste treffer wint. Velden zijn if, changes, exists en when. Zonder rules beslissen only en except.",
172
"info.kw.only": "Een taknaam, branches, tags, merge_requests, of een regex tussen slashes.",
173
"info.kw.except": "Het omgekeerde van only.",
174
"info.kw.when": "on_success is de standaard, verder on_failure, always en manual. Een rule mag never zeggen.",
175
"info.kw.allow_failure": "Een mislukking stopt de rest niet. De job zelf wordt een waarschuwing.",
176
"info.kw.artifacts": "paths en expire_in. Eenheden zijn seconden, minuten, uren, dagen, weken, of never.",
177
"info.kw.resource_group": "Jobs met deze naam in één repository draaien niet tegelijk.",
178
"info.kw.timeout": "Vervangt de servertime-out voor deze job. De runner stopt de container als de tijd om is.",
179
"info.kw.retry": "Een getal, of max en when. max loopt van 0 tot 2 en een hoger getal wordt afgekapt. when noemt script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure of always.",
180
"info.kw.parallel": "Een getal tot 50, of een matrix. Genummerde jobs heten naam 1/N en krijgen CI_NODE_INDEX en CI_NODE_TOTAL. Een matrix is het product van elke lijst, en die producten achter elkaar. Sleutels worden variabelen.",
181
"info.kw.services": "Sidecar-containers op één netwerk met de job. Tekst, of name, alias, command, entrypoint en variables. Zonder alias vervalt de registry en de tag. Er is geen healthcheck verder dan een gestarte container.",
182
"info.kw.environment": "Een naam, of name en url. Zet de omgevingsvariabelen. Er is geen deployment en geen stop-job.",
183
"info.kw.interruptible": "Standaard uit. Een nieuwere pipeline op dezelfde ref annuleert oudere jobs die dit aan hebben en nog in de wachtrij staan of lopen.",
184
"info.kw.tags": "Bewaard bij de job. Steve draait elke job. Tags kiezen geen runner.",
185
"info.kw.extends": "Eén naam of een lijst. Een job waarvan de naam met een punt begint is een sjabloon en draait niet.",
186
"info.kw.if": "Een expressie. De eerste rule waarvan if, changes en exists allemaal kloppen wint.",
187
"info.kw.changes": "Paden in de diff van de push. Is die diff niet te bepalen, dan klopt de voorwaarde.",
188
"info.kw.exists": "Elk genoemd pad moet in de commit staan. Is de boom onbekend, dan klopt de voorwaarde.",
189
190
"info.var.CI": "Altijd waar.",
191
"info.var.CI_CONFIG_PATH": "Pad van het pipelinebestand.",
192
"info.var.CI_SERVER_NAME": "Altijd BlueGit.",
193
"info.var.CI_COMMIT_SHA": "Volledige commit-id.",
194
"info.var.CI_COMMIT_SHORT_SHA": "Eerste acht tekens van de commit-id.",
195
"info.var.CI_COMMIT_REF": "Volledige git-ref.",
196
"info.var.CI_COMMIT_REF_NAME": "Naam van de tak of de tag.",
197
"info.var.CI_COMMIT_REF_SLUG": "Ref-naam die veilig is in een URL.",
198
"info.var.CI_COMMIT_TITLE": "Onderwerp van de commit.",
199
"info.var.CI_COMMIT_BRANCH": "Taknaam. Leeg op een tag.",
200
"info.var.CI_COMMIT_TAG": "Tagnaam. Leeg op een tak.",
201
"info.var.CI_DEFAULT_BRANCH": "Standaardtak van de repository.",
202
"info.var.CI_PIPELINE_ID": "Pipelinenummer. Nul zolang rules worden beoordeeld.",
203
"info.var.CI_PIPELINE_SOURCE": "push, web, of merge_request_event.",
204
"info.var.CI_PIPELINE_URL": "Link naar de pipeline.",
205
"info.var.CI_PROJECT_PATH": "Eigenaar en repository.",
206
"info.var.CI_PROJECT_NAME": "Naam van de repository.",
207
"info.var.CI_PROJECT_NAMESPACE": "Pad van de eigenaar.",
208
"info.var.CI_PROJECT_URL": "Link naar de repository.",
209
"info.var.CI_API_URL": "Wortel van de API.",
210
"info.var.CI_JOB_ID": "Jobnummer.",
211
"info.var.CI_JOB_NAME": "Naam van de job.",
212
"info.var.CI_JOB_STAGE": "Naam van de stage.",
213
"info.var.CI_JOB_URL": "Link naar de job.",
214
"info.var.CI_JOB_TOKEN": "Token van deze job. In het log staat een masker.",
215
"info.var.CI_NODE_INDEX": "Index van deze parallel- of matrixjob.",
216
"info.var.CI_NODE_TOTAL": "Aantal parallel- of matrixjobs.",
217
"info.var.CI_ENVIRONMENT_NAME": "Naam van de omgeving.",
218
"info.var.CI_ENVIRONMENT_URL": "Adres van de omgeving.",
219
"info.var.CI_MERGE_REQUEST_ID": "Interne id van de merge request.",
220
"info.var.CI_MERGE_REQUEST_IID": "Nummer van de merge request in het project.",
221
"info.var.CI_MERGE_REQUEST_TITLE": "Titel van de merge request.",
222
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Brontak.",
223
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit van de brontak.",
224
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Doeltak.",
225
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Punt van de doeltak.",
226
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Projectpad van de merge request.",
227
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Link naar dat project.",
228
229
"info.diff.file": "Het bestand heet blue-ci-cd.yml, niet de GitLab-bestandsnaam.",
230
"info.diff.runner": "Er is één runner. De naam staat in runner.name en is standaard Steve. tags kiezen geen andere runner.",
231
"info.diff.include": "include leest alleen een lokaal bestand. Een include van een project, een URL of een template wordt genegeerd.",
232
"info.diff.unsupported": "pages, spec, trigger-pipelines, child-pipelines, coverage, id_tokens, inherit en hooks worden genegeerd met een waarschuwing.",
233
"info.diff.services": "services op het hoogste niveau wordt genegeerd. Job-services delen een netwerk en hebben geen healthcheck verder dan een gestarte container.",
234
"info.diff.env": "environment zet alleen variabelen. Er is geen deployment en geen stop-job.",
235
"info.diff.retry": "retry max is hoogstens 2.",
236
"info.diff.parallel": "parallel is hoogstens 50.",
237
"info.diff.rules": "Het pipelinenummer is nul zolang rules draaien. Job-, node- en omgevingsvariabelen bestaan alleen in de container.",
238
"info.diff.mr": "Een merge-request-pipeline draait op de commit van de bron, niet op een samengevoegde boom. Hij start bij het openen, bij elke push naar de bron, en opnieuw als iemand naar de doeltak pusht.",
239
"info.diff.cache": "cache blijft op deze machine en wordt niet gedeeld.",
240
"info.diff.images": "Een imagenaam die een preset is wordt lokaal gebouwd. Elke andere naam is een gewoon Docker-image.",
241
}
242
243
var infoDE = map[string]string{
244
"nav.info": "Info",
245
"title.info": "CI/CD",
246
"info.lead": "Nachschlagewerk für blue-ci-cd.yml und die Image-Presets, die Steve baut.",
247
248
"info.col.keyword": "Schlüsselwort",
249
"info.col.meaning": "Bedeutung",
250
"info.col.name": "Preset",
251
"info.col.base": "Image",
252
"info.col.tools": "Inhalt",
253
"info.col.where": "Verfügbar",
254
255
"info.sec.pipeline": "Pipeline",
256
"info.sec.job": "Jobs",
257
"info.sec.rules": "Regeln",
258
"info.sec.variables": "Variablen",
259
"info.sec.diff": "Unterschiede zu GitLab",
260
"info.sec.presets": "Image-Presets",
261
262
"info.where.both": "Regeln und Container",
263
"info.where.container": "Nur im Container",
264
"info.where.mr": "Merge Request",
265
266
"info.rules.intro": "Die erste passende Regel gewinnt. && bindet stärker als ||. Klammern gruppieren. Eine leere Variable ist null. == und != vergleichen. =~ und !~ prüfen ein RE2-Muster. Ein Schrägstrich im Muster wird mit einem Backslash geschrieben. Die Flagge i steht direkt hinter der schließenden Klammer. Ein Muster in einer Variable muss gültig sein, wenn die Regel läuft.",
267
"info.presets.intro": "Ein Job wählt ein Preset mit dem Schlüsselwort image. Steve baut das Dockerfile beim ersten Gebrauch und verwendet das Ergebnis wieder. Jeder andere Name, etwa node:22, bleibt ein normales Docker-Image.",
268
"info.presets.config": "Ein Preset ergänzt oder ersetzt man unter ci.presets in config.yml, mit image, dockerfile oder from.",
269
"info.presets.mapped": "Verwendet dieses Image unverändert.",
270
271
"info.kw.stages": "Reihenfolge der Stages. Fehlt sie, folgen die Stages der Reihenfolge, in der Jobs sie nennen. Ein Job ohne Stage nutzt test.",
272
"info.kw.variables": "Ein Text oder ein Feld value. Ein Job überschreibt denselben Namen. Verfügbar in Regeln und im Container.",
273
"info.kw.image": "Standardimage, als Text oder als Feld name. default.image gewinnt, wenn es gesetzt ist. Ein Preset wie bluegit/base ist erlaubt.",
274
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry und interruptible für Jobs, die sie nicht selbst setzen.",
275
"info.kw.include": "Nur ein lokaler Pfad. Ein Job mit demselben Namen wird zusammengeführt und die äußere Datei gewinnt je Feld.",
276
"info.kw.before_script": "Shell-Zeilen, die vor script laufen.",
277
"info.kw.after_script": "Shell-Zeilen, die nach script laufen, auch wenn script scheitert.",
278
"info.kw.cache": "paths und ein Textschlüssel. Bleibt auf diesem Rechner für ein Repository.",
279
"info.kw.workflow": "rules wie bei einem Job. Kein Treffer oder when never erzeugt keine Pipeline.",
280
"info.kw.jobs": "Optionale ältere Map von Jobs. Jobs dürfen auch auf der obersten Ebene stehen, aber nicht an beiden Stellen.",
281
"info.kw.stage": "Name der Stage. Weggelassen bedeutet test.",
282
"info.kw.script": "Shell-Zeilen. Der Job scheitert, wenn eine Zeile scheitert.",
283
"info.kw.needs": "Jobnamen oder job und optional. Eine leere Liste startet sofort. Weggelassen wartet der Job auf frühere Stages. Ein need auf einen Parallel-Job wartet auf jede Kopie.",
284
"info.kw.rules": "Der erste Treffer gewinnt. Felder sind if, changes, exists und when. Ohne rules entscheiden only und except.",
285
"info.kw.only": "Ein Branchname, branches, tags, merge_requests oder ein Regex zwischen Schrägstrichen.",
286
"info.kw.except": "Das Gegenteil von only.",
287
"info.kw.when": "on_success ist der Standard, außerdem on_failure, always und manual. Eine Regel darf never sagen.",
288
"info.kw.allow_failure": "Ein Fehler stoppt den Rest nicht. Der Job selbst wird eine Warnung.",
289
"info.kw.artifacts": "paths und expire_in. Einheiten sind Sekunden, Minuten, Stunden, Tage, Wochen oder never.",
290
"info.kw.resource_group": "Jobs mit diesem Namen in einem Repository laufen nicht gleichzeitig.",
291
"info.kw.timeout": "Ersetzt das Server-Timeout für diesen Job. Der Runner stoppt den Container, wenn die Zeit um ist.",
292
"info.kw.retry": "Eine Zahl oder max und when. max liegt zwischen 0 und 2, eine höhere Zahl wird gekappt. when nennt script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure oder always.",
293
"info.kw.parallel": "Eine Zahl bis 50 oder eine Matrix. Nummerierte Jobs heißen Name 1/N und erhalten CI_NODE_INDEX und CI_NODE_TOTAL. Eine Matrix ist das Produkt jeder Liste, danach aneinandergereiht. Schlüssel werden Variablen.",
294
"info.kw.services": "Sidecar-Container im selben Netz wie der Job. Text oder name, alias, command, entrypoint und variables. Ohne Alias entfallen Registry und Tag. Es gibt keine Health-Prüfung außer einem gestarteten Container.",
295
"info.kw.environment": "Ein Name oder name und url. Setzt die Umgebungsvariablen. Es gibt kein Deployment und keinen Stop-Job.",
296
"info.kw.interruptible": "Standardmäßig aus. Eine neuere Pipeline auf derselben Ref bricht ältere Jobs ab, die dies gesetzt haben und noch warten oder laufen.",
297
"info.kw.tags": "Am Job gespeichert. Steve führt jeden Job aus. Tags wählen keinen Runner.",
298
"info.kw.extends": "Ein Name oder eine Liste. Ein Job, dessen Name mit einem Punkt beginnt, ist eine Vorlage und läuft nicht.",
299
"info.kw.if": "Ein Ausdruck. Die erste Regel, deren if, changes und exists alle passen, gewinnt.",
300
"info.kw.changes": "Pfade im Diff des Push. Ist der Diff nicht bestimmbar, trifft die Bedingung zu.",
301
"info.kw.exists": "Jeder genannte Pfad muss im Commit stehen. Ist der Baum unbekannt, trifft die Bedingung zu.",
302
303
"info.var.CI": "Immer wahr.",
304
"info.var.CI_CONFIG_PATH": "Pfad der Pipeline-Datei.",
305
"info.var.CI_SERVER_NAME": "Immer BlueGit.",
306
"info.var.CI_COMMIT_SHA": "Volle Commit-Id.",
307
"info.var.CI_COMMIT_SHORT_SHA": "Die ersten acht Zeichen der Commit-Id.",
308
"info.var.CI_COMMIT_REF": "Volle Git-Ref.",
309
"info.var.CI_COMMIT_REF_NAME": "Name des Branches oder des Tags.",
310
"info.var.CI_COMMIT_REF_SLUG": "Ref-Name, der in einer URL sicher ist.",
311
"info.var.CI_COMMIT_TITLE": "Betreff des Commits.",
312
"info.var.CI_COMMIT_BRANCH": "Branchname. Leer bei einem Tag.",
313
"info.var.CI_COMMIT_TAG": "Tagname. Leer bei einem Branch.",
314
"info.var.CI_DEFAULT_BRANCH": "Standardbranch des Repositorys.",
315
"info.var.CI_PIPELINE_ID": "Pipelinenummer. Null, solange Regeln geprüft werden.",
316
"info.var.CI_PIPELINE_SOURCE": "push, web oder merge_request_event.",
317
"info.var.CI_PIPELINE_URL": "Link zur Pipeline.",
318
"info.var.CI_PROJECT_PATH": "Besitzer und Repository.",
319
"info.var.CI_PROJECT_NAME": "Name des Repositorys.",
320
"info.var.CI_PROJECT_NAMESPACE": "Pfad des Besitzers.",
321
"info.var.CI_PROJECT_URL": "Link zum Repository.",
322
"info.var.CI_API_URL": "Wurzel der API.",
323
"info.var.CI_JOB_ID": "Jobnummer.",
324
"info.var.CI_JOB_NAME": "Name des Jobs.",
325
"info.var.CI_JOB_STAGE": "Name der Stage.",
326
"info.var.CI_JOB_URL": "Link zum Job.",
327
"info.var.CI_JOB_TOKEN": "Token dieses Jobs. Im Log steht eine Maske.",
328
"info.var.CI_NODE_INDEX": "Index dieses Parallel- oder Matrix-Jobs.",
329
"info.var.CI_NODE_TOTAL": "Anzahl der Parallel- oder Matrix-Jobs.",
330
"info.var.CI_ENVIRONMENT_NAME": "Name der Umgebung.",
331
"info.var.CI_ENVIRONMENT_URL": "Adresse der Umgebung.",
332
"info.var.CI_MERGE_REQUEST_ID": "Interne Id des Merge Requests.",
333
"info.var.CI_MERGE_REQUEST_IID": "Nummer des Merge Requests im Projekt.",
334
"info.var.CI_MERGE_REQUEST_TITLE": "Titel des Merge Requests.",
335
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Quellbranch.",
336
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit des Quellbranches.",
337
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Zielbranch.",
338
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Spitze des Zielbranches.",
339
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Projektpfad des Merge Requests.",
340
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Link zu diesem Projekt.",
341
342
"info.diff.file": "Die Datei heißt blue-ci-cd.yml, nicht der GitLab-Dateiname.",
343
"info.diff.runner": "Es gibt einen Runner. Der Name steht in runner.name und ist standardmäßig Steve. tags wählen keinen anderen Runner.",
344
"info.diff.include": "include liest nur eine lokale Datei. Ein Include aus einem Projekt, einer URL oder einer Vorlage wird ignoriert.",
345
"info.diff.unsupported": "pages, spec, Trigger-Pipelines, Child-Pipelines, coverage, id_tokens, inherit und hooks werden mit einer Warnung ignoriert.",
346
"info.diff.services": "services auf der obersten Ebene wird ignoriert. Job-Services teilen ein Netz und haben keine Health-Prüfung außer einem gestarteten Container.",
347
"info.diff.env": "environment setzt nur Variablen. Es gibt kein Deployment und keinen Stop-Job.",
348
"info.diff.retry": "retry max ist höchstens 2.",
349
"info.diff.parallel": "parallel ist höchstens 50.",
350
"info.diff.rules": "Die Pipelinenummer ist null, solange Regeln laufen. Job-, Node- und Umgebungsvariablen gibt es nur im Container.",
351
"info.diff.mr": "Eine Merge-Request-Pipeline läuft auf dem Quell-Commit, nicht auf einem zusammengeführten Baum. Sie startet beim Öffnen, bei jedem Push zur Quelle und erneut, wenn jemand den Zielbranch pusht.",
352
"info.diff.cache": "cache bleibt auf diesem Rechner und wird nicht geteilt.",
353
"info.diff.images": "Ein Imagename, der ein Preset ist, wird lokal gebaut. Jeder andere Name ist ein normales Docker-Image.",
354
}
355
356
var infoFR = map[string]string{
357
"nav.info": "Info",
358
"title.info": "CI/CD",
359
"info.lead": "Référence de blue-ci-cd.yml et des presets d'image que Steve construit.",
360
361
"info.col.keyword": "Mot-clé",
362
"info.col.meaning": "Signification",
363
"info.col.name": "Preset",
364
"info.col.base": "Image",
365
"info.col.tools": "Contenu",
366
"info.col.where": "Disponible",
367
368
"info.sec.pipeline": "Pipeline",
369
"info.sec.job": "Jobs",
370
"info.sec.rules": "Règles",
371
"info.sec.variables": "Variables",
372
"info.sec.diff": "Différences avec GitLab",
373
"info.sec.presets": "Presets d'image",
374
375
"info.where.both": "Règles et conteneur",
376
"info.where.container": "Conteneur seulement",
377
"info.where.mr": "Merge request",
378
379
"info.rules.intro": "La première règle qui correspond gagne. && lie plus fort que ||. Les parenthèses groupent. Une variable vide vaut null. == et != comparent. =~ et !~ testent un motif RE2. Un slash dans un motif s'écrit avec un backslash. Le drapeau i suit juste la parenthèse fermante. Un motif dans une variable doit être valide au moment où la règle tourne.",
380
"info.presets.intro": "Un job choisit un preset avec le mot-clé image. Steve construit ce Dockerfile au premier usage et réutilise le résultat. Tout autre nom, comme node:22, reste une image Docker ordinaire.",
381
"info.presets.config": "On ajoute ou remplace un preset sous ci.presets dans config.yml, avec image, dockerfile ou from.",
382
"info.presets.mapped": "Utilise cette image telle quelle.",
383
384
"info.kw.stages": "Ordre des stages. S'il manque, les stages suivent l'ordre dans lequel les jobs les nomment. Un job sans stage utilise test.",
385
"info.kw.variables": "Un texte, ou un champ value. Un job remplace le même nom. Disponible dans les règles et dans le conteneur.",
386
"info.kw.image": "Image par défaut, en texte ou en champ name. default.image gagne s'il est posé. Un preset comme bluegit/base est permis.",
387
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry et interruptible pour les jobs qui ne les posent pas.",
388
"info.kw.include": "Seulement un chemin local. Un job du même nom est fusionné et le fichier extérieur gagne chaque champ.",
389
"info.kw.before_script": "Lignes de shell qui tournent avant script.",
390
"info.kw.after_script": "Lignes de shell qui tournent après script, même si script échoue.",
391
"info.kw.cache": "paths et une clé texte. Reste sur cette machine pour un dépôt.",
392
"info.kw.workflow": "rules, comme pour un job. Aucune correspondance, ou when never, ne crée pas de pipeline.",
393
"info.kw.jobs": "Ancienne map optionnelle de jobs. Les jobs peuvent aussi être au premier niveau, mais pas aux deux endroits.",
394
"info.kw.stage": "Nom du stage. Absent signifie test.",
395
"info.kw.script": "Lignes de shell. Le job échoue si une ligne échoue.",
396
"info.kw.needs": "Noms de jobs, ou job et optional. Une liste vide démarre tout de suite. Absente, le job attend les stages précédents. Un need sur un job parallèle attend chaque copie.",
397
"info.kw.rules": "La première correspondance gagne. Les champs sont if, changes, exists et when. Sans rules, only et except décident.",
398
"info.kw.only": "Un nom de branche, branches, tags, merge_requests, ou une regex entre des slashes.",
399
"info.kw.except": "Le contraire de only.",
400
"info.kw.when": "on_success est le défaut, aussi on_failure, always et manual. Une règle peut dire never.",
401
"info.kw.allow_failure": "Un échec n'arrête pas le reste. Le job lui-même devient un avertissement.",
402
"info.kw.artifacts": "paths et expire_in. Les unités sont secondes, minutes, heures, jours, semaines, ou never.",
403
"info.kw.resource_group": "Les jobs qui partagent ce nom dans un dépôt ne tournent pas en même temps.",
404
"info.kw.timeout": "Remplace le délai du serveur pour ce job. Le runner arrête le conteneur quand le temps est fini.",
405
"info.kw.retry": "Un nombre, ou max et when. max va de 0 à 2 et un nombre plus haut est coupé. when nomme script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure ou always.",
406
"info.kw.parallel": "Un nombre jusqu'à 50, ou une matrice. Les jobs numérotés s'appellent nom 1/N et reçoivent CI_NODE_INDEX et CI_NODE_TOTAL. Une matrice est le produit de chaque liste, puis ces produits à la suite. Les clés deviennent des variables.",
407
"info.kw.services": "Conteneurs sidecar sur un réseau avec le job. Texte, ou name, alias, command, entrypoint et variables. Sans alias, le registre et le tag tombent. Il n'y a pas de contrôle de santé au-delà d'un conteneur démarré.",
408
"info.kw.environment": "Un nom, ou name et url. Pose les variables d'environnement. Il n'y a pas de déploiement et pas de job d'arrêt.",
409
"info.kw.interruptible": "Éteint par défaut. Une pipeline plus récente sur la même ref annule les jobs plus anciens qui ont ceci et qui attendent encore ou tournent.",
410
"info.kw.tags": "Conservé sur le job. Steve exécute chaque job. Les tags ne choisissent pas un runner.",
411
"info.kw.extends": "Un nom ou une liste. Un job dont le nom commence par un point est un modèle et ne tourne pas.",
412
"info.kw.if": "Une expression. La première règle dont if, changes et exists correspondent tous gagne.",
413
"info.kw.changes": "Chemins dans le diff du push. Si ce diff est inconnu, la condition correspond.",
414
"info.kw.exists": "Chaque chemin cité doit être dans le commit. Si l'arbre est inconnu, la condition correspond.",
415
416
"info.var.CI": "Toujours vrai.",
417
"info.var.CI_CONFIG_PATH": "Chemin du fichier de pipeline.",
418
"info.var.CI_SERVER_NAME": "Toujours BlueGit.",
419
"info.var.CI_COMMIT_SHA": "Identifiant complet du commit.",
420
"info.var.CI_COMMIT_SHORT_SHA": "Huit premiers caractères de l'identifiant du commit.",
421
"info.var.CI_COMMIT_REF": "Réf git complète.",
422
"info.var.CI_COMMIT_REF_NAME": "Nom de la branche ou du tag.",
423
"info.var.CI_COMMIT_REF_SLUG": "Nom de réf sûr dans une URL.",
424
"info.var.CI_COMMIT_TITLE": "Sujet du commit.",
425
"info.var.CI_COMMIT_BRANCH": "Nom de branche. Vide sur un tag.",
426
"info.var.CI_COMMIT_TAG": "Nom du tag. Vide sur une branche.",
427
"info.var.CI_DEFAULT_BRANCH": "Branche par défaut du dépôt.",
428
"info.var.CI_PIPELINE_ID": "Numéro de pipeline. Zéro pendant l'évaluation des règles.",
429
"info.var.CI_PIPELINE_SOURCE": "push, web, ou merge_request_event.",
430
"info.var.CI_PIPELINE_URL": "Lien vers la pipeline.",
431
"info.var.CI_PROJECT_PATH": "Propriétaire et dépôt.",
432
"info.var.CI_PROJECT_NAME": "Nom du dépôt.",
433
"info.var.CI_PROJECT_NAMESPACE": "Chemin du propriétaire.",
434
"info.var.CI_PROJECT_URL": "Lien vers le dépôt.",
435
"info.var.CI_API_URL": "Racine de l'API.",
436
"info.var.CI_JOB_ID": "Numéro du job.",
437
"info.var.CI_JOB_NAME": "Nom du job.",
438
"info.var.CI_JOB_STAGE": "Nom du stage.",
439
"info.var.CI_JOB_URL": "Lien vers le job.",
440
"info.var.CI_JOB_TOKEN": "Jeton de ce job. Le journal le masque.",
441
"info.var.CI_NODE_INDEX": "Index de ce job parallèle ou de matrice.",
442
"info.var.CI_NODE_TOTAL": "Nombre de jobs parallèles ou de matrice.",
443
"info.var.CI_ENVIRONMENT_NAME": "Nom de l'environnement.",
444
"info.var.CI_ENVIRONMENT_URL": "Adresse de l'environnement.",
445
"info.var.CI_MERGE_REQUEST_ID": "Identifiant interne de la merge request.",
446
"info.var.CI_MERGE_REQUEST_IID": "Numéro de la merge request dans le projet.",
447
"info.var.CI_MERGE_REQUEST_TITLE": "Titre de la merge request.",
448
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Branche source.",
449
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit de la branche source.",
450
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Branche cible.",
451
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Pointe de la branche cible.",
452
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Chemin du projet de la merge request.",
453
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Lien vers ce projet.",
454
455
"info.diff.file": "Le fichier s'appelle blue-ci-cd.yml, pas le nom de fichier GitLab.",
456
"info.diff.runner": "Il y a un seul runner. Son nom est runner.name et vaut Steve par défaut. Les tags ne choisissent pas un autre runner.",
457
"info.diff.include": "include ne lit qu'un fichier local. Un include de projet, d'URL ou de modèle est ignoré.",
458
"info.diff.unsupported": "pages, spec, les pipelines déclenchées, les pipelines enfants, coverage, id_tokens, inherit et hooks sont ignorés avec un avertissement.",
459
"info.diff.services": "services au premier niveau est ignoré. Les services d'un job partagent un réseau et n'ont pas de contrôle de santé au-delà d'un conteneur démarré.",
460
"info.diff.env": "environment ne fait que poser des variables. Il n'y a pas de déploiement et pas de job d'arrêt.",
461
"info.diff.retry": "retry max est plafonné à 2.",
462
"info.diff.parallel": "parallel est plafonné à 50.",
463
"info.diff.rules": "Le numéro de pipeline est zéro pendant les règles. Les variables de job, de nœud et d'environnement n'existent que dans le conteneur.",
464
"info.diff.mr": "Une pipeline de merge request tourne sur le commit source, pas sur un arbre fusionné. Elle démarre à l'ouverture, à chaque push vers la source, et encore quand quelqu'un pousse la cible.",
465
"info.diff.cache": "cache reste sur cette machine et n'est pas partagé.",
466
"info.diff.images": "Un nom d'image qui est un preset est construit localement. Tout autre nom est une image Docker ordinaire.",
467
}
@@ -0,0 +1,467 @@1
package i18n2
3
// De infopagina staat apart, zodat de grote catalogi niet opnieuw uitgelijnd worden.4
func init() {5
addCatalog(en, infoEN)6
addCatalog(nl, infoNL)7
addCatalog(de, infoDE)8
addCatalog(fr, infoFR)9
}10
11
func addCatalog(dst, src map[string]string) {12
for k, v := range src {13
dst[k] = v14
}15
}16
17
var infoEN = map[string]string{18
"nav.info": "Info",19
"title.info": "CI/CD",20
"info.lead": "Reference for blue-ci-cd.yml and the image presets Steve builds.",21
22
"info.col.keyword": "Keyword",23
"info.col.meaning": "Meaning",24
"info.col.name": "Preset",25
"info.col.base": "Image",26
"info.col.tools": "Contents",27
"info.col.where": "Available",28
29
"info.sec.pipeline": "Pipeline",30
"info.sec.job": "Jobs",31
"info.sec.rules": "Rules",32
"info.sec.variables": "Variables",33
"info.sec.diff": "Differences with GitLab",34
"info.sec.presets": "Image presets",35
36
"info.where.both": "Rules and container",37
"info.where.container": "Container only",38
"info.where.mr": "Merge request",39
40
"info.rules.intro": "The first matching rule wins. && binds more tightly than ||. Parentheses group an expression. An empty variable is null. == and != compare. =~ and !~ match a RE2 pattern. A slash in a pattern is escaped with a backslash. The flag i sits right after the closing slash. A pattern stored in a variable must be valid when the rule runs.",41
"info.presets.intro": "A job picks a preset with its image keyword. Steve builds that Dockerfile on first use and reuses the result. Any other name, such as node:22, stays a normal Docker image.",42
"info.presets.config": "Add or replace a preset under ci.presets in config.yml with image, dockerfile or from.",43
"info.presets.mapped": "Uses this image as it is.",44
45
"info.kw.stages": "Stage order. When omitted, stages follow the order in which jobs name them. A job without a stage uses test.",46
"info.kw.variables": "A string, or a value field. A job overrides the same name. Available in rules and in the container.",47
"info.kw.image": "Default image, as text or as a name field. default.image wins when that is set. A preset such as bluegit/base is allowed.",48
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry and interruptible for jobs that do not set them.",49
"info.kw.include": "Only a local path. A job with the same name is merged and the outer file wins each field.",50
"info.kw.before_script": "Shell lines that run before script.",51
"info.kw.after_script": "Shell lines that run after script, also when script fails.",52
"info.kw.cache": "paths and a text key. Kept on this machine for one repository.",53
"info.kw.workflow": "rules, like a job. No match, or when never, creates no pipeline.",54
"info.kw.jobs": "Optional older map of jobs. Jobs may also sit at the top level, but not in both places.",55
"info.kw.stage": "Stage name. Omitted means test.",56
"info.kw.script": "Shell lines. The job fails when a line fails.",57
"info.kw.needs": "Job names, or job and optional. An empty list starts at once. Omitted, the job waits for earlier stages. A need on a parallel job waits for every copy.",58
"info.kw.rules": "The first match wins. Fields are if, changes, exists and when. Without rules, only and except decide.",59
"info.kw.only": "A branch name, branches, tags, merge_requests, or a regex between slashes.",60
"info.kw.except": "The opposite of only.",61
"info.kw.when": "on_success is the default, also on_failure, always and manual. A rule may say never.",62
"info.kw.allow_failure": "A failure does not stop the rest. The job itself becomes a warning.",63
"info.kw.artifacts": "paths and expire_in. Units are seconds, minutes, hours, days, weeks, or never.",64
"info.kw.resource_group": "Jobs that share this name in one repository do not run at the same time.",65
"info.kw.timeout": "Replaces the server timeout for this job. The runner stops the container when the time is up.",66
"info.kw.retry": "A number, or max and when. max runs from 0 to 2 and a higher number is cut off. when names script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure or always.",67
"info.kw.parallel": "A number up to 50, or a matrix. Numbered jobs are called name 1/N and receive CI_NODE_INDEX and CI_NODE_TOTAL. A matrix is the product of each list, then those products joined. Keys become variables.",68
"info.kw.services": "Sidecar containers on one network with the job. Text, or name, alias, command, entrypoint and variables. Without an alias the name drops the registry and the tag. There is no health check beyond a started container.",69
"info.kw.environment": "A name, or name and url. Sets the environment variables. There is no deployment and no stop job.",70
"info.kw.interruptible": "Off by default. A newer pipeline on the same ref cancels older jobs that set this and are still queued or running.",71
"info.kw.tags": "Stored on the job. Steve runs every job. Tags do not choose a runner.",72
"info.kw.extends": "One name or a list. A job whose name starts with a dot is a template and does not run.",73
"info.kw.if": "An expression. The first rule whose if, changes and exists all match is the winner.",74
"info.kw.changes": "Paths in the push diff. When that diff cannot be known, the condition matches.",75
"info.kw.exists": "Every listed path must be in the commit. When the tree is unknown, the condition matches.",76
77
"info.var.CI": "Always true.",78
"info.var.CI_CONFIG_PATH": "Path of the pipeline file.",79
"info.var.CI_SERVER_NAME": "Always BlueGit.",80
"info.var.CI_COMMIT_SHA": "Full commit id.",81
"info.var.CI_COMMIT_SHORT_SHA": "First eight characters of the commit id.",82
"info.var.CI_COMMIT_REF": "Full git ref.",83
"info.var.CI_COMMIT_REF_NAME": "Branch or tag name.",84
"info.var.CI_COMMIT_REF_SLUG": "Ref name made safe for a URL.",85
"info.var.CI_COMMIT_TITLE": "Commit subject.",86
"info.var.CI_COMMIT_BRANCH": "Branch name. Empty on a tag.",87
"info.var.CI_COMMIT_TAG": "Tag name. Empty on a branch.",88
"info.var.CI_DEFAULT_BRANCH": "Default branch of the repository.",89
"info.var.CI_PIPELINE_ID": "Pipeline number. Zero while rules are evaluated.",90
"info.var.CI_PIPELINE_SOURCE": "push, web, or merge_request_event.",91
"info.var.CI_PIPELINE_URL": "Link to the pipeline.",92
"info.var.CI_PROJECT_PATH": "Owner and repository.",93
"info.var.CI_PROJECT_NAME": "Repository name.",94
"info.var.CI_PROJECT_NAMESPACE": "Owner path.",95
"info.var.CI_PROJECT_URL": "Link to the repository.",96
"info.var.CI_API_URL": "Root of the API.",97
"info.var.CI_JOB_ID": "Job number.",98
"info.var.CI_JOB_NAME": "Job name.",99
"info.var.CI_JOB_STAGE": "Stage name.",100
"info.var.CI_JOB_URL": "Link to the job.",101
"info.var.CI_JOB_TOKEN": "Token for this job. It is masked in the log.",102
"info.var.CI_NODE_INDEX": "Index of this parallel or matrix job.",103
"info.var.CI_NODE_TOTAL": "How many parallel or matrix jobs there are.",104
"info.var.CI_ENVIRONMENT_NAME": "Environment name.",105
"info.var.CI_ENVIRONMENT_URL": "Environment address.",106
"info.var.CI_MERGE_REQUEST_ID": "Internal id of the merge request.",107
"info.var.CI_MERGE_REQUEST_IID": "Number of the merge request in the project.",108
"info.var.CI_MERGE_REQUEST_TITLE": "Title of the merge request.",109
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Source branch.",110
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit of the source branch.",111
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Target branch.",112
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Tip of the target branch.",113
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Project path of the merge request.",114
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Link to that project.",115
116
"info.diff.file": "The file is blue-ci-cd.yml, not the GitLab filename.",117
"info.diff.runner": "There is one runner. Its name is runner.name and the default is Steve. tags do not select another runner.",118
"info.diff.include": "include only reads a local file. A project, remote or template include is ignored.",119
"info.diff.unsupported": "pages, spec, trigger pipelines, child pipelines, coverage, id_tokens, inherit and hooks are ignored with a warning.",120
"info.diff.services": "services at the top level is ignored. Job services share a network and have no health check beyond a started container.",121
"info.diff.env": "environment only sets variables. There is no deployment and no stop job.",122
"info.diff.retry": "retry max is capped at 2.",123
"info.diff.parallel": "parallel is capped at 50.",124
"info.diff.rules": "The pipeline number is zero while rules run. Job, node and environment variables exist only in the container.",125
"info.diff.mr": "A merge request pipeline runs on the source commit, not a merged tree. It starts when the request opens, on every push to the source, and again when someone pushes the target.",126
"info.diff.cache": "cache stays on this machine and is not shared.",127
"info.diff.images": "An image name that matches a preset is built locally. Every other name is a normal Docker image.",128
}129
130
var infoNL = map[string]string{131
"nav.info": "Info",132
"title.info": "CI/CD",133
"info.lead": "Naslag voor blue-ci-cd.yml en de image-presets die Steve bouwt.",134
135
"info.col.keyword": "Sleutelwoord",136
"info.col.meaning": "Betekenis",137
"info.col.name": "Preset",138
"info.col.base": "Image",139
"info.col.tools": "Inhoud",140
"info.col.where": "Beschikbaar",141
142
"info.sec.pipeline": "Pipeline",143
"info.sec.job": "Jobs",144
"info.sec.rules": "Rules",145
"info.sec.variables": "Variabelen",146
"info.sec.diff": "Verschillen met GitLab",147
"info.sec.presets": "Image-presets",148
149
"info.where.both": "Rules en container",150
"info.where.container": "Alleen in de container",151
"info.where.mr": "Merge request",152
153
"info.rules.intro": "De eerste rule die klopt wint. && bindt sterker dan ||. Haakjes groeperen. Een lege variabele is null. == en != vergelijken. =~ en !~ passen op een RE2-patroon. Een slash in een patroon schrijf je met een backslash. De vlag i staat direct achter de sluithaak. Een patroon in een variabele moet geldig zijn op het moment dat de rule draait.",154
"info.presets.intro": "Een job kiest een preset met het sleutelwoord image. Steve bouwt die Dockerfile bij het eerste gebruik en hergebruikt het resultaat. Elke andere naam, zoals node:22, blijft een gewoon Docker-image.",155
"info.presets.config": "Een preset toevoegen of vervangen doe je onder ci.presets in config.yml, met image, dockerfile of from.",156
"info.presets.mapped": "Gebruikt dit image zoals het is.",157
158
"info.kw.stages": "Volgorde van de stages. Weggelaten volgen de stages de volgorde waarin jobs ze noemen. Een job zonder stage gebruikt test.",159
"info.kw.variables": "Een tekst, of een veld value. Een job overschrijft dezelfde naam. Beschikbaar in rules en in de container.",160
"info.kw.image": "Standaardimage, als tekst of als veld name. default.image wint als dat gezet is. Een preset zoals bluegit/base mag.",161
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry en interruptible voor jobs die ze zelf niet zetten.",162
"info.kw.include": "Alleen een lokaal pad. Een job met dezelfde naam wordt samengevoegd en het buitenste bestand wint per veld.",163
"info.kw.before_script": "Shellregels die voor script draaien.",164
"info.kw.after_script": "Shellregels die na script draaien, ook als script mislukt.",165
"info.kw.cache": "paths en een tekstuele key. Blijft op deze machine voor één repository.",166
"info.kw.workflow": "rules, zoals bij een job. Geen treffer, of when never, maakt geen pipeline.",167
"info.kw.jobs": "Optionele oudere map van jobs. Jobs mogen ook op het hoogste niveau staan, maar niet op beide plekken.",168
"info.kw.stage": "Naam van de stage. Weggelaten betekent test.",169
"info.kw.script": "Shellregels. De job faalt als een regel faalt.",170
"info.kw.needs": "Jobnamen, of job en optional. Een lege lijst start meteen. Weggelaten wacht de job op eerdere stages. Een need op een parallel-job wacht op elk exemplaar.",171
"info.kw.rules": "De eerste treffer wint. Velden zijn if, changes, exists en when. Zonder rules beslissen only en except.",172
"info.kw.only": "Een taknaam, branches, tags, merge_requests, of een regex tussen slashes.",173
"info.kw.except": "Het omgekeerde van only.",174
"info.kw.when": "on_success is de standaard, verder on_failure, always en manual. Een rule mag never zeggen.",175
"info.kw.allow_failure": "Een mislukking stopt de rest niet. De job zelf wordt een waarschuwing.",176
"info.kw.artifacts": "paths en expire_in. Eenheden zijn seconden, minuten, uren, dagen, weken, of never.",177
"info.kw.resource_group": "Jobs met deze naam in één repository draaien niet tegelijk.",178
"info.kw.timeout": "Vervangt de servertime-out voor deze job. De runner stopt de container als de tijd om is.",179
"info.kw.retry": "Een getal, of max en when. max loopt van 0 tot 2 en een hoger getal wordt afgekapt. when noemt script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure of always.",180
"info.kw.parallel": "Een getal tot 50, of een matrix. Genummerde jobs heten naam 1/N en krijgen CI_NODE_INDEX en CI_NODE_TOTAL. Een matrix is het product van elke lijst, en die producten achter elkaar. Sleutels worden variabelen.",181
"info.kw.services": "Sidecar-containers op één netwerk met de job. Tekst, of name, alias, command, entrypoint en variables. Zonder alias vervalt de registry en de tag. Er is geen healthcheck verder dan een gestarte container.",182
"info.kw.environment": "Een naam, of name en url. Zet de omgevingsvariabelen. Er is geen deployment en geen stop-job.",183
"info.kw.interruptible": "Standaard uit. Een nieuwere pipeline op dezelfde ref annuleert oudere jobs die dit aan hebben en nog in de wachtrij staan of lopen.",184
"info.kw.tags": "Bewaard bij de job. Steve draait elke job. Tags kiezen geen runner.",185
"info.kw.extends": "Eén naam of een lijst. Een job waarvan de naam met een punt begint is een sjabloon en draait niet.",186
"info.kw.if": "Een expressie. De eerste rule waarvan if, changes en exists allemaal kloppen wint.",187
"info.kw.changes": "Paden in de diff van de push. Is die diff niet te bepalen, dan klopt de voorwaarde.",188
"info.kw.exists": "Elk genoemd pad moet in de commit staan. Is de boom onbekend, dan klopt de voorwaarde.",189
190
"info.var.CI": "Altijd waar.",191
"info.var.CI_CONFIG_PATH": "Pad van het pipelinebestand.",192
"info.var.CI_SERVER_NAME": "Altijd BlueGit.",193
"info.var.CI_COMMIT_SHA": "Volledige commit-id.",194
"info.var.CI_COMMIT_SHORT_SHA": "Eerste acht tekens van de commit-id.",195
"info.var.CI_COMMIT_REF": "Volledige git-ref.",196
"info.var.CI_COMMIT_REF_NAME": "Naam van de tak of de tag.",197
"info.var.CI_COMMIT_REF_SLUG": "Ref-naam die veilig is in een URL.",198
"info.var.CI_COMMIT_TITLE": "Onderwerp van de commit.",199
"info.var.CI_COMMIT_BRANCH": "Taknaam. Leeg op een tag.",200
"info.var.CI_COMMIT_TAG": "Tagnaam. Leeg op een tak.",201
"info.var.CI_DEFAULT_BRANCH": "Standaardtak van de repository.",202
"info.var.CI_PIPELINE_ID": "Pipelinenummer. Nul zolang rules worden beoordeeld.",203
"info.var.CI_PIPELINE_SOURCE": "push, web, of merge_request_event.",204
"info.var.CI_PIPELINE_URL": "Link naar de pipeline.",205
"info.var.CI_PROJECT_PATH": "Eigenaar en repository.",206
"info.var.CI_PROJECT_NAME": "Naam van de repository.",207
"info.var.CI_PROJECT_NAMESPACE": "Pad van de eigenaar.",208
"info.var.CI_PROJECT_URL": "Link naar de repository.",209
"info.var.CI_API_URL": "Wortel van de API.",210
"info.var.CI_JOB_ID": "Jobnummer.",211
"info.var.CI_JOB_NAME": "Naam van de job.",212
"info.var.CI_JOB_STAGE": "Naam van de stage.",213
"info.var.CI_JOB_URL": "Link naar de job.",214
"info.var.CI_JOB_TOKEN": "Token van deze job. In het log staat een masker.",215
"info.var.CI_NODE_INDEX": "Index van deze parallel- of matrixjob.",216
"info.var.CI_NODE_TOTAL": "Aantal parallel- of matrixjobs.",217
"info.var.CI_ENVIRONMENT_NAME": "Naam van de omgeving.",218
"info.var.CI_ENVIRONMENT_URL": "Adres van de omgeving.",219
"info.var.CI_MERGE_REQUEST_ID": "Interne id van de merge request.",220
"info.var.CI_MERGE_REQUEST_IID": "Nummer van de merge request in het project.",221
"info.var.CI_MERGE_REQUEST_TITLE": "Titel van de merge request.",222
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Brontak.",223
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit van de brontak.",224
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Doeltak.",225
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Punt van de doeltak.",226
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Projectpad van de merge request.",227
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Link naar dat project.",228
229
"info.diff.file": "Het bestand heet blue-ci-cd.yml, niet de GitLab-bestandsnaam.",230
"info.diff.runner": "Er is één runner. De naam staat in runner.name en is standaard Steve. tags kiezen geen andere runner.",231
"info.diff.include": "include leest alleen een lokaal bestand. Een include van een project, een URL of een template wordt genegeerd.",232
"info.diff.unsupported": "pages, spec, trigger-pipelines, child-pipelines, coverage, id_tokens, inherit en hooks worden genegeerd met een waarschuwing.",233
"info.diff.services": "services op het hoogste niveau wordt genegeerd. Job-services delen een netwerk en hebben geen healthcheck verder dan een gestarte container.",234
"info.diff.env": "environment zet alleen variabelen. Er is geen deployment en geen stop-job.",235
"info.diff.retry": "retry max is hoogstens 2.",236
"info.diff.parallel": "parallel is hoogstens 50.",237
"info.diff.rules": "Het pipelinenummer is nul zolang rules draaien. Job-, node- en omgevingsvariabelen bestaan alleen in de container.",238
"info.diff.mr": "Een merge-request-pipeline draait op de commit van de bron, niet op een samengevoegde boom. Hij start bij het openen, bij elke push naar de bron, en opnieuw als iemand naar de doeltak pusht.",239
"info.diff.cache": "cache blijft op deze machine en wordt niet gedeeld.",240
"info.diff.images": "Een imagenaam die een preset is wordt lokaal gebouwd. Elke andere naam is een gewoon Docker-image.",241
}242
243
var infoDE = map[string]string{244
"nav.info": "Info",245
"title.info": "CI/CD",246
"info.lead": "Nachschlagewerk für blue-ci-cd.yml und die Image-Presets, die Steve baut.",247
248
"info.col.keyword": "Schlüsselwort",249
"info.col.meaning": "Bedeutung",250
"info.col.name": "Preset",251
"info.col.base": "Image",252
"info.col.tools": "Inhalt",253
"info.col.where": "Verfügbar",254
255
"info.sec.pipeline": "Pipeline",256
"info.sec.job": "Jobs",257
"info.sec.rules": "Regeln",258
"info.sec.variables": "Variablen",259
"info.sec.diff": "Unterschiede zu GitLab",260
"info.sec.presets": "Image-Presets",261
262
"info.where.both": "Regeln und Container",263
"info.where.container": "Nur im Container",264
"info.where.mr": "Merge Request",265
266
"info.rules.intro": "Die erste passende Regel gewinnt. && bindet stärker als ||. Klammern gruppieren. Eine leere Variable ist null. == und != vergleichen. =~ und !~ prüfen ein RE2-Muster. Ein Schrägstrich im Muster wird mit einem Backslash geschrieben. Die Flagge i steht direkt hinter der schließenden Klammer. Ein Muster in einer Variable muss gültig sein, wenn die Regel läuft.",267
"info.presets.intro": "Ein Job wählt ein Preset mit dem Schlüsselwort image. Steve baut das Dockerfile beim ersten Gebrauch und verwendet das Ergebnis wieder. Jeder andere Name, etwa node:22, bleibt ein normales Docker-Image.",268
"info.presets.config": "Ein Preset ergänzt oder ersetzt man unter ci.presets in config.yml, mit image, dockerfile oder from.",269
"info.presets.mapped": "Verwendet dieses Image unverändert.",270
271
"info.kw.stages": "Reihenfolge der Stages. Fehlt sie, folgen die Stages der Reihenfolge, in der Jobs sie nennen. Ein Job ohne Stage nutzt test.",272
"info.kw.variables": "Ein Text oder ein Feld value. Ein Job überschreibt denselben Namen. Verfügbar in Regeln und im Container.",273
"info.kw.image": "Standardimage, als Text oder als Feld name. default.image gewinnt, wenn es gesetzt ist. Ein Preset wie bluegit/base ist erlaubt.",274
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry und interruptible für Jobs, die sie nicht selbst setzen.",275
"info.kw.include": "Nur ein lokaler Pfad. Ein Job mit demselben Namen wird zusammengeführt und die äußere Datei gewinnt je Feld.",276
"info.kw.before_script": "Shell-Zeilen, die vor script laufen.",277
"info.kw.after_script": "Shell-Zeilen, die nach script laufen, auch wenn script scheitert.",278
"info.kw.cache": "paths und ein Textschlüssel. Bleibt auf diesem Rechner für ein Repository.",279
"info.kw.workflow": "rules wie bei einem Job. Kein Treffer oder when never erzeugt keine Pipeline.",280
"info.kw.jobs": "Optionale ältere Map von Jobs. Jobs dürfen auch auf der obersten Ebene stehen, aber nicht an beiden Stellen.",281
"info.kw.stage": "Name der Stage. Weggelassen bedeutet test.",282
"info.kw.script": "Shell-Zeilen. Der Job scheitert, wenn eine Zeile scheitert.",283
"info.kw.needs": "Jobnamen oder job und optional. Eine leere Liste startet sofort. Weggelassen wartet der Job auf frühere Stages. Ein need auf einen Parallel-Job wartet auf jede Kopie.",284
"info.kw.rules": "Der erste Treffer gewinnt. Felder sind if, changes, exists und when. Ohne rules entscheiden only und except.",285
"info.kw.only": "Ein Branchname, branches, tags, merge_requests oder ein Regex zwischen Schrägstrichen.",286
"info.kw.except": "Das Gegenteil von only.",287
"info.kw.when": "on_success ist der Standard, außerdem on_failure, always und manual. Eine Regel darf never sagen.",288
"info.kw.allow_failure": "Ein Fehler stoppt den Rest nicht. Der Job selbst wird eine Warnung.",289
"info.kw.artifacts": "paths und expire_in. Einheiten sind Sekunden, Minuten, Stunden, Tage, Wochen oder never.",290
"info.kw.resource_group": "Jobs mit diesem Namen in einem Repository laufen nicht gleichzeitig.",291
"info.kw.timeout": "Ersetzt das Server-Timeout für diesen Job. Der Runner stoppt den Container, wenn die Zeit um ist.",292
"info.kw.retry": "Eine Zahl oder max und when. max liegt zwischen 0 und 2, eine höhere Zahl wird gekappt. when nennt script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure oder always.",293
"info.kw.parallel": "Eine Zahl bis 50 oder eine Matrix. Nummerierte Jobs heißen Name 1/N und erhalten CI_NODE_INDEX und CI_NODE_TOTAL. Eine Matrix ist das Produkt jeder Liste, danach aneinandergereiht. Schlüssel werden Variablen.",294
"info.kw.services": "Sidecar-Container im selben Netz wie der Job. Text oder name, alias, command, entrypoint und variables. Ohne Alias entfallen Registry und Tag. Es gibt keine Health-Prüfung außer einem gestarteten Container.",295
"info.kw.environment": "Ein Name oder name und url. Setzt die Umgebungsvariablen. Es gibt kein Deployment und keinen Stop-Job.",296
"info.kw.interruptible": "Standardmäßig aus. Eine neuere Pipeline auf derselben Ref bricht ältere Jobs ab, die dies gesetzt haben und noch warten oder laufen.",297
"info.kw.tags": "Am Job gespeichert. Steve führt jeden Job aus. Tags wählen keinen Runner.",298
"info.kw.extends": "Ein Name oder eine Liste. Ein Job, dessen Name mit einem Punkt beginnt, ist eine Vorlage und läuft nicht.",299
"info.kw.if": "Ein Ausdruck. Die erste Regel, deren if, changes und exists alle passen, gewinnt.",300
"info.kw.changes": "Pfade im Diff des Push. Ist der Diff nicht bestimmbar, trifft die Bedingung zu.",301
"info.kw.exists": "Jeder genannte Pfad muss im Commit stehen. Ist der Baum unbekannt, trifft die Bedingung zu.",302
303
"info.var.CI": "Immer wahr.",304
"info.var.CI_CONFIG_PATH": "Pfad der Pipeline-Datei.",305
"info.var.CI_SERVER_NAME": "Immer BlueGit.",306
"info.var.CI_COMMIT_SHA": "Volle Commit-Id.",307
"info.var.CI_COMMIT_SHORT_SHA": "Die ersten acht Zeichen der Commit-Id.",308
"info.var.CI_COMMIT_REF": "Volle Git-Ref.",309
"info.var.CI_COMMIT_REF_NAME": "Name des Branches oder des Tags.",310
"info.var.CI_COMMIT_REF_SLUG": "Ref-Name, der in einer URL sicher ist.",311
"info.var.CI_COMMIT_TITLE": "Betreff des Commits.",312
"info.var.CI_COMMIT_BRANCH": "Branchname. Leer bei einem Tag.",313
"info.var.CI_COMMIT_TAG": "Tagname. Leer bei einem Branch.",314
"info.var.CI_DEFAULT_BRANCH": "Standardbranch des Repositorys.",315
"info.var.CI_PIPELINE_ID": "Pipelinenummer. Null, solange Regeln geprüft werden.",316
"info.var.CI_PIPELINE_SOURCE": "push, web oder merge_request_event.",317
"info.var.CI_PIPELINE_URL": "Link zur Pipeline.",318
"info.var.CI_PROJECT_PATH": "Besitzer und Repository.",319
"info.var.CI_PROJECT_NAME": "Name des Repositorys.",320
"info.var.CI_PROJECT_NAMESPACE": "Pfad des Besitzers.",321
"info.var.CI_PROJECT_URL": "Link zum Repository.",322
"info.var.CI_API_URL": "Wurzel der API.",323
"info.var.CI_JOB_ID": "Jobnummer.",324
"info.var.CI_JOB_NAME": "Name des Jobs.",325
"info.var.CI_JOB_STAGE": "Name der Stage.",326
"info.var.CI_JOB_URL": "Link zum Job.",327
"info.var.CI_JOB_TOKEN": "Token dieses Jobs. Im Log steht eine Maske.",328
"info.var.CI_NODE_INDEX": "Index dieses Parallel- oder Matrix-Jobs.",329
"info.var.CI_NODE_TOTAL": "Anzahl der Parallel- oder Matrix-Jobs.",330
"info.var.CI_ENVIRONMENT_NAME": "Name der Umgebung.",331
"info.var.CI_ENVIRONMENT_URL": "Adresse der Umgebung.",332
"info.var.CI_MERGE_REQUEST_ID": "Interne Id des Merge Requests.",333
"info.var.CI_MERGE_REQUEST_IID": "Nummer des Merge Requests im Projekt.",334
"info.var.CI_MERGE_REQUEST_TITLE": "Titel des Merge Requests.",335
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Quellbranch.",336
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit des Quellbranches.",337
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Zielbranch.",338
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Spitze des Zielbranches.",339
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Projektpfad des Merge Requests.",340
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Link zu diesem Projekt.",341
342
"info.diff.file": "Die Datei heißt blue-ci-cd.yml, nicht der GitLab-Dateiname.",343
"info.diff.runner": "Es gibt einen Runner. Der Name steht in runner.name und ist standardmäßig Steve. tags wählen keinen anderen Runner.",344
"info.diff.include": "include liest nur eine lokale Datei. Ein Include aus einem Projekt, einer URL oder einer Vorlage wird ignoriert.",345
"info.diff.unsupported": "pages, spec, Trigger-Pipelines, Child-Pipelines, coverage, id_tokens, inherit und hooks werden mit einer Warnung ignoriert.",346
"info.diff.services": "services auf der obersten Ebene wird ignoriert. Job-Services teilen ein Netz und haben keine Health-Prüfung außer einem gestarteten Container.",347
"info.diff.env": "environment setzt nur Variablen. Es gibt kein Deployment und keinen Stop-Job.",348
"info.diff.retry": "retry max ist höchstens 2.",349
"info.diff.parallel": "parallel ist höchstens 50.",350
"info.diff.rules": "Die Pipelinenummer ist null, solange Regeln laufen. Job-, Node- und Umgebungsvariablen gibt es nur im Container.",351
"info.diff.mr": "Eine Merge-Request-Pipeline läuft auf dem Quell-Commit, nicht auf einem zusammengeführten Baum. Sie startet beim Öffnen, bei jedem Push zur Quelle und erneut, wenn jemand den Zielbranch pusht.",352
"info.diff.cache": "cache bleibt auf diesem Rechner und wird nicht geteilt.",353
"info.diff.images": "Ein Imagename, der ein Preset ist, wird lokal gebaut. Jeder andere Name ist ein normales Docker-Image.",354
}355
356
var infoFR = map[string]string{357
"nav.info": "Info",358
"title.info": "CI/CD",359
"info.lead": "Référence de blue-ci-cd.yml et des presets d'image que Steve construit.",360
361
"info.col.keyword": "Mot-clé",362
"info.col.meaning": "Signification",363
"info.col.name": "Preset",364
"info.col.base": "Image",365
"info.col.tools": "Contenu",366
"info.col.where": "Disponible",367
368
"info.sec.pipeline": "Pipeline",369
"info.sec.job": "Jobs",370
"info.sec.rules": "Règles",371
"info.sec.variables": "Variables",372
"info.sec.diff": "Différences avec GitLab",373
"info.sec.presets": "Presets d'image",374
375
"info.where.both": "Règles et conteneur",376
"info.where.container": "Conteneur seulement",377
"info.where.mr": "Merge request",378
379
"info.rules.intro": "La première règle qui correspond gagne. && lie plus fort que ||. Les parenthèses groupent. Une variable vide vaut null. == et != comparent. =~ et !~ testent un motif RE2. Un slash dans un motif s'écrit avec un backslash. Le drapeau i suit juste la parenthèse fermante. Un motif dans une variable doit être valide au moment où la règle tourne.",380
"info.presets.intro": "Un job choisit un preset avec le mot-clé image. Steve construit ce Dockerfile au premier usage et réutilise le résultat. Tout autre nom, comme node:22, reste une image Docker ordinaire.",381
"info.presets.config": "On ajoute ou remplace un preset sous ci.presets dans config.yml, avec image, dockerfile ou from.",382
"info.presets.mapped": "Utilise cette image telle quelle.",383
384
"info.kw.stages": "Ordre des stages. S'il manque, les stages suivent l'ordre dans lequel les jobs les nomment. Un job sans stage utilise test.",385
"info.kw.variables": "Un texte, ou un champ value. Un job remplace le même nom. Disponible dans les règles et dans le conteneur.",386
"info.kw.image": "Image par défaut, en texte ou en champ name. default.image gagne s'il est posé. Un preset comme bluegit/base est permis.",387
"info.kw.default": "image, before_script, after_script, tags, timeout, cache, retry et interruptible pour les jobs qui ne les posent pas.",388
"info.kw.include": "Seulement un chemin local. Un job du même nom est fusionné et le fichier extérieur gagne chaque champ.",389
"info.kw.before_script": "Lignes de shell qui tournent avant script.",390
"info.kw.after_script": "Lignes de shell qui tournent après script, même si script échoue.",391
"info.kw.cache": "paths et une clé texte. Reste sur cette machine pour un dépôt.",392
"info.kw.workflow": "rules, comme pour un job. Aucune correspondance, ou when never, ne crée pas de pipeline.",393
"info.kw.jobs": "Ancienne map optionnelle de jobs. Les jobs peuvent aussi être au premier niveau, mais pas aux deux endroits.",394
"info.kw.stage": "Nom du stage. Absent signifie test.",395
"info.kw.script": "Lignes de shell. Le job échoue si une ligne échoue.",396
"info.kw.needs": "Noms de jobs, ou job et optional. Une liste vide démarre tout de suite. Absente, le job attend les stages précédents. Un need sur un job parallèle attend chaque copie.",397
"info.kw.rules": "La première correspondance gagne. Les champs sont if, changes, exists et when. Sans rules, only et except décident.",398
"info.kw.only": "Un nom de branche, branches, tags, merge_requests, ou une regex entre des slashes.",399
"info.kw.except": "Le contraire de only.",400
"info.kw.when": "on_success est le défaut, aussi on_failure, always et manual. Une règle peut dire never.",401
"info.kw.allow_failure": "Un échec n'arrête pas le reste. Le job lui-même devient un avertissement.",402
"info.kw.artifacts": "paths et expire_in. Les unités sont secondes, minutes, heures, jours, semaines, ou never.",403
"info.kw.resource_group": "Les jobs qui partagent ce nom dans un dépôt ne tournent pas en même temps.",404
"info.kw.timeout": "Remplace le délai du serveur pour ce job. Le runner arrête le conteneur quand le temps est fini.",405
"info.kw.retry": "Un nombre, ou max et when. max va de 0 à 2 et un nombre plus haut est coupé. when nomme script_failure, runner_system_failure, job_execution_timeout, stuck_or_timeout_failure ou always.",406
"info.kw.parallel": "Un nombre jusqu'à 50, ou une matrice. Les jobs numérotés s'appellent nom 1/N et reçoivent CI_NODE_INDEX et CI_NODE_TOTAL. Une matrice est le produit de chaque liste, puis ces produits à la suite. Les clés deviennent des variables.",407
"info.kw.services": "Conteneurs sidecar sur un réseau avec le job. Texte, ou name, alias, command, entrypoint et variables. Sans alias, le registre et le tag tombent. Il n'y a pas de contrôle de santé au-delà d'un conteneur démarré.",408
"info.kw.environment": "Un nom, ou name et url. Pose les variables d'environnement. Il n'y a pas de déploiement et pas de job d'arrêt.",409
"info.kw.interruptible": "Éteint par défaut. Une pipeline plus récente sur la même ref annule les jobs plus anciens qui ont ceci et qui attendent encore ou tournent.",410
"info.kw.tags": "Conservé sur le job. Steve exécute chaque job. Les tags ne choisissent pas un runner.",411
"info.kw.extends": "Un nom ou une liste. Un job dont le nom commence par un point est un modèle et ne tourne pas.",412
"info.kw.if": "Une expression. La première règle dont if, changes et exists correspondent tous gagne.",413
"info.kw.changes": "Chemins dans le diff du push. Si ce diff est inconnu, la condition correspond.",414
"info.kw.exists": "Chaque chemin cité doit être dans le commit. Si l'arbre est inconnu, la condition correspond.",415
416
"info.var.CI": "Toujours vrai.",417
"info.var.CI_CONFIG_PATH": "Chemin du fichier de pipeline.",418
"info.var.CI_SERVER_NAME": "Toujours BlueGit.",419
"info.var.CI_COMMIT_SHA": "Identifiant complet du commit.",420
"info.var.CI_COMMIT_SHORT_SHA": "Huit premiers caractères de l'identifiant du commit.",421
"info.var.CI_COMMIT_REF": "Réf git complète.",422
"info.var.CI_COMMIT_REF_NAME": "Nom de la branche ou du tag.",423
"info.var.CI_COMMIT_REF_SLUG": "Nom de réf sûr dans une URL.",424
"info.var.CI_COMMIT_TITLE": "Sujet du commit.",425
"info.var.CI_COMMIT_BRANCH": "Nom de branche. Vide sur un tag.",426
"info.var.CI_COMMIT_TAG": "Nom du tag. Vide sur une branche.",427
"info.var.CI_DEFAULT_BRANCH": "Branche par défaut du dépôt.",428
"info.var.CI_PIPELINE_ID": "Numéro de pipeline. Zéro pendant l'évaluation des règles.",429
"info.var.CI_PIPELINE_SOURCE": "push, web, ou merge_request_event.",430
"info.var.CI_PIPELINE_URL": "Lien vers la pipeline.",431
"info.var.CI_PROJECT_PATH": "Propriétaire et dépôt.",432
"info.var.CI_PROJECT_NAME": "Nom du dépôt.",433
"info.var.CI_PROJECT_NAMESPACE": "Chemin du propriétaire.",434
"info.var.CI_PROJECT_URL": "Lien vers le dépôt.",435
"info.var.CI_API_URL": "Racine de l'API.",436
"info.var.CI_JOB_ID": "Numéro du job.",437
"info.var.CI_JOB_NAME": "Nom du job.",438
"info.var.CI_JOB_STAGE": "Nom du stage.",439
"info.var.CI_JOB_URL": "Lien vers le job.",440
"info.var.CI_JOB_TOKEN": "Jeton de ce job. Le journal le masque.",441
"info.var.CI_NODE_INDEX": "Index de ce job parallèle ou de matrice.",442
"info.var.CI_NODE_TOTAL": "Nombre de jobs parallèles ou de matrice.",443
"info.var.CI_ENVIRONMENT_NAME": "Nom de l'environnement.",444
"info.var.CI_ENVIRONMENT_URL": "Adresse de l'environnement.",445
"info.var.CI_MERGE_REQUEST_ID": "Identifiant interne de la merge request.",446
"info.var.CI_MERGE_REQUEST_IID": "Numéro de la merge request dans le projet.",447
"info.var.CI_MERGE_REQUEST_TITLE": "Titre de la merge request.",448
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME": "Branche source.",449
"info.var.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA": "Commit de la branche source.",450
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_NAME": "Branche cible.",451
"info.var.CI_MERGE_REQUEST_TARGET_BRANCH_SHA": "Pointe de la branche cible.",452
"info.var.CI_MERGE_REQUEST_PROJECT_PATH": "Chemin du projet de la merge request.",453
"info.var.CI_MERGE_REQUEST_PROJECT_URL": "Lien vers ce projet.",454
455
"info.diff.file": "Le fichier s'appelle blue-ci-cd.yml, pas le nom de fichier GitLab.",456
"info.diff.runner": "Il y a un seul runner. Son nom est runner.name et vaut Steve par défaut. Les tags ne choisissent pas un autre runner.",457
"info.diff.include": "include ne lit qu'un fichier local. Un include de projet, d'URL ou de modèle est ignoré.",458
"info.diff.unsupported": "pages, spec, les pipelines déclenchées, les pipelines enfants, coverage, id_tokens, inherit et hooks sont ignorés avec un avertissement.",459
"info.diff.services": "services au premier niveau est ignoré. Les services d'un job partagent un réseau et n'ont pas de contrôle de santé au-delà d'un conteneur démarré.",460
"info.diff.env": "environment ne fait que poser des variables. Il n'y a pas de déploiement et pas de job d'arrêt.",461
"info.diff.retry": "retry max est plafonné à 2.",462
"info.diff.parallel": "parallel est plafonné à 50.",463
"info.diff.rules": "Le numéro de pipeline est zéro pendant les règles. Les variables de job, de nœud et d'environnement n'existent que dans le conteneur.",464
"info.diff.mr": "Une pipeline de merge request tourne sur le commit source, pas sur un arbre fusionné. Elle démarre à l'ouverture, à chaque push vers la source, et encore quand quelqu'un pousse la cible.",465
"info.diff.cache": "cache reste sur cette machine et n'est pas partagé.",466
"info.diff.images": "Un nom d'image qui est un preset est construit localement. Tout autre nom est une image Docker ordinaire.",467
}@@ -0,0 +1,3 @@
1
# runtime: Alpine 3.20
2
FROM alpine:3.20
3
RUN apk add --no-cache bash ca-certificates curl git
@@ -0,0 +1,3 @@1
# runtime: Alpine 3.202
FROM alpine:3.203
RUN apk add --no-cache bash ca-certificates curl git@@ -0,0 +1,3 @@
1
# runtime: .NET SDK 8
2
FROM mcr.microsoft.com/dotnet/sdk:8.0
3
RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates curl git && rm -rf /var/lib/apt/lists/*
@@ -0,0 +1,3 @@1
# runtime: .NET SDK 82
FROM mcr.microsoft.com/dotnet/sdk:8.03
RUN apt-get update && apt-get install -y --no-install-recommends bash ca-certificates curl git && rm -rf /var/lib/apt/lists/*@@ -0,0 +1,3 @@
1
# runtime: Go 1.22
2
FROM golang:1.22-alpine
3
RUN apk add --no-cache bash ca-certificates curl git
@@ -0,0 +1,3 @@1
# runtime: Go 1.222
FROM golang:1.22-alpine3
RUN apk add --no-cache bash ca-certificates curl git@@ -0,0 +1,3 @@
1
# runtime: Java 21
2
FROM eclipse-temurin:21-jdk-alpine
3
RUN apk add --no-cache bash ca-certificates curl git
@@ -0,0 +1,3 @@1
# runtime: Java 212
FROM eclipse-temurin:21-jdk-alpine3
RUN apk add --no-cache bash ca-certificates curl git@@ -0,0 +1,3 @@
1
# runtime: Node.js 22
2
FROM node:22-alpine
3
RUN apk add --no-cache bash ca-certificates curl git
@@ -0,0 +1,3 @@1
# runtime: Node.js 222
FROM node:22-alpine3
RUN apk add --no-cache bash ca-certificates curl git@@ -0,0 +1,3 @@
1
# runtime: Python 3.12
2
FROM python:3.12-alpine
3
RUN apk add --no-cache bash ca-certificates curl git
@@ -0,0 +1,3 @@1
# runtime: Python 3.122
FROM python:3.12-alpine3
RUN apk add --no-cache bash ca-certificates curl git@@ -0,0 +1,3 @@
1
# runtime: Rust 1.81
2
FROM rust:1.81-alpine
3
RUN apk add --no-cache bash ca-certificates curl git
@@ -0,0 +1,3 @@1
# runtime: Rust 1.812
FROM rust:1.81-alpine3
RUN apk add --no-cache bash ca-certificates curl git@@ -0,0 +1,325 @@
1
// Package images zijn de image-aliassen die Steve voor een job bouwt.
2
// bluegit/node is geen aparte runner: het is een Dockerfile die bij het
3
// eerste gebruik lokaal wordt gebouwd en daarna hergebruikt. Een gewone
4
// naam zoals node:22 blijft een gewoon Docker-image.
5
package images
6
7
import (
8
"context"
9
"crypto/sha256"
10
"embed"
11
"encoding/hex"
12
"fmt"
13
"os"
14
"os/exec"
15
"path/filepath"
16
"regexp"
17
"sort"
18
"strings"
19
"sync"
20
)
21
22
//go:embed dockerfiles/*/*
23
var dockerfiles embed.FS
24
25
// builtinOrder is de volgorde op de infopagina.
26
var builtinOrder = []string{"base", "node", "python", "go", "rust", "java", "dotnet"}
27
28
// Preset is één alias. Direct gezet betekent: gebruik dat image zonder bouw.
29
type Preset struct {
30
Name string
31
From string
32
Runtime string
33
Tools []string
34
Dockerfile []byte
35
Direct string
36
}
37
38
// Override komt uit ci.presets in config.yml.
39
type Override struct {
40
Image string
41
Dockerfile string
42
From string
43
}
44
45
var nameRE = regexp.MustCompile(`^[a-z0-9]+(?:[._-][a-z0-9]+)*(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)+$`)
46
47
// Known zegt of name een ingebouwde alias is.
48
func Known(name string) bool {
49
for _, n := range builtinOrder {
50
if "bluegit/"+n == name {
51
return true
52
}
53
}
54
return false
55
}
56
57
// ValidateOverride keurt één configregel goed.
58
// hasBuiltin is waar als name al een ingebouwde alias is; from mag die
59
// Dockerfile dan herschrijven.
60
func ValidateOverride(name string, o Override, hasBuiltin bool) error {
61
if !nameRE.MatchString(name) {
62
return fmt.Errorf("ci.presets %q: de naam moet een image-alias zijn, zoals team/tools", name)
63
}
64
if o.Image != "" && (o.Dockerfile != "" || o.From != "") {
65
return fmt.Errorf("ci.presets %s: image sluit dockerfile en from uit", name)
66
}
67
if o.Image == "" && o.Dockerfile == "" && o.From == "" {
68
return fmt.Errorf("ci.presets %s: geef image, dockerfile of from", name)
69
}
70
if o.From != "" && o.Dockerfile == "" && o.Image == "" && !hasBuiltin {
71
return fmt.Errorf("ci.presets %s: from hoort bij een ingebouwde preset of een dockerfile", name)
72
}
73
if o.Image != "" && !validRef(o.Image) {
74
return fmt.Errorf("ci.presets %s: image %q is ongeldig", name, o.Image)
75
}
76
if o.From != "" && !validRef(o.From) {
77
return fmt.Errorf("ci.presets %s: from %q is ongeldig", name, o.From)
78
}
79
if o.Dockerfile != "" {
80
if _, err := os.Stat(o.Dockerfile); err != nil {
81
return fmt.Errorf("ci.presets %s: dockerfile %s: %w", name, o.Dockerfile, err)
82
}
83
}
84
return nil
85
}
86
87
func validRef(s string) bool {
88
return s != "" && strings.TrimSpace(s) == s && !strings.ContainsAny(s, " \t")
89
}
90
91
// Builtin leest de Dockerfiles die in het binary zitten.
92
func Builtin() []Preset {
93
var out []Preset
94
for _, name := range builtinOrder {
95
raw, err := dockerfiles.ReadFile("dockerfiles/" + name + "/Dockerfile")
96
if err != nil {
97
continue
98
}
99
from, runtime, tools, err := ParseDockerfile(raw)
100
if err != nil {
101
continue
102
}
103
out = append(out, Preset{
104
Name: "bluegit/" + name, From: from, Runtime: runtime, Tools: tools, Dockerfile: raw,
105
})
106
}
107
return out
108
}
109
110
// Effective is de ingebouwde lijst plus de aliassen uit de configuratie.
111
// Een bestaande naam wordt vervangen. Nieuwe namen komen er alfabetisch achter.
112
func Effective(over map[string]Override) ([]Preset, error) {
113
base := Builtin()
114
index := map[string]int{}
115
for i, p := range base {
116
index[p.Name] = i
117
}
118
var extra []string
119
for name := range over {
120
if _, ok := index[name]; ok {
121
continue
122
}
123
extra = append(extra, name)
124
}
125
sort.Strings(extra)
126
order := make([]string, 0, len(base)+len(extra))
127
for _, p := range base {
128
order = append(order, p.Name)
129
}
130
order = append(order, extra...)
131
out := make([]Preset, 0, len(order))
132
for _, name := range order {
133
o, ok := over[name]
134
if !ok {
135
out = append(out, base[index[name]])
136
continue
137
}
138
cur := Preset{Name: name}
139
if i, known := index[name]; known {
140
cur = base[i]
141
}
142
next, err := apply(cur, o)
143
if err != nil {
144
return nil, err
145
}
146
out = append(out, next)
147
}
148
return out, nil
149
}
150
151
func apply(base Preset, o Override) (Preset, error) {
152
if err := ValidateOverride(base.Name, o, len(base.Dockerfile) > 0); err != nil {
153
return Preset{}, err
154
}
155
if o.Image != "" {
156
return Preset{Name: base.Name, From: o.Image, Runtime: o.Image, Direct: o.Image}, nil
157
}
158
data := append([]byte(nil), base.Dockerfile...)
159
if o.Dockerfile != "" {
160
raw, err := os.ReadFile(o.Dockerfile)
161
if err != nil {
162
return Preset{}, fmt.Errorf("ci.presets %s: %w", base.Name, err)
163
}
164
data = raw
165
}
166
if len(data) == 0 {
167
return Preset{}, fmt.Errorf("ci.presets %s: geen dockerfile", base.Name)
168
}
169
if o.From != "" {
170
data = rewriteFrom(data, o.From)
171
}
172
from, runtime, tools, err := ParseDockerfile(data)
173
if err != nil {
174
return Preset{}, fmt.Errorf("ci.presets %s: %w", base.Name, err)
175
}
176
return Preset{Name: base.Name, From: from, Runtime: runtime, Tools: tools, Dockerfile: data}, nil
177
}
178
179
// Find zoekt een exacte alias. node:22 is er geen.
180
func Find(set []Preset, image string) (Preset, bool) {
181
image = strings.TrimSpace(image)
182
for _, p := range set {
183
if p.Name == image {
184
return p, true
185
}
186
}
187
return Preset{}, false
188
}
189
190
// ParseDockerfile leest FROM, een regel "# runtime:" en de pakketten uit apk of apt-get.
191
func ParseDockerfile(data []byte) (from, runtime string, tools []string, err error) {
192
sawFrom := false
193
for _, line := range strings.Split(string(data), "\n") {
194
trim := strings.TrimSpace(line)
195
if trim == "" {
196
continue
197
}
198
if strings.HasPrefix(trim, "#") {
199
if rest, ok := strings.CutPrefix(trim, "# runtime:"); ok {
200
runtime = strings.TrimSpace(rest)
201
}
202
continue
203
}
204
if !sawFrom {
205
fields := strings.Fields(trim)
206
if len(fields) < 2 || !strings.EqualFold(fields[0], "FROM") {
207
return "", "", nil, fmt.Errorf("dockerfile moet met FROM beginnen")
208
}
209
from = fields[1]
210
sawFrom = true
211
continue
212
}
213
tools = append(tools, packages(trim)...)
214
}
215
if from == "" {
216
return "", "", nil, fmt.Errorf("dockerfile mist FROM")
217
}
218
if runtime == "" {
219
runtime = from
220
}
221
return from, runtime, tools, nil
222
}
223
224
func packages(line string) []string {
225
var out []string
226
if i := strings.Index(line, "apk add"); i >= 0 {
227
out = append(out, packageTokens(line[i+len("apk add"):])...)
228
}
229
if i := strings.Index(line, "apt-get install"); i >= 0 {
230
rest := line[i+len("apt-get install"):]
231
if j := strings.Index(rest, "&&"); j >= 0 {
232
rest = rest[:j]
233
}
234
out = append(out, packageTokens(rest)...)
235
}
236
return out
237
}
238
239
func packageTokens(s string) []string {
240
var out []string
241
for _, f := range strings.Fields(s) {
242
if strings.HasPrefix(f, "-") {
243
continue
244
}
245
out = append(out, f)
246
}
247
return out
248
}
249
250
func rewriteFrom(data []byte, from string) []byte {
251
lines := strings.Split(string(data), "\n")
252
for i, line := range lines {
253
trim := strings.TrimSpace(line)
254
if trim == "" || strings.HasPrefix(trim, "#") {
255
continue
256
}
257
if strings.HasPrefix(strings.ToUpper(trim), "FROM ") {
258
lines[i] = "FROM " + from
259
}
260
break
261
}
262
return []byte(strings.Join(lines, "\n"))
263
}
264
265
var (
266
buildMu = sync.Mutex{}
267
buildOf = map[string]*sync.Mutex{}
268
)
269
270
func lockRef(ref string) func() {
271
buildMu.Lock()
272
m := buildOf[ref]
273
if m == nil {
274
m = &sync.Mutex{}
275
buildOf[ref] = m
276
}
277
buildMu.Unlock()
278
m.Lock()
279
return m.Unlock
280
}
281
282
// Ensure bouwt de Dockerfile als het resultaat nog niet lokaal staat.
283
// De tag is de alias plus een hash van de Dockerfile, zodat een wijziging
284
// een nieuwe bouw is en een gelijke Dockerfile de cache raakt.
285
func (p Preset) Ensure(ctx context.Context, dockerBin string) (ref string, built bool, err error) {
286
if p.Direct != "" {
287
return p.Direct, false, nil
288
}
289
if len(p.Dockerfile) == 0 {
290
return "", false, fmt.Errorf("preset %s heeft geen dockerfile", p.Name)
291
}
292
sum := sha256.Sum256(p.Dockerfile)
293
ref = p.Name + ":" + hex.EncodeToString(sum[:6])
294
unlock := lockRef(ref)
295
defer unlock()
296
if ok, _ := imageExists(ctx, dockerBin, ref); ok {
297
return ref, false, nil
298
}
299
dir, err := os.MkdirTemp("", "bluegit-preset-")
300
if err != nil {
301
return "", false, err
302
}
303
defer os.RemoveAll(dir)
304
if err := os.WriteFile(filepath.Join(dir, "Dockerfile"), p.Dockerfile, 0o644); err != nil {
305
return "", false, err
306
}
307
cmd := exec.CommandContext(ctx, dockerBin, "build", "-t", ref, dir)
308
out, err := cmd.CombinedOutput()
309
if err != nil {
310
msg := strings.TrimSpace(string(out))
311
if msg == "" {
312
msg = err.Error()
313
}
314
return "", false, fmt.Errorf("%s", msg)
315
}
316
return ref, true, nil
317
}
318
319
func imageExists(ctx context.Context, dockerBin, ref string) (bool, error) {
320
cmd := exec.CommandContext(ctx, dockerBin, "image", "inspect", "--format", "{{.Id}}", ref)
321
if err := cmd.Run(); err != nil {
322
return false, err
323
}
324
return true, nil
325
}
@@ -0,0 +1,325 @@1
// Package images zijn de image-aliassen die Steve voor een job bouwt.2
// bluegit/node is geen aparte runner: het is een Dockerfile die bij het3
// eerste gebruik lokaal wordt gebouwd en daarna hergebruikt. Een gewone4
// naam zoals node:22 blijft een gewoon Docker-image.5
package images6
7
import (8
"context"9
"crypto/sha256"10
"embed"11
"encoding/hex"12
"fmt"13
"os"14
"os/exec"15
"path/filepath"16
"regexp"17
"sort"18
"strings"19
"sync"20
)21
22
//go:embed dockerfiles/*/*23
var dockerfiles embed.FS24
25
// builtinOrder is de volgorde op de infopagina.26
var builtinOrder = []string{"base", "node", "python", "go", "rust", "java", "dotnet"}27
28
// Preset is één alias. Direct gezet betekent: gebruik dat image zonder bouw.29
type Preset struct {30
Name string31
From string32
Runtime string33
Tools []string34
Dockerfile []byte35
Direct string36
}37
38
// Override komt uit ci.presets in config.yml.39
type Override struct {40
Image string41
Dockerfile string42
From string43
}44
45
var nameRE = regexp.MustCompile(`^[a-z0-9]+(?:[._-][a-z0-9]+)*(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)+$`)46
47
// Known zegt of name een ingebouwde alias is.48
func Known(name string) bool {49
for _, n := range builtinOrder {50
if "bluegit/"+n == name {51
return true52
}53
}54
return false55
}56
57
// ValidateOverride keurt één configregel goed.58
// hasBuiltin is waar als name al een ingebouwde alias is; from mag die59
// Dockerfile dan herschrijven.60
func ValidateOverride(name string, o Override, hasBuiltin bool) error {61
if !nameRE.MatchString(name) {62
return fmt.Errorf("ci.presets %q: de naam moet een image-alias zijn, zoals team/tools", name)63
}64
if o.Image != "" && (o.Dockerfile != "" || o.From != "") {65
return fmt.Errorf("ci.presets %s: image sluit dockerfile en from uit", name)66
}67
if o.Image == "" && o.Dockerfile == "" && o.From == "" {68
return fmt.Errorf("ci.presets %s: geef image, dockerfile of from", name)69
}70
if o.From != "" && o.Dockerfile == "" && o.Image == "" && !hasBuiltin {71
return fmt.Errorf("ci.presets %s: from hoort bij een ingebouwde preset of een dockerfile", name)72
}73
if o.Image != "" && !validRef(o.Image) {74
return fmt.Errorf("ci.presets %s: image %q is ongeldig", name, o.Image)75
}76
if o.From != "" && !validRef(o.From) {77
return fmt.Errorf("ci.presets %s: from %q is ongeldig", name, o.From)78
}79
if o.Dockerfile != "" {80
if _, err := os.Stat(o.Dockerfile); err != nil {81
return fmt.Errorf("ci.presets %s: dockerfile %s: %w", name, o.Dockerfile, err)82
}83
}84
return nil85
}86
87
func validRef(s string) bool {88
return s != "" && strings.TrimSpace(s) == s && !strings.ContainsAny(s, " \t")89
}90
91
// Builtin leest de Dockerfiles die in het binary zitten.92
func Builtin() []Preset {93
var out []Preset94
for _, name := range builtinOrder {95
raw, err := dockerfiles.ReadFile("dockerfiles/" + name + "/Dockerfile")96
if err != nil {97
continue98
}99
from, runtime, tools, err := ParseDockerfile(raw)100
if err != nil {101
continue102
}103
out = append(out, Preset{104
Name: "bluegit/" + name, From: from, Runtime: runtime, Tools: tools, Dockerfile: raw,105
})106
}107
return out108
}109
110
// Effective is de ingebouwde lijst plus de aliassen uit de configuratie.111
// Een bestaande naam wordt vervangen. Nieuwe namen komen er alfabetisch achter.112
func Effective(over map[string]Override) ([]Preset, error) {113
base := Builtin()114
index := map[string]int{}115
for i, p := range base {116
index[p.Name] = i117
}118
var extra []string119
for name := range over {120
if _, ok := index[name]; ok {121
continue122
}123
extra = append(extra, name)124
}125
sort.Strings(extra)126
order := make([]string, 0, len(base)+len(extra))127
for _, p := range base {128
order = append(order, p.Name)129
}130
order = append(order, extra...)131
out := make([]Preset, 0, len(order))132
for _, name := range order {133
o, ok := over[name]134
if !ok {135
out = append(out, base[index[name]])136
continue137
}138
cur := Preset{Name: name}139
if i, known := index[name]; known {140
cur = base[i]141
}142
next, err := apply(cur, o)143
if err != nil {144
return nil, err145
}146
out = append(out, next)147
}148
return out, nil149
}150
151
func apply(base Preset, o Override) (Preset, error) {152
if err := ValidateOverride(base.Name, o, len(base.Dockerfile) > 0); err != nil {153
return Preset{}, err154
}155
if o.Image != "" {156
return Preset{Name: base.Name, From: o.Image, Runtime: o.Image, Direct: o.Image}, nil157
}158
data := append([]byte(nil), base.Dockerfile...)159
if o.Dockerfile != "" {160
raw, err := os.ReadFile(o.Dockerfile)161
if err != nil {162
return Preset{}, fmt.Errorf("ci.presets %s: %w", base.Name, err)163
}164
data = raw165
}166
if len(data) == 0 {167
return Preset{}, fmt.Errorf("ci.presets %s: geen dockerfile", base.Name)168
}169
if o.From != "" {170
data = rewriteFrom(data, o.From)171
}172
from, runtime, tools, err := ParseDockerfile(data)173
if err != nil {174
return Preset{}, fmt.Errorf("ci.presets %s: %w", base.Name, err)175
}176
return Preset{Name: base.Name, From: from, Runtime: runtime, Tools: tools, Dockerfile: data}, nil177
}178
179
// Find zoekt een exacte alias. node:22 is er geen.180
func Find(set []Preset, image string) (Preset, bool) {181
image = strings.TrimSpace(image)182
for _, p := range set {183
if p.Name == image {184
return p, true185
}186
}187
return Preset{}, false188
}189
190
// ParseDockerfile leest FROM, een regel "# runtime:" en de pakketten uit apk of apt-get.191
func ParseDockerfile(data []byte) (from, runtime string, tools []string, err error) {192
sawFrom := false193
for _, line := range strings.Split(string(data), "\n") {194
trim := strings.TrimSpace(line)195
if trim == "" {196
continue197
}198
if strings.HasPrefix(trim, "#") {199
if rest, ok := strings.CutPrefix(trim, "# runtime:"); ok {200
runtime = strings.TrimSpace(rest)201
}202
continue203
}204
if !sawFrom {205
fields := strings.Fields(trim)206
if len(fields) < 2 || !strings.EqualFold(fields[0], "FROM") {207
return "", "", nil, fmt.Errorf("dockerfile moet met FROM beginnen")208
}209
from = fields[1]210
sawFrom = true211
continue212
}213
tools = append(tools, packages(trim)...)214
}215
if from == "" {216
return "", "", nil, fmt.Errorf("dockerfile mist FROM")217
}218
if runtime == "" {219
runtime = from220
}221
return from, runtime, tools, nil222
}223
224
func packages(line string) []string {225
var out []string226
if i := strings.Index(line, "apk add"); i >= 0 {227
out = append(out, packageTokens(line[i+len("apk add"):])...)228
}229
if i := strings.Index(line, "apt-get install"); i >= 0 {230
rest := line[i+len("apt-get install"):]231
if j := strings.Index(rest, "&&"); j >= 0 {232
rest = rest[:j]233
}234
out = append(out, packageTokens(rest)...)235
}236
return out237
}238
239
func packageTokens(s string) []string {240
var out []string241
for _, f := range strings.Fields(s) {242
if strings.HasPrefix(f, "-") {243
continue244
}245
out = append(out, f)246
}247
return out248
}249
250
func rewriteFrom(data []byte, from string) []byte {251
lines := strings.Split(string(data), "\n")252
for i, line := range lines {253
trim := strings.TrimSpace(line)254
if trim == "" || strings.HasPrefix(trim, "#") {255
continue256
}257
if strings.HasPrefix(strings.ToUpper(trim), "FROM ") {258
lines[i] = "FROM " + from259
}260
break261
}262
return []byte(strings.Join(lines, "\n"))263
}264
265
var (266
buildMu = sync.Mutex{}267
buildOf = map[string]*sync.Mutex{}268
)269
270
func lockRef(ref string) func() {271
buildMu.Lock()272
m := buildOf[ref]273
if m == nil {274
m = &sync.Mutex{}275
buildOf[ref] = m276
}277
buildMu.Unlock()278
m.Lock()279
return m.Unlock280
}281
282
// Ensure bouwt de Dockerfile als het resultaat nog niet lokaal staat.283
// De tag is de alias plus een hash van de Dockerfile, zodat een wijziging284
// een nieuwe bouw is en een gelijke Dockerfile de cache raakt.285
func (p Preset) Ensure(ctx context.Context, dockerBin string) (ref string, built bool, err error) {286
if p.Direct != "" {287
return p.Direct, false, nil288
}289
if len(p.Dockerfile) == 0 {290
return "", false, fmt.Errorf("preset %s heeft geen dockerfile", p.Name)291
}292
sum := sha256.Sum256(p.Dockerfile)293
ref = p.Name + ":" + hex.EncodeToString(sum[:6])294
unlock := lockRef(ref)295
defer unlock()296
if ok, _ := imageExists(ctx, dockerBin, ref); ok {297
return ref, false, nil298
}299
dir, err := os.MkdirTemp("", "bluegit-preset-")300
if err != nil {301
return "", false, err302
}303
defer os.RemoveAll(dir)304
if err := os.WriteFile(filepath.Join(dir, "Dockerfile"), p.Dockerfile, 0o644); err != nil {305
return "", false, err306
}307
cmd := exec.CommandContext(ctx, dockerBin, "build", "-t", ref, dir)308
out, err := cmd.CombinedOutput()309
if err != nil {310
msg := strings.TrimSpace(string(out))311
if msg == "" {312
msg = err.Error()313
}314
return "", false, fmt.Errorf("%s", msg)315
}316
return ref, true, nil317
}318
319
func imageExists(ctx context.Context, dockerBin, ref string) (bool, error) {320
cmd := exec.CommandContext(ctx, dockerBin, "image", "inspect", "--format", "{{.Id}}", ref)321
if err := cmd.Run(); err != nil {322
return false, err323
}324
return true, nil325
}@@ -0,0 +1,125 @@
1
package images
2
3
import (
4
"context"
5
"os"
6
"path/filepath"
7
"strings"
8
"testing"
9
)
10
11
func TestBuiltinPresets(t *testing.T) {
12
set := Builtin()
13
if len(set) != len(builtinOrder) {
14
t.Fatalf("aantal %d", len(set))
15
}
16
want := []string{"bluegit/base", "bluegit/node", "bluegit/python", "bluegit/go", "bluegit/rust", "bluegit/java", "bluegit/dotnet"}
17
for i, name := range want {
18
p := set[i]
19
if p.Name != name || p.From == "" || p.Runtime == "" || p.Direct != "" {
20
t.Fatalf("%d %+v", i, p)
21
}
22
joined := strings.Join(p.Tools, " ")
23
for _, tool := range []string{"bash", "ca-certificates", "curl", "git"} {
24
if !strings.Contains(joined, tool) {
25
t.Fatalf("%s mist %s in %s", name, tool, joined)
26
}
27
}
28
}
29
if set[0].From != "alpine:3.20" || set[1].From != "node:22-alpine" || set[6].From != "mcr.microsoft.com/dotnet/sdk:8.0" {
30
t.Fatalf("bases %s %s %s", set[0].From, set[1].From, set[6].From)
31
}
32
if _, ok := Find(set, "node:22"); ok {
33
t.Fatal("node:22 is een gewoon image")
34
}
35
if _, ok := Find(set, "bluegit/go"); !ok {
36
t.Fatal("bluegit/go")
37
}
38
}
39
40
func TestEffectiveOverride(t *testing.T) {
41
dir := t.TempDir()
42
path := filepath.Join(dir, "Dockerfile")
43
body := []byte("# runtime: Extra\nFROM debian:bookworm-slim\nRUN apt-get install -y --no-install-recommends curl git && rm -rf /var/lib/apt/lists/*\n")
44
if err := os.WriteFile(path, body, 0o644); err != nil {
45
t.Fatal(err)
46
}
47
set, err := Effective(map[string]Override{
48
"bluegit/node": {From: "node:22-bookworm"},
49
"team/tools": {Dockerfile: path},
50
"team/plain": {Image: "alpine:3.20"},
51
})
52
if err != nil {
53
t.Fatal(err)
54
}
55
node, ok := Find(set, "bluegit/node")
56
if !ok || node.From != "node:22-bookworm" || !strings.Contains(string(node.Dockerfile), "FROM node:22-bookworm") {
57
t.Fatalf("node %+v", node)
58
}
59
if strings.Contains(string(node.Dockerfile), "node:22-alpine") {
60
t.Fatal("oude FROM bleef staan")
61
}
62
tools, ok := Find(set, "team/tools")
63
if !ok || tools.From != "debian:bookworm-slim" || tools.Runtime != "Extra" {
64
t.Fatalf("tools %+v", tools)
65
}
66
plain, ok := Find(set, "team/plain")
67
if !ok || plain.Direct != "alpine:3.20" || len(plain.Dockerfile) != 0 {
68
t.Fatalf("plain %+v", plain)
69
}
70
if _, err := Effective(map[string]Override{"Nope": {Image: "alpine"}}); err == nil {
71
t.Fatal("hoofdletters")
72
}
73
if _, err := Effective(map[string]Override{"team/both": {Image: "alpine", From: "debian"}}); err == nil {
74
t.Fatal("image en from")
75
}
76
}
77
78
func TestEnsureBuildsOnce(t *testing.T) {
79
dir := t.TempDir()
80
logPath := filepath.Join(dir, "log")
81
builtPath := filepath.Join(dir, "built")
82
script := filepath.Join(dir, "docker")
83
body := `#!/bin/sh
84
echo "$@" >> "` + logPath + `"
85
tag=""
86
for a in "$@"; do tag="$a"; done
87
if [ "$1" = "image" ]; then
88
if grep -qx "$tag" "` + builtPath + `" 2>/dev/null; then
89
exit 0
90
fi
91
exit 1
92
fi
93
if [ "$1" = "build" ]; then
94
prev=""
95
for a in "$@"; do
96
if [ "$prev" = "-t" ]; then printf '%s\n' "$a" >> "` + builtPath + `"; fi
97
prev="$a"
98
done
99
exit 0
100
fi
101
exit 1
102
`
103
if err := os.WriteFile(script, []byte(body), 0o755); err != nil {
104
t.Fatal(err)
105
}
106
p, ok := Find(Builtin(), "bluegit/base")
107
if !ok {
108
t.Fatal("base")
109
}
110
ref, built, err := p.Ensure(context.Background(), script)
111
if err != nil || !built || !strings.HasPrefix(ref, "bluegit/base:") {
112
t.Fatalf("eerst %s %v %v", ref, built, err)
113
}
114
ref2, built2, err := p.Ensure(context.Background(), script)
115
if err != nil || built2 || ref2 != ref {
116
t.Fatalf("cache %s %v %v", ref2, built2, err)
117
}
118
log, err := os.ReadFile(logPath)
119
if err != nil {
120
t.Fatal(err)
121
}
122
if strings.Count(string(log), "build ") != 1 {
123
t.Fatalf("bouwt vaker:\n%s", log)
124
}
125
}
@@ -0,0 +1,125 @@1
package images2
3
import (4
"context"5
"os"6
"path/filepath"7
"strings"8
"testing"9
)10
11
func TestBuiltinPresets(t *testing.T) {12
set := Builtin()13
if len(set) != len(builtinOrder) {14
t.Fatalf("aantal %d", len(set))15
}16
want := []string{"bluegit/base", "bluegit/node", "bluegit/python", "bluegit/go", "bluegit/rust", "bluegit/java", "bluegit/dotnet"}17
for i, name := range want {18
p := set[i]19
if p.Name != name || p.From == "" || p.Runtime == "" || p.Direct != "" {20
t.Fatalf("%d %+v", i, p)21
}22
joined := strings.Join(p.Tools, " ")23
for _, tool := range []string{"bash", "ca-certificates", "curl", "git"} {24
if !strings.Contains(joined, tool) {25
t.Fatalf("%s mist %s in %s", name, tool, joined)26
}27
}28
}29
if set[0].From != "alpine:3.20" || set[1].From != "node:22-alpine" || set[6].From != "mcr.microsoft.com/dotnet/sdk:8.0" {30
t.Fatalf("bases %s %s %s", set[0].From, set[1].From, set[6].From)31
}32
if _, ok := Find(set, "node:22"); ok {33
t.Fatal("node:22 is een gewoon image")34
}35
if _, ok := Find(set, "bluegit/go"); !ok {36
t.Fatal("bluegit/go")37
}38
}39
40
func TestEffectiveOverride(t *testing.T) {41
dir := t.TempDir()42
path := filepath.Join(dir, "Dockerfile")43
body := []byte("# runtime: Extra\nFROM debian:bookworm-slim\nRUN apt-get install -y --no-install-recommends curl git && rm -rf /var/lib/apt/lists/*\n")44
if err := os.WriteFile(path, body, 0o644); err != nil {45
t.Fatal(err)46
}47
set, err := Effective(map[string]Override{48
"bluegit/node": {From: "node:22-bookworm"},49
"team/tools": {Dockerfile: path},50
"team/plain": {Image: "alpine:3.20"},51
})52
if err != nil {53
t.Fatal(err)54
}55
node, ok := Find(set, "bluegit/node")56
if !ok || node.From != "node:22-bookworm" || !strings.Contains(string(node.Dockerfile), "FROM node:22-bookworm") {57
t.Fatalf("node %+v", node)58
}59
if strings.Contains(string(node.Dockerfile), "node:22-alpine") {60
t.Fatal("oude FROM bleef staan")61
}62
tools, ok := Find(set, "team/tools")63
if !ok || tools.From != "debian:bookworm-slim" || tools.Runtime != "Extra" {64
t.Fatalf("tools %+v", tools)65
}66
plain, ok := Find(set, "team/plain")67
if !ok || plain.Direct != "alpine:3.20" || len(plain.Dockerfile) != 0 {68
t.Fatalf("plain %+v", plain)69
}70
if _, err := Effective(map[string]Override{"Nope": {Image: "alpine"}}); err == nil {71
t.Fatal("hoofdletters")72
}73
if _, err := Effective(map[string]Override{"team/both": {Image: "alpine", From: "debian"}}); err == nil {74
t.Fatal("image en from")75
}76
}77
78
func TestEnsureBuildsOnce(t *testing.T) {79
dir := t.TempDir()80
logPath := filepath.Join(dir, "log")81
builtPath := filepath.Join(dir, "built")82
script := filepath.Join(dir, "docker")83
body := `#!/bin/sh84
echo "$@" >> "` + logPath + `"85
tag=""86
for a in "$@"; do tag="$a"; done87
if [ "$1" = "image" ]; then88
if grep -qx "$tag" "` + builtPath + `" 2>/dev/null; then89
exit 090
fi91
exit 192
fi93
if [ "$1" = "build" ]; then94
prev=""95
for a in "$@"; do96
if [ "$prev" = "-t" ]; then printf '%s\n' "$a" >> "` + builtPath + `"; fi97
prev="$a"98
done99
exit 0100
fi101
exit 1102
`103
if err := os.WriteFile(script, []byte(body), 0o755); err != nil {104
t.Fatal(err)105
}106
p, ok := Find(Builtin(), "bluegit/base")107
if !ok {108
t.Fatal("base")109
}110
ref, built, err := p.Ensure(context.Background(), script)111
if err != nil || !built || !strings.HasPrefix(ref, "bluegit/base:") {112
t.Fatalf("eerst %s %v %v", ref, built, err)113
}114
ref2, built2, err := p.Ensure(context.Background(), script)115
if err != nil || built2 || ref2 != ref {116
t.Fatalf("cache %s %v %v", ref2, built2, err)117
}118
log, err := os.ReadFile(logPath)119
if err != nil {120
t.Fatal(err)121
}122
if strings.Count(string(log), "build ") != 1 {123
t.Fatalf("bouwt vaker:\n%s", log)124
}125
}@@ -0,0 +1,135 @@
1
package runner
2
3
import (
4
"context"
5
"os"
6
"path/filepath"
7
"strings"
8
"testing"
9
10
"gitlab.com/Timfa/bluegit/internal/images"
11
)
12
13
func TestImageLogPresetAndPlain(t *testing.T) {
14
lines := imageLog("bluegit/node", "node:22-alpine", "bluegit/node:abc", "sha256:id", nil, []string{"docker.io/library/node@sha256:dead"})
15
joined := strings.Join(lines, "\n")
16
for _, want := range []string{
17
"Using image preset bluegit/node based on node:22-alpine",
18
"Using docker image bluegit/node:abc ...",
19
"Underlying image node:22-alpine with digest docker.io/library/node@sha256:dead ...",
20
} {
21
if !strings.Contains(joined, want) {
22
t.Fatalf("mist %q in %s", want, joined)
23
}
24
}
25
plain := imageLog("", "", "node:22", "", nil, nil)
26
if len(plain) != 1 || plain[0] != "Using docker image node:22 ..." || strings.Contains(plain[0], "preset") {
27
t.Fatalf("gewoon image: %q", plain)
28
}
29
}
30
31
func TestResolveImageBuildsPresetAndLeavesPlainImages(t *testing.T) {
32
dir := t.TempDir()
33
logPath := filepath.Join(dir, "log")
34
builtPath := filepath.Join(dir, "built")
35
script := filepath.Join(dir, "docker")
36
body := `#!/bin/sh
37
echo "$@" >> "` + logPath + `"
38
tag=""
39
for a in "$@"; do tag="$a"; done
40
if [ "$1" = "image" ]; then
41
case "$tag" in
42
bluegit/*)
43
if grep -qx "$tag" "` + builtPath + `" 2>/dev/null; then
44
printf '%s\n' "sha256:built"
45
printf '%s\n' "$tag@sha256:builtdigest"
46
exit 0
47
fi
48
exit 1
49
;;
50
esac
51
printf '%s\n' "sha256:base"
52
printf '%s\n' "docker.io/library/base@sha256:basedigest"
53
exit 0
54
fi
55
if [ "$1" = "build" ]; then
56
prev=""
57
for a in "$@"; do
58
if [ "$prev" = "-t" ]; then printf '%s\n' "$a" >> "` + builtPath + `"; fi
59
prev="$a"
60
done
61
exit 0
62
fi
63
exit 1
64
`
65
if err := os.WriteFile(script, []byte(body), 0o755); err != nil {
66
t.Fatal(err)
67
}
68
r := &Runner{Docker: script}
69
ref, lines, err := r.resolveImage(context.Background(), "bluegit/node")
70
if err != nil {
71
t.Fatal(err)
72
}
73
if !strings.HasPrefix(ref, "bluegit/node:") {
74
t.Fatalf("ref %s", ref)
75
}
76
joined := strings.Join(lines, "\n")
77
for _, want := range []string{
78
"Building image preset bluegit/node ...",
79
"Using image preset bluegit/node based on node:22-alpine",
80
"Using docker image " + ref,
81
"Underlying image node:22-alpine with digest docker.io/library/base@sha256:basedigest ...",
82
} {
83
if !strings.Contains(joined, want) {
84
t.Fatalf("mist %q in\n%s", want, joined)
85
}
86
}
87
if _, lines, err = r.resolveImage(context.Background(), "bluegit/node"); err != nil {
88
t.Fatal(err)
89
}
90
if strings.Contains(strings.Join(lines, "\n"), "Building image preset") {
91
t.Fatal("cache bouwt opnieuw")
92
}
93
plain, plainLines, err := r.resolveImage(context.Background(), "node:22")
94
if err != nil || plain != "node:22" {
95
t.Fatalf("plain %s %v", plain, err)
96
}
97
if strings.Contains(strings.Join(plainLines, "\n"), "preset") {
98
t.Fatalf("node:22 werd een preset: %s", plainLines)
99
}
100
log, err := os.ReadFile(logPath)
101
if err != nil {
102
t.Fatal(err)
103
}
104
if strings.Count(string(log), "\nbuild ")+strings.Count(string(log), "build -t") == 0 && !strings.Contains(string(log), "build ") {
105
t.Fatalf("geen build:\n%s", log)
106
}
107
}
108
109
func TestDirectPresetDoesNotBuild(t *testing.T) {
110
dir := t.TempDir()
111
script := filepath.Join(dir, "docker")
112
if err := os.WriteFile(script, []byte("#!/bin/sh\nexit 1\n"), 0o755); err != nil {
113
t.Fatal(err)
114
}
115
r := &Runner{Docker: script, Presets: map[string]images.Override{
116
"team/plain": {Image: "alpine:3.20"},
117
}}
118
// Docker ontbreekt niet: het script bestaat. inspect faalt, dat is geen fout.
119
// Een direct gemapte preset roept Ensure aan, dat geen build doet, en daarna inspect.
120
// inspect faalt stil. De regels noemen wel de preset.
121
ref, lines, err := r.resolveImage(context.Background(), "team/plain")
122
if err != nil {
123
t.Fatal(err)
124
}
125
if ref != "alpine:3.20" {
126
t.Fatalf("ref %s", ref)
127
}
128
joined := strings.Join(lines, "\n")
129
if !strings.Contains(joined, "Using image preset team/plain based on alpine:3.20") {
130
t.Fatalf("%s", joined)
131
}
132
if strings.Contains(joined, "Building image preset") {
133
t.Fatal("een mapping wordt gebouwd")
134
}
135
}
@@ -0,0 +1,135 @@1
package runner2
3
import (4
"context"5
"os"6
"path/filepath"7
"strings"8
"testing"9
10
"gitlab.com/Timfa/bluegit/internal/images"11
)12
13
func TestImageLogPresetAndPlain(t *testing.T) {14
lines := imageLog("bluegit/node", "node:22-alpine", "bluegit/node:abc", "sha256:id", nil, []string{"docker.io/library/node@sha256:dead"})15
joined := strings.Join(lines, "\n")16
for _, want := range []string{17
"Using image preset bluegit/node based on node:22-alpine",18
"Using docker image bluegit/node:abc ...",19
"Underlying image node:22-alpine with digest docker.io/library/node@sha256:dead ...",20
} {21
if !strings.Contains(joined, want) {22
t.Fatalf("mist %q in %s", want, joined)23
}24
}25
plain := imageLog("", "", "node:22", "", nil, nil)26
if len(plain) != 1 || plain[0] != "Using docker image node:22 ..." || strings.Contains(plain[0], "preset") {27
t.Fatalf("gewoon image: %q", plain)28
}29
}30
31
func TestResolveImageBuildsPresetAndLeavesPlainImages(t *testing.T) {32
dir := t.TempDir()33
logPath := filepath.Join(dir, "log")34
builtPath := filepath.Join(dir, "built")35
script := filepath.Join(dir, "docker")36
body := `#!/bin/sh37
echo "$@" >> "` + logPath + `"38
tag=""39
for a in "$@"; do tag="$a"; done40
if [ "$1" = "image" ]; then41
case "$tag" in42
bluegit/*)43
if grep -qx "$tag" "` + builtPath + `" 2>/dev/null; then44
printf '%s\n' "sha256:built"45
printf '%s\n' "$tag@sha256:builtdigest"46
exit 047
fi48
exit 149
;;50
esac51
printf '%s\n' "sha256:base"52
printf '%s\n' "docker.io/library/base@sha256:basedigest"53
exit 054
fi55
if [ "$1" = "build" ]; then56
prev=""57
for a in "$@"; do58
if [ "$prev" = "-t" ]; then printf '%s\n' "$a" >> "` + builtPath + `"; fi59
prev="$a"60
done61
exit 062
fi63
exit 164
`65
if err := os.WriteFile(script, []byte(body), 0o755); err != nil {66
t.Fatal(err)67
}68
r := &Runner{Docker: script}69
ref, lines, err := r.resolveImage(context.Background(), "bluegit/node")70
if err != nil {71
t.Fatal(err)72
}73
if !strings.HasPrefix(ref, "bluegit/node:") {74
t.Fatalf("ref %s", ref)75
}76
joined := strings.Join(lines, "\n")77
for _, want := range []string{78
"Building image preset bluegit/node ...",79
"Using image preset bluegit/node based on node:22-alpine",80
"Using docker image " + ref,81
"Underlying image node:22-alpine with digest docker.io/library/base@sha256:basedigest ...",82
} {83
if !strings.Contains(joined, want) {84
t.Fatalf("mist %q in\n%s", want, joined)85
}86
}87
if _, lines, err = r.resolveImage(context.Background(), "bluegit/node"); err != nil {88
t.Fatal(err)89
}90
if strings.Contains(strings.Join(lines, "\n"), "Building image preset") {91
t.Fatal("cache bouwt opnieuw")92
}93
plain, plainLines, err := r.resolveImage(context.Background(), "node:22")94
if err != nil || plain != "node:22" {95
t.Fatalf("plain %s %v", plain, err)96
}97
if strings.Contains(strings.Join(plainLines, "\n"), "preset") {98
t.Fatalf("node:22 werd een preset: %s", plainLines)99
}100
log, err := os.ReadFile(logPath)101
if err != nil {102
t.Fatal(err)103
}104
if strings.Count(string(log), "\nbuild ")+strings.Count(string(log), "build -t") == 0 && !strings.Contains(string(log), "build ") {105
t.Fatalf("geen build:\n%s", log)106
}107
}108
109
func TestDirectPresetDoesNotBuild(t *testing.T) {110
dir := t.TempDir()111
script := filepath.Join(dir, "docker")112
if err := os.WriteFile(script, []byte("#!/bin/sh\nexit 1\n"), 0o755); err != nil {113
t.Fatal(err)114
}115
r := &Runner{Docker: script, Presets: map[string]images.Override{116
"team/plain": {Image: "alpine:3.20"},117
}}118
// Docker ontbreekt niet: het script bestaat. inspect faalt, dat is geen fout.119
// Een direct gemapte preset roept Ensure aan, dat geen build doet, en daarna inspect.120
// inspect faalt stil. De regels noemen wel de preset.121
ref, lines, err := r.resolveImage(context.Background(), "team/plain")122
if err != nil {123
t.Fatal(err)124
}125
if ref != "alpine:3.20" {126
t.Fatalf("ref %s", ref)127
}128
joined := strings.Join(lines, "\n")129
if !strings.Contains(joined, "Using image preset team/plain based on alpine:3.20") {130
t.Fatalf("%s", joined)131
}132
if strings.Contains(joined, "Building image preset") {133
t.Fatal("een mapping wordt gebouwd")134
}135
}@@ -18,22 +18,25 @@ import (
18
18
"gitlab.com/Timfa/bluegit/internal/access"
19
19
"gitlab.com/Timfa/bluegit/internal/ci"
20
20
"gitlab.com/Timfa/bluegit/internal/gitrepo"
21
"gitlab.com/Timfa/bluegit/internal/images"
21
22
"gitlab.com/Timfa/bluegit/internal/store"
22
23
"gitlab.com/Timfa/bluegit/internal/webhook"
23
24
)
24
25
25
26
// Runner plant jobs en stuurt het resultaat door naar webhooks.
26
27
type Runner struct {
27
Store *store.Store
28
GitBin string
29
Docker string
30
Storage string
31
BaseURL string
32
Network string
33
Name string
34
Timeout time.Duration
35
Log *slog.Logger
36
OnEvent func(repoID int64, ev webhook.Event)
28
Store *store.Store
29
GitBin string
30
Docker string
31
Storage string
32
BaseURL string
33
Network string
34
Name string
35
Timeout time.Duration
36
Log *slog.Logger
37
OnEvent func(repoID int64, ev webhook.Event)
38
// Presets zijn de image-aliassen uit ci.presets. Nil is de ingebouwde lijst.
39
Presets map[string]images.Override
37
40
slots chan struct{}
38
41
mu sync.RWMutex
39
42
cancelMu sync.Mutex
@@ -374,14 +377,26 @@ func (r *Runner) runOne(ctx context.Context, p store.Pipeline, job store.Job) ([
374
377
return nil, err
375
378
}
376
379
sink.secrets = mask
377
if _, err := exec.LookPath(r.Docker); err != nil {
378
for _, line := range dockerImageLines(job.Image, "", nil) {
380
ref, lines, rerr := r.resolveImage(ctx, job.Image)
381
for _, line := range lines {
382
sink.emit(line)
383
}
384
if rerr != nil {
385
sink.closeSection()
386
return mask, rerr
387
}
388
job.Image = ref
389
for i := range job.Services {
390
sref, slines, serr := r.resolveImage(ctx, job.Services[i].Name)
391
for _, line := range slines {
379
392
sink.emit(line)
380
393
}
381
sink.closeSection()
382
return mask, fmt.Errorf("runner_system_failure: docker (%s) is not available; the job only runs in a container", r.Docker)
394
if serr != nil {
395
sink.closeSection()
396
return mask, serr
397
}
398
job.Services[i].Name = sref
383
399
}
384
r.logImage(ctx, sink, job.Image)
385
400
network := r.Network
386
401
if len(job.Services) > 0 {
387
402
net, cleanup, serr := r.startServices(ctx, job)
@@ -493,11 +508,64 @@ func shellScript(job store.Job, note placeNote) string {
493
508
return b.String()
494
509
}
495
510
496
func (r *Runner) logImage(ctx context.Context, sink *logSink, image string) {
497
id, digests := r.inspectImage(ctx, image)
498
for _, line := range dockerImageLines(image, id, digests) {
499
sink.emit(line)
511
// resolveImage kiest het image waarmee de container start.
512
// Een alias zoals bluegit/node wordt gebouwd. node:22 blijft zichzelf.
513
func (r *Runner) resolveImage(ctx context.Context, image string) (string, []string, error) {
514
image = strings.TrimSpace(image)
515
set, err := images.Effective(r.Presets)
516
if err != nil {
517
return image, nil, fmt.Errorf("runner_system_failure: %w", err)
500
518
}
519
missing := fmt.Errorf("runner_system_failure: docker (%s) is not available; the job only runs in a container", r.Docker)
520
if _, lookErr := exec.LookPath(r.Docker); lookErr != nil {
521
if p, ok := images.Find(set, image); ok {
522
return "", imageLog(p.Name, p.From, p.From, "", nil, nil), missing
523
}
524
return image, dockerImageLines(image, "", nil), missing
525
}
526
p, ok := images.Find(set, image)
527
if !ok {
528
id, digests := r.inspectImage(ctx, image)
529
return image, dockerImageLines(image, id, digests), nil
530
}
531
ref, built, err := p.Ensure(ctx, r.Docker)
532
if err != nil {
533
return "", imageLog(p.Name, p.From, "", "", nil, nil), fmt.Errorf("runner_system_failure: preset %s: %w", p.Name, err)
534
}
535
var lines []string
536
if built {
537
lines = append(lines, fmt.Sprintf("Building image preset %s ...", p.Name))
538
}
539
id, digests := r.inspectImage(ctx, ref)
540
var baseDigests []string
541
if ref != p.From {
542
_, baseDigests = r.inspectImage(ctx, p.From)
543
}
544
lines = append(lines, imageLog(p.Name, p.From, ref, id, digests, baseDigests)...)
545
return ref, lines, nil
546
}
547
548
func imageLog(preset, base, ref, id string, digests, baseDigests []string) []string {
549
var lines []string
550
if preset != "" {
551
lines = append(lines, fmt.Sprintf("Using image preset %s based on %s", preset, base))
552
}
553
if ref == "" {
554
return lines
555
}
556
lines = append(lines, dockerImageLines(ref, id, digests)...)
557
if preset != "" && ref != base {
558
digest := matchingDigest(base, baseDigests)
559
if digest == "" && len(baseDigests) > 0 {
560
digest = strings.TrimSpace(baseDigests[0])
561
}
562
if digest != "" {
563
lines = append(lines, fmt.Sprintf("Underlying image %s with digest %s ...", base, digest))
564
} else {
565
lines = append(lines, fmt.Sprintf("Underlying image %s ...", base))
566
}
567
}
568
return lines
501
569
}
502
570
503
571
func (r *Runner) inspectImage(ctx context.Context, image string) (string, []string) {
@@ -18,22 +18,25 @@ import (18
"gitlab.com/Timfa/bluegit/internal/access"18
"gitlab.com/Timfa/bluegit/internal/access"19
"gitlab.com/Timfa/bluegit/internal/ci"19
"gitlab.com/Timfa/bluegit/internal/ci"20
"gitlab.com/Timfa/bluegit/internal/gitrepo"20
"gitlab.com/Timfa/bluegit/internal/gitrepo"21
"gitlab.com/Timfa/bluegit/internal/images"21
"gitlab.com/Timfa/bluegit/internal/store"22
"gitlab.com/Timfa/bluegit/internal/store"22
"gitlab.com/Timfa/bluegit/internal/webhook"23
"gitlab.com/Timfa/bluegit/internal/webhook"23
)24
)24
25
25
// Runner plant jobs en stuurt het resultaat door naar webhooks.26
// Runner plant jobs en stuurt het resultaat door naar webhooks.26
type Runner struct {27
type Runner struct {27
Store *store.Store28
Store *store.Store28
GitBin string29
GitBin string29
Docker string30
Docker string30
Storage string31
Storage string31
BaseURL string32
BaseURL string32
Network string33
Network string33
Name string34
Name string34
Timeout time.Duration35
Timeout time.Duration35
Log *slog.Logger36
Log *slog.Logger36
OnEvent func(repoID int64, ev webhook.Event)37
OnEvent func(repoID int64, ev webhook.Event)38
// Presets zijn de image-aliassen uit ci.presets. Nil is de ingebouwde lijst.39
Presets map[string]images.Override37
slots chan struct{}40
slots chan struct{}38
mu sync.RWMutex41
mu sync.RWMutex39
cancelMu sync.Mutex42
cancelMu sync.Mutex@@ -374,14 +377,26 @@ func (r *Runner) runOne(ctx context.Context, p store.Pipeline, job store.Job) ([374
return nil, err377
return nil, err375
}378
}376
sink.secrets = mask379
sink.secrets = mask377
if _, err := exec.LookPath(r.Docker); err != nil {380
ref, lines, rerr := r.resolveImage(ctx, job.Image)378
for _, line := range dockerImageLines(job.Image, "", nil) {381
for _, line := range lines {382
sink.emit(line)383
}384
if rerr != nil {385
sink.closeSection()386
return mask, rerr387
}388
job.Image = ref389
for i := range job.Services {390
sref, slines, serr := r.resolveImage(ctx, job.Services[i].Name)391
for _, line := range slines {379
sink.emit(line)392
sink.emit(line)380
}393
}381
sink.closeSection()394
if serr != nil {382
return mask, fmt.Errorf("runner_system_failure: docker (%s) is not available; the job only runs in a container", r.Docker)395
sink.closeSection()396
return mask, serr397
}398
job.Services[i].Name = sref383
}399
}384
r.logImage(ctx, sink, job.Image)385
network := r.Network400
network := r.Network386
if len(job.Services) > 0 {401
if len(job.Services) > 0 {387
net, cleanup, serr := r.startServices(ctx, job)402
net, cleanup, serr := r.startServices(ctx, job)@@ -493,11 +508,64 @@ func shellScript(job store.Job, note placeNote) string {493
return b.String()508
return b.String()494
}509
}495
510
496
func (r *Runner) logImage(ctx context.Context, sink *logSink, image string) {511
// resolveImage kiest het image waarmee de container start.497
id, digests := r.inspectImage(ctx, image)512
// Een alias zoals bluegit/node wordt gebouwd. node:22 blijft zichzelf.498
for _, line := range dockerImageLines(image, id, digests) {513
func (r *Runner) resolveImage(ctx context.Context, image string) (string, []string, error) {499
sink.emit(line)514
image = strings.TrimSpace(image)515
set, err := images.Effective(r.Presets)516
if err != nil {517
return image, nil, fmt.Errorf("runner_system_failure: %w", err)500
}518
}519
missing := fmt.Errorf("runner_system_failure: docker (%s) is not available; the job only runs in a container", r.Docker)520
if _, lookErr := exec.LookPath(r.Docker); lookErr != nil {521
if p, ok := images.Find(set, image); ok {522
return "", imageLog(p.Name, p.From, p.From, "", nil, nil), missing523
}524
return image, dockerImageLines(image, "", nil), missing525
}526
p, ok := images.Find(set, image)527
if !ok {528
id, digests := r.inspectImage(ctx, image)529
return image, dockerImageLines(image, id, digests), nil530
}531
ref, built, err := p.Ensure(ctx, r.Docker)532
if err != nil {533
return "", imageLog(p.Name, p.From, "", "", nil, nil), fmt.Errorf("runner_system_failure: preset %s: %w", p.Name, err)534
}535
var lines []string536
if built {537
lines = append(lines, fmt.Sprintf("Building image preset %s ...", p.Name))538
}539
id, digests := r.inspectImage(ctx, ref)540
var baseDigests []string541
if ref != p.From {542
_, baseDigests = r.inspectImage(ctx, p.From)543
}544
lines = append(lines, imageLog(p.Name, p.From, ref, id, digests, baseDigests)...)545
return ref, lines, nil546
}547
548
func imageLog(preset, base, ref, id string, digests, baseDigests []string) []string {549
var lines []string550
if preset != "" {551
lines = append(lines, fmt.Sprintf("Using image preset %s based on %s", preset, base))552
}553
if ref == "" {554
return lines555
}556
lines = append(lines, dockerImageLines(ref, id, digests)...)557
if preset != "" && ref != base {558
digest := matchingDigest(base, baseDigests)559
if digest == "" && len(baseDigests) > 0 {560
digest = strings.TrimSpace(baseDigests[0])561
}562
if digest != "" {563
lines = append(lines, fmt.Sprintf("Underlying image %s with digest %s ...", base, digest))564
} else {565
lines = append(lines, fmt.Sprintf("Underlying image %s ...", base))566
}567
}568
return lines501
}569
}502
570
503
func (r *Runner) inspectImage(ctx context.Context, image string) (string, []string) {571
func (r *Runner) inspectImage(ctx context.Context, image string) (string, []string) {@@ -0,0 +1,48 @@
1
package server
2
3
import (
4
"html/template"
5
"net/http"
6
7
"gitlab.com/Timfa/bluegit/internal/cispec"
8
"gitlab.com/Timfa/bluegit/internal/i18n"
9
"gitlab.com/Timfa/bluegit/internal/images"
10
)
11
12
func (s *Server) infoPage(w http.ResponseWriter, r *http.Request) {
13
doc, raw, err := s.ciDocument(s.langOf(r))
14
if err != nil {
15
http.Error(w, err.Error(), http.StatusInternalServerError)
16
return
17
}
18
v := s.view(w, r, "title.info")
19
v.Page = "info"
20
v.Info = true
21
v.Spec = doc
22
v.SpecJSON = template.JS(raw)
23
s.render(w, "info", v)
24
}
25
26
func (s *Server) ciSpec(w http.ResponseWriter, r *http.Request) {
27
lang := i18n.EN
28
if q := r.URL.Query().Get("lang"); q != "" {
29
lang = i18n.Parse(q)
30
}
31
_, raw, err := s.ciDocument(lang)
32
if err != nil {
33
http.Error(w, err.Error(), http.StatusInternalServerError)
34
return
35
}
36
w.Header().Set("Content-Type", "application/json; charset=utf-8")
37
w.Header().Set("Cache-Control", "no-store")
38
_, _ = w.Write(raw)
39
}
40
41
func (s *Server) ciDocument(lang i18n.Lang) (cispec.Doc, []byte, error) {
42
set, err := images.Effective(s.Cfg.CI.ImageOverrides())
43
if err != nil {
44
return cispec.Doc{}, nil, err
45
}
46
doc := cispec.Build(lang, set)
47
return doc, cispec.Marshal(doc), nil
48
}
@@ -0,0 +1,48 @@1
package server2
3
import (4
"html/template"5
"net/http"6
7
"gitlab.com/Timfa/bluegit/internal/cispec"8
"gitlab.com/Timfa/bluegit/internal/i18n"9
"gitlab.com/Timfa/bluegit/internal/images"10
)11
12
func (s *Server) infoPage(w http.ResponseWriter, r *http.Request) {13
doc, raw, err := s.ciDocument(s.langOf(r))14
if err != nil {15
http.Error(w, err.Error(), http.StatusInternalServerError)16
return17
}18
v := s.view(w, r, "title.info")19
v.Page = "info"20
v.Info = true21
v.Spec = doc22
v.SpecJSON = template.JS(raw)23
s.render(w, "info", v)24
}25
26
func (s *Server) ciSpec(w http.ResponseWriter, r *http.Request) {27
lang := i18n.EN28
if q := r.URL.Query().Get("lang"); q != "" {29
lang = i18n.Parse(q)30
}31
_, raw, err := s.ciDocument(lang)32
if err != nil {33
http.Error(w, err.Error(), http.StatusInternalServerError)34
return35
}36
w.Header().Set("Content-Type", "application/json; charset=utf-8")37
w.Header().Set("Cache-Control", "no-store")38
_, _ = w.Write(raw)39
}40
41
func (s *Server) ciDocument(lang i18n.Lang) (cispec.Doc, []byte, error) {42
set, err := images.Effective(s.Cfg.CI.ImageOverrides())43
if err != nil {44
return cispec.Doc{}, nil, err45
}46
doc := cispec.Build(lang, set)47
return doc, cispec.Marshal(doc), nil48
}@@ -0,0 +1,84 @@
1
package server
2
3
import (
4
"encoding/json"
5
"net/http"
6
"net/http/httptest"
7
"strings"
8
"testing"
9
10
"gitlab.com/Timfa/bluegit/internal/cispec"
11
"gitlab.com/Timfa/bluegit/internal/config"
12
)
13
14
func TestCISpecPageMatchesAPI(t *testing.T) {
15
srv := &Server{Cfg: config.Config{BaseURL: "http://127.0.0.1:9"}}
16
ts := httptest.NewServer(srv.Handler())
17
t.Cleanup(ts.Close)
18
19
page, err := http.Get(ts.URL + "/-/info")
20
if err != nil {
21
t.Fatal(err)
22
}
23
body := read(t, page)
24
if page.StatusCode != 200 {
25
t.Fatalf("pagina %d", page.StatusCode)
26
}
27
for _, want := range []string{
28
`<script type="application/json" id="bluegit-ci-spec">`,
29
"bluegit/node",
30
"node:22",
31
"CI_JOB_TOKEN",
32
"workflow",
33
"Differences with GitLab",
34
`href="/-/info"`,
35
} {
36
if !strings.Contains(body, want) {
37
t.Fatalf("mist %q", want)
38
}
39
}
40
const start = `<script type="application/json" id="bluegit-ci-spec">`
41
i := strings.Index(body, start)
42
rest := body[i+len(start):]
43
j := strings.Index(rest, "</script>")
44
embedded := rest[:j]
45
46
api, err := http.Get(ts.URL + "/api/v1/ci/spec")
47
if err != nil {
48
t.Fatal(err)
49
}
50
raw := read(t, api)
51
if api.StatusCode != 200 || !strings.Contains(api.Header.Get("Content-Type"), "application/json") {
52
t.Fatalf("api %d %s", api.StatusCode, api.Header.Get("Content-Type"))
53
}
54
if embedded != strings.TrimRight(raw, "\n") && embedded != raw {
55
// Marshal eindigt op een newline. Het scriptblok bevat die newline.
56
if strings.TrimSpace(embedded) != strings.TrimSpace(raw) {
57
t.Fatalf("pagina en API wijken af\npage %q\napi %q", embedded[:80], raw[:80])
58
}
59
}
60
var doc cispec.Doc
61
if err := json.Unmarshal([]byte(raw), &doc); err != nil {
62
t.Fatal(err)
63
}
64
if doc.File != "blue-ci-cd.yml" || len(doc.Sections) < 6 {
65
t.Fatalf("%+v", doc.File)
66
}
67
68
nl, err := http.Get(ts.URL + "/api/v1/ci/spec?lang=nl")
69
if err != nil {
70
t.Fatal(err)
71
}
72
dutch := read(t, nl)
73
if !strings.Contains(dutch, "Volgorde van de stages") || !strings.Contains(dutch, "bluegit/base") {
74
t.Fatalf("nl: %s", dutch[:400])
75
}
76
cu, err := http.Get(ts.URL + "/api/v1/ci/spec?lang=cuneiform")
77
if err != nil {
78
t.Fatal(err)
79
}
80
signs := read(t, cu)
81
if strings.Contains(signs, "Stage order") || !strings.Contains(signs, `"name":"stages"`) && !strings.Contains(signs, `"name": "stages"`) {
82
t.Fatalf("spijkerschrift of sleutelnaam: %s", signs[:300])
83
}
84
}
@@ -0,0 +1,84 @@1
package server2
3
import (4
"encoding/json"5
"net/http"6
"net/http/httptest"7
"strings"8
"testing"9
10
"gitlab.com/Timfa/bluegit/internal/cispec"11
"gitlab.com/Timfa/bluegit/internal/config"12
)13
14
func TestCISpecPageMatchesAPI(t *testing.T) {15
srv := &Server{Cfg: config.Config{BaseURL: "http://127.0.0.1:9"}}16
ts := httptest.NewServer(srv.Handler())17
t.Cleanup(ts.Close)18
19
page, err := http.Get(ts.URL + "/-/info")20
if err != nil {21
t.Fatal(err)22
}23
body := read(t, page)24
if page.StatusCode != 200 {25
t.Fatalf("pagina %d", page.StatusCode)26
}27
for _, want := range []string{28
`<script type="application/json" id="bluegit-ci-spec">`,29
"bluegit/node",30
"node:22",31
"CI_JOB_TOKEN",32
"workflow",33
"Differences with GitLab",34
`href="/-/info"`,35
} {36
if !strings.Contains(body, want) {37
t.Fatalf("mist %q", want)38
}39
}40
const start = `<script type="application/json" id="bluegit-ci-spec">`41
i := strings.Index(body, start)42
rest := body[i+len(start):]43
j := strings.Index(rest, "</script>")44
embedded := rest[:j]45
46
api, err := http.Get(ts.URL + "/api/v1/ci/spec")47
if err != nil {48
t.Fatal(err)49
}50
raw := read(t, api)51
if api.StatusCode != 200 || !strings.Contains(api.Header.Get("Content-Type"), "application/json") {52
t.Fatalf("api %d %s", api.StatusCode, api.Header.Get("Content-Type"))53
}54
if embedded != strings.TrimRight(raw, "\n") && embedded != raw {55
// Marshal eindigt op een newline. Het scriptblok bevat die newline.56
if strings.TrimSpace(embedded) != strings.TrimSpace(raw) {57
t.Fatalf("pagina en API wijken af\npage %q\napi %q", embedded[:80], raw[:80])58
}59
}60
var doc cispec.Doc61
if err := json.Unmarshal([]byte(raw), &doc); err != nil {62
t.Fatal(err)63
}64
if doc.File != "blue-ci-cd.yml" || len(doc.Sections) < 6 {65
t.Fatalf("%+v", doc.File)66
}67
68
nl, err := http.Get(ts.URL + "/api/v1/ci/spec?lang=nl")69
if err != nil {70
t.Fatal(err)71
}72
dutch := read(t, nl)73
if !strings.Contains(dutch, "Volgorde van de stages") || !strings.Contains(dutch, "bluegit/base") {74
t.Fatalf("nl: %s", dutch[:400])75
}76
cu, err := http.Get(ts.URL + "/api/v1/ci/spec?lang=cuneiform")77
if err != nil {78
t.Fatal(err)79
}80
signs := read(t, cu)81
if strings.Contains(signs, "Stage order") || !strings.Contains(signs, `"name":"stages"`) && !strings.Contains(signs, `"name": "stages"`) {82
t.Fatalf("spijkerschrift of sleutelnaam: %s", signs[:300])83
}84
}@@ -19,6 +19,7 @@ import (
19
19
"gitlab.com/Timfa/bluegit/internal/access"
20
20
"gitlab.com/Timfa/bluegit/internal/activity"
21
21
"gitlab.com/Timfa/bluegit/internal/auth"
22
"gitlab.com/Timfa/bluegit/internal/cispec"
22
23
"gitlab.com/Timfa/bluegit/internal/config"
23
24
"gitlab.com/Timfa/bluegit/internal/i18n"
24
25
"gitlab.com/Timfa/bluegit/internal/realip"
@@ -65,6 +66,8 @@ func (s *Server) Handler() http.Handler {
65
66
s.mustTemplates()
66
67
mux := http.NewServeMux()
67
68
mux.HandleFunc("GET /assets/{file}", s.asset)
69
mux.HandleFunc("GET /-/info", s.infoPage)
70
mux.HandleFunc("GET /api/v1/ci/spec", s.ciSpec)
68
71
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
69
72
w.WriteHeader(http.StatusOK)
70
73
_, _ = w.Write([]byte("ok\n"))
@@ -499,6 +502,9 @@ type View struct {
499
502
StorageTotal string
500
503
MinFree string
501
504
Wide bool
505
Info bool
506
Spec cispec.Doc
507
SpecJSON template.JS
502
508
Page string
503
509
Lang string
504
510
HTMLLang string
@@ -19,6 +19,7 @@ import (19
"gitlab.com/Timfa/bluegit/internal/access"19
"gitlab.com/Timfa/bluegit/internal/access"20
"gitlab.com/Timfa/bluegit/internal/activity"20
"gitlab.com/Timfa/bluegit/internal/activity"21
"gitlab.com/Timfa/bluegit/internal/auth"21
"gitlab.com/Timfa/bluegit/internal/auth"22
"gitlab.com/Timfa/bluegit/internal/cispec"22
"gitlab.com/Timfa/bluegit/internal/config"23
"gitlab.com/Timfa/bluegit/internal/config"23
"gitlab.com/Timfa/bluegit/internal/i18n"24
"gitlab.com/Timfa/bluegit/internal/i18n"24
"gitlab.com/Timfa/bluegit/internal/realip"25
"gitlab.com/Timfa/bluegit/internal/realip"@@ -65,6 +66,8 @@ func (s *Server) Handler() http.Handler {65
s.mustTemplates()66
s.mustTemplates()66
mux := http.NewServeMux()67
mux := http.NewServeMux()67
mux.HandleFunc("GET /assets/{file}", s.asset)68
mux.HandleFunc("GET /assets/{file}", s.asset)69
mux.HandleFunc("GET /-/info", s.infoPage)70
mux.HandleFunc("GET /api/v1/ci/spec", s.ciSpec)68
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {71
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {69
w.WriteHeader(http.StatusOK)72
w.WriteHeader(http.StatusOK)70
_, _ = w.Write([]byte("ok\n"))73
_, _ = w.Write([]byte("ok\n"))@@ -499,6 +502,9 @@ type View struct {499
StorageTotal string502
StorageTotal string500
MinFree string503
MinFree string501
Wide bool504
Wide bool505
Info bool506
Spec cispec.Doc507
SpecJSON template.JS502
Page string508
Page string503
Lang string509
Lang string504
HTMLLang string510
HTMLLang string@@ -16,7 +16,7 @@ func (s *Server) noStorageText(r *http.Request) string {
16
16
17
17
func allowsWithoutStorage(r *http.Request) bool {
18
18
switch r.URL.Path {
19
case "/healthz", "/login", "/auth/callback", "/logout", "/setup":
19
case "/healthz", "/login", "/auth/callback", "/logout", "/setup", "/-/info", "/api/v1/ci/spec":
20
20
return true
21
21
}
22
22
return strings.HasPrefix(r.URL.Path, "/assets/")
@@ -16,7 +16,7 @@ func (s *Server) noStorageText(r *http.Request) string {16
16
17
func allowsWithoutStorage(r *http.Request) bool {17
func allowsWithoutStorage(r *http.Request) bool {18
switch r.URL.Path {18
switch r.URL.Path {19
case "/healthz", "/login", "/auth/callback", "/logout", "/setup":19
case "/healthz", "/login", "/auth/callback", "/logout", "/setup", "/-/info", "/api/v1/ci/spec":20
return true20
return true21
}21
}22
return strings.HasPrefix(r.URL.Path, "/assets/")22
return strings.HasPrefix(r.URL.Path, "/assets/")@@ -662,6 +662,22 @@ button.section-toggle {
662
662
}
663
663
.sidenav-links a.on { background: transparent; font-weight: 400; box-shadow: inset 0 -2px 0 var(--blue); }
664
664
}
665
.spec h2 { scroll-margin-top: calc(var(--top-h) + 12px); margin: 1.6rem 0 0.6rem; }
666
.spec .lead { margin-top: 0; }
667
.spec-example {
668
background: #142033; color: #e7f0ff; border-radius: var(--radius-lg);
669
padding: 0.85rem 1rem; overflow: auto; font-family: var(--mono); font-size: 0.88rem;
670
line-height: 1.45;
671
}
672
.spec-table { width: 100%; border-collapse: collapse; background: var(--card); }
673
.spec-table th, .spec-table td {
674
border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
675
padding: 0.45rem 0.7rem;
676
}
677
.spec-table th { font-size: var(--fs-sm); color: var(--muted); font-weight: 650; }
678
.spec-table code { font-family: var(--mono); font-size: 0.92em; }
679
.spec-list { margin: 0.2rem 0 0; padding-left: 1.2rem; }
680
.spec-list li { margin: 0.35rem 0; }
665
681
@media (max-width: 800px) {
666
682
.proj, .fileview, .joblayout { grid-template-columns: minmax(0, 1fr); }
667
683
.proj > *, .fileview > *, .toolbar, .commitbar, .hscroll { min-width: 0; max-width: 100%; }
@@ -662,6 +662,22 @@ button.section-toggle {662
}662
}663
.sidenav-links a.on { background: transparent; font-weight: 400; box-shadow: inset 0 -2px 0 var(--blue); }663
.sidenav-links a.on { background: transparent; font-weight: 400; box-shadow: inset 0 -2px 0 var(--blue); }664
}664
}665
.spec h2 { scroll-margin-top: calc(var(--top-h) + 12px); margin: 1.6rem 0 0.6rem; }666
.spec .lead { margin-top: 0; }667
.spec-example {668
background: #142033; color: #e7f0ff; border-radius: var(--radius-lg);669
padding: 0.85rem 1rem; overflow: auto; font-family: var(--mono); font-size: 0.88rem;670
line-height: 1.45;671
}672
.spec-table { width: 100%; border-collapse: collapse; background: var(--card); }673
.spec-table th, .spec-table td {674
border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;675
padding: 0.45rem 0.7rem;676
}677
.spec-table th { font-size: var(--fs-sm); color: var(--muted); font-weight: 650; }678
.spec-table code { font-family: var(--mono); font-size: 0.92em; }679
.spec-list { margin: 0.2rem 0 0; padding-left: 1.2rem; }680
.spec-list li { margin: 0.35rem 0; }665
@media (max-width: 800px) {681
@media (max-width: 800px) {666
.proj, .fileview, .joblayout { grid-template-columns: minmax(0, 1fr); }682
.proj, .fileview, .joblayout { grid-template-columns: minmax(0, 1fr); }667
.proj > *, .fileview > *, .toolbar, .commitbar, .hscroll { min-width: 0; max-width: 100%; }683
.proj > *, .fileview > *, .toolbar, .commitbar, .hscroll { min-width: 0; max-width: 100%; }@@ -0,0 +1,44 @@
1
{{define "info"}}
2
{{template "layout-start" .}}
3
<article class="spec">
4
<h1>{{t "title.info"}}</h1>
5
<p class="lead">{{t "info.lead"}}</p>
6
<pre class="spec-example">{{.Spec.Example}}</pre>
7
{{range .Spec.Sections}}
8
<h2 id="{{.ID}}">{{.Title}}</h2>
9
{{if .Intro}}<p>{{.Intro}}</p>{{end}}
10
{{if eq .Kind "keywords"}}
11
<table class="spec-table">
12
<thead><tr><th>{{t "info.col.keyword"}}</th><th>{{t "info.col.meaning"}}</th></tr></thead>
13
<tbody>
14
{{range .Items}}<tr><td><code>{{.Name}}</code></td><td>{{.Summary}}</td></tr>{{end}}
15
</tbody>
16
</table>
17
{{else if eq .Kind "variables"}}
18
<table class="spec-table">
19
<thead><tr><th>{{t "info.col.keyword"}}</th><th>{{t "info.col.where"}}</th><th>{{t "info.col.meaning"}}</th></tr></thead>
20
<tbody>
21
{{range .Variables}}<tr><td><code>{{.Name}}</code></td><td>{{.Where}}</td><td>{{.Summary}}</td></tr>{{end}}
22
</tbody>
23
</table>
24
{{else if eq .Kind "list"}}
25
<ul class="spec-list">{{range .Lines}}<li>{{.}}</li>{{end}}</ul>
26
{{else if eq .Kind "presets"}}
27
<table class="spec-table">
28
<thead><tr><th>{{t "info.col.name"}}</th><th>{{t "info.col.base"}}</th><th>{{t "info.col.tools"}}</th></tr></thead>
29
<tbody>
30
{{range .Presets}}
31
<tr>
32
<td><code>{{.Name}}</code></td>
33
<td><code>{{.From}}</code>{{if .Runtime}}<div class="muted">{{.Runtime}}</div>{{end}}</td>
34
<td>{{if .Tools}}{{range $i, $tool := .Tools}}{{if $i}}, {{end}}<code>{{$tool}}</code>{{end}}{{else}}{{t "info.presets.mapped"}}{{end}}</td>
35
</tr>
36
{{end}}
37
</tbody>
38
</table>
39
{{end}}
40
{{end}}
41
<script type="application/json" id="bluegit-ci-spec">{{.SpecJSON}}</script>
42
</article>
43
{{template "layout-end" .}}
44
{{end}}
@@ -0,0 +1,44 @@1
{{define "info"}}2
{{template "layout-start" .}}3
<article class="spec">4
<h1>{{t "title.info"}}</h1>5
<p class="lead">{{t "info.lead"}}</p>6
<pre class="spec-example">{{.Spec.Example}}</pre>7
{{range .Spec.Sections}}8
<h2 id="{{.ID}}">{{.Title}}</h2>9
{{if .Intro}}<p>{{.Intro}}</p>{{end}}10
{{if eq .Kind "keywords"}}11
<table class="spec-table">12
<thead><tr><th>{{t "info.col.keyword"}}</th><th>{{t "info.col.meaning"}}</th></tr></thead>13
<tbody>14
{{range .Items}}<tr><td><code>{{.Name}}</code></td><td>{{.Summary}}</td></tr>{{end}}15
</tbody>16
</table>17
{{else if eq .Kind "variables"}}18
<table class="spec-table">19
<thead><tr><th>{{t "info.col.keyword"}}</th><th>{{t "info.col.where"}}</th><th>{{t "info.col.meaning"}}</th></tr></thead>20
<tbody>21
{{range .Variables}}<tr><td><code>{{.Name}}</code></td><td>{{.Where}}</td><td>{{.Summary}}</td></tr>{{end}}22
</tbody>23
</table>24
{{else if eq .Kind "list"}}25
<ul class="spec-list">{{range .Lines}}<li>{{.}}</li>{{end}}</ul>26
{{else if eq .Kind "presets"}}27
<table class="spec-table">28
<thead><tr><th>{{t "info.col.name"}}</th><th>{{t "info.col.base"}}</th><th>{{t "info.col.tools"}}</th></tr></thead>29
<tbody>30
{{range .Presets}}31
<tr>32
<td><code>{{.Name}}</code></td>33
<td><code>{{.From}}</code>{{if .Runtime}}<div class="muted">{{.Runtime}}</div>{{end}}</td>34
<td>{{if .Tools}}{{range $i, $tool := .Tools}}{{if $i}}, {{end}}<code>{{$tool}}</code>{{end}}{{else}}{{t "info.presets.mapped"}}{{end}}</td>35
</tr>36
{{end}}37
</tbody>38
</table>39
{{end}}40
{{end}}41
<script type="application/json" id="bluegit-ci-spec">{{.SpecJSON}}</script>42
</article>43
{{template "layout-end" .}}44
{{end}}@@ -15,16 +15,18 @@
15
15
{{if .User}}
16
16
<a href="/">{{t "nav.dashboard"}}</a>
17
17
<a href="/new">{{t "nav.new"}}</a>
18
<a href="/-/info">{{t "nav.info"}}</a>
18
19
{{if .User.InstanceAdmin}}<a href="/setup">{{t "nav.storage"}}</a>{{end}}
19
20
<a href="/settings">{{.User.Username}}</a>
20
21
<form method="post" action="/logout"><input type="hidden" name="csrf" value="{{.CSRF}}"><button type="submit">{{t "nav.signout"}}</button></form>
21
22
{{else}}
23
<a href="/-/info">{{t "nav.info"}}</a>
22
24
<a class="btn" href="/login">{{t "nav.signin"}}</a>
23
25
{{end}}
24
26
</nav>
25
27
</header>
26
<div class="frame{{if or .Repo .Group .User}} with-side{{end}}">
27
{{if .Repo}}{{template "reposide" .}}{{else if .Group}}{{template "groupside" .}}{{else if .User}}{{template "dashside" .}}{{end}}
28
<div class="frame{{if or .Repo .Group .Info .User}} with-side{{end}}">
29
{{if .Repo}}{{template "reposide" .}}{{else if .Group}}{{template "groupside" .}}{{else if .Info}}{{template "infoside" .}}{{else if .User}}{{template "dashside" .}}{{end}}
28
30
<div class="content">
29
31
<main{{if .Wide}} class="wide"{{end}}>
30
32
{{if .Notice}}<p class="flash">{{.Notice}}</p>{{end}}
@@ -85,6 +87,19 @@
85
87
</aside>
86
88
{{end}}
87
89
90
{{define "infoside"}}
91
<aside class="sidenav">
92
<a class="sidecontext" href="/-/info">
93
<span class="sidename">{{t "title.info"}}</span>
94
</a>
95
<nav class="sidenav-links">
96
{{range .Spec.Sections}}
97
<a href="/-/info#{{.ID}}">{{.Title}}</a>
98
{{end}}
99
</nav>
100
</aside>
101
{{end}}
102
88
103
{{define "dashside"}}
89
104
<aside class="sidenav">
90
105
<a class="sidecontext" href="/">
@@ -94,6 +109,7 @@
94
109
<nav class="sidenav-links">
95
110
<a href="/"{{if eq .Page "dashboard"}} class="on"{{end}}>{{t "nav.dashboard"}}</a>
96
111
<a href="/new"{{if eq .Page "new"}} class="on"{{end}}>{{t "nav.new"}}</a>
112
<a href="/-/info"{{if eq .Page "info"}} class="on"{{end}}>{{t "nav.info"}}</a>
97
113
<a href="/settings"{{if eq .Page "account"}} class="on"{{end}}>{{.User.Username}}</a>
98
114
{{if .User.InstanceAdmin}}<a href="/setup"{{if eq .Page "setup"}} class="on"{{end}}>{{t "nav.storage"}}</a>{{end}}
99
115
</nav>
@@ -15,16 +15,18 @@15
{{if .User}}15
{{if .User}}16
<a href="/">{{t "nav.dashboard"}}</a>16
<a href="/">{{t "nav.dashboard"}}</a>17
<a href="/new">{{t "nav.new"}}</a>17
<a href="/new">{{t "nav.new"}}</a>18
<a href="/-/info">{{t "nav.info"}}</a>18
{{if .User.InstanceAdmin}}<a href="/setup">{{t "nav.storage"}}</a>{{end}}19
{{if .User.InstanceAdmin}}<a href="/setup">{{t "nav.storage"}}</a>{{end}}19
<a href="/settings">{{.User.Username}}</a>20
<a href="/settings">{{.User.Username}}</a>20
<form method="post" action="/logout"><input type="hidden" name="csrf" value="{{.CSRF}}"><button type="submit">{{t "nav.signout"}}</button></form>21
<form method="post" action="/logout"><input type="hidden" name="csrf" value="{{.CSRF}}"><button type="submit">{{t "nav.signout"}}</button></form>21
{{else}}22
{{else}}23
<a href="/-/info">{{t "nav.info"}}</a>22
<a class="btn" href="/login">{{t "nav.signin"}}</a>24
<a class="btn" href="/login">{{t "nav.signin"}}</a>23
{{end}}25
{{end}}24
</nav>26
</nav>25
</header>27
</header>26
<div class="frame{{if or .Repo .Group .User}} with-side{{end}}">28
<div class="frame{{if or .Repo .Group .Info .User}} with-side{{end}}">27
{{if .Repo}}{{template "reposide" .}}{{else if .Group}}{{template "groupside" .}}{{else if .User}}{{template "dashside" .}}{{end}}29
{{if .Repo}}{{template "reposide" .}}{{else if .Group}}{{template "groupside" .}}{{else if .Info}}{{template "infoside" .}}{{else if .User}}{{template "dashside" .}}{{end}}28
<div class="content">30
<div class="content">29
<main{{if .Wide}} class="wide"{{end}}>31
<main{{if .Wide}} class="wide"{{end}}>30
{{if .Notice}}<p class="flash">{{.Notice}}</p>{{end}}32
{{if .Notice}}<p class="flash">{{.Notice}}</p>{{end}}@@ -85,6 +87,19 @@85
</aside>87
</aside>86
{{end}}88
{{end}}87
89
90
{{define "infoside"}}91
<aside class="sidenav">92
<a class="sidecontext" href="/-/info">93
<span class="sidename">{{t "title.info"}}</span>94
</a>95
<nav class="sidenav-links">96
{{range .Spec.Sections}}97
<a href="/-/info#{{.ID}}">{{.Title}}</a>98
{{end}}99
</nav>100
</aside>101
{{end}}102
88
{{define "dashside"}}103
{{define "dashside"}}89
<aside class="sidenav">104
<aside class="sidenav">90
<a class="sidecontext" href="/">105
<a class="sidecontext" href="/">@@ -94,6 +109,7 @@94
<nav class="sidenav-links">109
<nav class="sidenav-links">95
<a href="/"{{if eq .Page "dashboard"}} class="on"{{end}}>{{t "nav.dashboard"}}</a>110
<a href="/"{{if eq .Page "dashboard"}} class="on"{{end}}>{{t "nav.dashboard"}}</a>96
<a href="/new"{{if eq .Page "new"}} class="on"{{end}}>{{t "nav.new"}}</a>111
<a href="/new"{{if eq .Page "new"}} class="on"{{end}}>{{t "nav.new"}}</a>112
<a href="/-/info"{{if eq .Page "info"}} class="on"{{end}}>{{t "nav.info"}}</a>97
<a href="/settings"{{if eq .Page "account"}} class="on"{{end}}>{{.User.Username}}</a>113
<a href="/settings"{{if eq .Page "account"}} class="on"{{end}}>{{.User.Username}}</a>98
{{if .User.InstanceAdmin}}<a href="/setup"{{if eq .Page "setup"}} class="on"{{end}}>{{t "nav.storage"}}</a>{{end}}114
{{if .User.InstanceAdmin}}<a href="/setup"{{if eq .Page "setup"}} class="on"{{end}}>{{t "nav.storage"}}</a>{{end}}99
</nav>115
</nav>@@ -42,3 +42,8 @@ ci:
42
42
concurrency: 1
43
43
network: bridge
44
44
timeout_seconds: 1800
45
# Image-aliassen. De ingebouwde presets zijn bluegit/base, bluegit/node,
46
# bluegit/python, bluegit/go, bluegit/rust, bluegit/java en bluegit/dotnet.
47
# presets:
48
# team/tools:
49
# image: alpine:3.20
@@ -42,3 +42,8 @@ ci:42
concurrency: 142
concurrency: 143
network: bridge43
network: bridge44
timeout_seconds: 180044
timeout_seconds: 180045
# Image-aliassen. De ingebouwde presets zijn bluegit/base, bluegit/node,46
# bluegit/python, bluegit/go, bluegit/rust, bluegit/java en bluegit/dotnet.47
# presets:48
# team/tools:49
# image: alpine:3.20