summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Eval.hs2
-rw-r--r--src/Job.hs3
-rw-r--r--src/Job/Types.hs4
-rw-r--r--test/asset/run/many_repos.yaml8
-rw-r--r--test/script/run.et27
5 files changed, 31 insertions, 13 deletions
diff --git a/src/Eval.hs b/src/Eval.hs
index 7a5bad3..d260d91 100644
--- a/src/Eval.hs
+++ b/src/Eval.hs
@@ -69,7 +69,7 @@ collectOtherRepos dset decl = do
let gatherDependencies seen (d : ds)
| d `elem` seen = gatherDependencies seen ds
| Just job <- find ((d ==) . jobName) jobs
- = gatherDependencies (d : seen) (map fst (jobUses job) ++ ds)
+ = gatherDependencies (d : seen) (map fst (jobRequiredArtifacts job) ++ ds)
| otherwise = gatherDependencies (d : seen) ds
gatherDependencies seen [] = seen
diff --git a/src/Job.hs b/src/Job.hs
index 5a28a50..116a090 100644
--- a/src/Job.hs
+++ b/src/Job.hs
@@ -23,7 +23,6 @@ import Control.Monad.Catch
import Control.Monad.Except
import Control.Monad.IO.Class
-import Data.Containers.ListUtils
import Data.List
import Data.Map (Map)
import Data.Map qualified as M
@@ -304,7 +303,7 @@ waitForUsedArtifacts
-> m [ ( ArtifactSpec, ArtifactOutput ) ]
waitForUsedArtifacts tout job results outVar = do
origState <- liftIO $ atomically $ readTVar outVar
- let ( selfSpecs, artSpecs ) = partition ((jobName job ==) . fst) $ nubOrd $ jobUses job ++ (map jpArtifact $ jobPublish job)
+ let ( selfSpecs, artSpecs ) = partition ((jobName job ==) . fst) $ jobRequiredArtifacts job
forM_ selfSpecs $ \( _, artName@(ArtifactName tname) ) -> do
when (not (artName `elem` map fst (jobArtifacts job))) $ do
diff --git a/src/Job/Types.hs b/src/Job/Types.hs
index 8d02057..5d3f0f3 100644
--- a/src/Job/Types.hs
+++ b/src/Job/Types.hs
@@ -1,5 +1,6 @@
module Job.Types where
+import Data.Containers.ListUtils
import Data.Kind
import Data.Text (Text)
import Data.Text qualified as T
@@ -41,6 +42,9 @@ stringJobName (JobName name) = T.unpack name
textJobName :: JobName -> Text
textJobName (JobName name) = name
+jobRequiredArtifacts :: Job' d -> [ ArtifactSpec ]
+jobRequiredArtifacts job = nubOrd $ jobUses job ++ (map jpArtifact $ jobPublish job)
+
type family JobRepo d :: Type where
JobRepo Declared = Maybe ( RepoName, Maybe Text )
diff --git a/test/asset/run/many_repos.yaml b/test/asset/run/many_repos.yaml
index 0839ba6..9ab87a4 100644
--- a/test/asset/run/many_repos.yaml
+++ b/test/asset/run/many_repos.yaml
@@ -4,6 +4,8 @@ repo r3:
repo r4:
repo r5:
+destination d1:
+
job first:
checkout:
- repo: r1
@@ -77,6 +79,12 @@ job dependent:
path: some_other_file
+job dependent_publish:
+ publish:
+ - to: d1
+ artifact: first.out
+
+
job transitive:
uses:
- dependent.out
diff --git a/test/script/run.et b/test/script/run.et
index 99cce0b..95dc2ac 100644
--- a/test/script/run.et
+++ b/test/script/run.et
@@ -484,45 +484,52 @@ test RunWithManyRepos:
expect /([0-9a-f]+)/ from git_init capture r5t
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "first" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "first" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect /(.*)/ from p capture done
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "$mc.first.$r1c.$r2t.$r3c.$r4t" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "$mc.first.$r1c.$r2t.$r3c.$r4t" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect /(.*)/ from p capture done
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "first_manual_revision" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "first_manual_revision" ]
expect_success from p of "$mt.first_manual_revision.$r1t.$r2t.$r4t"
expect /(.*)/ from p capture done
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "$mc.first_manual_revision.$r1c.$r2t.$r4t" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "$mc.first_manual_revision.$r1c.$r2t.$r4t" ]
expect_success from p of "$mt.first_manual_revision.$r1t.$r2t.$r4t"
expect /(.*)/ from p capture done
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "dependent" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "dependent" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.dependent.$r1t.$r2t.$r3t.$r4t"
expect /(.*)/ from p capture done
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "$mc.dependent.$r1c.$r2t.$r3c.$r4t" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "$mc.dependent.$r1c.$r2t.$r3c.$r4t" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.dependent.$r1t.$r2t.$r3t.$r4t"
expect /(.*)/ from p capture done
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "transitive" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "dependent_publish" ]
+ expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
+ expect_success from p of "$mt.dependent_publish.$r1t.$r2t.$r3t.$r4t"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "transitive" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.dependent.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.transitive.$r1t.$r2t.$r3t.$r4t"
@@ -530,7 +537,7 @@ test RunWithManyRepos:
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "$mc.transitive.$r1c.$r2t.$r3c.$r4t" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "$mc.transitive.$r1c.$r2t.$r3c.$r4t" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.dependent.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.transitive.$r1t.$r2t.$r3t.$r4t"
@@ -538,7 +545,7 @@ test RunWithManyRepos:
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "combined" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "combined" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.second.$r2t.$r3t.$r5t"
expect_success from p of "$mt.combined.$r1t.$r2t.$r3t.$r4t.$r5t"
@@ -546,7 +553,7 @@ test RunWithManyRepos:
guard (done == "run-finish")
local:
- spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "./main", "run", "--rerun-all", "combined_transitive" ]
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r3:./dir_r3", "--repo=r4:./dir_r4", "--repo=r2:./dir_r2", "--repo=r5:./dir_r5", "--destination=d1:./dest1", "./main", "run", "--rerun-all", "combined_transitive" ]
expect_success from p of "$mt.first.$r1t.$r2t.$r3t.$r4t"
expect_success from p of "$mt.second.$r2t.$r3t.$r5t"
expect_success from p of "$mt.dependent.$r1t.$r2t.$r3t.$r4t"