summaryrefslogtreecommitdiff
path: root/src/Job/Types.hs
blob: 6918738812a6bc81302570856b4d37955fe4f413 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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