debian-forge-composer/internal/worker/api/openapi.yml
Lars Karlitski d3c99b8e93 worker: allow passing different jobs to workers
Until now, all jobs were put as "osbuild" jobs into the job queue and
the worker API hard-coded sending an osbuild manifest and upload
targets.

Change the API to take a "type" and "args" keys, which are equivalent to
the job-queue's type and args. Workers continue to support only osbuild
jobs, but this makes other jobs possible in the future.
2020-09-23 14:28:52 +01:00

191 lines
4.6 KiB
YAML

openapi: 3.0.0
info:
title: worker
version: '1.0'
servers: []
paths:
/status:
get:
summary: status
tags: []
responses:
'200':
description: OK
headers: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum:
- OK
required:
- status
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: GetStatus
description: Simple status handler to check whether the service is up.
/jobs:
post:
summary: Request a job
tags: []
responses:
'201':
description: Created
content:
application/json:
schema:
type: object
additionalProperties: false
properties:
id:
type: string
format: uuid
location:
type: string
artifact_location:
type: string
type:
type: string
enum:
- osbuild
args: {}
required:
- type
- location
- id
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: RequestJob
requestBody:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
description: Requests a job. This operation blocks until a job is available.
parameters: []
'/jobs/{token}':
parameters:
- schema:
type: string
name: token
in: path
required: true
get:
summary: Get running job
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
canceled:
type: boolean
required:
- canceled
4XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: GetJob
description: ''
patch:
summary: Update a running job
tags: []
responses: {}
operationId: UpdateJob
requestBody:
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum:
- WAITING
- RUNNING
- FINISHED
- FAILED
result: {}
required:
- status
- result
'/jobs/{token}/artifacts/{name}':
parameters:
- schema:
type: string
name: name
in: path
required: true
- schema:
type: string
name: token
in: path
required: true
put:
summary: Upload an artifact
tags: []
responses:
'200':
description: OK
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: UploadJobArtifact
requestBody:
content:
application/octet-stream:
schema:
type: string
components:
schemas:
Error:
title: Error
type: object
properties:
message:
type: string
required:
- message