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

This commit is contained in:
Giles Bradshaw 2020-04-26 09:54:48 +01:00
parent c0f1cb7a44
commit c0f500b362
1 changed files with 34 additions and 12 deletions

View File

@ -10,18 +10,25 @@ 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(secret): def echo(filename):
return [ def mapped(secret):
"echo {secret}=${environment} >> env-stack".format( return "export {environment}='${environment}' >> {filename} # {secret}".format(
secret = secret,
environment = secret.replace("-", "_").upper(),
filename = filename,
)
return mapped
def echoSecret(secret):
return "export {environment}=??? >> env-stack # {secret}".format(
secret = secret, secret = secret,
environment = secret.replace("-", "_").upper() environment = secret.replace("-", "_").upper()
) )
]
def export(secret): def export(secret):
return "export {toCaps}=${toCaps}".format( return "export {toCaps}=${toCaps}".format(
toCaps = secretToEnvironment(secret), toCaps = secretToEnvironment(secret),
) )
def printSecrets(env): def printSecrets(filename, env, secretEnv):
return { return {
"name": "print secrets", "name": "print secrets",
@ -35,7 +42,8 @@ def printSecrets(env):
"password": fromSecret("ssh-password"), "password": fromSecret("ssh-password"),
"script": [ "script": [
"rm -f env-stack", "rm -f env-stack",
] + map(echo, env) ] + map(echo(filename), env)
+ mapSecret(echoSecret, secretEnv)
} }
} }
def wait(delay, name): def wait(delay, name):
@ -176,12 +184,26 @@ def steps(name, dependsOn):
"name": name, "name": name,
"depends_on": dependsOn, "depends_on": dependsOn,
"steps": [ "steps": [
printSecrets([ printSecrets(
"env-stack",
[
"blog-domain"
"certbot-email",
"chat-domain",
"drone-domain",
"drone-gitea-client-id",
"drone-gitea-server",
"git-domain",
"local-docker-registry", "local-docker-registry",
"ssh-host", "remote-domain",
"ssh-user", "ssh-user",
"ssh-port", ],
]), [
"drone-convert-secret",
"drone-gitea-client-secret",
"drone-rpc-secret",
],
),
wait(15, "wait"), wait(15, "wait"),
build("guacamole-postgresql"), build("guacamole-postgresql"),
build("ngrok-gitea"), build("ngrok-gitea"),