Remove the concept of named, identifiable runs.
StarBoss is meant for building things checked into the repo It is also designed around repeatable builds. So it makes the assumption that running a build step for a specific version of a project will always result in the same output. So runs are identified by the project, build step, and version.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import cliutils, docopt, os, sequtils, tempfile, uuids
|
||||
import cliutils, docopt, os, sequtils, tempfile
|
||||
|
||||
import strawbosspkg/configuration
|
||||
import strawbosspkg/core
|
||||
@ -30,9 +30,6 @@ 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.
|
||||
|
||||
"""
|
||||
@ -57,7 +54,6 @@ Options
|
||||
|
||||
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,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import cliutils, logging, json, os, nre, sequtils, strtabs, tables, times, uuids
|
||||
import cliutils, logging, json, os, nre, sequtils, strtabs, tables, times
|
||||
|
||||
from langutils import sameContents
|
||||
from typeinfo import toAny
|
||||
@ -24,7 +24,6 @@ type
|
||||
envVars*: StringTableRef
|
||||
|
||||
RunRequest* = object
|
||||
id*: UUID
|
||||
projectName*, stepName*, buildRef*, workspaceDir*: string
|
||||
forceRebuild*: bool
|
||||
|
||||
@ -69,7 +68,6 @@ proc `==`*(a, b: StrawBossConfig): bool =
|
||||
|
||||
proc `==`*(a, b: RunRequest): bool =
|
||||
result =
|
||||
a.id == b.id and
|
||||
a.projectName == b.projectName and
|
||||
a.stepName == b.stepName and
|
||||
a.buildRef == b.buildRef and
|
||||
@ -197,7 +195,6 @@ proc loadBuildStatus*(statusFile: string): BuildStatus =
|
||||
|
||||
proc parseRunRequest*(reqJson: JsonNode): RunRequest =
|
||||
result = RunRequest(
|
||||
id: parseUUID(reqJson.getOrFail("id", "RunRequest").getStr),
|
||||
projectName: reqJson.getOrFail("projectName", "RunRequest").getStr,
|
||||
stepName: reqJson.getOrFail("stepName", "RunRequest").getStr,
|
||||
buildRef: reqJson.getOrFail("buildRef", "RunRequest").getStr,
|
||||
@ -223,7 +220,6 @@ proc `%`*(p: ProjectDef): JsonNode =
|
||||
|
||||
proc `%`*(req: RunRequest): JsonNode =
|
||||
result = %* {
|
||||
"id": $req.id,
|
||||
"projectName": req.projectName,
|
||||
"stepName": req.stepName,
|
||||
"buildRef": req.buildRef,
|
||||
|
@ -1,6 +1,8 @@
|
||||
import cliutils, logging, nre, os, osproc, sequtils, streams, strtabs, strutils, tables, uuids
|
||||
import cliutils, logging, json, os, osproc, sequtils, streams,
|
||||
strtabs, strutils, tables
|
||||
|
||||
import configuration
|
||||
import nre except toSeq
|
||||
import ./configuration
|
||||
from posix import link
|
||||
|
||||
type
|
||||
@ -185,10 +187,6 @@ proc initiateRun*(cfg: StrawBossConfig, req: RunRequest,
|
||||
if not existsDir(cfg.artifactsRepo & "/" & projectDef.name & "/run-requests"):
|
||||
createDir(cfg.artifactsRepo & "/" & projectDef.name & "/run-requests")
|
||||
|
||||
# Save the run request
|
||||
writeFile(cfg.artifactsRepo & "/" & projectDef.name &
|
||||
"/run-requests/" & $req.id & ".json", $req)
|
||||
|
||||
# Read in the existing system environment
|
||||
var env = loadEnv()
|
||||
env["GIT_DIR"] = ".git"
|
||||
|
@ -1,10 +1,9 @@
|
||||
import algorithm, asyncdispatch, bcrypt, cliutils, jester, json, jwt, logging,
|
||||
os, osproc, sequtils, strutils, tempfile, times, unittest, uuids
|
||||
os, osproc, sequtils, strutils, tempfile, times, unittest
|
||||
|
||||
import ./configuration, ./core
|
||||
|
||||
type Worker = object
|
||||
runId*: UUID
|
||||
process*: Process
|
||||
workingDir*: string
|
||||
|
||||
@ -77,11 +76,10 @@ proc spawnWorker(cfg: StrawBossConfig, req: RunRequest): Worker =
|
||||
|
||||
let dir = mkdtemp()
|
||||
var args = @["run", req.projectName, req.stepName, "-r", req.buildRef,
|
||||
"-w", dir, "-c", cfg.filePath, "-i", $req.id]
|
||||
"-w", dir, "-c", cfg.filePath]
|
||||
if req.forceRebuild: args.add("-f")
|
||||
debug "Launching worker: " & cfg.pathToExe & " " & args.join(" ")
|
||||
result = Worker(
|
||||
runId: req.id,
|
||||
process: startProcess(cfg.pathToExe, ".", args, loadEnv(), {poUsePath}),
|
||||
workingDir: dir)
|
||||
|
||||
@ -267,14 +265,6 @@ proc start*(cfg: StrawBossConfig): void =
|
||||
#resp($(%statuses), JSON)
|
||||
resp(Http501, makeJsonResp(Http501), JSON)
|
||||
|
||||
get "/project/@projectName/runs/@runId":
|
||||
## Details for a specific run
|
||||
|
||||
checkAuth(); if not authed: return true
|
||||
|
||||
# TODO
|
||||
resp(Http501, makeJsonResp(Http501), JSON)
|
||||
|
||||
get "/project/@projectName/step/@stepName":
|
||||
## Get step details including runs.
|
||||
|
||||
@ -297,7 +287,6 @@ proc start*(cfg: StrawBossConfig): void =
|
||||
checkAuth(); if not authed: return true
|
||||
|
||||
let runRequest = RunRequest(
|
||||
id: genUUID(),
|
||||
projectName: @"projectName",
|
||||
stepName: @"stepName",
|
||||
buildRef: if @"buildRef" != "": @"buildRef" else: nil,
|
||||
|
Reference in New Issue
Block a user