From 0574f0ec6aba84f506b2020a1c6d27d134b38887 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sat, 2 Dec 2017 19:08:29 -0600 Subject: [PATCH] Include the version being built in BuildStatus objects. --- src/main/nim/strawbosspkg/core.nim | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/nim/strawbosspkg/core.nim b/src/main/nim/strawbosspkg/core.nim index cd35e6a..e124ab3 100644 --- a/src/main/nim/strawbosspkg/core.nim +++ b/src/main/nim/strawbosspkg/core.nim @@ -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