Include the version being built in BuildStatus objects.

This commit is contained in:
Jonathan Bernard 2017-12-02 19:08:29 -06:00
parent ce7d4b60de
commit 0574f0ec6a

View File

@ -79,7 +79,10 @@ proc publishStatus(wksp: Workspace, state: BuildState, details: string): void =
## Update the status for a Workspace and publish this status to the
## Workspace's status file and any output message handlers.
wksp.status = BuildStatus(
runId: $wksp.runRequest.runId, state: state, details: details)
runId: $wksp.runRequest.runId,
state: state,
details: details,
version: wksp.version)
# Write to our run directory, and to our version status
writeFile(wksp.buildDataDir / "runs" /
@ -426,7 +429,8 @@ proc run*(cfg: StrawBossConfig, req: RunRequest,
result = BuildStatus(
runId: $req.runId,
state: BuildState.setup,
details: "initializing build workspace")
details: "initializing build workspace",
version: "")
outputHandler.sendStatusMsg(result)
var wksp: Workspace
@ -476,7 +480,7 @@ proc run*(cfg: StrawBossConfig, req: RunRequest,
except:
when not defined(release): echo getCurrentException().getStackTrace()
result = BuildStatus(runId: $req.runId, state: BuildState.failed,
details: getCurrentExceptionMsg())
details: getCurrentExceptionMsg(), version: "")
try: outputHandler.sendStatusMsg(result)
except: discard ""
return
@ -514,7 +518,8 @@ proc run*(cfg: StrawBossConfig, req: RunRequest,
wksp.publishStatus(BuildState.failed, msg)
result = wksp.status
except:
result = BuildStatus(runId: $req.runId, state: BuildState.failed, details: msg)
result = BuildStatus(runId: $req.runId, state: BuildState.failed,
details: msg, version: "")
try: outputHandler.sendStatusMsg(result)
except: discard ""
@ -545,7 +550,8 @@ proc spawnWorker*(cfg: StrawBossConfig, req: RunRequest):
let queuedStatus = BuildStatus(
runId: $req.runId,
state: BuildState.queued,
details: "request queued for execution")
details: "request queued for execution",
version: "")
writeFile(statusFile, $queuedStatus)
var args = @["run", reqFile, "-c", cfg.filePath]
@ -562,6 +568,7 @@ proc spawnWorker*(cfg: StrawBossConfig, req: RunRequest):
let exMsg = "run request rejected: " & getCurrentExceptionMsg()
try:
writeFile(statusFile,
$(BuildStatus(runId: $req.runId, state: BuildState.rejected, details: exMsg)))
$(BuildStatus(runId: $req.runId, state: BuildState.rejected,
details: exMsg, version: "")))
except: discard ""
raiseEx exMsg