mirror of
https://github.com/typeable/octopod.git
synced 2024-08-17 10:40:40 +03:00
Added the build git commit sha to ping endpoint (#110)
* Added the build git commit sha to ping endpoint * Fixed CI
This commit is contained in:
parent
071d58d0d2
commit
9440cb66a8
18
default.nix
18
default.nix
@ -32,7 +32,23 @@ let
|
|||||||
dontStrip = false;
|
dontStrip = false;
|
||||||
dontPatchELF = false;
|
dontPatchELF = false;
|
||||||
enableDeadCodeElimination = true;
|
enableDeadCodeElimination = true;
|
||||||
packages.octopod-backend = addLocalOptions { src = ./octopod-backend; };
|
packages.octopod-backend = addLocalOptions (
|
||||||
|
if prod
|
||||||
|
then {
|
||||||
|
src = pkgs.runCommand "octopod-backend-src" { }
|
||||||
|
''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r ${./octopod-backend}/* $out
|
||||||
|
cp -r ${builtins.path { path = ./.git; name = "dot-git"; }}/ $out/.git/
|
||||||
|
'';
|
||||||
|
components.exes.octopod-exe = {
|
||||||
|
build-tools =
|
||||||
|
pkgs.lib.mkForce [ pkgs.buildPackages.buildPackages.gitReallyMinimal ];
|
||||||
|
extraSrcFiles = [ ".git/**/*" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else { src = ./octopod-backend; }
|
||||||
|
);
|
||||||
packages.octo-cli = addLocalOptions { src = ./octo-cli; };
|
packages.octo-cli = addLocalOptions { src = ./octo-cli; };
|
||||||
packages.octopod-api = addLocalOptions { src = ./octopod-api; };
|
packages.octopod-api = addLocalOptions { src = ./octopod-api; };
|
||||||
packages.octopod-frontend = addLocalOptions { src = ./octopod-frontend; };
|
packages.octopod-frontend = addLocalOptions { src = ./octopod-frontend; };
|
||||||
|
@ -42,7 +42,7 @@ type DefaultApplicationOverrides =
|
|||||||
:> ReqBody '[JSON] (Config 'DeploymentLevel)
|
:> ReqBody '[JSON] (Config 'DeploymentLevel)
|
||||||
:> Post '[JSON] (DefaultConfig 'ApplicationLevel)
|
:> Post '[JSON] (DefaultConfig 'ApplicationLevel)
|
||||||
|
|
||||||
type PingEndpoint = "ping" :> GetNoContent
|
type PingEndpoint = "ping" :> Get '[PlainText] Text
|
||||||
type ProjectNameEndpoint =
|
type ProjectNameEndpoint =
|
||||||
"project_name" :> Get '[JSON] ProjectName
|
"project_name" :> Get '[JSON] ProjectName
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
|
import qualified Data.Text as T
|
||||||
|
import Development.GitRev
|
||||||
import Octopod.Server
|
import Octopod.Server
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = runOctopodServer
|
main = runOctopodServer (T.pack $gitHash)
|
||||||
|
@ -137,4 +137,6 @@ executable octopod-exe
|
|||||||
build-depends:
|
build-depends:
|
||||||
base >=4.7 && <5
|
base >=4.7 && <5
|
||||||
, octopod-backend
|
, octopod-backend
|
||||||
|
, gitrev
|
||||||
|
, text
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
@ -130,6 +130,7 @@ data AppState = AppState
|
|||||||
, depOverrideKeysCache :: CacheMap ServerError AppM' () [Text]
|
, depOverrideKeysCache :: CacheMap ServerError AppM' () [Text]
|
||||||
, appOverridesCache :: CacheMap ServerError AppM' (Config 'DeploymentLevel) (DefaultConfig 'ApplicationLevel)
|
, appOverridesCache :: CacheMap ServerError AppM' (Config 'DeploymentLevel) (DefaultConfig 'ApplicationLevel)
|
||||||
, appOverrideKeysCache :: CacheMap ServerError AppM' (Config 'DeploymentLevel) [Text]
|
, appOverrideKeysCache :: CacheMap ServerError AppM' (Config 'DeploymentLevel) [Text]
|
||||||
|
, gitSha :: Text
|
||||||
}
|
}
|
||||||
deriving stock (Generic)
|
deriving stock (Generic)
|
||||||
|
|
||||||
@ -154,8 +155,11 @@ data FullInfoListType
|
|||||||
| FullInfoOnlyForOne DeploymentName
|
| FullInfoOnlyForOne DeploymentName
|
||||||
deriving stock (Show)
|
deriving stock (Show)
|
||||||
|
|
||||||
runOctopodServer :: IO ()
|
runOctopodServer ::
|
||||||
runOctopodServer = do
|
-- | The git SHA
|
||||||
|
Text ->
|
||||||
|
IO ()
|
||||||
|
runOctopodServer sha = do
|
||||||
logger' <- newLogger
|
logger' <- newLogger
|
||||||
logInfo logger' "started"
|
logInfo logger' "started"
|
||||||
bgWorkersC <- newIORef 0
|
bgWorkersC <- newIORef 0
|
||||||
@ -257,6 +261,7 @@ runOctopodServer = do
|
|||||||
, depOverrideKeysCache = depOverrideKeysCache'
|
, depOverrideKeysCache = depOverrideKeysCache'
|
||||||
, appOverridesCache = appOverridesCache'
|
, appOverridesCache = appOverridesCache'
|
||||||
, appOverrideKeysCache = appOverrideKeysCache'
|
, appOverrideKeysCache = appOverrideKeysCache'
|
||||||
|
, gitSha = sha
|
||||||
}
|
}
|
||||||
|
|
||||||
app' = app appSt
|
app' = app appSt
|
||||||
@ -885,10 +890,10 @@ getInfo dName = do
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- | Handles the 'ping' request.
|
-- | Handles the 'ping' request.
|
||||||
pingH :: AppM NoContent
|
pingH :: AppM Text
|
||||||
pingH = do
|
pingH = do
|
||||||
_ <- runStatement $ select $ pure $ litExpr True
|
_ <- runStatement $ select $ pure $ litExpr True
|
||||||
pure NoContent
|
asks gitSha
|
||||||
|
|
||||||
-- | Handles the 'project_name' request.
|
-- | Handles the 'project_name' request.
|
||||||
projectNameH :: AppM ProjectName
|
projectNameH :: AppM ProjectName
|
||||||
|
@ -21,7 +21,6 @@ module Frontend.API
|
|||||||
fullInfoEndpoint,
|
fullInfoEndpoint,
|
||||||
statusEndpoint,
|
statusEndpoint,
|
||||||
restoreEndpoint,
|
restoreEndpoint,
|
||||||
pingEndpoint,
|
|
||||||
projectName,
|
projectName,
|
||||||
commandResponse,
|
commandResponse,
|
||||||
wsPath,
|
wsPath,
|
||||||
@ -127,10 +126,6 @@ restoreEndpoint ::
|
|||||||
Dynamic t (Either Text DeploymentName) ->
|
Dynamic t (Either Text DeploymentName) ->
|
||||||
Event t () ->
|
Event t () ->
|
||||||
m (Event t (ReqResult () CommandResponse))
|
m (Event t (ReqResult () CommandResponse))
|
||||||
pingEndpoint ::
|
|
||||||
MonadWidget t m =>
|
|
||||||
Event t () ->
|
|
||||||
m (Event t (ReqResult () NoContent))
|
|
||||||
projectName ::
|
projectName ::
|
||||||
MonadWidget t m =>
|
MonadWidget t m =>
|
||||||
Event t () ->
|
Event t () ->
|
||||||
@ -148,7 +143,7 @@ deploymentOverrideKeys
|
|||||||
:<|> statusEndpoint
|
:<|> statusEndpoint
|
||||||
:<|> restoreEndpoint
|
:<|> restoreEndpoint
|
||||||
)
|
)
|
||||||
:<|> pingEndpoint
|
:<|> _pingEndpoint
|
||||||
:<|> projectName = apiClients
|
:<|> projectName = apiClients
|
||||||
|
|
||||||
-- | Parser of kubectl command responses.
|
-- | Parser of kubectl command responses.
|
||||||
|
Loading…
Reference in New Issue
Block a user