propellor spin
This commit is contained in:
parent
c62c606c0e
commit
d8a241322e
|
@ -9,8 +9,14 @@ import Propellor.Property.Cron (CronTimes)
|
||||||
builduser :: UserName
|
builduser :: UserName
|
||||||
builduser = "builder"
|
builduser = "builder"
|
||||||
|
|
||||||
|
homedir :: FilePath
|
||||||
|
homedir = "/home/builder"
|
||||||
|
|
||||||
|
gitbuilderdir :: FilePath
|
||||||
|
gitbuilderdir = homedir </> "gitbuilder"
|
||||||
|
|
||||||
builddir :: FilePath
|
builddir :: FilePath
|
||||||
builddir = "gitbuilder"
|
builddir = gitbuilderdir </> "build"
|
||||||
|
|
||||||
builder :: Architecture -> CronTimes -> Bool -> Property
|
builder :: Architecture -> CronTimes -> Bool -> Property
|
||||||
builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
|
builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
|
||||||
|
@ -20,26 +26,22 @@ builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
|
||||||
"liblockfile-simple-perl", "cabal-install", "vim", "less"]
|
"liblockfile-simple-perl", "cabal-install", "vim", "less"]
|
||||||
, serviceRunning "cron" `requires` Apt.installed ["cron"]
|
, serviceRunning "cron" `requires` Apt.installed ["cron"]
|
||||||
, User.accountFor builduser
|
, User.accountFor builduser
|
||||||
, check (lacksdir builddir) $ userScriptProperty builduser
|
, check (not <$> doesDirectoryExist gitbuilderdir) $ userScriptProperty builduser
|
||||||
[ "git clone git://git.kitenet.net/gitannexbuilder " ++ builddir
|
[ "git clone git://git.kitenet.net/gitannexbuilder " ++ gitbuilderdir
|
||||||
, "cd " ++ builddir
|
, "cd " ++ gitbuilderdir
|
||||||
, "git checkout " ++ arch
|
, "git checkout " ++ arch
|
||||||
]
|
]
|
||||||
`describe` "gitbuilder setup"
|
`describe` "gitbuilder setup"
|
||||||
, check (lacksdir $ builddir </> "build") $ userScriptProperty builduser
|
, check (not <$> doesDirectoryExist builddir) $ userScriptProperty builduser
|
||||||
[ "cd " ++ builddir
|
[ "git clone git://git-annex.branchable.com/ " ++ builddir
|
||||||
, "git clone git://git-annex.branchable.com/ build"
|
|
||||||
]
|
]
|
||||||
, Property "git-annex source build deps installed" $ do
|
, "git-annex source build deps installed" ==> Apt.buildDepIn builddir
|
||||||
d <- homedir
|
, Cron.niceJob "gitannexbuilder" crontimes builduser gitbuilderdir "git pull ; ./autobuild"
|
||||||
ensureProperty $ Apt.buildDepIn (d </> builddir </> "build")
|
|
||||||
, Cron.niceJob "gitannexbuilder" crontimes builduser ("~/" ++ builddir) "git pull ; ./autobuild"
|
|
||||||
-- The builduser account does not have a password set,
|
-- The builduser account does not have a password set,
|
||||||
-- instead use the password privdata to hold the rsync server
|
-- instead use the password privdata to hold the rsync server
|
||||||
-- password used to upload the built image.
|
-- password used to upload the built image.
|
||||||
, Property "rsync password" $ do
|
, Property "rsync password" $ do
|
||||||
d <- homedir
|
let f = homedir </> "rsyncpassword"
|
||||||
let f = d </> "rsyncpassword"
|
|
||||||
if rsyncupload
|
if rsyncupload
|
||||||
then withPrivData (Password builduser) $ \p -> do
|
then withPrivData (Password builduser) $ \p -> do
|
||||||
oldp <- catchDefaultIO "" $ readFileStrict f
|
oldp <- catchDefaultIO "" $ readFileStrict f
|
||||||
|
@ -52,8 +54,3 @@ builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
|
||||||
, makeChange $ writeFile f "no password configured"
|
, makeChange $ writeFile f "no password configured"
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
where
|
|
||||||
homedir = fromMaybe ("/home/" ++ builduser) <$> User.homedir builduser
|
|
||||||
lacksdir d = do
|
|
||||||
h <- homedir
|
|
||||||
not <$> doesDirectoryExist (h </> d)
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ host hostname@"orca.kitenet.net" = standardSystem Unstable $ props
|
||||||
& Apt.buildDep ["git-annex"]
|
& Apt.buildDep ["git-annex"]
|
||||||
& Docker.docked container hostname "amd64-git-annex-builder"
|
& Docker.docked container hostname "amd64-git-annex-builder"
|
||||||
& Docker.docked container hostname "i386-git-annex-builder"
|
& Docker.docked container hostname "i386-git-annex-builder"
|
||||||
-- ! Docker.docked container hostname "armel-git-annex-builder"
|
& Docker.docked container hostname "armel-git-annex-builder-companion"
|
||||||
|
& Docker.docked container hostname "armel-git-annex-builder"
|
||||||
& Docker.garbageCollected
|
& Docker.garbageCollected
|
||||||
-- My laptop
|
-- My laptop
|
||||||
host _hostname@"darkstar.kitenet.net" = Just $ props
|
host _hostname@"darkstar.kitenet.net" = Just $ props
|
||||||
|
@ -67,11 +68,29 @@ container _host name
|
||||||
& serviceRunning "apache2"
|
& serviceRunning "apache2"
|
||||||
`requires` Apt.installed ["apache2"]
|
`requires` Apt.installed ["apache2"]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
-- armel builder has a companion container that run amd64 and
|
||||||
|
-- runs the build first to get TH splices. They share a home
|
||||||
|
-- directory, and need to have the same versions of all haskell
|
||||||
|
-- libraries installed.
|
||||||
|
| name == "armel-git-annex-builder-companion" = Just $ Docker.containerFrom
|
||||||
|
(image $ System (Debian Unstable) "amd64")
|
||||||
|
[ Docker.volume GitAnnexBuilder.homedir
|
||||||
|
]
|
||||||
|
| name == "armel-git-annex-builder" = Just $ Docker.containerFrom
|
||||||
|
(image $ System (Debian Unstable) "armel")
|
||||||
|
[ Docker.link (name ++ "-companion") "companion"
|
||||||
|
, Docker.volumes_from (name ++ "-companion")
|
||||||
|
, Docker.inside $ props
|
||||||
|
-- & GitAnnexBuilder.builder "armel" "15 * * * *" True
|
||||||
|
]
|
||||||
|
|
||||||
| "-git-annex-builder" `isSuffixOf` name =
|
| "-git-annex-builder" `isSuffixOf` name =
|
||||||
let arch = takeWhile (/= '-') name
|
let arch = takeWhile (/= '-') name
|
||||||
in Just $ Docker.containerFrom
|
in Just $ Docker.containerFrom
|
||||||
(image $ System (Debian Unstable) arch)
|
(image $ System (Debian Unstable) arch)
|
||||||
[ Docker.inside $ props & GitAnnexBuilder.builder arch "15 * * * *" True ]
|
[ Docker.inside $ props & GitAnnexBuilder.builder arch "15 * * * *" True ]
|
||||||
|
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
|
||||||
-- | Docker images I prefer to use.
|
-- | Docker images I prefer to use.
|
||||||
|
|
Loading…
Reference in New Issue