104 lines
1.8 KiB
YAML
104 lines
1.8 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
steps:
|
|
- name: print env
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
envs:
|
|
- drone_tag
|
|
- drone_commit
|
|
- drone_build_number
|
|
- drone_repo_name
|
|
- drone_repo_namespace
|
|
- ca_crt
|
|
host:
|
|
from_secret: ssh-host
|
|
key:
|
|
from_secret: ssh-key
|
|
port:
|
|
from_secret: ssh-port
|
|
script:
|
|
- "echo \"export CA_CRT='$${CA_CRT}'\" >> squid-env # \"ca-crt\""
|
|
username:
|
|
from_secret: ssh-user
|
|
environment:
|
|
CA_CRT:
|
|
from_secret: ca-crt
|
|
|
|
- name: scp
|
|
image: appleboy/drone-scp
|
|
settings:
|
|
command_timeout: 2m
|
|
host:
|
|
from_secret: ssh-host
|
|
key:
|
|
from_secret: ssh-key
|
|
port:
|
|
from_secret: ssh-port
|
|
source:
|
|
- .
|
|
target: /stack/squid
|
|
username:
|
|
from_secret: ssh-user
|
|
|
|
- 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
|
|
- local_docker_registry
|
|
- local_registry_password
|
|
host:
|
|
from_secret: ssh-host
|
|
key:
|
|
from_secret: ssh-key
|
|
port:
|
|
from_secret: ssh-port
|
|
script:
|
|
- set -e
|
|
- cd /stack/squid/myCA
|
|
- cd ..
|
|
- docker stack deploy -c docker-compose.yml squid
|
|
username:
|
|
from_secret: ssh-user
|
|
environment:
|
|
LOCAL_DOCKER_REGISTRY:
|
|
from_secret: local-docker-registry
|
|
LOCAL_REGISTRY_PASSWORD:
|
|
from_secret: local-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
|
|
|
|
...
|