You've already forked ansible-role-common
Include from external file.
This commit is contained in:
@@ -6,57 +6,17 @@ local distros = ['centos7',
|
|||||||
'debian11'];
|
'debian11'];
|
||||||
|
|
||||||
|
|
||||||
/* Configuration of DIND */
|
local utils = import './.drone/docker_service.libsonnet';
|
||||||
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) =
|
local gen_pipeline(distro) =
|
||||||
{kind: 'pipeline',
|
{kind: 'pipeline',
|
||||||
type: 'docker',
|
type: 'docker',
|
||||||
name: 'Test on %(distro)s' % { distro: distro },
|
name: 'Test on %(distro)s' % { distro: distro },
|
||||||
steps: [
|
steps: [
|
||||||
test_distro(distro),
|
utils.test_distro(distro),
|
||||||
email_notification()],
|
utils.email_notification()],
|
||||||
services: [
|
services: [
|
||||||
docker_service(),
|
utils.docker_service(),
|
||||||
],
|
],
|
||||||
volumes:
|
volumes:
|
||||||
[{
|
[{
|
||||||
|
|||||||
42
.drone/utils.libsonnet
Normal file
42
.drone/utils.libsonnet
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
docker_service()::
|
||||||
|
{
|
||||||
|
name: 'docker',
|
||||||
|
image: 'docker:dind',
|
||||||
|
privileged: true,
|
||||||
|
volumes: [{ name: 'dockersock', path: '/var/run' },],
|
||||||
|
},
|
||||||
|
|
||||||
|
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' ] },
|
||||||
|
},
|
||||||
|
|
||||||
|
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 }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user