diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-07-19 15:06:42 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-07-24 21:17:52 +0200 |
| commit | 73a141316db78b942160b11bdb3c92208f3eddd6 (patch) | |
| tree | 1f35f0b939c8f467a45c6cbd62be771865ab838b /src/Job.hs | |
| parent | 0ddc5807cab7cf3b791b1de4cffe2b1165b2480d (diff) | |
Diffstat (limited to 'src/Job.hs')
| -rw-r--r-- | src/Job.hs | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -18,6 +18,9 @@ module Job ( copyRecursive, copyRecursiveForce, + + currentCommitExpr, + branchExpr, ) where import Control.Concurrent @@ -49,6 +52,7 @@ import System.Posix.Signals import System.Process import Destination +import Expr import Job.Types import Output import Repo @@ -477,6 +481,9 @@ runJob job uses checkoutPath jdir = do , aoutStorePath = target } + forM_ (jobPush job) $ \JobPush {..} -> do + pushToBranch jpushDestination jpushSource + forM_ (jobPublish job) $ \pub -> do Just aout <- return $ lookup (jpArtifact pub) $ map (\aout -> ( ( jobId job, aoutName aout ), aout )) artifacts ++ uses let ppath = case jpPath pub of @@ -489,3 +496,19 @@ runJob job uses checkoutPath jdir = do return JobOutput { outArtifacts = artifacts } + + + +currentCommitExpr :: RepoName -> Expr JobSetContext Commit +currentCommitExpr rname = + addDependency [ RepoDependency rname RepoDepCommit ] $ + (pure getCommit) <*> (lookup (Just rname) . jscRepoRefs <$> GetContext) + where + getCommit = \case + Nothing -> error $ "currentCommitExpr: repo ‘" <> showRepoName rname <> "’ not found" + Just (RepoRefTree _) -> error $ "currentCommitExpr: expected commit in ‘" <> showRepoName rname <> "’, but got a tree" + Just (RepoRefCommit commit) -> commit + Just (RepoRefTag commit _) -> commit + +branchExpr :: RepoName -> Text -> Expr JobSetContext Branch +branchExpr rname bname = pure ((\repo -> Branch repo bname) . fromJust) <*> (lookup (Just rname) . jscRepos <$> GetContext) |