|
|
@@ -1,3 +1,20 @@ |
|
|
|
--- |
|
|
|
kind: pipeline |
|
|
|
type: docker |
|
|
|
name: register |
|
|
|
|
|
|
|
platform: |
|
|
|
os: linux |
|
|
|
arch: amd64 |
|
|
|
|
|
|
|
clone: |
|
|
|
disable: true |
|
|
|
|
|
|
|
trigger: |
|
|
|
event: |
|
|
|
exclude: |
|
|
|
- promote |
|
|
|
|
|
|
|
--- |
|
|
|
kind: pipeline |
|
|
|
type: docker |
|
|
@@ -9,7 +26,7 @@ platform: |
|
|
|
|
|
|
|
steps: |
|
|
|
- name: print env |
|
|
|
image: appleboy/drone-ssh:1.6.2 |
|
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea |
|
|
|
settings: |
|
|
|
envs: |
|
|
|
- drone_tag |
|
|
@@ -17,94 +34,59 @@ steps: |
|
|
|
- drone_build_number |
|
|
|
- drone_repo_name |
|
|
|
- drone_repo_namespace |
|
|
|
- local_docker_registry |
|
|
|
- registry_password |
|
|
|
- ssh_host |
|
|
|
- ssh_user |
|
|
|
- ssh_port |
|
|
|
- local_docker_registry |
|
|
|
- ca_crt |
|
|
|
- ssh_key |
|
|
|
- registry_password |
|
|
|
- local_domain |
|
|
|
- ca_key |
|
|
|
host: |
|
|
|
from_secret: ssh-host |
|
|
|
key: |
|
|
|
from_secret: ssh-key |
|
|
|
port: |
|
|
|
from_secret: ssh-port |
|
|
|
host: ${SSH_HOST} |
|
|
|
key: ${SSH_KEY} |
|
|
|
passphrase: ${SSH_PASSPHRASE} |
|
|
|
port: ${SSH_PORT} |
|
|
|
script: |
|
|
|
- rm -f env-squid |
|
|
|
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-squid # \"local-docker-registry\"" |
|
|
|
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-squid # \"registry-password\"" |
|
|
|
- "echo \"export SSH_HOST='$${SSH_HOST}'\" >> env-squid # \"ssh-host\"" |
|
|
|
- "echo \"export SSH_USER='$${SSH_USER}'\" >> env-squid # \"ssh-user\"" |
|
|
|
- "echo \"export SSH_PORT='$${SSH_PORT}'\" >> env-squid # \"ssh-port\"" |
|
|
|
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-squid # \"local-docker-registry\"" |
|
|
|
- "echo \"export CA_CRT='$${CA_CRT}'\" >> env-squid # \"ca-crt\"" |
|
|
|
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-squid # \"ssh-key\"" |
|
|
|
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-squid # \"registry-password\"" |
|
|
|
- "echo \"export LOCAL_DOMAIN='$${LOCAL_DOMAIN}'\" >> env-squid # \"local-domain\"" |
|
|
|
- "echo \"export CA_KEY='$${CA_KEY}'\" >> env-squid # \"ca-key\"" |
|
|
|
username: |
|
|
|
from_secret: ssh-user |
|
|
|
username: ${SSH_USER} |
|
|
|
environment: |
|
|
|
CA_CRT: |
|
|
|
from_secret: ca-crt |
|
|
|
CA_KEY: |
|
|
|
from_secret: ca-key |
|
|
|
LOCAL_DOCKER_REGISTRY: |
|
|
|
from_secret: local-docker-registry |
|
|
|
REGISTRY_PASSWORD: |
|
|
|
from_secret: registry-password |
|
|
|
SSH_HOST: |
|
|
|
from_secret: ssh-host |
|
|
|
SSH_KEY: |
|
|
|
from_secret: ssh-key |
|
|
|
SSH_PORT: |
|
|
|
from_secret: ssh-port |
|
|
|
SSH_USER: |
|
|
|
from_secret: ssh-user |
|
|
|
LOCAL_DOMAIN: |
|
|
|
from_secret: local-domain |
|
|
|
|
|
|
|
- name: scp |
|
|
|
image: appleboy/drone-scp:1.6.2 |
|
|
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 |
|
|
|
settings: |
|
|
|
command_timeout: 2m |
|
|
|
host: |
|
|
|
from_secret: ssh-host |
|
|
|
key: |
|
|
|
from_secret: ssh-key |
|
|
|
port: |
|
|
|
from_secret: ssh-port |
|
|
|
host: ${SSH_HOST} |
|
|
|
key: ${SSH_KEY} |
|
|
|
passphrase: ${SSH_PASSPHRASE} |
|
|
|
port: ${SSH_PORT} |
|
|
|
source: |
|
|
|
- . |
|
|
|
target: /stack/squid |
|
|
|
username: |
|
|
|
from_secret: ssh-user |
|
|
|
username: ${SSH_USER} |
|
|
|
|
|
|
|
- name: wait |
|
|
|
image: alpine |
|
|
|
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1 |
|
|
|
commands: |
|
|
|
- sleep 15 |
|
|
|
|
|
|
|
- name: "dockerbuild:" |
|
|
|
image: docker:dind |
|
|
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f |
|
|
|
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 |
|
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea |
|
|
|
settings: |
|
|
|
envs: |
|
|
|
- drone_tag |
|
|
@@ -112,57 +94,42 @@ steps: |
|
|
|
- drone_build_number |
|
|
|
- drone_repo_name |
|
|
|
- drone_repo_namespace |
|
|
|
- ssh_host |
|
|
|
- ssh_user |
|
|
|
- ssh_port |
|
|
|
- local_docker_registry |
|
|
|
- ca_crt |
|
|
|
- ssh_key |
|
|
|
- domain |
|
|
|
- registry_domain |
|
|
|
- registry_port |
|
|
|
- registry_password |
|
|
|
- ca_crt |
|
|
|
- local_domain |
|
|
|
- ca_key |
|
|
|
host: |
|
|
|
from_secret: ssh-host |
|
|
|
key: |
|
|
|
from_secret: ssh-key |
|
|
|
port: |
|
|
|
from_secret: ssh-port |
|
|
|
host: ${SSH_HOST} |
|
|
|
key: ${SSH_KEY} |
|
|
|
passphrase: ${SSH_PASSPHRASE} |
|
|
|
port: ${SSH_PORT} |
|
|
|
script: |
|
|
|
- export SSH_KEY=$${SSH_KEY} |
|
|
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD} |
|
|
|
- export CA_KEY=$${CA_KEY} |
|
|
|
- export SSH_HOST=$${SSH_HOST} |
|
|
|
- export SSH_USER=$${SSH_USER} |
|
|
|
- export SSH_PORT=$${SSH_PORT} |
|
|
|
- export LOCAL_DOCKER_REGISTRY=$${LOCAL_DOCKER_REGISTRY} |
|
|
|
- export CA_CRT=$${CA_CRT} |
|
|
|
- export LOCAL_DOMAIN=$${LOCAL_DOMAIN} |
|
|
|
- export DOMAIN=$${DOMAIN} |
|
|
|
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN} |
|
|
|
- export REGISTRY_PORT=$${REGISTRY_PORT} |
|
|
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD} |
|
|
|
- set -e |
|
|
|
- cd /stack/squid |
|
|
|
- sh .drone/login.sh |
|
|
|
- sh .drone/pull.sh |
|
|
|
- sh .drone/deploy.sh |
|
|
|
username: |
|
|
|
from_secret: ssh-user |
|
|
|
username: ${SSH_USER} |
|
|
|
environment: |
|
|
|
CA_CRT: |
|
|
|
from_secret: ca-crt |
|
|
|
CA_KEY: |
|
|
|
from_secret: ca-key |
|
|
|
LOCAL_DOCKER_REGISTRY: |
|
|
|
from_secret: local-docker-registry |
|
|
|
REGISTRY_PASSWORD: |
|
|
|
from_secret: registry-password |
|
|
|
SSH_HOST: |
|
|
|
from_secret: ssh-host |
|
|
|
SSH_KEY: |
|
|
|
from_secret: ssh-key |
|
|
|
SSH_PORT: |
|
|
|
from_secret: ssh-port |
|
|
|
SSH_USER: |
|
|
|
from_secret: ssh-user |
|
|
|
LOCAL_DOMAIN: |
|
|
|
from_secret: local-domain |
|
|
|
|
|
|
|
services: |
|
|
|
- name: docker |
|
|
|
image: docker:dind |
|
|
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f |
|
|
|
privileged: true |
|
|
|
volumes: |
|
|
|
- name: dockersock |
|
|
@@ -177,4 +144,10 @@ volumes: |
|
|
|
host: |
|
|
|
path: /etc/docker/certs.d |
|
|
|
|
|
|
|
trigger: |
|
|
|
event: |
|
|
|
- promote |
|
|
|
target: |
|
|
|
- production |
|
|
|
|
|
|
|
... |