portainer/.drone/drone-home.yml

157 lines
4.0 KiB
YAML
Raw Normal View History

2020-08-19 23:17:19 +00:00
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- local_docker_registry
- registry_password
- local_docker_registry
- guacamole_postgres_db
- guacamole_postgres_user
- guacamole_postgres_password
- registry_password
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- rm -f env-guacamole
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-guacamole # \"local-docker-registry\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-guacamole # \"registry-password\""
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-guacamole # \"local-docker-registry\""
- "echo \"export GUACAMOLE_POSTGRES_DB='$${GUACAMOLE_POSTGRES_DB}'\" >> env-guacamole # \"guacamole-postgres-db\""
- "echo \"export GUACAMOLE_POSTGRES_USER='$${GUACAMOLE_POSTGRES_USER}'\" >> env-guacamole # \"guacamole-postgres-user\""
- "echo \"export GUACAMOLE_POSTGRES_PASSWORD='$${GUACAMOLE_POSTGRES_PASSWORD}'\" >> env-guacamole # \"guacamole-postgres-password\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-guacamole # \"registry-password\""
username:
from_secret: ssh-user
environment:
GUACAMOLE_POSTGRES_DB:
from_secret: guacamole-postgres-db
GUACAMOLE_POSTGRES_PASSWORD:
from_secret: guacamole-postgres-password
GUACAMOLE_POSTGRES_USER:
from_secret: guacamole-postgres-user
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
- name: scp
image: appleboy/drone-scp:1.6.2
settings:
command_timeout: 2m
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
source:
- .
target: /stack/guacamole
username:
from_secret: ssh-user
- name: wait
image: alpine
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:dind
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- local_docker_registry
- guacamole_postgres_db
- guacamole_postgres_user
- guacamole_postgres_password
- registry_password
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- export GUACAMOLE_POSTGRES_PASSWORD=$${GUACAMOLE_POSTGRES_PASSWORD}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- export LOCAL_DOCKER_REGISTRY=$${LOCAL_DOCKER_REGISTRY}
- export GUACAMOLE_POSTGRES_DB=$${GUACAMOLE_POSTGRES_DB}
- export GUACAMOLE_POSTGRES_USER=$${GUACAMOLE_POSTGRES_USER}
- set -e
- cd /stack/guacamole
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username:
from_secret: ssh-user
environment:
GUACAMOLE_POSTGRES_DB:
from_secret: guacamole-postgres-db
GUACAMOLE_POSTGRES_PASSWORD:
from_secret: guacamole-postgres-password
GUACAMOLE_POSTGRES_USER:
from_secret: guacamole-postgres-user
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
- name: ca
path: /etc/docker/certs.d
volumes:
- name: dockersock
temp: {}
- name: ca
host:
path: /etc/docker/certs.d
...