composed secret printing
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Giles Bradshaw 2020-07-28 17:09:34 +01:00
parent a49d20dc90
commit 5e803aa57e
1 changed files with 35 additions and 10 deletions

View File

@ -1,5 +1,9 @@
local secrets = [
'ssh-host'
local publicSecrets = [
'ssh-host',
'ssh-user',
];
local secretSecrets = [
'ssh-passwoprd',
];
local util = {
// the head of an array
@ -52,7 +56,7 @@ local util = {
'_',
),
),
printEnv(file, env): function(step) step {
envSet(env): function(step) step {
environment +: {
[util.environment(env)]: util.fromSecret(
util.secret(env)
@ -62,6 +66,10 @@ local util = {
envs +: [
util.env(env),
],
},
},
printEnv(file, env): function(step) envSet(env)(step) {
settings +: {
script +: [
'echo "export %(environment)s=\'$${%(environment)s}\'" >> %(file)s # "%(secret)s"' % {
environment: util.environment(env),
@ -153,12 +161,6 @@ local images = {
path: '/etc/docker/certs.d',
},
},
{
name: 'ssh',
host: {
path: '/home/giles/.ssh'
},
},
],
steps:[
images.scp(
@ -179,7 +181,30 @@ local images = {
],
},
},
)
),/*
images.ssh {
name: 'deploy portainer',
"environment": environment(secrets),
"settings": {
"envs": [x.replace("-", "_") for x in secrets ],
username: util.fromSecret("ssh-root-user"),
password: util.fromSecret("ssh-root-password"),
script: [
'set -e',
'echo go',
] +
map(export, secrets) +
[
"export DRONE_REPO_LINK=$${{DRONE_GITEA_SERVER}}/{namespace}/{name}".format(name=ctx.repo.name, namespace=ctx.repo.namespace),
"export DRONE_COMMIT={commit}".format(commit=ctx.build.commit),
"docker network prune -f",
"cd {folder}".format(folder=folder),
"docker stack rm {name}".format(name = name),
"sleep 30",
"docker stack deploy -c {filename} {name}".format(name= name, filename = filename),
] + commands
}
}*/
],
}
]