From 96ea18daca78f9ad9db7e8ef64dc117b20aded27 Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Mon, 14 Mar 2022 17:08:34 +1300 Subject: [PATCH] Reverted jsonnet conf --- .drone.jsonnet | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index b697a9b..7ba520e 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -6,17 +6,57 @@ local distros = ['centos7', 'debian11']; -local utils = import './.drone/utils.libsonnet'; +/* Configuration of DIND */ +local docker_service() = + { + name: 'docker', + image: 'docker:dind', + privileged: true, + volumes: [{ name: 'dockersock', path: '/var/run' },], + }; + +local email_notification() = + { + name: 'notify by email', + image: 'drillster/drone-email', + settings: + { host: 'mail.guise.net.nz', + username: + { from_secret: 'EMAIL_USER' }, + password: + { from_secret: 'EMAIL_PASS' }, + from: 'drone@guise.net.nz' + }, + when: + { status: [ 'changed', 'failure' ] }, + }; + +local test_distro(distribution) = + { + name: 'Test on %(distribution)s' % { distribution: distribution }, + volumes: [{ name: 'dockersock', path: '/var/run' },], + image: 'guisea/ansible-molecule:latest', + commands: [ + 'sleep 10', // give docker enough time to start + 'mkdir ${DRONE_REPO_NAME}', + 'rsync -a . ${DRONE_REPO_NAME} --exclude ${DRONE_REPO_NAME}', + 'cd ${DRONE_REPO_NAME}', + 'molecule test' + ], + environment: + { MOLECULE_DISTRO: '%(distribution)s' % { distribution: distribution } + }, + }; local gen_pipeline(distro) = {kind: 'pipeline', type: 'docker', name: 'Test on %(distro)s' % { distro: distro }, steps: [ - utils.test_distro(distro), - utils.email_notification()], + test_distro(distro), + email_notification()], services: [ - utils.docker_service(), + docker_service(), ], volumes: [{