From aecba79be823cdcf5d48042f84adfe46c209f109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 13 Dec 2025 15:40:07 +0100 Subject: Full Job ID in evaluated artifac spec --- src/Eval.hs | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/Eval.hs') diff --git a/src/Eval.hs b/src/Eval.hs index 6680c44..1b7c3e2 100644 --- a/src/Eval.hs +++ b/src/Eval.hs @@ -144,6 +144,12 @@ evalJobs (current : evaluating) evaluated repos dset reqs = do let otherRepoTrees = catMaybes otherRepoTreesMb if all isJust otherRepoTreesMb then do + let otherRepoIds = flip mapMaybe otherRepoTrees $ \case + ( repo, ( subtree, tree )) -> do + guard $ maybe True (isNothing . snd) repo -- use only checkouts without explicit revision in job id + Just $ JobIdTree (fst <$> repo) subtree (treeId tree) + let currentJobId = JobId $ reverse $ reverse otherRepoIds ++ JobIdName (jobId current) : eiCurrentIdRev + checkouts <- forM (jobCheckout current) $ \dcheckout -> do return dcheckout { jcRepo = @@ -154,22 +160,32 @@ evalJobs (current : evaluating) evaluated repos dset reqs = do ] } + uses <- forM (jobUses current) $ \( jname, aname ) -> do + Just (Right job) <- return $ find ((jname ==) . either id jobName) evaluated + return ( jobId job, aname ) + destinations <- forM (jobPublish current) $ \dpublish -> do + let ( jname, _ ) = jpArtifact dpublish + jid <- if + | jname == jobName current -> return currentJobId + | otherwise -> do + Just (Right job) <- return $ find ((jname ==) . either id jobName) evaluated + return $ jobId job + case lookup (jpDestination dpublish) eiDestinations of - Just dest -> return $ dpublish { jpDestination = dest } + Just dest -> return dpublish + { jpArtifact = ( jid, snd (jpArtifact dpublish) ) + , jpDestination = dest + } Nothing -> throwError $ OtherEvalError $ "no url defined for destination ‘" <> textDestinationName (jpDestination dpublish) <> "’" - let otherRepoIds = flip mapMaybe otherRepoTrees $ \case - ( repo, ( subtree, tree )) -> do - guard $ maybe True (isNothing . snd) repo -- use only checkouts without explicit revision in job id - Just $ JobIdTree (fst <$> repo) subtree (treeId tree) let job = Job - { jobId = JobId $ reverse $ reverse otherRepoIds ++ JobIdName (jobId current) : eiCurrentIdRev + { jobId = currentJobId , jobName = jobName current , jobCheckout = checkouts , jobRecipe = jobRecipe current , jobArtifacts = jobArtifacts current - , jobUses = jobUses current + , jobUses = uses , jobPublish = destinations } evalJobs evaluating (Right job : evaluated) repos dset reqs -- cgit v1.2.3