salt-bootstrap/.drone.jsonnet

178 lines
4.8 KiB
Jsonnet
Raw Normal View History

2019-04-06 14:03:16 +01:00
local git_suites = [
2019-10-31 10:22:02 -04:00
{ name: 'Py2 2018.3(Git)', slug: 'py2-git-2018-3', depends: [] },
2019-04-14 14:00:58 +01:00
{ name: 'Py2 2019.2(Git)', slug: 'py2-git-2019-2', depends: ['Py2 2018.3(Git)'] },
2019-10-31 14:52:42 -04:00
// {name: 'Py2 develop(Stable)', slug: 'py2-git-develop'}, // Don't test against Salt's develop branch. Stability is not assured.
];
local git_py3_suites = [
2019-10-31 10:22:02 -04:00
{ name: 'Py3 2018.3(Git)', slug: 'py3-git-2018-3', depends: [] },
{ name: 'Py3 2019.2(Git)', slug: 'py3-git-2019-2', depends: ['Py3 2018.3(Git)'] },
2019-04-06 14:03:16 +01:00
];
local stable_suites = [
2019-04-14 13:41:26 +01:00
{ name: 'Py2 2018.3(Stable)', slug: 'py2-stable-2018-3', depends: ['Py2 2018.3(Git)'] },
{ name: 'Py2 2019.2(Stable)', slug: 'py2-stable-2019-2', depends: ['Py2 2019.2(Git)'] },
2019-10-31 14:52:42 -04:00
];
local stable_py3_suites = [
2019-10-31 10:22:02 -04:00
{ name: 'Py3 2018.3(Stable)', slug: 'py3-stable-2018-3', depends: ['Py3 2018.3(Git)'] },
{ name: 'Py3 2019.2(Stable)', slug: 'py3-stable-2019-2', depends: ['Py3 2019.2(Git)'] },
2019-04-06 13:17:01 +01:00
];
2019-04-06 20:13:44 +01:00
local distros = [
2019-04-14 14:13:35 +01:00
{ name: 'Arch', slug: 'arch', multiplier: 0, depends: [] },
2019-04-14 18:58:51 +01:00
// { name: 'Amazon 1', slug: 'amazon-1', multiplier: 1, depends: [] },
// { name: 'Amazon 2', slug: 'amazon-2', multiplier: 2, depends: [] },
2019-04-14 14:13:35 +01:00
{ name: 'CentOS 6', slug: 'centos-6', multiplier: 3, depends: [] },
{ name: 'CentOS 7', slug: 'centos-7', multiplier: 4, depends: [] },
2019-10-14 11:51:32 -06:00
{ name: 'CentOS 8', slug: 'centos-8', multiplier: 4, depends: [] },
2019-04-14 14:13:35 +01:00
{ name: 'Debian 8', slug: 'debian-8', multiplier: 5, depends: [] },
{ name: 'Debian 9', slug: 'debian-9', multiplier: 6, depends: [] },
2019-10-14 11:51:32 -06:00
{ name: 'Debian 10', slug: 'debian-10', multiplier: 6, depends: [] },
{ name: 'Fedora 30', slug: 'fedora-30', multiplier: 6, depends: [] },
2019-04-14 18:58:51 +01:00
{ name: 'Opensuse 15.0', slug: 'opensuse-15', multiplier: 4, depends: [] },
{ name: 'Ubuntu 16.04', slug: 'ubuntu-1604', multiplier: 1, depends: [] },
{ name: 'Ubuntu 18.04', slug: 'ubuntu-1804', multiplier: 0, depends: [] },
2019-04-06 13:58:12 +01:00
];
local stable_distros = [
'amazon-1',
'amazon-2',
'centos-6',
'centos-7',
2019-10-31 10:22:02 -04:00
'centos-8',
2019-04-06 13:58:12 +01:00
'debian-8',
'debian-9',
2019-10-31 10:22:02 -04:00
'debian-10',
2019-04-06 13:58:12 +01:00
'ubuntu-1604',
'ubuntu-1804',
2019-02-06 09:22:02 -07:00
];
2019-10-31 14:52:42 -04:00
local py3_distros = [
'amazon-2',
'centos-7',
'centos-8',
'debian-9',
'debian-10',
'ubuntu-1604',
'ubuntu-1804',
2019-10-31 17:18:47 -04:00
'fedora-30',
2019-10-31 14:52:42 -04:00
];
2019-10-31 17:18:47 -04:00
local py2_blacklist = [
'centos-8',
'debian-10',
];
2019-10-31 14:52:42 -04:00
local blacklist_2018 = [
'centos-8',
'debian-10',
];
2019-02-01 11:27:03 -07:00
local Shellcheck() = {
kind: 'pipeline',
2019-04-14 12:27:36 +01:00
name: 'Lint',
2019-02-01 11:27:03 -07:00
steps: [
{
2019-04-14 12:27:36 +01:00
name: 'shellcheck',
2019-02-01 11:27:03 -07:00
image: 'koalaman/shellcheck-alpine',
commands: [
'shellcheck -s sh -f checkstyle bootstrap-salt.sh',
],
},
],
2019-02-01 11:27:03 -07:00
};
2019-04-06 19:30:23 +01:00
local Build(distro) = {
2019-02-01 10:29:57 -07:00
kind: 'pipeline',
2019-04-07 10:08:11 +01:00
name: distro.name,
2019-04-14 12:29:42 +01:00
node: {
project: 'open',
},
2019-04-06 19:30:23 +01:00
2019-10-31 17:18:47 -04:00
local suite =
if std.count(py2_blacklist, distro.slug) > 0 then
[]
else if std.count(stable_distros, distro.slug) > 0 then
git_suites + stable_suites
else git_suites,
local suites = suite + if std.count(blacklist_2018, distro.slug) > 0 then
git_py3_suites + stable_py3_suites[1:]
else if std.count(py3_distros, distro.slug) > 0 then
git_py3_suites + stable_py3_suites
else [],
2019-02-01 10:29:57 -07:00
steps: [
2019-04-14 17:16:01 +01:00
{
name: 'throttle-build',
image: 'alpine',
commands: [
std.format(
"sh -c 't=%(offset)s; echo Sleeping %(offset)s seconds; sleep %(offset)s'",
{ offset: 5 * std.length(suites) * distro.multiplier }
),
],
},
2019-05-15 15:00:30 +01:00
{
2019-05-15 15:15:10 +01:00
name: 'create',
image: 'saltstack/drone-salt-bootstrap-testing',
2019-05-15 15:00:30 +01:00
environment: {
DOCKER_HOST: 'tcp://docker:2375',
},
depends_on: [
'throttle-build',
],
commands: [
'bundle install --with docker --without opennebula ec2 windows vagrant',
"echo 'Waiting for docker to start'",
'sleep 10', // give docker enough time to start
'docker ps -a',
2019-05-15 15:15:10 +01:00
std.format('bundle exec kitchen create %s', [distro.slug]),
2019-05-15 15:00:30 +01:00
],
},
2019-04-14 17:16:01 +01:00
] + [
2019-04-06 15:54:44 +01:00
{
2019-04-07 10:48:07 +01:00
name: suite.name,
image: 'saltstack/drone-salt-bootstrap-testing',
2019-04-14 15:18:41 +01:00
environment: {
DOCKER_HOST: 'tcp://docker:2375',
},
2019-04-06 18:40:04 +01:00
depends_on: [
2019-04-14 17:16:01 +01:00
'throttle-build',
2019-05-15 15:15:10 +01:00
'create',
2019-05-15 14:40:10 +01:00
],
2019-04-14 15:18:41 +01:00
commands: [
'pip install -U pip',
'pip install -r tests/requirements.txt',
'bundle install --with docker --without opennebula ec2 windows vagrant',
std.format('bundle exec kitchen test %s-%s', [suite.slug, distro.slug]),
],
2019-04-06 18:40:04 +01:00
}
for suite in suites
2019-02-01 11:05:41 -07:00
],
2019-04-14 15:18:41 +01:00
services: [
{
name: 'docker',
image: 'saltstack/drone-salt-bootstrap-testing',
2019-04-14 15:18:41 +01:00
privileged: true,
environment: {},
command: [
'--storage-driver=overlay2',
],
},
],
2019-02-01 10:29:57 -07:00
depends_on: [
2019-04-14 12:31:15 +01:00
'Lint',
2019-04-14 14:13:35 +01:00
] + distro.depends,
2019-02-01 10:29:57 -07:00
};
2019-02-06 09:22:02 -07:00
2019-02-01 13:18:24 -07:00
[
Shellcheck(),
] + [
2019-04-06 19:30:23 +01:00
Build(distro)
2019-04-06 20:13:44 +01:00
for distro in distros
]