Add swagger config
Add hydra api info to the README
hydra.yaml: added some more descriptions
Add /login
Add 404/403 responses
hydra.yaml -> hydra-api.yaml
Address PR comments
Fix syntax
Add project creation
Add PUT /project/{id}
Add /search
Add "/api/jobsets" endpoint
Add /api/push endpoint
Add jobset PUT definition
Add eval endpoint
Remove duplicated key
Fix typo
Fix structural errors
fix another error
Link to hydra-api.yaml from master
Add openapi yaml validation step to CI
LX326CB7QYUPVTX37SSK6VFSYKJIII6ARISYJBHZBVKVJ2NQTI3AC validate-openapi:runs-on: ubuntu-18.04steps:- uses: actions/checkout@v2with:fetch-depth: 0- uses: cachix/install-nix-action@v8- run: nix-shell -p openapi-generator-cli --run "openapi-generator-cli validate -i ./hydra-api.yaml"
openapi: "3.0.0"info:version: 1.0.0title: Hydra APIdescription: Specification of the Hydra REST APIservers:- url: https://hydra.nixos.orgpaths:/login:post:summary: Log in using username/password credentialsrequestBody:required: truecontent:application/json:schema:type: objectproperties:username:description: usertype: stringpassword:description: passwordtype: stringresponses:'200':description: successful logincontent:application/json:schema:type: objectproperties:username:description: usertype: stringfullname:description: full nametype: stringemailaddress:description: emailtype: stringuserroles:description: user rolestype: arrayitems:type: string'403':description: login failedcontent:application/json:schema:$ref: '#/components/schemas/Error'/:get:summary: Retrieves all projectsdescription: Retrieves a list of all projects.responses:'200':description: List of all configured projectscontent:application/json:schema:type: arrayitems:$ref: '#/components/schemas/Project'examples:projects-success:$ref: '#/components/examples/projects-success'/api/push:put:summary: trigger jobsetsparameters:- in: queryname: jobsetsdescription: project and jobset formatted as "<project>:<jobset>" to evaluateschema:type: stringresponses:'200':description: jobset trigger responsecontent:application/json:schema:type: objectproperties:jobsetsTriggered:type: arrayitems:type: string/api/jobsets:get:summary: retrieve a jobset overview for a projectparameters:- in: queryname: projectdescription: name of the projectschema:type: stringresponses:'200':description: jobset overviewcontent:application/json:schema:$ref: '#/components/schemas/JobsetOverview''404':description: project could not be foundcontent:application/json:schema:$ref: '#/components/schemas/Error'/search:get:summary: search for evaluationsdescription: search for evaluations by nameparameters:- in: queryname: queryschema:type: stringdescription: string to search forresponses:'200':description: search responsecontent:application/json:schema:$ref: '#/components/schemas/SearchResult''500':description: Empty search term or other internal errorcontent:application/json:schema:type: objectproperties:error:type: stringdescription: error message/project/{id}:put:summary: Create a projectparameters:- name: idin: pathdescription: project identifierrequired: trueschema:type: stringrequestBody:required: truecontent:application/json:schema:type: objectproperties:displayname:description: name of the projecttype: stringenabled:description: when set to true the project gets scheduled for evaluationtype: booleanhidden:description: when set to true the project is displayed in the web interfacetype: booleanresponses:'403':description: request unauthorizedcontent:application/json:schema:type: objectproperties:error:description: error messagetype: string'200':description: projects existscontent:application/json:schema:type: objectproperties:redirect:description: URL of the created projecttype: string'201':description: successful project creationcontent:application/json:schema:type: objectproperties:uri:description: URL of the created projecttype: stringname:description: name of the projecttype: stringredirect:description: URL of the created projecttype: stringtype:description: type of the created resource ("project")type: stringget:summary: Retrieves a project designated by nameparameters:- name: idin: pathdescription: project identifierrequired: trueschema:type: stringresponses:'200':description: project responsecontent:application/json:schema:$ref: '#/components/schemas/Project'examples:project-success:$ref: '#/components/examples/project-success''404':description: project could not be foundcontent:application/json:schema:$ref: '#/components/schemas/Error'/jobset/{project-id}/{jobset-id}:put:summary: Creates a jobset in an existing projectparameters:- name: project-idrequired: truein: pathdescription: name of the project to create the jobset inschema:type: string- name: jobset-idrequired: truein: pathdescription: name of the jobset to createschema:type: stringrequestBody:required: truecontent:application/json:schema:type: objectproperties:'description':description: a description of the jobsettype: stringcheckinterval:description: interval (in seconds) in which to check for evaluationtype: integerenabled:description: when true the jobset gets scheduled for evaluationtype: booleanvisible:description: when true the jobset is visible in the web frontendtype: booleankeepnr:description: number or evaluations to keeptype: integernixexprinput:description: the name of the jobset input which contains the nixexprpathtype: stringnixexprpath:nullable: truedescription: the path to the file to evaluatetype: stringinputs:description: inputs for this jobsettype: objectadditionalProperties:$ref: '#/components/schemas/JobsetInput'responses:'201':description: jobset creation responsecontent:application/json:schema:type: objectproperties:redirect:type: stringdescription: url pointing to the webui for the created jobseturi:type: stringdescription: url to the created jobsetname:type: stringdescription: name of the created jobset'type':type: stringdescription: Set to "jobset"'200':description: jobset creation response when jobset exists alreadycontent:application/json:schema:type: objectproperties:redirect:type: stringdescription: url pointing to the webui for the created jobsetget:summary: Retrieves a jobset designated by project and jobset idparameters:- name: project-idin: pathdescription: name of the project the jobset belongs torequired: trueschema:type: string- name: jobset-idin: pathdescription: name of the jobset to retrieverequired: trueschema:type: stringresponses:'200':description: jobset responsecontent:application/json:schema:$ref: '#/components/schemas/Jobset'examples:jobset-success:$ref: '#/components/examples/jobset-success''404':description: jobset couldn't be foundcontent:application/json:schema:$ref: '#/components/schemas/Error'/jobset/{project-id}/{jobset-id}/evals:get:summary: Retrieves all evaluations of a jobsetparameters:- name: project-idin: pathdescription: project identifierrequired: trueschema:type: string- name: jobset-idin: pathdescription: jobset identifierrequired: trueschema:type: stringresponses:'200':description: evaluationscontent:application/json:schema:type: arrayitems:$ref: '#/components/schemas/Evaluations'examples:evals-success:$ref: '#/components/examples/evals-success''404':description: jobset couldn't be foundcontent:application/json:schema:$ref: '#/components/schemas/Error'/build/{build-id}:get:summary: Retrieves a single build of a jobset by idparameters:- name: build-idin: pathdescription: build identifierrequired: trueschema:type: integerresponses:'200':description: buildcontent:application/json:schema:$ref: '#/components/schemas/Build'examples:build-success:$ref: '#/components/examples/build-success''404':description: build couldn't be foundcontent:application/json:schema:$ref: '#/components/schemas/Error'/eval/{build-id}:get:summary: Retrieves evaluations identified by build idparameters:- name: build-idin: pathdescription: build identifierrequired: trueschema:type: integerresponses:'200':description: evaluationcontent:application/json:schema:$ref: '#/components/schemas/JobsetEval'components:schemas:SearchResult:type: objectproperties:jobsets:description: jobsets matching search termtype: arrayitems:$ref: '#/components/schemas/Jobset'projects:description: projects missing search termtype: arrayitems:$ref: '#/components/schemas/Project'builds:description: builds matching search termtype: arrayitems:$ref: '#/components/schemas/Build'buildsdrv:description: derivations matching search termtype: arrayitems:$ref: '#/components/schemas/Build'Error:type: objectproperties:error:description: error messagetype: stringProject:type: objectproperties:owner:description: username of the project ownertype: stringname:description: name of the projecttype: stringdisplayname:description: name to be displayed in the web interfacetype: stringdescription:description: description of the projecttype: stringhidden:description: when set to true the project is not displayed in the web interfacetype: booleanenabled:description: when set to true the project gets scheduled for evaluationtype: booleanjobsets:description: list of jobsets belonging to this projecttype: arrayitems:type: stringJobsetInput:type: objectproperties:jobsetinputalts:type: arraydescription: ???items:type: stringJobset:type: objectproperties:fetcherrormsg:nullable: truedescription: contains the error message when there was a problem fetching sources for a jobsettype: stringnixexprinput:description: the name of the jobset input which contains the nixexprpathtype: stringerrormsg:description: contains the stderr output of the nix-instantiate commandtype: stringemailoverride:description: email address to send notices to instead of the package maintainer (can be a comma separated list)type: stringnixexprpath:nullable: truedescription: the path to the file to evaluatetype: stringenabled:description: when set to true the jobset gets scheduled for evaluationtype: booleanjobsetinputs:description: inputs configured for this jobsettype: objectadditionalProperties:$ref: '#/components/schemas/JobsetInput'JobsetEvalInput:type: objectproperties:uri:nullable: truedescription: URI of this input (which differs depending on the type of the input)type: string'type':description: The type of this inputtype: stringenum:- bzr- bzr-checkout- bitbucketpulls- darcs- git- githubpulls- gitlabpulls- hg- path- svn- svn-checkoutrevision:nullable: truedescription: A Git/Mercurial commit hash or a Subversion revision number.type: stringvalue:nullable: truedescription: A value that corresponds to the type of inputoneOf:- type: boolean- type: string- type: arrayitems:type: stringtype: booleandependency:nullable: truedescription: >**Deprecated**: The build id of another buildtype: stringJobsetEval:type: objectproperties:id:type: integerhasnewbuilds:description: is true if the number of JobsetEval members is different from the prior evaluation. (will always be true on the first evaluation)type: booleanbuilds:description: List of builds generated for this jobset evaluationtype: arrayitems:type: integerjobsetevalinputs:type: objectadditionalProperties:$ref: '#/components/schemas/JobsetEvalInput'JobsetOverview:type: arrayitems:type: objectproperties:name:description: name of the jobsettype: stringproject:description: name of the projecttype: stringnrtotal:description: number of evaluationstype: integercheckinterval:description: interval in seconds at which to check the jobset inputstype: integerhaserrormsg:description: true if the evaluation had errorstype: booleannrscheduled:description: number of scheduled evaluationstype: integernrfailed:description: number of failed evaluationstype: integererrortime:description: time an error occurred during evaluation (unix time stamp)type: integerfetcherrormsg:nullable: truedescription: contains the error message when there was a problem fetching sources for a jobsetstarttime:nullable: truedescription: time when build startedtype: integerlastcheckedtime:description: the last time the jobset inputs where checked to see if an evaluation needs to be scheduled (unix time stamp)type: integertriggertime:nullable: truedescription: time of the last evaluation trigger for this jobset (unix time stamp)type: integerEvaluations:type: objectproperties:first:description: first list of resultstype: stringnext:description: next list of resultstype: stringlast:description: last list of resultstype: stringevals:type: arraydescription: List of evaluationsitems:type: objectadditionalProperties:$ref: '#/components/schemas/JobsetEval'BuildProduct:type: objectproperties:filesize:nullable: truedescription: Size of the produced filetype: integerdefaultpath:description: This is a Git/Mercurial commit hash or a Subversion revision numbertype: string'type':description: Types of build product (user defined)type: stringname:description: Name of the filetype: stringsha1hash:nullable: truedescription: sha1 hash of the filetype: stringpath:description: the nix store pathtype: stringsubtype:description: user-specifiedtype: stringsha256hash:nullable: truedescription: sha256 hash of the filetype: stringBuildOutput:type: objectproperties:path:description: The nix store pathtype: stringBuild:type: objectproperties:id:type: integerstarttime:description: time when build startedtype: integerstoptime:description: time when build endedtype: integertimestamp:description: time when the build was first createdtype: integerjobsetevals:description: list of evaluations this build is part oftype: arrayitems:type: integerfinished:description: true when the build is finishedtype: booleannixname:description: name from the build's derivationtype: stringbuildstatus:nullable: true # should only be null if finished is falsedescription: |Indicates the build status:</br><ul><li>0 : succeeded</li><li>1 : failed</li><li>2 : dependency failed</li><li>3 : aborted</li><li>4 : canceled by the user</li><li>6 : failed with output</li><li>7 : timed out</li><li>9 : aborted</li><li>10 : log size limit exceeded</li><li>11 : output size limit exceeded</li><li>* : failed</li></ul><strong>Note:</strong>buildstatus should only be `null` if `finished` is false.type: integerjobset:description: jobset this build belongs totype: stringpriority:description: determines the priority with which this build will be executed (higher value means higher priority)type: integerjob:description: nix attribute from the nixexprpathtype: stringdrvpath:description: filename of the drvtype: stringsystem:description: system this build was done fortype: stringproject:description: project this build belongs totype: stringbuildproducts:type: objectadditionalProperties:$ref: '#/components/schemas/BuildProduct'buildoutputs:type: objectadditionalProperties:$ref: '#/components/schemas/BuildOutput'buildmetrics:description: |user defined build metrics from `$out/nix-support/hydra-metrics`. The file shoulddefine metrics separated by new lines using the following format:```<name> <value>[ <unit>]```The name and unit fields are strings, the value is a float. The unit is optional.type: objectproperties:name:type: stringdescription: name of the measured build metricvalue:type: stringdescription: measured valueunit:type: stringdescription: unit of the measured build metricexamples:projects-success:value:- enabled: 1name: example-hellohidden: 0description: helloowner: hydra-userjobsets:- hellodisplayname: example-hello- displayname: foojobsets:- foobarowner: hydra-username: fooenabled: 1description: foo projecthidden: 0project-success:value:name: fooenabled: 1hidden: 0description: foo projectdisplayname: fooowner: gilliganjobsets:- foobarjobset-success:value:nixexprpath: examples/hello.nixenabled: 1jobsetinputs:hydra:jobsetinputalts:- 'https://github.com/gilligan/hydra extend-readme'nixpkgs:jobsetinputalts:- 'https://github.com/nixos/nixpkgs-channels nixos-20.03'emailoverride: ''errormsg: ''nixexprinput: hydrafetcherrormsg: nullevals-success:value:last: '?page=1'evals:- builds:- 2jobsetevalinputs:hydra:revision: 84a3aecb1d976366060d0f0fd4df7d67b0855f5euri: 'https://github.com/gilligan/hydra'type: gitvalue: nulldependency: nullnixpkgs:dependency: nullvalue: nulluri: 'https://github.com/nixos/nixpkgs-channels'type: gitrevision: ab3adfe1c769c22b6629e59ea0ef88ec8ee4563fid: 2hasnewbuilds: 1first: '?page=1'build-success:value:buildproducts:'1':filesize: nulldefaultpath: ''name: hello-2.10type: nix-buildsha1hash: nullsha256hash: nullsubtype: ''path: /nix/store/y26qxcq1gg2hrqpxdc58b2fghv2bhxjg-hello-2.10id: 1buildstatus: 0nixname: hello-2.10finished: 1jobsetevals:- 1stoptime: 1588365711system: x86_64-linuxdrvpath: /nix/store/ab9zv2y5gm8hr6g318p0s6kaclwj4slr-hello-2.10.drvbuildoutputs:out:path: /nix/store/y26qxcq1gg2hrqpxdc58b2fghv2bhxjg-hello-2.10job: hellojobset: hellobuildmetrics: {}priority: 100project: example-hellostarttime: 1588365711timestamp: 1588365711