Merge branch 'home-deploy' of https://sigyl.com/git/giles/portainer into home-deploy

This commit is contained in:
Giles Bradshaw 2020-07-28 17:20:40 +01:00
commit 190c393af5
1 changed files with 23 additions and 24 deletions

View File

@ -56,7 +56,7 @@ local util = {
'_', '_',
), ),
), ),
envSet(env): function(step) step { envSet(env): {
environment +: { environment +: {
[util.environment(env)]: util.fromSecret( [util.environment(env)]: util.fromSecret(
util.secret(env) util.secret(env)
@ -68,7 +68,7 @@ local util = {
], ],
}, },
}, },
printEnv(file, env): function(step) util.envSet(env)(step) { printEnv(file, env): function(step) step (util.envSet(env)) {
settings +: { settings +: {
script +: [ script +: [
'echo "export %(environment)s=\'$${%(environment)s}\'" >> %(file)s # "%(secret)s"' % { 'echo "export %(environment)s=\'$${%(environment)s}\'" >> %(file)s # "%(secret)s"' % {
@ -188,29 +188,28 @@ local images = {
publicSecrets, publicSecrets,
) )
)( )(
images.ssh images.ssh {
) name: 'deploy portainer',
{ settings +: {
name: 'deploy portainer', username: util.fromSecret("ssh-root-user"),
settings +: { password: util.fromSecret("ssh-root-password"),
username: util.fromSecret("ssh-root-user"), script +: [
password: util.fromSecret("ssh-root-password"), 'set -e',
script +: [ 'echo go',
'set -e', ] /*+
'echo go', map(export, secrets) +
] /*+ [
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),
"export DRONE_REPO_LINK=$${{DRONE_GITEA_SERVER}}/{namespace}/{name}".format(name=ctx.repo.name, namespace=ctx.repo.namespace), "docker network prune -f",
"export DRONE_COMMIT={commit}".format(commit=ctx.build.commit), "cd {folder}".format(folder=folder),
"docker network prune -f", "docker stack rm {name}".format(name = name),
"cd {folder}".format(folder=folder), "sleep 30",
"docker stack rm {name}".format(name = name), "docker stack deploy -c {filename} {name}".format(name= name, filename = filename),
"sleep 30", ] + commands */
"docker stack deploy -c {filename} {name}".format(name= name, filename = filename), }
] + commands */
} }
} )
], ],
} }
] ]