You've already forked ansible-role-common
78 lines
1.7 KiB
Jsonnet
78 lines
1.7 KiB
Jsonnet
local distros = ['centos7',
|
|
'debian10',
|
|
'debian11'];
|
|
|
|
local docker_service() =
|
|
{
|
|
name: 'docker',
|
|
image: 'docker:dind',
|
|
privileged: true,
|
|
volumes: { name: 'dockersock', path: '/var/run' },
|
|
};
|
|
|
|
local pipeline(distribution) = {
|
|
kind: "pipeline",
|
|
type: "docker",
|
|
name: "%(distribution)" % { distribution: distribution }
|
|
};
|
|
|
|
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() =
|
|
[{kind: 'pipeline',
|
|
type: 'docker',
|
|
name: 'Test on %(distro)s' % { distro: distro },
|
|
steps: [
|
|
[test_distro('centos7'),
|
|
email_notification()],
|
|
[test_distro('debian10'),
|
|
email_notification()],
|
|
[test_distro('debian11'),
|
|
email_notification()],
|
|
],
|
|
services: [
|
|
docker_service(),
|
|
],
|
|
volumes:
|
|
{
|
|
name: 'dockersock',
|
|
temp: {},
|
|
},
|
|
}
|
|
for distro in distros];
|
|
|
|
[
|
|
gen_pipeline(),
|
|
]
|