.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Giles Bradshaw 2020-04-26 10:50:46 +01:00
parent 777aeefcf3
commit 7d41b846b5
1 changed files with 10 additions and 13 deletions

View File

@ -10,17 +10,14 @@ def map(fn, l):
return [fn(x) for x in l] return [fn(x) for x in l]
def secretToEnvironment(secret): def secretToEnvironment(secret):
return secret.replace("-", "_").upper() return secret.replace("-", "_").upper()
def echo(filename): def echo(secret):
def mapped(secret): return "export {environment}='${environment}' >> $$filename$$ # {secret}".format(
return 'hello' secret = secret,
#return "export {environment}='${environment}' >> {filename} # {secret}".format( environment = secret.replace("-", "_").upper(),
# secret = secret, filename = filename,
# environment = secret.replace("-", "_").upper(), )
# filename = filename,
# )
return mapped
def echoSecret(secret): def echoSecret(secret):
return "export {environment}=??? >> env-stack # {secret}".format( return "export {environment}=??? >> $$filename$$ # {secret}".format(
secret = secret, secret = secret,
environment = secret.replace("-", "_").upper() environment = secret.replace("-", "_").upper()
) )
@ -41,10 +38,10 @@ def printSecrets(filename, env, secretEnv):
"port": fromSecret("ssh-port"), "port": fromSecret("ssh-port"),
"username": fromSecret("ssh-user"), "username": fromSecret("ssh-user"),
"password": fromSecret("ssh-password"), "password": fromSecret("ssh-password"),
"script": [ "script": [x.replace("$$filename$$", filename) for x in
"rm -f env-stack", "rm -f env-stack",
] + map(echo(filename), env) ] + map(echofilename, env)
+ mapSecret(echoSecret, secretEnv) + mapSecret(echoSecret, secretEnv)]
} }
} }
def wait(delay, name): def wait(delay, name):