2020-08-05 07:30:16 +00:00
|
|
|
local images = import 'lib/images.libsonnet';
|
2020-08-05 11:06:47 +00:00
|
|
|
local environment = import 'node_modules/@sigyl/jsonnet-drone-environment/environment.libsonnet';
|
2020-08-05 07:30:16 +00:00
|
|
|
local compose = import 'node_modules/@sigyl/jsonnet-compose/compose.libsonnet';
|
|
|
|
local secretSecrets = import 'lib/secret-secrets.libsonnet';
|
|
|
|
local publicSecrets = import 'lib/public-secrets.libsonnet';
|
2020-07-30 14:32:27 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
|
|
|
type: 'docker',
|
|
|
|
name: 'build',
|
|
|
|
clone: {
|
|
|
|
disable: false,
|
|
|
|
depth: 0,
|
|
|
|
},
|
|
|
|
services: [
|
|
|
|
images.docker {
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
steps:[
|
|
|
|
images.scp(
|
|
|
|
'/stack/squid'
|
|
|
|
),
|
|
|
|
images.wait(15),
|
2020-08-05 11:06:47 +00:00
|
|
|
images.docker {
|
|
|
|
name +: 'build docker image:',
|
|
|
|
environment +: environment.environmentSecrets([
|
|
|
|
'LOCAL_DOCKER_REGISTRY',
|
|
|
|
'LOCAL_REGISTRY_PASSWORD',
|
|
|
|
]),
|
|
|
|
volumes: [
|
|
|
|
{
|
|
|
|
name: 'dockersock',
|
|
|
|
path: '/var/run',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
commands: [
|
|
|
|
'set -e',
|
|
|
|
'pwd',
|
|
|
|
'sleep 15',
|
|
|
|
'cd docker',
|
|
|
|
'docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}"',
|
2020-08-05 11:09:13 +00:00
|
|
|
'docker build . -t $${LOCAL_DOCKER_REGISTRY}squid',
|
|
|
|
'docker push $${LOCAL_DOCKER_REGISTRY}squid',
|
2020-08-05 11:06:47 +00:00
|
|
|
'docker logout $${LOCAL_DOCKER_REGISTRY}',
|
|
|
|
],
|
|
|
|
},
|
2020-08-05 08:01:03 +00:00
|
|
|
images.ssh {
|
|
|
|
name: 'deploy squid',
|
|
|
|
settings +: {
|
|
|
|
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",
|
|
|
|
]
|
2020-07-30 14:32:27 +00:00
|
|
|
}
|
2020-08-05 08:01:03 +00:00
|
|
|
}
|
2020-07-30 14:32:27 +00:00
|
|
|
],
|
|
|
|
}
|
|
|
|
]
|