From abcb6bf31ff9c86c4c1f3edf0b184dae8159f812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 13 Dec 2025 21:39:15 +0100 Subject: Prepare used artifacts within the prepareJob function Changelog: Prepare used artifacts for the `shell` command --- src/Job.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Job.hs b/src/Job.hs index d0f0116..2de0bb6 100644 --- a/src/Job.hs +++ b/src/Job.hs @@ -388,6 +388,13 @@ prepareJob dir job inner = do subtree <- maybe return (getSubtree Nothing . makeRelative (treeSubdir tree)) mbsub $ tree checkoutAt subtree $ checkoutPath fromMaybe "" dest + liftIO $ forM_ (jobUses job) $ \( jid, aname ) -> do + modifyError (userError . T.unpack) $ do + wpath <- getArtifactWorkPath dir jid aname + let target = checkoutPath wpath + liftIO $ createDirectoryIfMissing True $ takeDirectory target + copyArtifact dir jid aname target + let jdir = dir jobStorageSubdir (jobId job) liftIO $ createDirectoryIfMissing True jdir inner checkoutPath @@ -420,11 +427,6 @@ copyArtifact storageDir jid aname tpath = do runJob :: Job -> [ ( ArtifactSpec Evaluated, ArtifactOutput) ] -> FilePath -> FilePath -> ExceptT (JobStatus JobOutput) IO JobOutput runJob job uses checkoutPath jdir = do - liftIO $ forM_ (filter ((`elem` jobUses job) . fst) uses) $ \( _, aout ) -> do - let target = checkoutPath aoutWorkPath aout - createDirectoryIfMissing True $ takeDirectory target - copyRecursive (aoutStorePath aout) target - bracket (liftIO $ openFile (jdir "log") WriteMode) (liftIO . hClose) $ \logs -> do forM_ (fromMaybe [] $ jobRecipe job) $ \ep -> do ( p, input ) <- case ep of -- cgit v1.2.3