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

This commit is contained in:
Giles Bradshaw 2020-04-26 18:10:20 +01:00
parent 9db1dbb349
commit d50fea98e5
1 changed files with 2 additions and 49 deletions

View File

@ -11,6 +11,8 @@ load("@this//:build.star", "build")
load("@this//:scp.star", "scp") 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//:deploy.star", "deploy")
def buildHome(): def buildHome():
return { return {
@ -49,55 +51,6 @@ def buildNginx(name):
"sh build.sh {name} $${{LOCAL_DOCKER_REGISTRY}}".format(name = name), "sh build.sh {name} $${{LOCAL_DOCKER_REGISTRY}}".format(name = name),
], ],
} }
def pull(
images,
):
secrets = [ "local-docker-registry"]
return {
"name": "pull",
"image": "appleboy/drone-ssh",
"environment": environment(secrets),
"settings": {
"envs": [x.replace("-", "_") for x in secrets ],
"host": fromSecret("ssh-host"),
"port": fromSecret("ssh-port"),
"username": fromSecret("ssh-root-user"),
"password": fromSecret("ssh-root-password"),
"script": [
"set -e"
] +
map(export, secrets) +
["docker pull $${{LOCAL_DOCKER_REGISTRY}}{image}".format(image=image) for image in images ]
}
}
def deploy(
filename,
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 gitea",
"sleep 30",
"docker stack deploy -c {filename} gitea".format(filename = filename),
]
}
}
def pipeline(name, steps, dependsOn): def pipeline(name, steps, dependsOn):
return { return {
"kind": "pipeline", "kind": "pipeline",