From 3b0e72a3c39a0173c4bf0c1d0d21d000dd874ada Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Mon, 14 Mar 2022 12:18:38 +1300 Subject: [PATCH] JSONNET configuration added --- .drone.jsonnet | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .drone.jsonnet diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..53be428 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,55 @@ +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 } + }, + }; + +// Run the steps +{ + steps: [ + [test_distro('centos7'), + email_notification()], + [test_distro('debian10'), + email_notification()], + [test_distro('debian11'), + email_notification()], + ], + services: [ + docker_service(), + ] +} \ No newline at end of file