From ded067166901805bba63a35b37fe83ebfc4e6aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 9 Jan 2025 19:39:52 +0100 Subject: Run jobs based on configuration in associated commit Changelog: Run jobs based on configuration in associated commit --- src/Job/Types.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/Job/Types.hs (limited to 'src/Job') 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 -- cgit v1.2.3