Files
cron-apt/.drone.jsonnet
Aaron Guise f60465def9
All checks were successful
continuous-integration/drone/push Build is passing
Moved SMTP to Org Secrets
2022-11-01 11:08:08 +13:00

77 lines
1.7 KiB
Jsonnet

// Distros to Test on ;)
local distros = ['debian11',
'ubuntu2204'];
/* 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:
{ from_secret: 'EMAIL_HOST'},
username:
{ from_secret: 'EMAIL_USER'},
password:
{ from_secret: 'EMAIL_PASS'},
from: 'drone@guise.net.nz',
port: 587
}
};
local test_distro(distribution) =
{
name: 'Molecule test on %(distribution)s' % { distribution: distribution },
volumes: [{ name: 'dockersock', path: '/var/run' },],
pull: true,
image: 'guisea/ansible-molecule:alpine-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:
[test_distro(distro)],
services:
[docker_service()],
volumes:
[{
name: 'dockersock',
temp: {},
},],
};
// Generate the output
[
gen_pipeline('debian11'),
gen_pipeline('ubuntu2204'),
{kind: 'pipeline',
type: 'docker',
name: 'Notify',
steps: [email_notification()],
when:
{ status: [ 'success', 'failure' ] },
depends_on:
['Test on %(distro)s' % { distro: distro }
for distro in distros]
}
]