fix: deploy
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Giles Bradshaw 2020-08-05 09:01:03 +01:00
parent 032c77497c
commit cc19e18b51
4 changed files with 20 additions and 66 deletions

View File

@ -44,27 +44,6 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
'/stack/squid' '/stack/squid'
), ),
images.wait(15), images.wait(15),
compose(
std.map(
function(s) util.envSet(s),
publicSecrets + secretSecrets
) +
std.map(
function(s) function(step) step {
settings +: {
script +: [
'export %(env)s="$${%(env)s}"' % {
env: util.environment(s),
},
'echo "$${%s}"' % util.environment(s),
],
},
},
publicSecrets + secretSecrets
)
)
(
images.ssh { images.ssh {
name: 'deploy squid', name: 'deploy squid',
settings +: { settings +: {
@ -78,12 +57,11 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
'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"', '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 ..', 'cd ..',
"docker stack rm squid", "docker stack rm squid",
"sleep 30", "sleep 31",
"docker stack deploy -c docker-compose.yml squid", "docker stack deploy -c docker-compose.yml squid",
] ]
} }
} }
),
], ],
} }
] ]

View File

@ -38,11 +38,6 @@ steps:
- drone_build_number - drone_build_number
- drone_repo_name - drone_repo_name
- drone_repo_namespace - drone_repo_namespace
- ssh_host
- ssh_user
- ssh_root_user
- ssh_password
- ssh_key
host: host:
from_secret: ssh-host from_secret: ssh-host
key: key:
@ -57,31 +52,10 @@ steps:
- 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" - 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 .. - cd ..
- docker stack rm squid - docker stack rm squid
- sleep 30 - sleep 31
- docker stack deploy -c docker-compose.yml squid - 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}"
- export SSH_KEY="$${SSH_KEY}"
- echo "$${SSH_KEY}"
username: username:
from_secret: ssh-user from_secret: ssh-user
environment:
SSH_HOST:
from_secret: ssh-host
SSH_KEY:
from_secret: ssh-key
SSH_PASSWORD:
from_secret: ssh-password
SSH_ROOT_USER:
from_secret: ssh-root-user
SSH_USER:
from_secret: ssh-user
services: services:
- name: docker - name: docker

View File

@ -2,4 +2,5 @@
'ssh-host', 'ssh-host',
'ssh-user', 'ssh-user',
'ssh-root-user', 'ssh-root-user',
'local-docker-registry',
] ]

View File

@ -1,4 +1,5 @@
[ [
'ssh-password', 'ssh-password',
'ssh-key', 'ssh-key',
'local-registry-password',
] ]