2022-03-14 14:58:20 +13:00
|
|
|
// Distros to Test on ;)
|
|
|
|
|
local distros = ['centos7',
|
2022-03-14 15:29:51 +13:00
|
|
|
'centos8',
|
2022-03-14 15:34:17 +13:00
|
|
|
'rockylinux8',
|
2022-03-14 14:18:48 +13:00
|
|
|
'debian10',
|
|
|
|
|
'debian11'];
|
|
|
|
|
|
2022-03-14 14:58:20 +13:00
|
|
|
|
2022-03-14 17:08:34 +13:00
|
|
|
/* Configuration of DIND */
|
|
|
|
|
local docker_service() =
|
|
|
|
|
{
|
|
|
|
|
name: 'docker',
|
|
|
|
|
image: 'docker:dind',
|
|
|
|
|
privileged: true,
|
|
|
|
|
volumes: [{ name: 'dockersock', path: '/var/run' },],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
local email_notification() =
|
|
|
|
|
{
|
|
|
|
|
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:
|
2022-03-15 07:14:13 +13:00
|
|
|
{ status: [ 'success', 'failure' ] },
|
2022-03-14 17:08:34 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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 }
|
|
|
|
|
},
|
|
|
|
|
};
|
2022-03-14 12:18:38 +13:00
|
|
|
|
2022-03-15 07:46:37 +13:00
|
|
|
local gen_pipeline() =
|
|
|
|
|
[{kind: 'pipeline',
|
2022-03-14 14:18:48 +13:00
|
|
|
type: 'docker',
|
|
|
|
|
name: 'Test on %(distro)s' % { distro: distro },
|
2022-03-15 07:14:13 +13:00
|
|
|
steps:
|
2022-03-14 17:08:34 +13:00
|
|
|
test_distro(distro),
|
2022-03-15 07:14:13 +13:00
|
|
|
services:
|
2022-03-14 17:08:34 +13:00
|
|
|
docker_service(),
|
2022-03-14 14:18:48 +13:00
|
|
|
volumes:
|
2022-03-14 14:58:20 +13:00
|
|
|
[{
|
2022-03-14 14:18:48 +13:00
|
|
|
name: 'dockersock',
|
|
|
|
|
temp: {},
|
2022-03-15 07:14:13 +13:00
|
|
|
},
|
|
|
|
|
],
|
2022-03-15 07:46:37 +13:00
|
|
|
}
|
|
|
|
|
for distro in distros];
|
2022-03-14 14:18:48 +13:00
|
|
|
|
2022-03-14 14:58:20 +13:00
|
|
|
// Generate the output
|
2022-03-15 07:14:13 +13:00
|
|
|
[
|
|
|
|
|
{kind: 'pipeline',
|
|
|
|
|
name: 'Send notification by email',
|
|
|
|
|
steps: email_notification(),
|
|
|
|
|
depends_on: distros
|
2022-03-15 07:46:37 +13:00
|
|
|
},
|
|
|
|
|
gen_pipeline()
|
2022-03-14 14:58:20 +13:00
|
|
|
]
|