.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
41e327d728
commit
b9586add33
54
.drone.star
54
.drone.star
|
@ -8,8 +8,10 @@ def environment(env):
|
||||||
)
|
)
|
||||||
def map(fn, l):
|
def map(fn, l):
|
||||||
return [fn(x) for x in l]
|
return [fn(x) for x in l]
|
||||||
def echo(x):
|
def echo(secret):
|
||||||
return "echo {secret}=${environment} >> env-stack".format(secret = x, environment = x.replace("-", "_").upper())
|
return "echo {secret}=${environment} >> env-stack".format(secret = secret, environment = secret.replace("-", "_").upper())
|
||||||
|
def export(secret):
|
||||||
|
return "echo {toCaps}=${toCaps} >> env-stack".format(toCaps = secret.replace("-", "_").upper())
|
||||||
def printSecrets(env):
|
def printSecrets(env):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -68,7 +70,7 @@ def buildHome():
|
||||||
"local-docker-registry",
|
"local-docker-registry",
|
||||||
]),
|
]),
|
||||||
"commands": [
|
"commands": [
|
||||||
"cd lestencrypt-nginx",
|
"cd letsencrypt-nginx",
|
||||||
"sh build.home.sh $${{LOCAL_DOCKER_REGISTRY}}",
|
"sh build.home.sh $${{LOCAL_DOCKER_REGISTRY}}",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,49 @@ def scp(target):
|
||||||
".",
|
".",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
def deploy():
|
||||||
|
secrets = [
|
||||||
|
"drone-rpc-secret",
|
||||||
|
"drone-gitea-client-id",
|
||||||
|
"drone-gitea-client-secret",
|
||||||
|
"drone-gitea-server",
|
||||||
|
"drone-convert-secret",
|
||||||
|
"ssh-user",
|
||||||
|
"local-docker-registry",
|
||||||
|
"certbot-email",
|
||||||
|
"git-domain",
|
||||||
|
"drone-domain",
|
||||||
|
"chat-domain",
|
||||||
|
"remote-domain",
|
||||||
|
"blog-domain",
|
||||||
|
]
|
||||||
|
return {
|
||||||
|
"name": "deploy",
|
||||||
|
"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}}letsencrypt-git",
|
||||||
|
"docker pull $${{LOCAL_DOCKER_REGISTRY}}nginx-home1",
|
||||||
|
"docker pull $${{LOCAL_DOCKER_REGISTRY}}letsencrypt-chat",
|
||||||
|
"docker pull $${{LOCAL_DOCKER_REGISTRY}}letsencrypt-remote",
|
||||||
|
"docker pull $${{LOCAL_DOCKER_REGISTRY}}letsencrypt-blog",
|
||||||
|
"docker pull $${{LOCAL_DOCKER_REGISTRY}}letsencrypt-drone",
|
||||||
|
"docker network prune -f",
|
||||||
|
"cd /home/$SSH_USER/gitea-drone-stack",
|
||||||
|
"docker stack rm gitea",
|
||||||
|
"sleep 60",
|
||||||
|
"docker stack deploy -c docker-compose-home.yml gitea",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
def steps(name, dependsOn):
|
def steps(name, dependsOn):
|
||||||
return {
|
return {
|
||||||
"kind": "pipeline",
|
"kind": "pipeline",
|
||||||
|
@ -147,6 +191,7 @@ def steps(name, dependsOn):
|
||||||
"echo hello 'star lark'",
|
"echo hello 'star lark'",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
deploy(),
|
||||||
],
|
],
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
|
@ -182,6 +227,5 @@ def steps(name, dependsOn):
|
||||||
def main(ctx):
|
def main(ctx):
|
||||||
return [
|
return [
|
||||||
steps('first', []),
|
steps('first', []),
|
||||||
steps('second', ['first']),
|
|
||||||
]
|
]
|
||||||
|
|
Reference in New Issue