summaryrefslogtreecommitdiff
path: root/server/Worker.hs
diff options
context:
space:
mode:
Diffstat (limited to 'server/Worker.hs')
-rw-r--r--server/Worker.hs26
1 files changed, 21 insertions, 5 deletions
diff --git a/server/Worker.hs b/server/Worker.hs
index af07904..b3ce1da 100644
--- a/server/Worker.hs
+++ b/server/Worker.hs
@@ -20,12 +20,13 @@ import qualified Data.UUID.V4 as UUID
import Server (Config, JobStatus (..),
Org (..),
RemoteRef (reporef, repourl),
- ServerState, setJobStatus,
- tmpdir)
+ ServerState, adjustedPath,
+ setJobStatus, tmpdir)
import System.Directory (doesDirectoryExist)
+import System.Exit (ExitCode (ExitFailure))
import System.FilePath ((</>))
import System.Process
-
+import WriteRepo (writeAdjustedRepository)
data Job = Job
{ jobRef :: RemoteRef
@@ -67,9 +68,24 @@ runJob config Job {..} done = do
callgit gitdir [ "worktree", "add", "--force", workdir, toString ref ]
res <- recursiveCheckDir (orgLintconfig jobOrg) workdir (orgEntrypoint jobOrg)
- >>= evaluateNF . shrinkDirResult
+ >>= evaluateNF
+
+ writeAdjustedRepository (orgLintconfig jobOrg) workdir (toString $ adjustedPath rev jobOrg) res
+ >>= \case ExitFailure 1 ->
+ -- error's in the result anyways
+ pure ()
+ ExitFailure 2 ->
+ -- TODO: use a fastlogger for this or sth
+ -- TODO: shouldn't have linted this map at all
+ putTextLn "ERROR: outpath already exists"
+ ExitFailure n -> do -- impossible
+ print n
+ pure ()
+ _ -> pure () -- all good
+
+ putTextLn "still here!"
setJobStatus done jobOrg jobRef $
- Linted res rev
+ Linted (shrinkDirResult res) rev
cleanup workdir = do
callgit gitdir [ "worktree", "remove", "-f", "-f", workdir ]