test: squid:4
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Giles Bradshaw 2020-08-06 11:05:40 +01:00
parent 3b24eabf9f
commit 12e3666db0
3 changed files with 37 additions and 20 deletions

View File

@ -49,7 +49,7 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
'/stack/squid' '/stack/squid'
), ),
images.wait(15), images.wait(15),
images.docker { /*images.docker {
name +: 'build docker image:', name +: 'build docker image:',
environment +: environment.environmentSecrets([ environment +: environment.environmentSecrets([
'LOCAL_DOCKER_REGISTRY', 'LOCAL_DOCKER_REGISTRY',
@ -68,10 +68,10 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
'cd squid-4', 'cd squid-4',
'docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}"', 'docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}"',
'docker build . -t $${LOCAL_DOCKER_REGISTRY}squid-4', 'docker build . -t $${LOCAL_DOCKER_REGISTRY}squid-4',
'docker push $${LOCAL_DOCKER_REGISTRY}squid', 'docker push $${LOCAL_DOCKER_REGISTRY}squid-4',
'docker logout $${LOCAL_DOCKER_REGISTRY}', 'docker logout $${LOCAL_DOCKER_REGISTRY}',
], ],
},/* },
images.docker { images.docker {
name +: 'build docker image:', name +: 'build docker image:',
environment +: environment.environmentSecrets([ environment +: environment.environmentSecrets([
@ -94,7 +94,7 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
'docker push $${LOCAL_DOCKER_REGISTRY}squid', 'docker push $${LOCAL_DOCKER_REGISTRY}squid',
'docker logout $${LOCAL_DOCKER_REGISTRY}', 'docker logout $${LOCAL_DOCKER_REGISTRY}',
], ],
} */ /* } */
compose([ compose([
environment.envSet('local-docker-registry'), environment.envSet('local-docker-registry'),
environment.envSet('local-registry-password'), environment.envSet('local-registry-password'),
@ -119,7 +119,7 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
] ]
} }
}, },
),*/ ),
], ],
} }
] ]

View File

@ -29,25 +29,42 @@ steps:
commands: commands:
- sleep 15 - sleep 15
- name: "dockerbuild docker image:" - name: deploy squid
image: docker:dind image: appleboy/drone-ssh
commands: 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 - set -e
- pwd - docker network prune -f
- sleep 15 - cd /stack/squid/myCA
- cd squid-4 - cd ..
- docker stack rm squid
- sleep 60
- docker volume rm squid_squid-cache
- export SQUID_IMAGE=$${LOCAL_DOCKER_REGISTRY}squid
- docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}" - docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}"
- docker build . -t $${LOCAL_DOCKER_REGISTRY}squid-4 - docker pull $${SQUID_IMAGE}
- docker push $${LOCAL_DOCKER_REGISTRY}squid - docker stack deploy -c docker-compose.yml squid
- docker logout $${LOCAL_DOCKER_REGISTRY} username:
from_secret: ssh-user
environment: environment:
LOCAL_DOCKER_REGISTRY: LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry from_secret: local-docker-registry
LOCAL_REGISTRY_PASSWORD: LOCAL_REGISTRY_PASSWORD:
from_secret: local-registry-password from_secret: local-registry-password
volumes:
- name: dockersock
path: /var/run
services: services:
- name: docker - name: docker

View File

@ -1,6 +1,6 @@
ARG DOCKER_PREFIX= ARG DOCKER_PREFIX=
FROM ${DOCKER_PREFIX}ubuntu:artful FROM ${DOCKER_PREFIX}ubuntu:xenial
ARG TRUST_CERT= ARG TRUST_CERT=