git - drone - ghost - guacamole - rocket chat https://sigyl.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

39 lines
1.2 KiB

  1. load("@this//:from-secret.star", "fromSecret")
  2. load("@this//:map.star", "map")
  3. load("@this//:environment.star", "environment")
  4. load("@this//:export.star", "export")
  5. def deploy(
  6. filename,
  7. name,
  8. folder,
  9. secrets,
  10. commands,
  11. ctx
  12. ):
  13. return {
  14. "name": "deploy {name}".format(name = name),
  15. "image": "appleboy/drone-ssh",
  16. "environment": environment(secrets),
  17. "settings": {
  18. "envs": [x.replace("-", "_") for x in secrets ],
  19. "host": fromSecret("ssh-host"),
  20. "port": fromSecret("ssh-port"),
  21. "username": fromSecret("ssh-root-user"),
  22. "password": fromSecret("ssh-root-password"),
  23. "script": [
  24. "set -e"
  25. ] +
  26. map(export, secrets) +
  27. [
  28. "export DRONE_REPO_LINK=$${{DRONE_GITEA_SERVER}}/{namespace}/{name}".format(name=ctx.repo.name, namespace=ctx.repo.namespace),
  29. "export DRONE_COMMIT={commit}".format(commit=ctx.build.commit),
  30. "docker network prune -f",
  31. "cd {folder}".format(folder=folder),
  32. "docker stack rm {name}".format(name = name),
  33. "sleep 30",
  34. "docker stack deploy -c {filename} {name}".format(name= name, filename = filename),
  35. ] + commands
  36. }
  37. }