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

This commit is contained in:
Giles Bradshaw 2020-04-27 22:06:32 +01:00
parent c24b7f8967
commit bab9236a00
2 changed files with 37 additions and 1 deletions

View File

@ -12,7 +12,7 @@ load("@this//:scp.star", "scp")
load("@this//:public-secrets.star", "publicSecrets") load("@this//:public-secrets.star", "publicSecrets")
load("@this//:secret-secrets.star", "secretSecrets") load("@this//:secret-secrets.star", "secretSecrets")
load("@this//:pull.star", "pull") load("@this//:pull.star", "pull")
load("@this//:deploy.star", "deploy") load("@this//:deploy-2.star", "deploy")
load("@this//:build-folder.star", "buildFolder") load("@this//:build-folder.star", "buildFolder")
load("@this//:build-docker-folder.star", "buildDockerFolder") load("@this//:build-docker-folder.star", "buildDockerFolder")
load("@this//:pipeline.star", "pipeline") load("@this//:pipeline.star", "pipeline")
@ -56,6 +56,7 @@ def main(ctx):
]), ]),
deploy( deploy(
"docker-compose-remote.yml", "docker-compose-remote.yml",
"remote-drone",
"/home/giles/gitea-drone-stack", "/home/giles/gitea-drone-stack",
), ),
], ],

View File

@ -0,0 +1,35 @@
load("@this//:from-secret.star", "fromSecret")
load("@this//:map.star", "map")
load("@this//:environment.star", "environment")
load("@this//:export.star", "export")
load("@this//:public-secrets.star", "publicSecrets")
load("@this//:secret-secrets.star", "secretSecrets")
def deploy(
filename,
name,
folder,
):
return {
"name": "deploy",
"image": "appleboy/drone-ssh",
"environment": environment(publicSecrets + secretSecrets),
"settings": {
"envs": [x.replace("-", "_") for x in publicSecrets + secretSecrets ],
"host": fromSecret("ssh-host"),
"port": fromSecret("ssh-port"),
"username": fromSecret("ssh-root-user"),
"password": fromSecret("ssh-root-password"),
"script": [
"set -e"
] +
map(export, publicSecrets + secretSecrets) +
[
"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),
]
}
}