This repository has been archived by the owner on Feb 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
payload.go
85 lines (83 loc) · 3.06 KB
/
payload.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// +build !windows
package main
// Returns json schema for the payload part of the task definition. Please
// note we use a go string and do not load an external file, since we want this
// to be *part of the compiled executable*. If this sat in another file that
// was loaded at runtime, it would not be burned into the build, which would be
// bad for the following two reasons:
// 1) we could no longer distribute a single binary file that didn't require
// installation/extraction
// 2) the payload schema is specific to the version of the code, therefore
// should be versioned directly with the code and *frozen on build*.
//
// Run `generic-worker show-payload-schema` to output this schema to standard
// out.
func taskPayloadSchema() string {
return `{
"id": "http://schemas.taskcluster.net/generic-worker/v1/payload.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Generic worker payload",
"description": "This schema defines the structure of the ` + "`payload`" + ` property referred to in a Task Cluster Task definition.",
"type": "object",
"required": [
"command",
"maxRunTime"
],
"properties": {
"command": {
"title": "Commands to run",
"type": "array",
"minItems": 1,
"items": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
},
"description": "One array per command (each command is an array of arguments). Several arrays for several commands."
},
"env": {
"title": "Environment variable mappings.",
"description": "Example: ` + "```" + `{ \"PATH\": \"C:\\\\Windows\\\\system32;C:\\\\Windows\", \"GOOS\": \"darwin\" }` + "```" + `",
"type": "object"
},
"maxRunTime": {
"type": "number",
"title": "Maximum run time in seconds",
"description": "Maximum time the task container can run in seconds",
"multipleOf": 1.0,
"minimum": 1,
"maximum": 86400
},
"artifacts": {
"type": "array",
"title": "Artifacts to be published",
"description": "Artifacts to be published. For example: ` + "`" + `{ \"type\": \"file\", \"path\": \"builds\\\\firefox.exe\", \"expires\": \"2015-08-19T17:30:00.000Z\" }` + "`" + `",
"items": {
"type": "object",
"properties": {
"type": {
"title": "Artifact upload type.",
"type": "string",
"enum": ["file", "directory"],
"description": "Artifacts can be either an individual ` + "`file`" + ` or a ` + "`directory`" + ` containing potentially multiple files with recursively included subdirectories"
},
"path": {
"title": "Artifact location",
"type": "string",
"description": "Filesystem path of artifact"
},
"expires": {
"title": "Expiry date and time",
"type": "string",
"format": "date-time",
"description": "Date when artifact should expire must be in the future"
}
},
"required": ["type", "path", "expires"]
}
}
}
}`
}