buildbot: allow failure messages to be sent to an alternate address
authorBen Lippmeier <benl@ouroborus.net>
Sat, 13 Nov 2010 10:23:06 +0000 (10:23 +0000)
committerBen Lippmeier <benl@ouroborus.net>
Sat, 13 Nov 2010 10:23:06 +0000 (10:23 +0000)
dph-buildbot/src/Args.hs
dph-buildbot/src/Config.hs
dph-buildbot/src/Main.hs

index 1139e6b..a95f277 100644 (file)
@@ -31,6 +31,7 @@ data BuildArg
        | ArgTestIterations
        | ArgMailFrom 
        | ArgMailTo
+       | ArgMailFailTo
        | ArgMailBanner
        | ArgSendTestMail
        | ArgWriteResults
@@ -180,6 +181,12 @@ buildArgs
                , argData       = argDataOptional "address" ArgtypeString
                , argDesc       = "(opt. for test modes)  ... to this address." }                       
 
+       , Arg   { argIndex      = ArgMailFailTo
+               , argAbbr       = Nothing
+               , argName       = Just "mail-fail-to"
+               , argData       = argDataOptional "address" ArgtypeString
+               , argDesc       = "(opt. for test modes)  ... but send failure messages to this other address." }                       
+
        , Arg   { argIndex      = ArgMailBanner
                , argAbbr       = Nothing
                , argName       = Just "mail-banner"
index c93f773..7170d85 100644 (file)
@@ -46,6 +46,7 @@ data Config
        -- What do with the results.
        , configWriteResults    :: Maybe (FilePath, Bool)
        , configMailFromTo      :: Maybe (String, String)
+       , configMailFailTo      :: Maybe String
        , configMailBanner      :: Maybe String
        , configUploadResults   :: Maybe String }
        deriving Show
@@ -156,5 +157,6 @@ slurpConfig args
                                                = Nothing
                                                in      result
 
+               , configMailFailTo      = getArg args ArgMailFailTo
                , configMailBanner      = getArg args ArgMailBanner
                }
index a39da28..7ec34c1 100644 (file)
@@ -134,10 +134,13 @@ runTotalCatch config
                outLn $ render $ ppr err
                maybe   (return ())
                        (\(from, to) -> do
+                               -- target for fail messages can be overridden
+                               let failto      = fromMaybe to (configMailFailTo config)
+
                                outBlank
                                outLn $ "* Mailing result to " ++ to 
 
-                               mail    <- createMailWithCurrentTime from to "[nightly] DPH Performance Test FAILED :-("
+                               mail    <- createMailWithCurrentTime from failto "[nightly] DPH Performance Test FAILED :-("
                                        $ render $ vcat
                                        [ text "DPH Performance Build Failed :-("
                                        , blank