diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-15 15:29:01 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-16 20:48:12 +0100 |
commit | 52dca5dc0e60d4d84aa5ecf280a45b24f1111dda (patch) | |
tree | eb1e010819ff3a241f9c53db07bb10b1f5a9ccf3 /src/Job.hs | |
parent | 3bb1c548e2696abd3f7dc2d7b9fbc27ceb490c36 (diff) |
Checkout referenced repos when preparing job
Diffstat (limited to 'src/Job.hs')
-rw-r--r-- | src/Job.hs | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -286,12 +286,23 @@ prepareJob dir mbCommit job inner = do jdirCommit <- case mbCommit of Just commit -> do tree <- getCommitTree commit - checkoutAt tree checkoutPath + forM_ (jobContainingCheckout job) $ \(JobCheckout mbsub dest) -> do + subtree <- maybe return (getSubtree mbCommit) mbsub $ tree + checkoutAt subtree $ checkoutPath </> fromMaybe "" dest return $ showTreeId (treeId tree) </> stringJobName (jobName job) Nothing -> do + when (not $ null $ jobContainingCheckout job) $ do + fail $ "no containing repository, can't do checkout" return $ stringJobName (jobName job) - let jdir = dir </> "jobs" </> jdirCommit + jdirOther <- forM (jobOtherCheckout job) $ \( EvaluatedJobRepo repo, revision, JobCheckout mbsub dest ) -> do + commit <- readCommit repo $ fromMaybe "HEAD" revision + tree <- getCommitTree commit + subtree <- maybe return (getSubtree (Just commit)) mbsub $ tree + checkoutAt subtree $ checkoutPath </> fromMaybe "" dest + return $ showTreeId (treeId tree) + + let jdir = dir </> "jobs" </> jdirCommit </> joinPath jdirOther liftIO $ createDirectoryIfMissing True jdir inner checkoutPath jdir |