diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-09 19:39:52 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-10 20:17:54 +0100 |
commit | ded067166901805bba63a35b37fe83ebfc4e6aa8 (patch) | |
tree | 6ef85e05f4caa49662fabfa2a0b91cdf83e03fe6 /src/Job/Types.hs | |
parent | 03c781c1a60759622e772ac7fb6a167111ed0bea (diff) |
Run jobs based on configuration in associated commit
Changelog: Run jobs based on configuration in associated commit
Diffstat (limited to 'src/Job/Types.hs')
-rw-r--r-- | src/Job/Types.hs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Job/Types.hs b/src/Job/Types.hs new file mode 100644 index 0000000..6918738 --- /dev/null +++ b/src/Job/Types.hs @@ -0,0 +1,38 @@ +module Job.Types where + +import Data.Text (Text) +import Data.Text qualified as T + +import System.Process + +import Repo + + +data Job = Job + { jobName :: JobName + , jobRecipe :: [ CreateProcess ] + , jobArtifacts :: [ ( ArtifactName, CreateProcess ) ] + , jobUses :: [ ( JobName, ArtifactName ) ] + } + +data JobName = JobName Text + deriving (Eq, Ord, Show) + +stringJobName :: JobName -> String +stringJobName (JobName name) = T.unpack name + +textJobName :: JobName -> Text +textJobName (JobName name) = name + + +data ArtifactName = ArtifactName Text + deriving (Eq, Ord, Show) + + +data JobSet = JobSet + { jobsetCommit :: Commit + , jobsetJobsEither :: Either String [ Job ] + } + +jobsetJobs :: JobSet -> [ Job ] +jobsetJobs = either (const []) id . jobsetJobsEither |