From d6ff11543a3897dd2b38ed121f958ef0050e272c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 13 Nov 2025 22:59:11 +0100 Subject: Support publishing artifacts in the same job they're created --- src/Job.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Job.hs') diff --git a/src/Job.hs b/src/Job.hs index 41b3abc..b40273f 100644 --- a/src/Job.hs +++ b/src/Job.hs @@ -296,7 +296,12 @@ waitForUsedArtifacts -> m [ ( ArtifactSpec, ArtifactOutput ) ] waitForUsedArtifacts tout job results outVar = do origState <- liftIO $ atomically $ readTVar outVar - let artSpecs = nubOrd $ jobUses job ++ (map jpArtifact $ jobPublish job) + let ( selfSpecs, artSpecs ) = partition ((jobName job ==) . fst) $ nubOrd $ jobUses job ++ (map jpArtifact $ jobPublish job) + + forM_ selfSpecs $ \( _, artName@(ArtifactName tname) ) -> do + when (not (artName `elem` map fst (jobArtifacts job))) $ do + throwError . JobError =<< liftIO (outputFootnote tout $ "Artifact ‘" <> tname <> "’ not produced by the job") + ujobs <- forM artSpecs $ \(ujobName@(JobName tjobName), uartName) -> do case find (\( j, _, _ ) -> jobName j == ujobName) results of Just ( _, _, var ) -> return ( var, ( ujobName, uartName )) @@ -413,7 +418,7 @@ runJob job uses checkoutPath jdir = do } forM_ (jobPublish job) $ \pub -> do - Just aout <- return $ lookup (jpArtifact pub) uses + Just aout <- return $ lookup (jpArtifact pub) $ map (\aout -> ( ( jobName job, aoutName aout ), aout )) artifacts ++ uses let ppath = case jpPath pub of Just path | hasTrailingPathSeparator path -> path takeFileName (aoutWorkPath aout) -- cgit v1.2.3