@@ -88,40 +88,32 @@ deployPush deployPath getNixBuilders = do
8888 route <- readDeployConfig deployPath $ "config" </> "common" </> "route"
8989 routeHost <- getHostFromRoute enableHttps route
9090 let srcPath = deployPath </> "src"
91− Right (ThunkData_Packed thunkPtr) <- readThunk srcPath
92− let version = show . _thunkRev_commit $ _thunkPtr_rev thunkPtr
93− build = do
94− builders <- getNixBuilders
95− buildOutput <- nixBuild $ def
96− { _nixBuildConfig_target = Target
97− { _target_path = srcPath
98− , _target_attr = Just "server.system"
99− }
100− , _nixBuildConfig_outLink = OutLink_None
101− , _nixBuildConfig_args =
102− [ strArg "hostName" host
103− , strArg "adminEmail" adminEmail
104− , strArg "routeHost" routeHost
105− , strArg "version" version
106− , boolArg "enableHttps" enableHttps
107− , rawArg "config" $ deployPath </> "config"
108− ]
109− , _nixBuildConfig_builders = builders
110− }
111− return $ listToMaybe $ lines buildOutput
112− result <- readThunk srcPath >>= \case
113− Right (ThunkData_Packed _) ->
114− build
91+ thunkPtr <- readThunk srcPath >>= \case
92+ Right (ThunkData_Packed ptr) -> return ptr
11593 Right (ThunkData_Checkout _) -> do
11694 checkGitCleanStatus srcPath True >>= \case
117− True -> do
118− result <- build
119− packThunk srcPath
120− return result
121− False -> do
122− _ <- failWith $ T.pack $ "ob deploy push: ensure " <> srcPath <> " has no pending changes and latest is pushed upstream."
123− return Nothing
124− _ -> return Nothing
95+ True -> packThunk srcPath
96+ False -> failWith $ T.pack $ "ob deploy push: ensure " <> srcPath <> " has no pending changes and latest is pushed upstream."
97+ Left err -> failWith $ "ob deploy push: couldn't read src thunk: " <> T.pack (show err)
98+ let version = show . _thunkRev_commit $ _thunkPtr_rev thunkPtr
99+ builders <- getNixBuilders
100+ buildOutput <- nixBuild $ def
101+ { _nixBuildConfig_target = Target
102+ { _target_path = srcPath
103+ , _target_attr = Just "server.system"
104+ }
105+ , _nixBuildConfig_outLink = OutLink_None
106+ , _nixBuildConfig_args =
107+ [ strArg "hostName" host
108+ , strArg "adminEmail" adminEmail
109+ , strArg "routeHost" routeHost
110+ , strArg "version" version
111+ , boolArg "enableHttps" enableHttps
112+ , rawArg "config" $ deployPath </> "config"
113+ ]
114+ , _nixBuildConfig_builders = builders
115+ }
116+ let result = listToMaybe $ lines buildOutput
125117 forM_ result $ \res -> do
126118 let knownHostsPath = deployPath </> "backend_known_hosts"
127119 sshOpts = sshArgs knownHostsPath (deployPath </> "ssh_key") False