WIP: Working on server.
This commit is contained in:
parent
ca029ab67d
commit
9f68963f18
8
api.rst
Normal file
8
api.rst
Normal file
@ -0,0 +1,8 @@
|
||||
GET /api/ping
|
||||
POST /api/auth-token
|
||||
GET /api/projects -- return project summaries
|
||||
POST /api/projects -- create a new project
|
||||
GET /api/project/<proj-id> -- return detailed project record (include steps)
|
||||
GET /api/project/<proj-id>/<step-id> -- return detailed step information (include runs)
|
||||
POST /api/project/<proj-id>/<step-id>/run/<ref> -- kick off a run
|
||||
GET /api/project/<proj-id>/<step-id>/run/<ref> -- return detailed run information
|
@ -1,4 +1,8 @@
|
||||
import docopt, json, logging, nre, os, osproc, sequtils, streams, strtabs, strutils, tables, tempfile
|
||||
import asyncdispatch, asyncnet, docopt, jester, json, logging, nre, os,
|
||||
osproc, sequtils, streams, strtabs, strutils, tables, tempfile
|
||||
|
||||
settings:
|
||||
port = Port(8180)
|
||||
|
||||
let SB_VER = "0.1.0"
|
||||
|
||||
@ -274,9 +278,18 @@ proc runStep(step: Step, wksp: Workspace): void =
|
||||
raiseEx "step " & step.name & " failed: unable to copy artifact " &
|
||||
artifactPath & ":\n" & getCurrentExceptionMsg()
|
||||
|
||||
# Server routes
|
||||
routes:
|
||||
get "/api/ping":
|
||||
resp $(%*"pong"), "application/json"
|
||||
|
||||
get "/api/projects":
|
||||
resp $(%*[]), "application/json"
|
||||
|
||||
when isMainModule:
|
||||
|
||||
logging.addHandler(newConsoleLogger())
|
||||
if logging.getHandlers().len == 0:
|
||||
logging.addHandler(newConsoleLogger())
|
||||
|
||||
let cfg = loadStrawBossConfig("strawboss.config.json")
|
||||
if not existsDir(cfg.artifactsRepo):
|
||||
@ -320,3 +333,5 @@ Usage:
|
||||
except:
|
||||
fatal "strawboss: " & getCurrentExceptionMsg()
|
||||
quit(QuitFailure)
|
||||
elif args["serve"]:
|
||||
runForever()
|
||||
|
@ -8,5 +8,5 @@ license = "MIT"
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires @["nim >= 0.16.1", "docopt >= 0.1.0", "tempfile"]
|
||||
requires @["nim >= 0.16.1", "docopt >= 0.1.0", "tempfile", "jester"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user