GET /api/project/<project-name> endpoint.
This commit is contained in:
parent
f222d859e6
commit
7aa0a69215
@ -204,8 +204,7 @@ proc parseRunRequest*(reqJson: JsonNode): RunRequest =
|
|||||||
proc `%`*(s: BuildStatus): JsonNode =
|
proc `%`*(s: BuildStatus): JsonNode =
|
||||||
result = %* {
|
result = %* {
|
||||||
"state": s.state,
|
"state": s.state,
|
||||||
"details": s.details
|
"details": s.details }
|
||||||
}
|
|
||||||
|
|
||||||
proc `%`*(p: ProjectDef): JsonNode =
|
proc `%`*(p: ProjectDef): JsonNode =
|
||||||
result = %* {
|
result = %* {
|
||||||
@ -217,6 +216,26 @@ proc `%`*(p: ProjectDef): JsonNode =
|
|||||||
result["envVars"] = newJObject()
|
result["envVars"] = newJObject()
|
||||||
for k, v in p.envVars: result["envVars"][k] = %v
|
for k, v in p.envVars: result["envVars"][k] = %v
|
||||||
|
|
||||||
|
proc `%`*(s: Step): JsonNode =
|
||||||
|
result = %* {
|
||||||
|
"name": s.name,
|
||||||
|
"stepCmd": s.stepCmd,
|
||||||
|
"workingDir": s.workingDir,
|
||||||
|
"artifacts": s.artifacts,
|
||||||
|
"cmdInput": s.cmdInput,
|
||||||
|
"depends": s.depends,
|
||||||
|
"expectedEnv": s.expectedEnv,
|
||||||
|
"dontSkip": s.dontSkip }
|
||||||
|
|
||||||
|
proc `%`*(p: ProjectConfig): JsonNode =
|
||||||
|
result = %* {
|
||||||
|
"name": p.name,
|
||||||
|
"versionCmd": p.versionCmd }
|
||||||
|
|
||||||
|
result["steps"] = newJObject()
|
||||||
|
for name, step in p.steps:
|
||||||
|
result["steps"][name] = %step
|
||||||
|
|
||||||
proc `%`*(req: RunRequest): JsonNode =
|
proc `%`*(req: RunRequest): JsonNode =
|
||||||
result = %* {
|
result = %* {
|
||||||
"projectName": req.projectName,
|
"projectName": req.projectName,
|
||||||
|
@ -245,9 +245,9 @@ proc start*(cfg: StrawBossConfig): void =
|
|||||||
var respObj = newJObject()
|
var respObj = newJObject()
|
||||||
respObj["definition"] = %projDef
|
respObj["definition"] = %projDef
|
||||||
|
|
||||||
#if projConf.isSome():
|
if projConf.isSome():
|
||||||
# let pc: ProjectConfig = projConf.get()
|
let pc: ProjectConfig = projConf.get()
|
||||||
# respObj["configuration"] = %pc
|
respObj["configuration"] = %pc
|
||||||
|
|
||||||
resp($respObj, JSON)
|
resp($respObj, JSON)
|
||||||
|
|
||||||
|
@ -124,6 +124,19 @@ suite "load and save configuration objects":
|
|||||||
let cfgStr = $cfg
|
let cfgStr = $cfg
|
||||||
check cfg == parseStrawBossConfig(parseJson(cfgStr))
|
check cfg == parseStrawBossConfig(parseJson(cfgStr))
|
||||||
|
|
||||||
|
test "%step":
|
||||||
|
let step = Step(
|
||||||
|
name: "build", stepCmd: "true", workingDir: "dirA",
|
||||||
|
artifacts: @[], depends: @["compile"], cmdInput: @[],
|
||||||
|
expectedEnv: @["CWD", "TERM"], dontSkip: true)
|
||||||
|
|
||||||
|
let stepJS = %step
|
||||||
|
|
||||||
|
for k in @["name", "stepCmd", "workingDir", "artifacts", "cmdInput",
|
||||||
|
"depends", "expectedEnv", "dontSkip"]:
|
||||||
|
|
||||||
|
check stepJS.hasKey(k)
|
||||||
|
|
||||||
test "loadBuildStatus":
|
test "loadBuildStatus":
|
||||||
let st = loadBuildStatus("src/test/json/test-status.json")
|
let st = loadBuildStatus("src/test/json/test-status.json")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user