.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9db1dbb349
commit
d50fea98e5
51
.drone.star
51
.drone.star
|
@ -11,6 +11,8 @@ load("@this//:build.star", "build")
|
|||
load("@this//:scp.star", "scp")
|
||||
load("@this//:public-secrets.star", "publicSecrets")
|
||||
load("@this//:secret-secrets.star", "secretSecrets")
|
||||
load("@this//:pull.star", "pull")
|
||||
load("@this//:deploy.star", "deploy")
|
||||
|
||||
def buildHome():
|
||||
return {
|
||||
|
@ -49,55 +51,6 @@ def buildNginx(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):
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
|
|
Reference in New Issue