git.iko.soy/typeable/octopod
on master help sign in
rename 'template' to 'tag'
commit2539dd8aeb4ead043a525a29715d337d4e7abb3e authorAndrei Orlov <aaorlov1@gmail.com> dateTue 11 Feb 2020, 21:13 (7 years ago) parent9485fe5
4 files changed+12−12
sqitch/deploy/deployments.sql+1−1 src/API/Lib.hs+1−1 src/DMC/Lib.hs+6−6 src/DMS/Lib.hs+4−4
sqitch/deploy/deployments.sql+1−1
@@ -5,7 +5,7 @@ BEGIN;
55CREATE TABLE deployments (
66 id BIGSERIAL PRIMARY KEY,
77 name TEXT NOT NULL,
8− template TEXT NOT NULL,
8+ tag TEXT NOT NULL,
99 envs TEXT NOT NULL,
1010 created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
1111 updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
src/API/Lib.hs+1−1
@@ -13,7 +13,7 @@ import Options.Generic
1313import Servant.API
1414
1515data Deployment
16− = Deployment { name :: Text, template :: Text, envs :: [Text] }
16+ = Deployment { name :: Text, tag :: Text, envs :: [Text] }
1717 deriving (Generic, Show)
1818
1919instance ToJSON Deployment
src/DMC/Lib.hs+6−6
@@ -25,11 +25,11 @@ import System.Process.Typed
2525import API.Lib (Deployment(Deployment), DeploymentAPI)
2626
2727data Args
28− = Create { name :: Text, template :: Text, envs :: [Text] }
28+ = Create { name :: Text, tag :: Text, envs :: [Text] }
2929 | List
3030 | Edit { name :: Text }
3131 | Destroy { name :: Text }
32− | Update { name :: Text, template :: Text }
32+ | Update { name :: Text, tag :: Text }
3333 deriving (Generic, Show)
3434
3535instance ParseRecord Args where
@@ -61,8 +61,8 @@ getBaseUrl = do
6161 p = read . tail . uriPort $ uriData
6262 return $ BaseUrl s h p ""
6363
64−handleCommand clientEnv Create {name, template, envs}
65− = handleResponse =<< runClientM (create $ Deployment name template envs) clientEnv
64+handleCommand clientEnv Create {name, tag, envs}
65+ = handleResponse =<< runClientM (create $ Deployment name tag envs) clientEnv
6666
6767handleCommand clientEnv List = (\l -> handleResponse $ unlines <$> l) =<< runClientM list clientEnv
6868
@@ -88,8 +88,8 @@ handleCommand clientEnv Edit {name} = do
8888
8989handleCommand clientEnv Destroy {name} = handleResponse =<< runClientM (destroy name) clientEnv
9090
91−handleCommand clientEnv Update {name, template}
92− = handleResponse =<< runClientM (update name $ Deployment name template envs) clientEnv
91+handleCommand clientEnv Update {name, tag}
92+ = handleResponse =<< runClientM (update name $ Deployment name tag envs) clientEnv
9393 where envs = ["UNUSED_KEY=UNUSED_VALUE"]
9494
9595deploymentAPI :: Proxy DeploymentAPI
src/DMS/Lib.hs+4−4
@@ -80,7 +80,7 @@ create p d = do
8080 createDeployment :: Deployment -> Handler Int64
8181 createDeployment (Deployment n t e) = liftIO $
8282 withResource p $ \conn ->
83− execute conn "INSERT INTO deployments (name, template, envs) VALUES (?, ?, ?)" (n, t, unlines e)
83+ execute conn "INSERT INTO deployments (name, tag, envs) VALUES (?, ?, ?)" (n, t, unlines e)
8484
8585 executeHelmCommand :: Deployment -> String -> Handler ()
8686 executeHelmCommand d helm = liftIO . withProcessWait_ (proc helm $ args d) $ \pr -> do
@@ -98,7 +98,7 @@ get p n = do
9898 where
9999 getDeployment :: Handler [Deployment]
100100 getDeployment = fmap (fmap (\(n, t, e) -> Deployment n t $ lines e)) . liftIO $
101− withResource p $ \conn -> query conn "SELECT name, template, envs FROM deployments WHERE name = ?" (Only n)
101+ withResource p $ \conn -> query conn "SELECT name, tag, envs FROM deployments WHERE name = ?" (Only n)
102102
103103edit :: PgPool -> Text -> Deployment -> Handler Text
104104edit p n (Deployment _ _ e) = do
@@ -139,11 +139,11 @@ destroy p n = do
139139update :: PgPool -> Text -> Deployment -> Handler Text
140140update p n (Deployment _ t _) = do
141141 updateDeployment
142− liftIO . putStrLn $ "deployment updated, name: " ++ unpack n ++ ", template: " ++ unpack t
142+ liftIO . putStrLn $ "deployment updated, name: " ++ unpack n ++ ", tag: " ++ unpack t
143143 return ""
144144
145145 where
146146 updateDeployment :: Handler Int64
147147 updateDeployment = liftIO $
148148 withResource p $ \conn ->
149− execute conn "UPDATE deployments SET template = ?, updated_at = now() WHERE name = ?" (t, n)
149+ execute conn "UPDATE deployments SET tag = ?, updated_at = now() WHERE name = ?" (t, n)