/
types.go
534 lines (448 loc) · 15.8 KB
/
types.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
// This source code file is AUTO-GENERATED by github.com/taskcluster/jsonschema2go
package tcqueueevents
import (
tcclient "github.com/taskcluster/taskcluster/clients/client-go/v22"
)
type (
// Information about the artifact that was created
Artifact struct {
// Mimetype for the artifact that was created.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date and time after which the artifact created will be automatically
// deleted by the queue.
Expires tcclient.Time `json:"expires"`
// Name of the artifact that was created, this is useful if you want to
// attempt to fetch the artifact. But keep in mind that just because an
// artifact is created doesn't mean that it's immediately available.
//
// Max length: 1024
Name string `json:"name"`
// This is the `storageType` for the request that was used to create the
// artifact.
//
// Possible values:
// * "blob"
// * "reference"
// * "error"
StorageType string `json:"storageType"`
}
// Message reporting a new artifact has been created for a given task.
ArtifactCreatedMessage struct {
// Information about the artifact that was created
Artifact Artifact `json:"artifact"`
// Id of the run on which artifact was created.
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
// Identifier for the worker-group within which the run with the created
// artifacted is running.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for the worker within which the run with the created artifact
// is running.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// JSON object with information about a run
RunInformation struct {
// Reason for the creation of this run,
// **more reasons may be added in the future**.
//
// Possible values:
// * "scheduled"
// * "retry"
// * "task-retry"
// * "rerun"
// * "exception"
ReasonCreated string `json:"reasonCreated"`
// Reason that run was resolved, this is mainly
// useful for runs resolved as `exception`.
// Note, **more reasons may be added in the future**, also this
// property is only available after the run is resolved. Some of these
// reasons, notably `intermittent-task`, `worker-shutdown`, and
// `claim-expired`, will trigger an automatic retry of the task.
//
// Possible values:
// * "completed"
// * "failed"
// * "deadline-exceeded"
// * "canceled"
// * "superseded"
// * "claim-expired"
// * "worker-shutdown"
// * "malformed-payload"
// * "resource-unavailable"
// * "internal-error"
// * "intermittent-task"
ReasonResolved string `json:"reasonResolved,omitempty"`
// Date-time at which this run was resolved, ie. when the run changed
// state from `running` to either `completed`, `failed` or `exception`.
// This property is only present after the run as been resolved.
Resolved tcclient.Time `json:"resolved,omitempty"`
// Id of this task run, `run-id`s always starts from `0`
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// Date-time at which this run was scheduled, ie. when the run was
// created in state `pending`.
Scheduled tcclient.Time `json:"scheduled"`
// Date-time at which this run was claimed, ie. when the run changed
// state from `pending` to `running`. This property is only present
// after the run has been claimed.
Started tcclient.Time `json:"started,omitempty"`
// State of this run
//
// Possible values:
// * "pending"
// * "running"
// * "completed"
// * "failed"
// * "exception"
State string `json:"state"`
// Time at which the run expires and is resolved as `failed`, if the
// run isn't reclaimed. Note, only present after the run has been
// claimed.
TakenUntil tcclient.Time `json:"takenUntil,omitempty"`
// Identifier for group that worker who executes this run is a part of,
// this identifier is mainly used for efficient routing.
// Note, this property is only present after the run is claimed.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup,omitempty"`
// Identifier for worker evaluating this run within given
// `workerGroup`. Note, this property is only available after the run
// has been claimed.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId,omitempty"`
}
// Subset of a task definition
Task struct {
// Arbitrary key-value tags (only strings limited to 4k). These can be used
// to attach informal metadata to a task. Use this for informal tags that
// tasks can be classified by. You can also think of strings here as
// candidates for formal metadata. Something like
// `purpose: 'build' || 'test'` is a good example.
//
// Default: {}
//
// Map entries:
// Max length: 4096
Tags map[string]string `json:"tags"`
}
// Message reporting that a task has complete successfully.
TaskCompletedMessage struct {
// Id of the run that completed the task
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Subset of a task definition containing values that are useful for determining
// whether a message is interesting to the receiver. Where the full task
// definition is required, the receiver should call queue.task to download that
// definition.
Task Var `json:"task,omitempty"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
// Identifier for the worker-group within which this run ran.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for the worker that executed this run.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// Message reporting that a task has been defined. The task may or may not be
// _scheduled_ too.
TaskDefinedMessage struct {
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Subset of a task definition containing values that are useful for determining
// whether a message is interesting to the receiver. Where the full task
// definition is required, the receiver should call queue.task to download that
// definition.
Task Var `json:"task,omitempty"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
}
// Message reporting that Taskcluster have failed to run a task.
TaskExceptionMessage struct {
// Id of the last run for the task, not provided if `deadline`
// was exceeded before a run was started.
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId,omitempty"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Subset of a task definition containing values that are useful for determining
// whether a message is interesting to the receiver. Where the full task
// definition is required, the receiver should call queue.task to download that
// definition.
Task Var `json:"task,omitempty"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
// Identifier for the worker-group within which the last attempt of the task
// ran. Not provided, if `deadline` was exceeded before a run was started.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup,omitempty"`
// Identifier for the last worker that failed to report, causing the task
// to fail. Not provided, if `deadline` was exceeded before a run
// was started.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId,omitempty"`
}
// Message reporting that a task failed to complete successfully.
TaskFailedMessage struct {
// Id of the run that failed.
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Subset of a task definition containing values that are useful for determining
// whether a message is interesting to the receiver. Where the full task
// definition is required, the receiver should call queue.task to download that
// definition.
Task Var `json:"task,omitempty"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
// Identifier for the worker-group within which this run ran.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for the worker that executed this run.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// Message written once a task group has no tasks to be run. It is
// possible for a task group to later have another task added, in which
// case this message will be sent again once it finishes.
TaskGroupResolvedMessage struct {
// Identifier for the scheduler that created this task-group.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
SchedulerID string `json:"schedulerId"`
// Identifier for the task-group being listed.
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskGroupID string `json:"taskGroupId"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version,omitempty"`
}
// Required task metadata
TaskMetadata struct {
// Human readable description of the task, please **explain** what the
// task does. A few lines of documentation is not going to hurt you.
//
// Max length: 32768
Description string `json:"description"`
// Human readable name of task, used to very briefly given an idea about
// what the task does.
//
// Max length: 255
Name string `json:"name"`
// E-mail of person who caused this task, e.g. the person who did
// `hg push`. The person we should contact to ask why this task is here.
//
// Max length: 255
Owner string `json:"owner"`
// Link to source of this task, should specify a file, revision and
// repository. This should be place someone can go an do a git/hg blame
// to who came up with recipe for this task.
//
// Syntax: ^https?://
// Max length: 4096
Source string `json:"source"`
}
// Message reporting that a task is now pending
TaskPendingMessage struct {
// Id of run that became pending, `run-id`s always starts from 0
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Subset of a task definition
Task Task `json:"task,omitempty"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
}
// Message reporting that a given run of a task have started
TaskRunningMessage struct {
// Id of the run that just started, always starts from 0
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Time at which the run expires and is resolved as `failed`, if the run
// isn't reclaimed.
TakenUntil tcclient.Time `json:"takenUntil"`
// Message version
//
// Possible values:
// * 1
Version int64 `json:"version"`
// Identifier for the worker-group within which this run started.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for the worker executing this run.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// A representation of **task status** as known by the queue
TaskStatusStructure struct {
// Deadline of the task, `pending` and `running` runs are
// resolved as **exception** if not resolved by other means
// before the deadline. Note, deadline cannot be more than
// 5 days into the future
Deadline tcclient.Time `json:"deadline"`
// Task expiration, time at which task definition and
// status is deleted. Notice that all artifacts for the task
// must have an expiration that is no later than this.
Expires tcclient.Time `json:"expires"`
// Unique identifier for a provisioner, that can supply specified
// `workerType`
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}$
ProvisionerID string `json:"provisionerId"`
// Number of retries left for the task in case of infrastructure issues
//
// Mininum: 0
// Maximum: 999
RetriesLeft int64 `json:"retriesLeft"`
// List of runs, ordered so that index `i` has `runId == i`
Runs []RunInformation `json:"runs"`
// All tasks in a task group must have the same `schedulerId`. This is used for several purposes:
//
// * it can represent the entity that created the task;
// * it can limit addition of new tasks to a task group: the caller of
// `createTask` must have a scope related to the `schedulerId` of the task
// group;
// * it controls who can manipulate tasks, again by requiring
// `schedulerId`-related scopes; and
// * it appears in the routing key for Pulse messages about the task.
//
// Default: "-"
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
SchedulerID string `json:"schedulerId"`
// State of this task. This is just an auxiliary property derived from state
// of latests run, or `unscheduled` if none.
//
// Possible values:
// * "unscheduled"
// * "pending"
// * "running"
// * "completed"
// * "failed"
// * "exception"
State string `json:"state"`
// Identifier for a group of tasks scheduled together with this task.
// Generally, all tasks related to a single event such as a version-control
// push or a nightly build have the same `taskGroupId`. This property
// defaults to `taskId` if it isn't specified. Tasks with `taskId` equal to
// the `taskGroupId` are, [by convention](/docs/manual/using/task-graph),
// decision tasks.
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskGroupID string `json:"taskGroupId"`
// Unique task identifier, this is UUID encoded as
// [URL-safe base64](http://tools.ietf.org/html/rfc4648#section-5) and
// stripped of `=` padding.
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskID string `json:"taskId"`
// Unique identifier for a worker-type within a specific provisioner
//
// Syntax: ^[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerType string `json:"workerType"`
}
// Subset of a task definition containing values that are useful for determining
// whether a message is interesting to the receiver. Where the full task
// definition is required, the receiver should call queue.task to download that
// definition.
Var struct {
// Arbitrary key-value tags (only strings limited to 4k). These can be used
// to attach informal metadata to a task. Use this for informal tags that
// tasks can be classified by. You can also think of strings here as
// candidates for formal metadata. Something like
// `purpose: 'build' || 'test'` is a good example.
//
// Default: {}
//
// Map entries:
// Max length: 4096
Tags map[string]string `json:"tags"`
}
)