forked from saltstack/salt-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.jsonnet
208 lines (188 loc) · 5.66 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
local git_suites = [
{ name: 'Py2 2018.3(Git)', slug: 'py2-git-2018-3', depends: [] },
{ name: 'Py2 2019.2(Git)', slug: 'py2-git-2019-2', depends: ['Py2 2018.3(Git)'] },
{ name: 'Py2 3000(Git)', slug: 'py2-git-3000', depends: ['Py2 2019.2(Git)'] },
// {name: 'Py2 develop(Stable)', slug: 'py2-git-develop'}, // Don't test against Salt's develop branch. Stability is not assured.
];
local git_py3_suites = [
{ 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)'] },
{ name: 'Py3 3000(Git)', slug: 'py3-git-3000', depends: ['Py3 2019.2(Git)'] },
];
local stable_suites = [
{ 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)'] },
{ name: 'Py2 3000(Stable)', slug: 'py2-stable-3000', depends: ['Py2 3000(Git)'] },
];
local stable_py3_suites = [
{ 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)'] },
{ name: 'Py3 3000(Stable)', slug: 'py3-stable-3000', depends: ['Py3 3000(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: 'CentOS 8', slug: 'centos-8', multiplier: 5, depends: [] },
{ name: 'Debian 8', slug: 'debian-8', multiplier: 6, depends: [] },
{ name: 'Debian 9', slug: 'debian-9', multiplier: 7, depends: [] },
{ name: 'Debian 10', slug: 'debian-10', multiplier: 5, depends: [] },
{ name: 'Fedora 30', slug: 'fedora-30', multiplier: 4, depends: [] },
{ name: 'Fedora 31', slug: 'fedora-31', multiplier: 3, depends: [] },
{ name: 'Opensuse 15.1', slug: 'opensuse-15', multiplier: 2, 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',
'centos-8',
'debian-8',
'debian-9',
'debian-10',
'fedora-30',
'ubuntu-1604',
'ubuntu-1804',
];
local py3_distros = [
'amazon-2',
// 'arch',
'centos-7',
'centos-8',
'debian-9',
'debian-10',
'ubuntu-1604',
'ubuntu-1804',
'fedora-30',
'fedora-31',
];
local py2_blacklist = [
'centos-8',
'debian-10',
'fedora-30',
'fedora-31',
];
local blacklist_2018 = [
'centos-8',
'debian-10',
'amazon-2',
];
local Shellcheck() = {
kind: 'pipeline',
name: 'Lint',
steps: [
{
name: 'shellcheck',
image: 'koalaman/shellcheck-alpine:v0.6.0',
commands: [
'shellcheck -s sh -f checkstyle bootstrap-salt.sh',
],
},
],
};
local Build(distro) = {
kind: 'pipeline',
name: distro.name,
node: {
project: 'open',
},
local temp_git_suites = if std.count(py2_blacklist, distro.slug) > 0 then
[]
else
git_suites,
local temp_stable_suites = if std.count(py2_blacklist, distro.slug) > 0 then
[]
else if std.count(stable_distros, distro.slug) > 0 then
stable_suites
else
[],
local temp_git_py3_suites = if std.count(py3_distros, distro.slug) < 1 then
[]
else if std.count(blacklist_2018, distro.slug) > 0 then
git_py3_suites[1:]
else if std.count(py3_distros, distro.slug) > 0 then
git_py3_suites
else
[],
local temp_stable_py3_suites = if std.count(stable_distros, distro.slug) < 1 then
[]
else if std.count(blacklist_2018, distro.slug) > 0 then
stable_py3_suites[1:]
else if std.count(py3_distros, distro.slug) > 0 then
stable_py3_suites
else
[],
local suites = temp_git_suites + temp_stable_suites + temp_git_py3_suites + temp_stable_py3_suites,
steps: [
{
name: 'throttle-build',
image: 'alpine',
commands: [
std.format(
"sh -c 't=%(offset)s; echo Sleeping %(offset)s seconds; sleep %(offset)s'",
{ offset: 6 * 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 20', // 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
]