propellor spin

This commit is contained in:
Joey Hess 2014-04-01 18:06:02 -04:00
parent 0dc5c27180
commit 3ea5a38395
Failed to extract signature
2 changed files with 9 additions and 7 deletions

View File

@ -3,9 +3,10 @@ module Propellor.Property.SiteSpecific.GitAnnexBuilder where
import Propellor import Propellor
import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.User as User import qualified Propellor.Property.User as User
import qualified Propellor.Property.Cron as Cron
import Propellor.Property.Cron (CronTimes) import Propellor.Property.Cron (CronTimes)
type Arch = String import Data.Char
builduser :: UserName builduser :: UserName
builduser = "builder" builduser = "builder"
@ -13,21 +14,22 @@ builduser = "builder"
builddir :: FilePath builddir :: FilePath
builddir = "gitbuilder" builddir = "gitbuilder"
builder :: Arch -> CronTimes -> Property builder :: Architecture -> CronTimes -> Property
builder arch crontimes = combineProperties "gitannexbuilder" builder arch crontimes = combineProperties "gitannexbuilder"
[ Apt.stdSourcesList Unstable [ Apt.stdSourcesList Unstable
, Apt.buildDep ["git-annex"] , Apt.buildDep ["git-annex"]
, Apt.installed ["git", "rsync", "liblockfile-simple-perl", "cabal"] , Apt.installed ["git", "rsync", "moreutils",
"liblockfile-simple-perl", "cabal"]
, serviceRunning "cron" `requires` Apt.installed ["cron"] , serviceRunning "cron" `requires` Apt.installed ["cron"]
, User.accountFor builduser , User.accountFor builduser
, check (lacksdir builddir) $ userScriptProperty builduser , check (lacksdir builddir) $ userScriptProperty builduser
[ "git clone https://github.com/joeyh/gitbuilder/" [ "git clone https://github.com/joeyh/gitbuilder/"
, "cd gitbuilder" , "cd gitbuilder"
, "git checkout " ++ arch , "git checkout " ++ map toLower (show arch)
, "git clone https://git-annex.branchable.com/ git-annex" , "git clone https://git-annex.branchable.com/ build"
, "echo '"++crontimes++" cd gitbuilder/autobuild' | crontab -"
] ]
`describe` "gitbuilder setup" `describe` "gitbuilder setup"
, Cron.niceJob "gitannexbuilder" crontimes builduser "~/gitbuilder" "./autobuild"
, check (lacksdir $ builddir </> "git-annex") $ userScriptProperty builduser , check (lacksdir $ builddir </> "git-annex") $ userScriptProperty builduser
[ "cd gitbuilder" [ "cd gitbuilder"
, "git clone https://git-annex.branchable.com/ git-annex" , "git clone https://git-annex.branchable.com/ git-annex"

View File

@ -67,7 +67,7 @@ container _ "webserver" = Just $ Docker.containerFrom
] ]
container _ "git-annex-amd64-builder" = Just $ Docker.containerFrom container _ "git-annex-amd64-builder" = Just $ Docker.containerFrom
(image $ System (Debian Unstable) Amd64) (image $ System (Debian Unstable) Amd64)
[ Docker.inside [ GitAnnexBuilder.builder "amd64" "30 * * * *" ] ] [ Docker.inside [ GitAnnexBuilder.builder Amd64 "15 * * * *" ] ]
container _ _ = Nothing container _ _ = Nothing
-- | Docker images I prefer to use. -- | Docker images I prefer to use.