Add GIT_DIR to the ENV to make sure git commands find the repo.
This commit is contained in:
parent
a2350ef7fd
commit
ca029ab67d
@ -155,13 +155,17 @@ proc loadProjectConfig(cfgFile: string): ProjectCfg =
|
||||
proc setupProjectForWork(projectDef: ProjectDef, buildRef, artifactsRepo: string): Workspace =
|
||||
|
||||
info "Setting up to do work for '" & projectDef.name & "' at ref " & buildRef & "."
|
||||
var env = ENV
|
||||
env["GIT_DIR"] = ".git"
|
||||
|
||||
# Create a temp directory that we'll work in
|
||||
let projDir = mkdtemp()
|
||||
debug "Workspace for '" & projectDef.name & ": " & projDir
|
||||
assert projDir.isAbsolute
|
||||
|
||||
# Clone the project into the $temp/repo directory
|
||||
let cloneResult = exec("git", projDir, ["clone", projectDef.repo, "repo"],
|
||||
ENV, {poUsePath}, logProcOutput)
|
||||
env, {poUsePath}, logProcOutput)
|
||||
|
||||
if cloneResult.exitCode != 0:
|
||||
removeDir(projDir)
|
||||
@ -169,7 +173,7 @@ proc setupProjectForWork(projectDef: ProjectDef, buildRef, artifactsRepo: string
|
||||
|
||||
# Checkout the requested ref
|
||||
let checkoutResult = exec("git", projDir & "/repo", ["checkout", buildRef],
|
||||
ENV, {poUsePath}, logProcOutput)
|
||||
env, {poUsePath}, logProcOutput)
|
||||
|
||||
if checkoutResult.exitCode != 0:
|
||||
removeDir(projDir)
|
||||
@ -183,7 +187,7 @@ proc setupProjectForWork(projectDef: ProjectDef, buildRef, artifactsRepo: string
|
||||
"repo (expected at '" & projectDef.cfgFilePath & "')."
|
||||
|
||||
let projectCfg = loadProjectConfig(projCfgFile)
|
||||
result = Workspace(env: ENV, workingDir: projDir, project: projectCfg,
|
||||
result = Workspace(env: env, workingDir: projDir, project: projectCfg,
|
||||
artifactsRepo: artifactsRepo)
|
||||
|
||||
# Merge in the project-defined env vars
|
||||
@ -207,8 +211,6 @@ proc setupProjectForWork(projectDef: ProjectDef, buildRef, artifactsRepo: string
|
||||
debug "Building version " & versionResult.output.strip
|
||||
result.env["VERSION"] = versionResult.output.strip
|
||||
|
||||
debug "Workspace for '" & projectCfg.name & ": " & projDir
|
||||
|
||||
## TODO
|
||||
proc runStep(step: Step, wksp: Workspace): void =
|
||||
|
||||
@ -277,12 +279,12 @@ when isMainModule:
|
||||
logging.addHandler(newConsoleLogger())
|
||||
|
||||
let cfg = loadStrawBossConfig("strawboss.config.json")
|
||||
if not existsDir(cfg.artifactsRepo):
|
||||
info "Artifacts repo (" & cfg.artifactsRepo & ") does not exist. Creating..."
|
||||
createDir(cfg.artifactsRepo)
|
||||
|
||||
let artifactsRepo = expandFilename(cfg.artifactsRepo)
|
||||
|
||||
if not existsDir(artifactsRepo):
|
||||
info "Artifacts repo (" & artifactsRepo & ") does not exist. Creating..."
|
||||
createDir(artifactsRepo)
|
||||
|
||||
let doc = """
|
||||
Usage:
|
||||
strawboss serve
|
||||
|
Loading…
x
Reference in New Issue
Block a user