-
Notifications
You must be signed in to change notification settings - Fork 14
/
barney.yaml
354 lines (321 loc) · 13.5 KB
/
barney.yaml
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# Copyright (c) 2022 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
images:
build-floor:
units:
- image: code.arista.io/infra/barney/barnzilla%base
- image: code.arista.io/infra/barney/barnzilla%network
- image: code.arista.io/infra/barney/barnzilla%rpms/yum
- image: code.arista.io/infra/barney/barnzilla%rpms/yum-utils
- image: code.arista.io/infra/barney/barnzilla%rpms/wget/fakeroot/sudo/EosImage/EosImageBuildUtils/EosUtils/EosSwimUtils
- image: code.arista.io/infra/barney/barnzilla%rpms/rpm-build
- image: code.arista.io/infra/barney/barnzilla%rpmdb
mfw_pkg/backup-scripts:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -t package/feeds/mfw/backup-scripts/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/backup-scripts
cp bin/packages/x86_64/*/* /dest/mfw-packages/backup-scripts
internal/test/mfw_pkg/backup-scripts:
units:
- image: code.arista.io/mfw/build%world
- image: .%mfw_pkg/backup-scripts
entry:
mutables:
- /usr
test/mfw_pkg/backup-scripts:
units:
- floor: .%internal/test/mfw_pkg/backup-scripts
build: |
mkdir /var/lock
opkg install /mfw-packages/*/*
mfw_pkg/crash-collector:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -t package/feeds/mfw/crash-collector/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/crash-collector
cp bin/packages/x86_64/*/* /dest/mfw-packages/crash-collector
internal/test/mfw_pkg/crash-collector:
units:
- image: code.arista.io/mfw/build%world
- image: .%mfw_pkg/crash-collector
entry:
mutables:
- /usr
test/mfw_pkg/crash-collector:
units:
- floor: .%internal/test/mfw_pkg/crash-collector
build: |
mkdir /var/lock
opkg install /mfw-packages/*/*
mfw_pkg/credentials:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -t package/feeds/mfw/credentials/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/credentials
cp bin/packages/x86_64/*/* /dest/mfw-packages/credentials
internal/test/mfw_pkg/credentials:
units:
- image: code.arista.io/mfw/build%world
- image: .%mfw_pkg/credentials
entry:
mutables:
- /usr
test/mfw_pkg/credentials:
units:
- floor: .%internal/test/mfw_pkg/credentials
build: |
mkdir /var/lock
opkg install /mfw-packages/*/*
mfw_pkg/mfw-eu:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -r eu -t package/feeds/mfw/mfw-eu/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/mfw-eu
cp bin/packages/x86_64/*/* /dest/mfw-packages/mfw-eu
internal/test/mfw_pkg/mfw-eu:
units:
- image: code.arista.io/mfw/build%world
- image: .%mfw_pkg/mfw-eu
entry:
mutables:
- /usr
test/mfw_pkg/mfw-eu:
units:
- floor: .%internal/test/mfw_pkg/mfw-eu
build: |
mkdir /var/lock
opkg install /mfw-packages/*/*
mfw_pkg/pyconnector:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -t package/feeds/mfw/pyconnector/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/pyconnector
cp bin/packages/x86_64/*/* /dest/mfw-packages/pyconnector
internal/test/mfw_pkg/pyconnector:
units:
- image: code.arista.io/mfw/build%world
- image: .%mfw_pkg/pyconnector
entry:
mutables:
- /usr
test/mfw_pkg/pyconnector:
units:
- floor: .%internal/test/mfw_pkg/pyconnector
build: |
mkdir /var/lock
opkg install /mfw-packages/*/*
mfw_pkg/upgrade-scripts:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -t package/feeds/mfw/upgrade-scripts/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/upgrade-scripts
cp bin/packages/x86_64/*/* /dest/mfw-packages/upgrade-scripts
internal/test/mfw_pkg/upgrade-scripts:
units:
- image: code.arista.io/mfw/build%world
- image: .%mfw_pkg/upgrade-scripts
entry:
mutables:
- /usr
test/mfw_pkg/upgrade-scripts:
units:
- floor: .%internal/test/mfw_pkg/upgrade-scripts
build: |
mkdir /var/lock
opkg install /mfw-packages/*/*
# Create the mfw-feeds RPM consisting of some basic scripts
mfw_pkg/mfw-feeds-rpm:
units:
- floor: .%build-floor
entry:
mutables:
- /var/lib
- /var/tmp
sources:
- github.com/untangle/mfw_feeds
- github.com/sivel/speedtest-cli
build: |
# Remove once barnzilla%base is fixed to no longer break rpmdb
/usr/libexec/barnzilla/init-rpmdb-from-rpmcache
MFWFEEDS_DIR="/src/github.com/untangle/mfw_feeds"
MFWFEEDS_TARDIR="/dest/mfw-tardir/"
RPMDIR="/dest/mfw_rpms"
# Build rpm build root
mkdir -p /tmp/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,BUILDROOT}
mkdir -p $MFWFEEDS_TARDIR/{geoip-database,speedtest-cli}
mkdir -p $RPMDIR
cp -r $MFWFEEDS_DIR/{wan-manager,upgrade-scripts,backup-scripts} $MFWFEEDS_TARDIR
cd $MFWFEEDS_TARDIR
wget -O - https://downloads.untangle.com/download.php?resource=geoipCountry | \
tar -xz --strip-components=1 -C geoip-database/
# Patch speedtest-cli
cd /src/github.com/sivel/speedtest-cli
patch -p1 < $MFWFEEDS_DIR/speedtest-cli/patches/0001-Switch-to-python3.patch \
&& patch -p1 < $MFWFEEDS_DIR/speedtest-cli/patches/0002-Add-simple-json-output-option.patch
cp speedtest.py $MFWFEEDS_TARDIR/speedtest-cli
# Bundle stuffs in MFWFEEDS_TARDIR to a single source tar.gz for rpm spec file
cd $MFWFEEDS_TARDIR && tar -czvf /tmp/rpmbuild/SOURCES/mfw_feeds.tar.gz --transform 's|^|mfw_feeds/|' *
# build the rpm and copy it to the right directory
rpmbuild -v --define '_topdir /tmp/rpmbuild' -bb $MFWFEEDS_DIR/mfw-feeds.spec
cp -r /tmp/rpmbuild/RPMS/noarch/* $RPMDIR
rm -rf $MFWFEEDS_TARDIR
# The current working directory is saved in future images
cd /
# Generate an image of floor + RPMs before testing
testImage/mfw_pkg/mfw-feeds-rpm:
units:
- image: .%mfw_pkg/mfw-feeds-rpm
- image: .%build-floor
- image: code.arista.io/infra/barney/barnzilla%rpmdb
# Install the generated RPM and check if it was successfully installed
test/mfw_pkg/mfw-feeds-rpm:
units:
- floor: .%testImage/mfw_pkg/mfw-feeds-rpm
entry:
mutables:
- /var/lib
- /var/tmp
build: |
# Remove once barnzilla%base is fixed to no longer break rpmdb
/usr/libexec/barnzilla/init-rpmdb-from-rpmcache
sudo yum --releasever 7 -y --installroot=/dest/testRoot install /mfw_rpms/*.rpm
echo "mfw-feeds-rpm Installed Files" > /dest/testResults
ls /dest/testRoot/usr/bin/wan-manager && echo "/usr/bin/wan-manager" >> /dest/testResults
ls /dest/testRoot/usr/bin/upgrade.sh && echo "/usr/bin/upgrade.sh" >> /dest/testResults
ls /dest/testRoot/usr/bin/speedtest-cli && echo "/usr/bin/speedtest-cli" >> /dest/testResults
ls /dest/testRoot/usr/bin/upload-backup.sh && echo "/usr/bin/upload-backup.sh" >> /dest/testResults
ls /dest/testRoot/usr/share/geoip/GeoLite2-Country.mmdb && echo "/usr/share/geoip/GeoLite2-Country.mmdb" >> /dest/testResults
mfw_pkg/wan-manager:
units:
- floor: code.arista.io/mfw/build%toolchain
sources:
- code.arista.io/mfw/build
- github.com/untangle/openwrt
- github.com/untangle/mfw_feeds
build: |
set -e
# copy build%toolchain's staging_dir into our source tree
cp -a /mfw-toolchain/staging_dir /src/github.com/untangle/openwrt/
# use barney-supplied feeds instead of fetching from github
perl -i -pe 's|^src-git mfw .+|src-link mfw /src/github.com/untangle/mfw_feeds|' /src/code.arista.io/mfw/build/feeds.conf.mfw
# barney sets DESTDIR to /dest, but this really confuses openwrt
unset DESTDIR
# avoid rebuilding wan-utils, as it's already built from its own
# repository; removing the dependency is a bit nasty, but we
# consider it acceptable still because for MFW we install all
# the packages together at image creation time, and we don't
# have to support further upgrades
perl -i -pe 's/ .?wan-utils//' /src/github.com/untangle/mfw_feeds/wan-manager/Makefile
# build our package
cd /src/github.com/untangle/openwrt
/src/code.arista.io/mfw/build/build.sh -f /src -t package/feeds/mfw/wan-manager/compile
# copy resulting packages to destination image
mkdir -p /dest/mfw-packages/wan-manager
cp bin/packages/x86_64/*/* /dest/mfw-packages/wan-manager
## Commented-out for now because it needs kmod-nft, which is only
## built by untangle/packetd
# internal/test/mfw_pkg/wan-manager:
# units:
# - image: code.arista.io/mfw/build%world
# - image: .%mfw_pkg/wan-manager
# entry:
# mutables:
# - /usr
#
# test/mfw_pkg/wan-manager:
# units:
# - floor: .%internal/test/mfw_pkg/wan-manager
# build: |
# mkdir /var/lock
# opkg install /mfw-packages/*/*