-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfig.yml
496 lines (452 loc) · 16.2 KB
/
config.yml
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
---
common-steps:
- &removevirtualenv
run:
name: Removes the upstream virtualenv from the original container image
command: sudo pip uninstall virtualenv -y
- &installdeps
run:
name: Install Debian packaging dependencies
command: make install-deps
- &getlatestreleasedversion
run:
name: Get latest released version of the project
command: |
cd ~/packaging/securedrop-*
export VERSION_TO_BUILD="$(git describe --tags $(git rev-list --tags --max-count=1))"
# Enable access to this env var in subsequent run steps
echo $VERSION_TO_BUILD > ~/packaging/sd_version
echo 'export VERSION_TO_BUILD=$(cat ~/packaging/sd_version)' >> $BASH_ENV
- &getnightlyversion
run:
name: Create nightly version for python packages
command: |
cd ~/packaging/securedrop-*
# Nightly versioning format is: LATEST_TAG-dev-YYMMDD-HHMMSS
export VERSION_TO_BUILD="$(git describe --tags $(git rev-list --tags --max-count=1))-dev-$(date +%Y%m%d)-$(date +%H%M%S)"
# Enable access to this env var in subsequent run steps
echo $VERSION_TO_BUILD > ~/packaging/sd_version
echo 'export VERSION_TO_BUILD=$(cat ~/packaging/sd_version)' >> $BASH_ENV
./update_version.sh $VERSION_TO_BUILD
git tag $VERSION_TO_BUILD
- &getrpmnightlyversion
run:
name: Create nightly version for rpm packages
command: |
cd ~/packaging/securedrop-*
# Nightly versioning format for RPMs is since rpm does not like '-' in versions: LATEST_TAG.dev.YYMMDD.HHMMSS
export VERSION_TO_BUILD="$(git describe --tags $(git rev-list --tags --max-count=1)).dev.$(date +%Y%m%d).$(date +%H%M%S)"
# Enable access to this env var in subsequent run steps
echo $VERSION_TO_BUILD > ~/packaging/sd_version
echo 'export VERSION_TO_BUILD=$(cat ~/packaging/sd_version)' >> $BASH_ENV
./update_version.sh $VERSION_TO_BUILD
git tag $VERSION_TO_BUILD
- &getnightlymetapackageversion
run:
name: Create nightly version for metapackages
command: |
PLATFORM="$(lsb_release -sc)"
CURRENT_VERSION=$(grep -oP "\d+\.\d+\.\d+" ~/project/${PKG_NAME}/debian/changelog-${PLATFORM} | head -n1)
# Nightly versioning format is: LATEST_TAG-dev-YYMMDD-HHMMSS
export VERSION_TO_BUILD="$CURRENT_VERSION-dev-$(date +%Y%m%d)-$(date +%H%M%S)"
# Enable access to this env var in subsequent run steps
echo $VERSION_TO_BUILD > ~/packaging/sd_version
echo 'export VERSION_TO_BUILD=$(cat ~/packaging/sd_version)' >> $BASH_ENV
- &makesourcetarball
run:
name: Create source tarball
command: |
cd ~/packaging/securedrop-*
git checkout $VERSION_TO_BUILD
python3 setup.py sdist
- &clonesecuredropclient
run:
name: Clone the repository to be packaged
command: |
mkdir ~/packaging && cd ~/packaging
git clone https://github.com/freedomofpress/securedrop-client.git
export PKG_NAME="securedrop-client"
# Enable access to this env var in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &clonesecuredropproxy
run:
name: Clone the repository to be packaged
command: |
mkdir ~/packaging && cd ~/packaging
git clone https://github.com/freedomofpress/securedrop-proxy.git
export PKG_NAME="securedrop-proxy"
# Enable access to this env var in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &clonesecuredroplog
run:
name: Clone the repository to be packaged
command: |
mkdir ~/packaging && cd ~/packaging
git clone https://github.com/freedomofpress/securedrop-log.git
export PKG_NAME="securedrop-log"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &clonesecuredropexport
run:
name: Clone the repository to be packaged
command: |
mkdir ~/packaging && cd ~/packaging
git clone https://github.com/freedomofpress/securedrop-export.git
export PKG_NAME="securedrop-export"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &clonesecuredropworkstation
run:
name: Clone the repository to be packaged
command: |
mkdir ~/packaging && cd ~/packaging
git clone https://github.com/freedomofpress/securedrop-workstation.git
export PKG_NAME="securedrop-workstation"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &updatedebianchangelog
run:
name: Update debian changelog
command: |
cd ~/project/$PKG_NAME/debian
export DEBFULLNAME='Automated builds'
export [email protected]
export PLATFORM="$(lsb_release -sc)"
dch --changelog changelog-${PLATFORM} --distribution unstable --package "$PKG_NAME" --newversion $VERSION_TO_BUILD+${PLATFORM} "This is an automated build."
- &builddebianpackage
run:
name: Build debian package
command: |
export PKG_PATH=~/packaging/$PKG_NAME/dist/$PKG_NAME-$VERSION_TO_BUILD.tar.gz
export PKG_VERSION=$VERSION_TO_BUILD
make $PKG_NAME
ls ~/project/build/debbuild/packaging/*.deb
- &addsshkeys
add_ssh_keys:
fingerprints:
- "e5:b5:6e:d0:4e:ce:52:40:33:30:5e:6f:c5:73:38:20"
- &setsvsdispname
run:
name: Set package name to securedrop-workstation-svs-disp
command: |
mkdir ~/packaging
export PKG_NAME="securedrop-workstation-svs-disp"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &setsdgrsecname
run:
name: Set package name to securedrop-workstation-grsec
command: |
mkdir ~/packaging
export PKG_NAME="securedrop-workstation-grsec"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &setsdconfigname
run:
name: Set package name to securedrop-workstation-config
command: |
mkdir ~/packaging
export PKG_NAME="securedrop-workstation-config"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &setsdkeyringname
run:
name: Set package name to securedrop-keyring
command: |
mkdir ~/packaging
export PKG_NAME="securedrop-keyring"
# Enable access to this env car in subsequent run steps
echo $PKG_NAME > ~/packaging/sd_package_name
echo 'export PKG_NAME=$(cat ~/packaging/sd_package_name)' >> $BASH_ENV
- &setmetapackageversion
run:
name: Get metapackage version via distribution changelog
command: |
PLATFORM="$(lsb_release -sc)"
CURRENT_VERSION=$(grep -oP "\d+\.\d+\.\d+" ${PKG_NAME}/debian/changelog-${PLATFORM} | head -n1)
export VERSION_TO_BUILD="$CURRENT_VERSION"
# Enable access to this env var in subsequent run steps
echo $VERSION_TO_BUILD > ~/packaging/sd_version
echo 'export VERSION_TO_BUILD=$(cat ~/packaging/sd_version)' >> $BASH_ENV
- &installgitlfs
run:
name: Install Git LFS.
command: |
export GIT_LFS_VERSION=2.9.2
export GIT_LFS_CHECKSUM=04346234130e518d165bdc7e9964375bbeb3b98efabd042084530cc34288274c
wget https://github.com/git-lfs/git-lfs/releases/download/v$GIT_LFS_VERSION/git-lfs-linux-amd64-v$GIT_LFS_VERSION.tar.gz
sha256sum git-lfs-linux-amd64-v$GIT_LFS_VERSION.tar.gz | grep $GIT_LFS_CHECKSUM
tar xzf git-lfs-linux-amd64-v$GIT_LFS_VERSION.tar.gz
sudo mv git-lfs /usr/local/bin/git-lfs
git lfs install
- &commitworkstationdebs
run:
name: Commit workstation debs for deployment to apt-test-qubes.freedom.press
command: |
PLATFORM="$(lsb_release -sc)"
git clone [email protected]:freedomofpress/securedrop-dev-packages-lfs.git
cd securedrop-dev-packages-lfs
git config user.email "[email protected]"
git config user.name "sdcibot"
# Copy built debian packages to the relevant workstation repo and git push.
cp ~/project/build/debbuild/packaging/*.deb ./workstation/${PLATFORM}/
git add workstation/${PLATFORM}/*.deb
git commit -m "Automated SecureDrop workstation build"
git push origin main
version: 2.1
jobs:
lint-and-test:
machine:
image: ubuntu-2004:202010-01
steps:
- checkout
- run:
name: install test requirements, run linters, and run tests
command: |
make install-deps
make lint-desktop-files
virtualenv -p python3 .venv
source .venv/bin/activate
pip install -r test-requirements.txt
make test
reprotest-wheels:
machine:
image: ubuntu-2004:202010-01
steps:
- checkout
- run:
name: install test requirements and run tests
command: |
make install-deps
virtualenv -p python3 .venv
source .venv/bin/activate
pip install -r test-requirements.txt
pytest -vvs tests/test_reproducible_wheels.py
reprotest-debs:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- run:
name: install test requirements and run tests
command: |
make install-deps
virtualenv -p python3 .venv
source .venv/bin/activate
pip install -r test-requirements.txt
# Patch reprotest in-place to skip 'setarch' prefix, which fails under containers.
# We cannot use Ubuntu 20.04 python3.8 to build Debian 10 python3.7 packages.
sudo sed -i -re "292s/^(\s+).*\$/\1return _.prepend_to_build_command_raw('')/" /usr/lib/python3/dist-packages/reprotest/build.py
pytest -vvs tests/test_reproducible_debian_packages.py
build-buster-securedrop-log:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredroplog
- *getnightlyversion
- *makesourcetarball
- *builddebianpackage
build-nightly-buster-securedrop-log:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredroplog
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *addsshkeys
- *commitworkstationdebs
build-buster-securedrop-client:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredropclient
- *getnightlyversion
- *makesourcetarball
- *builddebianpackage
build-nightly-buster-securedrop-client:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredropclient
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *addsshkeys
- *commitworkstationdebs
build-buster-securedrop-proxy:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredropproxy
- *getnightlyversion
- *makesourcetarball
- *builddebianpackage
build-nightly-buster-securedrop-proxy:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredropproxy
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *addsshkeys
- *commitworkstationdebs
build-buster-securedrop-export:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredropexport
- *getlatestreleasedversion
- *makesourcetarball
- *builddebianpackage
build-nightly-buster-securedrop-export:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *clonesecuredropexport
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *addsshkeys
- *commitworkstationdebs
build-buster-securedrop-workstation-svs-disp:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *setsvsdispname
- *setmetapackageversion
- *builddebianpackage
build-nightly-buster-securedrop-workstation-svs-disp:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *removevirtualenv
- *installdeps
- *setsvsdispname
- *getnightlymetapackageversion
- *updatedebianchangelog
- *builddebianpackage
- *addsshkeys
- *commitworkstationdebs
build-buster-securedrop-workstation-grsec:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *installdeps
- *setsdgrsecname
- *setmetapackageversion
- *builddebianpackage
build-buster-securedrop-workstation-config:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *installdeps
- *setsdconfigname
- *setmetapackageversion
- *builddebianpackage
build-nightly-buster-securedrop-workstation-config:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *installdeps
- *setsdconfigname
- *getnightlymetapackageversion
- *updatedebianchangelog
- *builddebianpackage
- *addsshkeys
- *commitworkstationdebs
build-buster-securedrop-keyring:
docker:
- image: circleci/python:3.7-buster
steps:
- checkout
- *installdeps
- *setsdkeyringname
- *setmetapackageversion
- *builddebianpackage
workflows:
build-packages:
jobs:
- lint-and-test
- reprotest-wheels
- reprotest-debs
- build-buster-securedrop-client
- build-buster-securedrop-proxy
- build-buster-securedrop-workstation-svs-disp
- build-buster-securedrop-export
- build-buster-securedrop-log
- build-buster-securedrop-workstation-grsec
- build-buster-securedrop-workstation-config
- build-buster-securedrop-keyring
# Nightly jobs for each package are run in series to ensure there are no
# conflicts or race conditions when committing deb packages to git-lfs.
# Each nightly job requires the completion of the previous task in the sequence.
nightly:
triggers:
- schedule:
cron: "0 6 * * *"
filters:
branches:
only:
- main
jobs:
- build-nightly-buster-securedrop-client
- build-nightly-buster-securedrop-proxy:
requires:
- build-nightly-buster-securedrop-client
- build-nightly-buster-securedrop-export:
requires:
- build-nightly-buster-securedrop-proxy
- build-nightly-buster-securedrop-log:
requires:
- build-nightly-buster-securedrop-export
- build-nightly-buster-securedrop-workstation-svs-disp:
requires:
- build-nightly-buster-securedrop-log
- build-nightly-buster-securedrop-workstation-config:
requires:
- build-nightly-buster-securedrop-workstation-svs-disp