forked from saltstack/salt-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.jsonnet
136 lines (125 loc) · 3.87 KB
/
.drone.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
local git_suites = [
{ name: 'Py2 2017.7(Git)', slug: 'py2-git-2017-7', depends: [] },
{ name: 'Py2 2018.3(Git)', slug: 'py2-git-2018-3', depends: ['Py2 2017.7(Git)'] },
{ name: 'Py2 2019.2(Git)', slug: 'py2-git-2019-2', depends: ['Py2 2018.3(Git)'] },
// {name: 'Py2 develop(Stable)', slug: 'py2-git-develop'}, // Don't test against Salt's develop branch. Stability is not assured.
];
local stable_suites = [
{ name: 'Py2 2017.7(Stable)', slug: 'py2-stable-2017-7', depends: ['Py2 2017.7(Git)'] },
{ 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)'] },
];
local distros = [
{ name: 'Arch', slug: 'arch', multiplier: 0, depends: [] },
// { name: 'Amazon 1', slug: 'amazon-1', multiplier: 1, depends: [] },
// { name: 'Amazon 2', slug: 'amazon-2', multiplier: 2, depends: [] },
{ name: 'CentOS 6', slug: 'centos-6', multiplier: 3, depends: [] },
{ name: 'CentOS 7', slug: 'centos-7', multiplier: 4, depends: [] },
{ name: 'Debian 8', slug: 'debian-8', multiplier: 5, depends: [] },
{ name: 'Debian 9', slug: 'debian-9', multiplier: 6, depends: [] },
{ name: 'Fedora 28', slug: 'fedora-28', multiplier: 6, depends: [] },
{ name: 'Fedora 29', slug: 'fedora-29', multiplier: 5, depends: [] },
{ name: 'Opensuse 15.0', slug: 'opensuse-15', multiplier: 4, depends: [] },
{ name: 'Opensuse 42.3', slug: 'opensuse-42', multiplier: 3, depends: [] },
{ name: 'Ubuntu 16.04', slug: 'ubuntu-1604', multiplier: 1, depends: [] },
{ name: 'Ubuntu 18.04', slug: 'ubuntu-1804', multiplier: 0, depends: [] },
];
local stable_distros = [
'amazon-1',
'amazon-2',
'centos-6',
'centos-7',
'debian-8',
'debian-9',
'ubuntu-1604',
'ubuntu-1804',
];
local Shellcheck() = {
kind: 'pipeline',
name: 'Lint',
steps: [
{
name: 'shellcheck',
image: 'koalaman/shellcheck-alpine',
commands: [
'shellcheck -s sh -f checkstyle bootstrap-salt.sh',
],
},
],
};
local Build(distro) = {
kind: 'pipeline',
name: distro.name,
node: {
project: 'open',
},
local suites = if std.count(stable_distros, distro.slug) > 0 then git_suites + stable_suites else git_suites,
steps: [
{
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 }
),
],
},
{
name: 'create',
image: 'saltstack/drone-salt-bootstrap-testing',
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',
std.format('bundle exec kitchen create %s', [distro.slug]),
],
},
] + [
{
name: suite.name,
image: 'saltstack/drone-salt-bootstrap-testing',
environment: {
DOCKER_HOST: 'tcp://docker:2375',
},
depends_on: [
'throttle-build',
'create',
],
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]),
],
}
for suite in suites
],
services: [
{
name: 'docker',
image: 'saltstack/drone-salt-bootstrap-testing',
privileged: true,
environment: {},
command: [
'--storage-driver=overlay2',
],
},
],
depends_on: [
'Lint',
] + distro.depends,
};
[
Shellcheck(),
] + [
Build(distro)
for distro in distros
]