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,46 +44,24 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
'/stack/squid'
),
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 {
name: 'deploy squid',
settings +: {
//username: util.fromSecret("ssh-root-user"),
//password: util.fromSecret("ssh-root-password"),
script +: [
'set -e',
"docker network prune -f",
"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 ..',
"docker stack rm squid",
"sleep 30",
"docker stack deploy -c docker-compose.yml squid",
]
}
images.ssh {
name: 'deploy squid',
settings +: {
//username: util.fromSecret("ssh-root-user"),
//password: util.fromSecret("ssh-root-password"),
script +: [
'set -e',
"docker network prune -f",
"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 ..',
"docker stack rm squid",
"sleep 31",
"docker stack deploy -c docker-compose.yml squid",
]
}
),
}
],
}
]

View File

@ -38,11 +38,6 @@ steps:
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- ssh_host
- ssh_user
- ssh_root_user
- ssh_password
- ssh_key
host:
from_secret: ssh-host
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"
- cd ..
- docker stack rm squid
- sleep 30
- sleep 31
- 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:
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:
- name: docker

View File

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

View File

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