2020-07-30 14:32:27 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: build
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: scp
|
|
|
|
image: appleboy/drone-scp
|
|
|
|
settings:
|
|
|
|
command_timeout: 2m
|
2020-08-05 07:49:09 +00:00
|
|
|
host:
|
|
|
|
from_secret: ssh-host
|
|
|
|
key:
|
|
|
|
from_secret: ssh-key
|
|
|
|
port:
|
|
|
|
from_secret: ssh-port
|
2020-07-30 14:32:27 +00:00
|
|
|
source:
|
|
|
|
- .
|
|
|
|
target: /stack/squid
|
2020-08-05 07:49:09 +00:00
|
|
|
username:
|
|
|
|
from_secret: ssh-user
|
2020-07-30 14:32:27 +00:00
|
|
|
|
|
|
|
- name: wait
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- sleep 15
|
|
|
|
|
|
|
|
- name: deploy squid
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
envs:
|
|
|
|
- drone_tag
|
|
|
|
- drone_commit
|
|
|
|
- drone_build_number
|
|
|
|
- drone_repo_name
|
|
|
|
- drone_repo_namespace
|
|
|
|
- ssh_host
|
|
|
|
- ssh_user
|
|
|
|
- ssh_root_user
|
|
|
|
- ssh_password
|
2020-08-05 07:30:16 +00:00
|
|
|
- ssh_key
|
2020-08-05 07:49:09 +00:00
|
|
|
host:
|
|
|
|
from_secret: ssh-host
|
|
|
|
key:
|
|
|
|
from_secret: ssh-key
|
|
|
|
port:
|
|
|
|
from_secret: ssh-port
|
2020-07-30 14:32:27 +00:00
|
|
|
script:
|
|
|
|
- set -e
|
|
|
|
- docker network prune -f
|
2020-08-04 19:48:14 +00:00
|
|
|
- cd /stack/squid/myCA
|
|
|
|
- openssl genrsa -out CA_key.pem 2048
|
|
|
|
- openssl req -x509 -days 600 -new -nodes -key CA_key.pem -out CA_crt.pem -extensions v3_ca -config openssl.cnf -subj "/C=US/ST=California/L=Mountain View/O=Google/OU=Enterprise/CN=MyCA"
|
|
|
|
- cd ..
|
2020-07-30 14:32:27 +00:00
|
|
|
- docker stack rm squid
|
|
|
|
- sleep 30
|
|
|
|
- docker stack deploy -c docker-compose.yml squid
|
|
|
|
- export SSH_HOST="$${SSH_HOST}"
|
|
|
|
- echo "$${SSH_HOST}"
|
|
|
|
- export SSH_USER="$${SSH_USER}"
|
|
|
|
- echo "$${SSH_USER}"
|
|
|
|
- export SSH_ROOT_USER="$${SSH_ROOT_USER}"
|
|
|
|
- echo "$${SSH_ROOT_USER}"
|
|
|
|
- export SSH_PASSWORD="$${SSH_PASSWORD}"
|
|
|
|
- echo "$${SSH_PASSWORD}"
|
2020-08-05 07:30:16 +00:00
|
|
|
- export SSH_KEY="$${SSH_KEY}"
|
|
|
|
- echo "$${SSH_KEY}"
|
2020-08-05 07:49:09 +00:00
|
|
|
username:
|
|
|
|
from_secret: ssh-user
|
2020-07-30 14:32:27 +00:00
|
|
|
environment:
|
|
|
|
SSH_HOST:
|
|
|
|
from_secret: ssh-host
|
2020-08-05 07:30:16 +00:00
|
|
|
SSH_KEY:
|
|
|
|
from_secret: ssh-key
|
2020-07-30 14:32:27 +00:00
|
|
|
SSH_PASSWORD:
|
|
|
|
from_secret: ssh-password
|
|
|
|
SSH_ROOT_USER:
|
|
|
|
from_secret: ssh-root-user
|
|
|
|
SSH_USER:
|
|
|
|
from_secret: ssh-user
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
...
|