Reworking runs to include an id, save the run request.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import docopt, os, sequtils, tempfile
|
||||
import docopt, os, sequtils, tempfile, uuids
|
||||
|
||||
import strawbosspkg/private/util
|
||||
import strawbosspkg/configuration
|
||||
@ -31,6 +31,9 @@ Options
|
||||
|
||||
-r --reference <ref> Build the project at this commit reference.
|
||||
|
||||
-i --run-id <id> Use the given UUID as the run ID. If not given, a
|
||||
new UUID is generated for this run.
|
||||
|
||||
-w --workspace <workspace> Use the given directory as the build workspace.
|
||||
|
||||
"""
|
||||
@ -51,14 +54,17 @@ Options
|
||||
|
||||
if args["run"]:
|
||||
|
||||
let req = RunRequest(
|
||||
projectName: $args["<project>"],
|
||||
stepName: $args["<step>"],
|
||||
buildRef: if args["--reference"]: $args["--reference"] else: nil,
|
||||
forceRebuild: args["--force-rebuild"],
|
||||
workspaceDir: if args["--workspace"]: $args["<workspace>"] else: mkdtemp())
|
||||
let wkspDir = if args["--workspace"]: $args["--workspace"] else: mkdtemp()
|
||||
|
||||
try:
|
||||
let req = RunRequest(
|
||||
id: if args["--run-id"]: parseUUID($args["--run-id"]) else: genUUID(),
|
||||
projectName: $args["<project>"],
|
||||
stepName: $args["<step>"],
|
||||
buildRef: if args["--reference"]: $args["--reference"] else: nil,
|
||||
forceRebuild: args["--force-rebuild"],
|
||||
workspaceDir: wkspDir)
|
||||
|
||||
let status = core.runStep(cfg, req, logProcOutput)
|
||||
if status.state == "failed": raiseEx status.details
|
||||
echo "strawboss: build passed."
|
||||
@ -66,7 +72,7 @@ Options
|
||||
echo "strawboss: build FAILED: " & getCurrentExceptionMsg() & "."
|
||||
quit(QuitFailure)
|
||||
finally:
|
||||
if existsDir(req.workspaceDir): removeDir(req.workspaceDir)
|
||||
if existsDir(wkspDir): removeDir(wkspDir)
|
||||
|
||||
elif args["serve"]: server.start(cfg)
|
||||
|
||||
|
Reference in New Issue
Block a user