aboutsummaryrefslogtreecommitdiffstats
path: root/builds.sr.ht/api.md
blob: 36fa40e2b4a5a4b7b9da032f1ae4638f20877a25 (plain) (blame)
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
The build.sr.ht API allows you to insert jobs, monitor their progress, and
access some information about the build system. Authentication to this API is
brokered by meta.sr.ht. This API uses standard sr.ht error responses.

# API Endpoints

The following endpoints are available to users with an OAuth key valid for the
specified scope.

## POST /api/jobs

**Scopes**: jobs:write

Inserts a new job into the job queue.

    {
      "manifest": "string",         The build manifest
      "note": "string",             Human-friendly description of this build
                                      (markdown, optional)
      "tags": [...],                Arbitrary list of strings that identify this
                                      build and can be used to navigate the
                                      dashboard. Each string must use only
                                      lowercase alphanumeric characters, or any
                                      of "-_.:" (optional)
      "access:read": [              List of users that have read access to this
                                      job (optional). The user submitting the
                                      build will be included regardless of this
                                      value. The special username "*" indicates
                                      public read access to this build.
                                      Defaults to *.
        "string"                    Username
      ],
      "access:write": [             List of users that have write access to this
                                      job (optional). The user submitting the
                                      build will be included regardless of this
                                      value.
        "string"                    Username
      ],
      "triggers": [...],            Post-build triggers (optional)
      "execute": boolean,           True to start the build immediately
                                      (optional - defaults to true)
    }

## GET /api/jobs/:id

Gets information about a job by its ID.

**Scopes**: jobs:read

    {
      "id": integer,
      "status": "job status enum",
      "setup_log": "url",               URL to captured stdout/stderr of setup
      "tasks": [
        {
          "name": "setup",
          "status": "task status enum"
          "log": "url",
        },
        ...
      ]
    }

### Job status enum

- pending: waiting for user intervention to start
- queued: queued to start when a worker is available
- running: job is in-progress
- success: build completed without errors
- failed: build completed with errors

### Task status enum

- pending: waiting for earlier tasks to complete
- running: task is in-progress
- success: task completed without errors
- failed: task completed with errors