refined calling control scripts (#116)

* Show errors from stdout to user in config check command

* Renamed control script arguments

* renamed variables
This commit is contained in:
iko 2021-09-29 14:49:21 +03:00 committed by GitHub
parent bdcae3555b
commit a2c8ab0915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -97,9 +97,9 @@ in
failScript = pkgs.writeScript "fail.sh" ''
#!${pkgs.bash}/bin/bash
1>&2 echo "You did something wrong :("
echo "You did something wrong :("
echo "You did something wrong, but you shouldn't see this."
1>&2 echo "You did something wrong, but you shouldn't see this."
exit 1
'';
@ -144,9 +144,9 @@ in
export CONFIG_CHECKING_COMMAND=${echoScript}
export INFO_COMMAND=${infoScript}
export NOTIFICATION_COMMAND=${writeScript}
export DEPLOYMENT_OVERRIDES_COMMAND=${infoScript}
export DEPLOYMENT_CONFIG_COMMAND=${infoScript}
export DEPLOYMENT_KEYS_COMMAND=${infoScript}
export APPLICATION_OVERRIDES_COMMAND=${infoScript}
export APPLICATION_CONFIG_COMMAND=${infoScript}
export APPLICATION_KEYS_COMMAND=${infoScript}
export UNARCHIVE_COMMAND=${writeScript}
export POWER_AUTHORIZATION_HEADER="123"

View File

@ -187,9 +187,9 @@ runOctopodServer sha = do
archiveCheckingCmd <- Command . pack <$> getEnvOrDie "ARCHIVE_CHECKING_COMMAND"
tagCheckingCmd <- Command . pack <$> getEnvOrDie "CONFIG_CHECKING_COMMAND"
infoCmd <- Command . pack <$> getEnvOrDie "INFO_COMMAND"
dOverridesCmd <- Command . pack <$> getEnvOrDie "DEPLOYMENT_OVERRIDES_COMMAND"
dOverridesCmd <- Command . pack <$> getEnvOrDie "DEPLOYMENT_CONFIG_COMMAND"
dKeysCmd <- Command . pack <$> getEnvOrDie "DEPLOYMENT_KEYS_COMMAND"
aOverridesCmd <- Command . pack <$> getEnvOrDie "APPLICATION_OVERRIDES_COMMAND"
aOverridesCmd <- Command . pack <$> getEnvOrDie "APPLICATION_CONFIG_COMMAND"
aKeysCmd <- Command . pack <$> getEnvOrDie "APPLICATION_KEYS_COMMAND"
unarchiveCmd <- Command . pack <$> getEnvOrDie "UNARCHIVE_COMMAND"
powerAuthorizationHeader <- AuthHeader . BSC.pack <$> getEnvOrDie "POWER_AUTHORIZATION_HEADER"
@ -1109,11 +1109,11 @@ upsertDeploymentMetadatum dName dMetadata =
failIfImageNotFound :: Deployment -> AppM ()
failIfImageNotFound dep = do
cfg <- getDeploymentConfig dep
(ec, _, Stderr err, _) <- runCommandArgs configCheckingCommand =<< configCheckCommandArgs cfg dep
(ec, Stdout out, _, _) <- runCommandArgs configCheckingCommand =<< configCheckCommandArgs cfg dep
case ec of
ExitSuccess -> pure ()
ExitFailure _ ->
throwError err400 {errBody = BSL.fromStrict $ T.encodeUtf8 err}
throwError err400 {errBody = BSL.fromStrict $ T.encodeUtf8 out}
-- | Helper to create an application-level error.
appError :: Text -> BSL.ByteString

View File

@ -255,5 +255,5 @@ overridesArgs (Config cc) =
$ cc
where
argumentName = case knownOverrideLevel @l of
ApplicationLevel -> "--app-env-override"
DeploymentLevel -> "--deployment-override"
ApplicationLevel -> "--application-config"
DeploymentLevel -> "--deployment-config"