Skip to content

Commit 6265e9c

Browse files
authored
Update JSON schema for runner context to avoid issues with GitLab (#2398)
Signed-off-by: Rafał Kuć <[email protected]>
1 parent f49a48a commit 6265e9c

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

internal/schemavalidators/external_schemas/runnercontext/runner-context-response-0.1.schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
"id": {
88
"type": "string",
99
"description": "Unique identifier for the runner context schema version"
10+
},
11+
"errors": {
12+
"items": {
13+
"type": "string"
14+
},
15+
"type": "array",
16+
"description": "Array of error messages"
1017
}
1118
},
1219
"additionalProperties": false,
@@ -319,7 +326,6 @@
319326
"additionalProperties": false,
320327
"type": "object",
321328
"required": [
322-
"owner",
323329
"repository"
324330
]
325331
},

internal/schemavalidators/schemavalidators_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ func TestValidateRunnerContext(t *testing.T) {
194194
name: "0.1 GitHub rulesets",
195195
filePath: "./testdata/runner_context_rulesets-v0.1.json",
196196
},
197+
{
198+
name: "0.1 GitLab no protection",
199+
filePath: "./testdata/runner_context_gitlab_no_protection-v0.1.json",
200+
},
197201
{
198202
name: "invalid Chainloop runner context - missing meta",
199203
filePath: "./testdata/runner_context_missing-meta-v0.1.json",
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"meta": {
3+
"id": "chainloop.dev/runner-context/v0.1"
4+
},
5+
"data": {
6+
"tool": "platform@6df8c658",
7+
"provider": "gitlab",
8+
"repos": [
9+
{
10+
"repository": "69340413",
11+
"branches": [
12+
{
13+
"name": "main",
14+
"active_rules": [
15+
{
16+
"name": "allow_force_push",
17+
"enabled": "false"
18+
},
19+
{
20+
"name": "code_owner_approval_required",
21+
"enabled": "false"
22+
},
23+
{
24+
"name": "push_access_levels",
25+
"enabled": "true",
26+
"context": [
27+
{
28+
"name": "access_level",
29+
"value": "40",
30+
"enabled": "true"
31+
},
32+
{
33+
"name": "access_level_description",
34+
"value": "Maintainers",
35+
"enabled": "true"
36+
}
37+
]
38+
},
39+
{
40+
"name": "merge_access_levels",
41+
"enabled": "true",
42+
"context": [
43+
{
44+
"name": "access_level",
45+
"value": "40",
46+
"enabled": "true"
47+
},
48+
{
49+
"name": "access_level_description",
50+
"value": "Maintainers",
51+
"enabled": "true"
52+
}
53+
]
54+
}
55+
]
56+
}
57+
]
58+
}
59+
]
60+
}
61+
}

0 commit comments

Comments
 (0)