forked from DataDog/datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
4270 lines (3899 loc) · 186 KB
/
.gitlab-ci.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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
include: 'https://gitlab-templates.ddbuild.io/slack-notifier/v1/template.yml'
default:
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- unknown_failure
- api_failure
workflow:
rules:
- if: $CI_COMMIT_TAG =~ /^dca-/ || $CI_COMMIT_TAG == null || $DEPLOY_AGENT == "true"
stages:
- maintenance_jobs
- deps_build
- deps_fetch
- source_test
- binary_build
- integration_test
- package_build
- internal_deploy
- check_deploy
- testkitchen_deploy
- testkitchen_testing
- pkg_metrics
- image_build
- image_deploy
- deploy6
- deploy7
- choco_build
- choco_deploy
- deploy_invalidate
- trigger_release
- e2e
- testkitchen_cleanup
- notify
variables:
# The SRC_PATH is in the GOPATH of the builders which
# currently is /go
SRC_PATH: /go/src/github.com/DataDog/datadog-agent
# Directory in which we execute the omnibus build.
# For an unknown reason, it does not go well with
# a ruby dependency if we build directly into $CI_PROJECT_DIR/.omnibus
OMNIBUS_BASE_DIR: /.omnibus
# Directory in which we put the artifacts after the build
# Must be in $CI_PROJECT_DIR
OMNIBUS_PACKAGE_DIR: $CI_PROJECT_DIR/.omnibus/pkg/
# Directory in which we execute the omnibus build for SUSE
# as we want to separate the RPM built for this distro.
OMNIBUS_BASE_DIR_SUSE: /.omnibus/suse
# Directory in which we put the artifacts after the build
# Must be in $CI_PROJECT_DIR
OMNIBUS_PACKAGE_DIR_SUSE: $CI_PROJECT_DIR/.omnibus/suse/pkg
OMNIBUS_BASE_DIR_WIN: c:\omni-base\$CI_RUNNER_ID
OMNIBUS_BASE_DIR_WIN_OMNIBUS: c:/omni-base/$CI_RUNNER_ID
DD_AGENT_TESTING_DIR: $CI_PROJECT_DIR/test/kitchen
STATIC_BINARIES_DIR: bin/static
DOGSTATSD_BINARIES_DIR: bin/dogstatsd
AGENT_BINARIES_DIR: bin/agent
CLUSTER_AGENT_BINARIES_DIR: bin/datadog-cluster-agent
CLUSTER_AGENT_CLOUDFOUNDRY_BINARIES_DIR: bin/datadog-cluster-agent-cloudfoundry
SYSTEM_PROBE_BINARIES_DIR: bin/system-probe
DEB_S3_BUCKET: apt.datad0g.com
RPM_S3_BUCKET: yum.datad0g.com
MACOS_S3_BUCKET: dd-agent-macostesting
WIN_S3_BUCKET: dd-agent-mstesting
PROCESS_S3_BUCKET: datad0g-process-agent
ANDROID_S3_BUCKET: dd-agent-androidtesting
DEB_RPM_BUCKET_BRANCH: nightly # branch of the DEB_S3_BUCKET and RPM_S3_BUCKET repos to release to, 'nightly' or 'beta'
DEB_TESTING_S3_BUCKET: apttesting.datad0g.com
RPM_TESTING_S3_BUCKET: yumtesting.datad0g.com
WINDOWS_TESTING_S3_BUCKET_A6: pipelines/A6/$CI_PIPELINE_ID
WINDOWS_TESTING_S3_BUCKET_A7: pipelines/A7/$CI_PIPELINE_ID
WINDOWS_BUILDS_S3_BUCKET: $WIN_S3_BUCKET/builds
ANDROID_BUILDS_S3_BUCKET: $ANDROID_S3_BUCKET/builds
DEB_RPM_TESTING_BUCKET_BRANCH: testing # branch of the DEB_TESTING_S3_BUCKET and RPM_TESTING_S3_BUCKET repos to release to, 'testing'
DD_REPO_BRANCH_NAME: $CI_COMMIT_REF_NAME
S3_CP_OPTIONS: --only-show-errors --region us-east-1 --sse AES256
S3_CP_CMD: aws s3 cp $S3_CP_OPTIONS
S3_ARTIFACTS_URI: s3://dd-ci-artefacts-build-stable/$CI_PROJECT_NAME/$CI_PIPELINE_ID
## comment out both lines below (S3_OMNIBUS_CACHE_BUCKET and USE_S3_CACHING) to allow
## build to succeed with S3 caching disabled.
S3_OMNIBUS_CACHE_BUCKET: dd-ci-datadog-agent-omnibus-cache-build-stable
USE_S3_CACHING: --omnibus-s3-cache
S3_DSD6_URI: s3://dsd6-staging
RELEASE_VERSION_6: nightly
RELEASE_VERSION_7: nightly-a7
DATADOG_AGENT_BUILDIMAGES: v2894686-d80c3ce
DATADOG_AGENT_BUILDERS: v2894668-736db00
DATADOG_AGENT_WINBUILDIMAGES: v3078400-b2b4314
DATADOG_AGENT_ARMBUILDIMAGES: v2894686-d80c3ce
DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v2894686-d80c3ce
BCC_VERSION: v0.12.0
SYSTEM_PROBE_GO_VERSION: 1.14.7
DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded
#
# Condition mixins for simplification of rules
#
.if_master_branch: &if_master_branch
if: $CI_COMMIT_BRANCH == "master"
.if_not_master_branch: &if_not_master_branch
if: $CI_COMMIT_BRANCH != "master"
.if_tagged_commit: &if_tagged_commit
if: $CI_COMMIT_TAG != null
.if_not_tagged_commit: &if_not_tagged_commit
if: $CI_COMMIT_TAG == null
# Run job only on deploy pipelines
.if_deploy: &if_deploy
if: $DEPLOY_AGENT == "true"
.if_deploy_6: &if_deploy_6
if: $DEPLOY_AGENT == "true" && $RELEASE_VERSION_6 != ""
.if_deploy_7: &if_deploy_7
if: $DEPLOY_AGENT == "true" && $RELEASE_VERSION_7 != ""
.if_not_deploy: &if_not_deploy
if: $DEPLOY_AGENT != "true"
# anchor to trigger test kitchen setup, run, and cleanup (so all stages
# are run if one stage is run). Triggers as defined:
# - master
# - tags (a tagged build)
# - deploys (as above)
# - web (when the build is triggered by a specific build request through the
# web interface. This way, if a kitchen run is desired on a specific branch,
# it can be triggered by requesting a specific build)
# - api (when the build is triggered by an API call)
#
.if_test_kitchen_deploy: &if_test_kitchen_deploy
if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG != null || $DEPLOY_AGENT == "true" || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "api"
.if_not_test_kitchen_deploy: &if_not_test_kitchen_deploy
if: $CI_COMMIT_BRANCH != "master" && $CI_COMMIT_TAG == null && $DEPLOY_AGENT != "true" && $CI_PIPELINE_SOURCE != "web" && $CI_PIPELINE_SOURCE != "api"
# true only on deploys and when RELEASE_VERSION_X is NOT "nightly". In this setting
# we are building either a new tagged version of the agent (an RC for example).
# In both cases the artifacts should be uploaded to our staging repository.
.if_deploy_on_tag_6: &if_deploy_on_tag_6
# no RELEASE_VERSION means a nightly build for omnibus
if: $DEPLOY_AGENT == "true" && $RELEASE_VERSION_6 != "nightly" && $RELEASE_VERSION_6 != ""
.if_not_deploy_on_tag_6: &if_not_deploy_on_tag_6
# no RELEASE_VERSION means a nightly build for omnibus
if: $DEPLOY_AGENT != "true" || $RELEASE_VERSION_6 == "nightly" || $RELEASE_VERSION_6 == ""
.if_deploy_on_tag_7: &if_deploy_on_tag_7
# no RELEASE_VERSION means a nightly build for omnibus
if: $DEPLOY_AGENT == "true" && $RELEASE_VERSION_7 != "nightly-a7" && $RELEASE_VERSION_7 != ""
.if_not_deploy_on_tag_7: &if_not_deploy_on_tag_7
# no RELEASE_VERSION means a nightly build for omnibus
if: $DEPLOY_AGENT != "true" || $RELEASE_VERSION_7 == "nightly-a7" || $RELEASE_VERSION_7 == ""
# true only on deploys and when RELEASE_VERSION_X is "nightly". In this setting we
# build from master and update the nightly build for windows, linux and docker.
.if_deploy_on_nightly: &if_deploy_on_nightly
if: $DEPLOY_AGENT == "true" && $RELEASE_VERSION_6 == "nightly" && $RELEASE_VERSION_7 == "nightly-a7"
.if_not_deploy_on_nightly: &if_not_deploy_on_nightly
if: $DEPLOY_AGENT != "true" || $RELEASE_VERSION_6 != "nightly" || $RELEASE_VERSION_7 != "nightly-a7"
# true only when RELEASE_VERSION_X is not set
.if_version_6: &if_version_6
if: $RELEASE_VERSION_6 != ""
.if_not_version_6: &if_not_version_6
if: $RELEASE_VERSION_6 == ""
.if_version_7: &if_version_7
if: $RELEASE_VERSION_7 != ""
.if_not_version_7: &if_not_version_7
if: $RELEASE_VERSION_7 == ""
#
# deps_build
#
#
# build libbcc
.build_libbcc_common:
stage: deps_build
script:
- git clone -b "$BCC_VERSION" --depth=1 https://github.com/iovisor/bcc.git /tmp/bcc
# Patch libbcc to remove references to glibc symbols with a too recent version
- cd /tmp/bcc
- patch -p1 < "$CI_PROJECT_DIR"/omnibus/config/software/libbcc_compat.patch
- mkdir /tmp/bcc/build
- cd /tmp/bcc/build
- cmake .. -DCMAKE_INSTALL_PREFIX=/opt/libbcc -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath,$DATADOG_AGENT_EMBEDDED_PATH/lib" -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-rpath,$DATADOG_AGENT_EMBEDDED_PATH/lib"
- make -j 4 #"$(nproc)"
# Check that libbcc has no references to too recent glibc
- objdump -p src/cc/libbcc.so | grep GLIBC_2.29 && exit 1
- objdump -p src/cc/libbcc.so | grep GLIBC_2.26 && exit 1
- make install
- cd /opt/libbcc
- chmod go-rwx lib/libbcc*
- rm -rf share/bcc/examples share/bcc/introspection share/bcc/man share/bcc/tools lib/python2* lib/python3*
- cp $(ldd lib/libbcc.so | awk '$1 ~ /^libtinfo/ {system("dirname " $3)}')/libtinfo* lib
- tar cvaf /tmp/libbcc.tar.xz .
- $S3_CP_CMD /tmp/libbcc.tar.xz $S3_ARTIFACTS_URI/libbcc-$ARCH.tar.xz
build_libbcc_x64:
extends: .build_libbcc_common
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
variables:
ARCH: amd64
build_libbcc_arm64:
extends: .build_libbcc_common
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
variables:
ARCH: arm64
#
# source_test
#
#
.go_deps:
stage: deps_fetch
needs: []
script:
# HACK: empty the build directory cache (that can come from previous runs)
# to not have remainders of previous runs, which can make our deps bootstrapping logic fail.
# TODO: remove this once we switch to k8s runners, they won't have this problem
- find "$CI_BUILDS_DIR" ! -path '*DataDog/datadog-agent*' -depth # -delete implies -depth
- find "$CI_BUILDS_DIR" ! -path '*DataDog/datadog-agent*' -delete || true # Allow failure, we can't remove parent folders of datadog-agent
- inv -e deps --verbose
- cd $GOPATH/pkg && tar czf $CI_PROJECT_DIR/go-pkg.tar.gz .
- cd $GOPATH/bin && tar czf $CI_PROJECT_DIR/go-bin.tar.gz .
- cd $CI_PROJECT_DIR/vendor && tar czf $CI_PROJECT_DIR/vendor.tar.gz .
artifacts:
expire_in: 1 day
paths:
- $CI_PROJECT_DIR/go-pkg.tar.gz
- $CI_PROJECT_DIR/go-bin.tar.gz
- $CI_PROJECT_DIR/vendor.tar.gz
linux_x64_go_deps:
extends: .go_deps
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
linux_arm64_go_deps:
extends: .go_deps
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
linux_armhf_go_deps:
extends: .go_deps
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_armhf:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
.retrieve_linux_go_deps: &retrieve_linux_go_deps |
mkdir -p $GOPATH/bin && tar xzf go-bin.tar.gz -C $GOPATH/bin
mkdir -p $GOPATH/pkg && tar xzf go-pkg.tar.gz -C $GOPATH/pkg
mkdir vendor && tar xzf vendor.tar.gz -C vendor
rm -f go-bin.tar.gz go-pkg.tar.gz vendor.tar.gz
.tests_windows_base:
stage: source_test
needs: []
tags: ["runner:windows-docker", "windowsversion:1809"]
script:
- docker run --rm -m 8192M -v "$(Get-Location):c:\mnt" -e AWS_NETWORKING=true -e SIGN_WINDOWS=true -e PY_RUNTIMES="$PYTHON_RUNTIMES" -e NEW_BUILDER="$NEW_BUILDER" 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/windows_1809_${ARCH}:$Env:DATADOG_AGENT_WINBUILDIMAGES c:\mnt\tasks\winbuildscripts\unittests.bat
variables:
NEW_BUILDER: "true"
tests_windows-x64:
extends: .tests_windows_base
variables:
PYTHON_RUNTIMES: 3
ARCH: "x64"
tests_windows-x86:
rules:
- <<: *if_not_deploy
# temporarily allow failure for tests
extends: .tests_windows_base
variables:
PYTHON_RUNTIMES: 3
ARCH: "x86"
.tests_preparation: &tests_preparation
needs: ["linux_x64_go_deps"]
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate $CONDA_ENV
- python3 -m pip install wheel
- python3 -m pip install -r requirements.txt
- GO111MODULE=off go get gopkg.in/yaml.v2
- GO111MODULE=off go get github.com/stretchr/testify
- inv -e rtloader.make --install-prefix=$SRC_PATH/dev --python-runtimes "$PYTHON_RUNTIMES"
- inv -e rtloader.install
- inv -e rtloader.format --raise-if-changed
- inv -e rtloader.test
# run tests for deb-x64
tests_deb-x64-py2:
stage: source_test
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
variables:
PYTHON_RUNTIMES: '2'
CONDA_ENV: ddpy2
<<: *tests_preparation
script:
- inv -e test --race --profile --python-runtimes "$PYTHON_RUNTIMES" --cpus 4
tests_deb-x64-py3:
stage: source_test
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
variables:
PYTHON_RUNTIMES: '3'
CONDA_ENV: ddpy3
<<: *tests_preparation
script:
- inv -e test --race --profile --python-runtimes "$PYTHON_RUNTIMES" --cpus 4
# run tests for rpm-x64
tests_rpm-x64-py2:
stage: source_test
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/rpm_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
variables:
PYTHON_RUNTIMES: '2'
CONDA_ENV: ddpy2
<<: *tests_preparation
script:
# Exclude systemd because it cannot succeed on Centos 6: the image doesn't have the shared object required by
# https://github.com/coreos/go-systemd/blob/c8cc474ba8655dfbdb0ac7fcc09b7faf5b643caf/sdjournal/functions.go#L46
# This is OK because the test on systemd still runs on the debian image above
- inv -e test --race --profile --python-runtimes "$PYTHON_RUNTIMES" --cpus 4 --build-exclude=systemd
tests_rpm-x64-py3:
stage: source_test
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/rpm_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
variables:
PYTHON_RUNTIMES: '3'
CONDA_ENV: ddpy3
<<: *tests_preparation
script:
# Exclude systemd because it cannot succeed on Centos 6: the image doesn't have the shared object required by
# https://github.com/coreos/go-systemd/blob/c8cc474ba8655dfbdb0ac7fcc09b7faf5b643caf/sdjournal/functions.go#L46
# This is OK because the test on systemd still runs on the debian image above
- inv -e test --race --profile --python-runtimes "$PYTHON_RUNTIMES" --cpus 4 --build-exclude=systemd
# run tests for eBPF code
tests_ebpf:
stage: source_test
needs: ["build_libbcc_x64", "linux_x64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_x64:$DATADOG_AGENT_SYSPROBE_BUILDIMAGES
before_script:
- *retrieve_linux_go_deps
- mkdir -p $CI_PROJECT_DIR/.tmp/binary-ebpf
- cd $SRC_PATH
- python3 -m pip install -r requirements.txt
# Retrieve libbcc from S3
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-amd64.tar.xz /tmp/libbcc.tar.xz
- mkdir /opt/libbcc
- tar -xvf /tmp/libbcc.tar.xz -C /opt/libbcc
after_script:
- cd $SRC_PATH
- cp ./pkg/ebpf/c/tracer-ebpf.o $CI_PROJECT_DIR/.tmp/binary-ebpf/tracer-ebpf.o
- cp ./pkg/ebpf/c/tracer-ebpf-debug.o $CI_PROJECT_DIR/.tmp/binary-ebpf/tracer-ebpf-debug.o
- cp ./pkg/ebpf/c/offset-guess.o $CI_PROJECT_DIR/.tmp/binary-ebpf/offset-guess.o
- cp ./pkg/ebpf/c/offset-guess-debug.o $CI_PROJECT_DIR/.tmp/binary-ebpf/offset-guess-debug.o
tags: [ "runner:main", "size:large" ]
script:
# For now only check bpf bytes since we don't have a way to run eBPF tests without mounting a debugfs
- CGO_CFLAGS='-I/opt/libbcc/include' CGO_LDFLAGS='-Wl,-rpath,/opt/libbcc/lib -L/opt/libbcc/lib' inv -e system-probe.test --only-check-bpf-bytes
artifacts:
when: always
paths:
- $CI_PROJECT_DIR/.tmp/binary-ebpf
# scan the dependencies for security vulnerabilities with snyk
security_scan_test:
rules:
- <<: *if_master_branch
stage: source_test
needs: ["linux_x64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/snyk:latest
tags: ["runner:main", "size:large"]
before_script:
# this image isn't built in the datadog-agent-builders repo
# it doesn't have invoke so we install the dependencies without invoke
- *retrieve_linux_go_deps
- mkdir -p $GOPATH/src/github.com/DataDog/datadog-agent
- rsync -azr --delete ./ $GOPATH/src/github.com/DataDog/datadog-agent
- cd $GOPATH/src/github.com/DataDog/datadog-agent
- python3 -m pip install -r requirements.txt
script:
- set +x # don't print the api key to the logs
# send the list of the dependencies to snyk
- SNYK_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.snyk_token --with-decryption --query "Parameter.Value" --out text)
snyk monitor --command=python3 --project-name=datadog-agent-requirements.txt --file=requirements.txt --package-manager=pip
- SNYK_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.snyk_token --with-decryption --query "Parameter.Value" --out text)
snyk monitor --project-name=datadog-agent-go.sum --file=go.mod
# check consistency of go.mod file with project imports
go_mod_tidy_check:
stage: source_test
needs: ["linux_x64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
before_script:
- *retrieve_linux_go_deps
- python3 -m pip install --upgrade --ignore-installed pip setuptools
- python3 -m pip install -r requirements.txt
script:
# Print a message and fail if "go mod tidy" modifies go.mod
- go mod tidy
- git diff-files --exit-code go.mod || (echo "go.mod is out of sync with project imports. Please run 'inv deps' and commit the changes on go.mod/go.sum." && false)
#
# binary_build
#
# build dogstatsd static for deb-x64
build_dogstatsd_static-deb_x64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
needs: ["tests_deb-x64-py3", "linux_x64_go_deps"]
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate ddpy3
script:
- inv -e dogstatsd.build --static --major-version 7
- $S3_CP_CMD $SRC_PATH/$STATIC_BINARIES_DIR/dogstatsd $S3_ARTIFACTS_URI/static/dogstatsd
# build dogstatsd for deb-x64
build_dogstatsd-deb_x64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
needs: ["tests_deb-x64-py3", "linux_x64_go_deps"]
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate ddpy3
script:
- inv -e dogstatsd.build --major-version 7
- $S3_CP_CMD $SRC_PATH/$DOGSTATSD_BINARIES_DIR/dogstatsd $S3_ARTIFACTS_URI/dogstatsd/dogstatsd
# build dogstatsd static for deb-arm
build_dogstatsd_static-deb_arm64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["tests_deb-x64-py3", "linux_arm64_go_deps"]
variables:
ARCH: arm64
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc
# Hack to work around the cloning issue with arm runners
- mkdir -p $GOPATH/src/github.com/DataDog
- cp -R $GOPATH/src/github.com/*/*/DataDog/datadog-agent $GOPATH/src/github.com/DataDog
- cd $SRC_PATH
script:
- inv -e dogstatsd.build --static --major-version 7
- $S3_CP_CMD $SRC_PATH/$STATIC_BINARIES_DIR/dogstatsd $S3_ARTIFACTS_URI/static/dogstatsd.$ARCH
# build dogstatsd linked for deb-arm
build_dogstatsd-deb_arm64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["tests_deb-x64-py3", "linux_arm64_go_deps"]
variables:
ARCH: arm64
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc
# Hack to work around the cloning issue with arm runners
- mkdir -p $GOPATH/src/github.com/DataDog
- cp -R $GOPATH/src/github.com/*/*/DataDog/datadog-agent $GOPATH/src/github.com/DataDog
- cd $SRC_PATH
script:
- inv -e dogstatsd.build --major-version 7
- $S3_CP_CMD $SRC_PATH/$DOGSTATSD_BINARIES_DIR/dogstatsd $S3_ARTIFACTS_URI/dogstatsd/dogstatsd.$ARCH
# build iot agent for deb-x64, to make sure the build is not broken because of build flags
build_iot_agent-deb_x64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
needs: ["tests_deb-x64-py3", "linux_x64_go_deps"]
before_script:
- *retrieve_linux_go_deps
script:
- inv -e agent.build --iot --major-version 7
- $S3_CP_CMD $SRC_PATH/$AGENT_BINARIES_DIR/agent $S3_ARTIFACTS_URI/iot/agent
# build iot agent for ARM, to make sure the build is not broken because of build targets
build_iot_agent-deb_arm64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_BUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["tests_deb-x64-py3", "linux_arm64_go_deps"]
variables:
ARCH: arm64
before_script:
- *retrieve_linux_go_deps
# Hack to work around the cloning issue with arm runners
- mkdir -p $GOPATH/src/github.com/DataDog
- cp -R $GOPATH/src/github.com/*/*/DataDog/datadog-agent $GOPATH/src/github.com/DataDog
- cd $SRC_PATH
script:
- inv -e agent.build --iot --major-version 7
.cluster_agent-build_common: &cluster_agent-build_common
stage: binary_build
needs: ["go_mod_tidy_check"]
script:
# Assuming that by default, the RELEASE_VERSION_7 entry will get used (ie. nightly-a7)
- if [[ "$CI_COMMIT_TAG" =~ ^dca- ]]; then export RELEASE_VERSION="$CI_COMMIT_TAG"; else export RELEASE_VERSION="$RELEASE_VERSION_7"; fi
- inv -e cluster-agent.build --release-version "$RELEASE_VERSION"
- $S3_CP_CMD $SRC_PATH/$CLUSTER_AGENT_BINARIES_DIR/datadog-cluster-agent $S3_ARTIFACTS_URI/datadog-cluster-agent.$ARCH
- $S3_CP_CMD $SRC_PATH/Dockerfiles/cluster-agent/datadog-cluster.yaml $S3_ARTIFACTS_URI/datadog-cluster.yaml
- $S3_CP_CMD $SRC_PATH/Dockerfiles/cluster-agent/security-agent-policies $S3_ARTIFACTS_URI/security-agent-policies --recursive
# For the Windows Docker image
build_windows_container_entrypoint:
rules:
- <<: *if_version_7
when: on_success
stage: binary_build
tags: ["runner:windows-docker", "windowsversion:1809"]
needs:
- tests_windows-x64
variables:
ARCH: "x64"
script:
- if (Test-Path build-out) { remove-item -recurse -force build-out }
- docker run --rm -m 4096M -v "$(Get-Location):c:\mnt" -e CI_JOB_ID=${CI_JOB_ID} -e WINDOWS_BUILDER=true -e AWS_NETWORKING=true -e TARGET_ARCH="$ARCH" 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/windows_1809_${ARCH}:${Env:DATADOG_AGENT_WINBUILDIMAGES} c:\mnt\Dockerfiles\agent\windows\entrypoint\build.bat
- get-childitem build-out\${CI_JOB_ID}
- copy build-out\${CI_JOB_ID}\*.exe ./entrypoint.exe
- remove-item -recurse -force build-out\${CI_JOB_ID}
artifacts:
expire_in: 2 weeks
paths:
- entrypoint.exe
# build cluster-agent bin
cluster_agent-build_amd64:
<<: *cluster_agent-build_common
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
needs: ["go_mod_tidy_check", "linux_x64_go_deps"]
variables:
ARCH: amd64
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate ddpy3
cluster_agent-build_arm64:
<<: *cluster_agent-build_common
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_BUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["go_mod_tidy_check", "linux_arm64_go_deps"]
variables:
ARCH: arm64
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc
# Hack to work around the cloning issue with arm runners
- mkdir -p $GOPATH/src/github.com/DataDog
- cp -R $GOPATH/src/github.com/*/*/DataDog/datadog-agent $GOPATH/src/github.com/DataDog
- cd $SRC_PATH
# build cluster-agent-cloudfoundry bin
cluster_agent_cloudfoundry-build_amd64:
rules:
- <<: *if_version_7
stage: binary_build
needs: ["go_mod_tidy_check", "linux_x64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
artifacts:
expire_in: 2 weeks
paths:
- $OMNIBUS_PACKAGE_DIR
variables:
ARCH: amd64
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate ddpy3
script:
- inv -e cluster-agent-cloudfoundry.build
- cd $SRC_PATH/$CLUSTER_AGENT_CLOUDFOUNDRY_BINARIES_DIR
- mkdir -p $OMNIBUS_PACKAGE_DIR
- export PACKAGE_VERSION=$(inv agent.version --url-safe --major-version 7)
- tar cf $OMNIBUS_PACKAGE_DIR/datadog-cluster-agent-cloudfoundry-$PACKAGE_VERSION-$ARCH.tar.xz datadog-cluster-agent-cloudfoundry
#
# integration_test
#
# run benchmarks on deb
# benchmarks-deb_x64:
# stage: integration_test
# image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
# allow_failure: true # FIXME: this was set to true to temporarily unblock the pipeline
# tags: [ "runner:main", "size:large" ]
# script:
# - inv -e bench.aggregator
# # FIXME: in our docker image, non ascii characters printed by the benchmark
# # make invoke traceback. For now, the workaround is to call the benchmarks
# # manually
# - inv -e bench.build-dogstatsd
# - set +x # make sure we don't output the creds to the build log
# - DD_AGENT_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.dd_agent_api_key --with-decryption --query "Parameter.Value" --out text)
# # dogstatsd validation - not really benchmarking: gitlab isn't the right place to do this.
# - ./bin/benchmarks/dogstatsd -pps=20000 -dur 30 -ser 5 -branch $DD_REPO_BRANCH_NAME -api-key $DD_AGENT_API_KEY
# artifacts:
# expire_in: 2 weeks
# paths:
# - benchmarks
# check the size of the static dogstatsd binary
dogstatsd_x64_size_test:
stage: integration_test
needs: ["build_dogstatsd_static-deb_x64"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:large" ]
before_script:
- source /root/.bashrc && conda activate ddpy3
# Disable global before_script
- mkdir -p $STATIC_BINARIES_DIR
- $S3_CP_CMD $S3_ARTIFACTS_URI/static/dogstatsd $STATIC_BINARIES_DIR/dogstatsd
script:
- inv -e dogstatsd.size-test --skip-build
# check the size of the static dogstatsd binary
dogstatsd_arm64_size_test:
stage: integration_test
needs: ["build_dogstatsd_static-deb_arm64"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
variables:
ARCH: arm64
before_script:
- source /root/.bashrc
# Disable global before_script
- mkdir -p $STATIC_BINARIES_DIR
- $S3_CP_CMD $S3_ARTIFACTS_URI/static/dogstatsd.$ARCH $STATIC_BINARIES_DIR/dogstatsd
script:
- inv -e dogstatsd.size-test --skip-build
.system-probe_build_common:
before_script:
# Hack to work around the cloning issue with arm runners
- mkdir -p $GOPATH/src/github.com/DataDog
- '[[ "$ARCH" == arm64 ]] && cp -R $GOPATH/src/github.com/*/*/DataDog/datadog-agent $GOPATH/src/github.com/DataDog'
- cd $SRC_PATH
# HACK: empty the build directory cache (that can come from previous runs)
# to not have remainders of previous runs, which can make our deps bootstrapping logic fail.
# TODO: remove this once we switch to k8s runners, they won't have this problem
- find "$CI_BUILDS_DIR" ! -path '*DataDog/datadog-agent*' -depth # -delete implies -depth
- find "$CI_BUILDS_DIR" ! -path '*DataDog/datadog-agent*' -delete || true # Allow failure, we can't remove parent folders of datadog-agent
- inv -e deps --verbose
# Retrieve libbcc from S3
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-$ARCH.tar.xz /tmp/libbcc.tar.xz
- mkdir -p $DATADOG_AGENT_EMBEDDED_PATH
- tar -xvf /tmp/libbcc.tar.xz -C $DATADOG_AGENT_EMBEDDED_PATH
script:
- inv -e system-probe.build --go-version=$SYSTEM_PROBE_GO_VERSION --embedded-path=$DATADOG_AGENT_EMBEDDED_PATH
- inv -e system-probe.test --only-check-bpf-bytes
- $S3_CP_CMD $SRC_PATH/$SYSTEM_PROBE_BINARIES_DIR/system-probe $S3_ARTIFACTS_URI/system-probe.$ARCH
- $S3_CP_CMD $SRC_PATH/pkg/ebpf/c/tracer-ebpf.o $S3_ARTIFACTS_URI/tracer-ebpf.o.$ARCH
- $S3_CP_CMD $SRC_PATH/pkg/ebpf/c/tracer-ebpf-debug.o $S3_ARTIFACTS_URI/tracer-ebpf-debug.o.$ARCH
- $S3_CP_CMD $SRC_PATH/pkg/ebpf/c/offset-guess.o $S3_ARTIFACTS_URI/offset-guess.o.$ARCH
- $S3_CP_CMD $SRC_PATH/pkg/ebpf/c/offset-guess-debug.o $S3_ARTIFACTS_URI/offset-guess-debug.o.$ARCH
- $S3_CP_CMD $SRC_PATH/pkg/security/ebpf/c/runtime-security.o $S3_ARTIFACTS_URI/runtime-security.o.$ARCH
- $S3_CP_CMD $SRC_PATH/pkg/security/ebpf/c/runtime-security-syscall-wrapper.o $S3_ARTIFACTS_URI/runtime-security-syscall-wrapper.o.$ARCH
build_system-probe-x64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_x64:$DATADOG_AGENT_SYSPROBE_BUILDIMAGES
needs: ["build_libbcc_x64", "tests_deb-x64-py3"]
tags: [ "runner:main", "size:large" ]
extends: .system-probe_build_common
variables:
ARCH: amd64
build_system-probe-arm64:
stage: binary_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_arm64:$DATADOG_AGENT_SYSPROBE_BUILDIMAGES
needs: ["build_libbcc_arm64", "go_mod_tidy_check"]
tags: ["runner:docker-arm", "platform:arm64"]
extends: .system-probe_build_common
variables:
ARCH: arm64
#
# package_build
#
#
.agent_build_common_deb: &agent_build_common_deb
script:
- echo "About to build for $RELEASE_VERSION"
# remove artifacts from previous pipelines that may come from the cache
- rm -rf $OMNIBUS_PACKAGE_DIR/*
# Artifacts and cache must live within project directory but we run omnibus in a neutral directory.
# Thus, we move the artifacts at the end in a gitlab-friendly dir.
- mkdir -p /tmp/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/system-probe.${PACKAGE_ARCH} /tmp/system-probe/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/tracer-ebpf.o.${PACKAGE_ARCH} /tmp/system-probe/tracer-ebpf.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/tracer-ebpf-debug.o.${PACKAGE_ARCH} /tmp/system-probe/tracer-ebpf-debug.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/offset-guess.o.${PACKAGE_ARCH} /tmp/system-probe/offset-guess.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/offset-guess-debug.o.${PACKAGE_ARCH} /tmp/system-probe/offset-guess-debug.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/runtime-security.o.${PACKAGE_ARCH} /tmp/system-probe/runtime-security.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/runtime-security-syscall-wrapper.o.${PACKAGE_ARCH} /tmp/system-probe/runtime-security-syscall-wrapper.o
- chmod 755 /tmp/system-probe/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-${PACKAGE_ARCH}.tar.xz /tmp/libbcc.tar.xz
# Use --skip-deps since the deps are installed by `before_script`.
- inv -e agent.omnibus-build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --system-probe-bin=/tmp/system-probe --libbcc-tarball=/tmp/libbcc.tar.xz
- $S3_CP_CMD $OMNIBUS_BASE_DIR/pkg/datadog-agent_*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DEB
- $S3_CP_CMD $OMNIBUS_BASE_DIR/pkg/datadog-agent-dbg_*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DBG_DEB
- mkdir -p $OMNIBUS_PACKAGE_DIR && cp $OMNIBUS_BASE_DIR/pkg/datadog-agent*_${PACKAGE_ARCH}.deb{,.metadata.json} $OMNIBUS_PACKAGE_DIR
# TODO: enabling the cache cause builds to be slower and slower on `master`. Re-enable once this is investigated/fixed
# cache:
# # cache per branch
# key: $CI_COMMIT_REF_NAME
# paths:
# - $OMNIBUS_BASE_DIR
artifacts:
expire_in: 2 weeks
paths:
- $OMNIBUS_PACKAGE_DIR
# build Agent package for deb-x64
agent_deb-x64-a6:
rules:
- <<: *if_version_6
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
needs: ["tests_deb-x64-py2", "tests_deb-x64-py3", "build_system-probe-x64", "linux_x64_go_deps"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
CONDA_ENV: ddpy3
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
PACKAGE_ARCH: amd64
DESTINATION_DEB: 'datadog-agent_6_amd64.deb'
DESTINATION_DBG_DEB: 'datadog-agent-dbg_6_amd64.deb'
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate $CONDA_ENV
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *agent_build_common_deb
agent_deb-x64-a7:
rules:
- <<: *if_version_7
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
needs: ["tests_deb-x64-py3", "build_system-probe-x64", "linux_x64_go_deps"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
CONDA_ENV: ddpy3
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
PACKAGE_ARCH: amd64
DESTINATION_DEB: 'datadog-agent_7_amd64.deb'
DESTINATION_DBG_DEB: 'datadog-agent-dbg_7_amd64.deb'
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate $CONDA_ENV
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *agent_build_common_deb
agent_deb-arm64-a6:
rules:
- <<: *if_version_6
stage: package_build
needs: ["go_mod_tidy_check", "build_system-probe-arm64", "linux_arm64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
variables:
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
PACKAGE_ARCH: arm64
DESTINATION_DEB: 'datadog-agent_6_arm64.deb'
DESTINATION_DBG_DEB: 'datadog-agent-dbg_6_arm64.deb'
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *agent_build_common_deb
agent_deb-arm64-a7:
rules:
- <<: *if_version_7
stage: package_build
needs: ["go_mod_tidy_check", "build_system-probe-arm64", "linux_arm64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
variables:
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
PACKAGE_ARCH: arm64
DESTINATION_DEB: 'datadog-agent_7_arm64.deb'
DESTINATION_DBG_DEB: 'datadog-agent-dbg_7_arm64.deb'
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *agent_build_common_deb
.iot_agent_build_common_deb: &iot_agent_build_common_deb
rules:
- <<: *if_version_7
script:
- *retrieve_linux_go_deps
- echo "About to build for $RELEASE_VERSION_7"
- echo "Detected host architecture $(uname -m)"
# $DD_TARGET_ARCH is only set by Arm build images, so assume amd64 if not present
- echo "Target architecture ${DD_TARGET_ARCH:=amd64}"
# remove artifacts from previous pipelines that may come from the cache
- rm -rf $OMNIBUS_PACKAGE_DIR/*
# Artifacts and cache must live within project directory but we run omnibus in a neutral directory.
# Thus, we move the artifacts at the end in a gitlab-friendly dir.
# Use --skip-deps since the deps are installed by `before_script`.
- inv -e agent.omnibus-build --iot --log-level debug --release-version "$RELEASE_VERSION_7" --major-version 7 --base-dir $OMNIBUS_BASE_DIR --skip-deps
- find $OMNIBUS_BASE_DIR/pkg
- find $OMNIBUS_BASE_DIR/pkg -name "datadog-iot-agent*_${PACKAGE_ARCH}.deb" -exec dpkg -c {} \;
- $S3_CP_CMD $OMNIBUS_BASE_DIR/pkg/datadog-iot-agent*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DEB
- mkdir -p $OMNIBUS_PACKAGE_DIR && cp $OMNIBUS_BASE_DIR/pkg/datadog-iot-agent*_${PACKAGE_ARCH}.deb{,.metadata.json} $OMNIBUS_PACKAGE_DIR
# TODO: enabling the cache cause builds to be slower and slower on `master`. Re-enable once this is investigated/fixed
# cache:
# # cache per branch
# key: $CI_COMMIT_REF_NAME
# paths:
# - $OMNIBUS_BASE_DIR
artifacts:
expire_in: 2 weeks
paths:
- $OMNIBUS_PACKAGE_DIR
iot_agent_deb-x64:
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
needs: ["linux_x64_go_deps"]
variables:
PACKAGE_ARCH: amd64
DESTINATION_DEB: 'datadog-iot-agent_7_amd64.deb'
<<: *iot_agent_build_common_deb
iot_agent_deb-arm64:
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["linux_arm64_go_deps"]
variables:
PACKAGE_ARCH: arm64
DESTINATION_DEB: 'datadog-iot-agent_7_arm64.deb'
<<: *iot_agent_build_common_deb
iot_agent_deb-armhf:
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_armhf:$DATADOG_AGENT_ARMBUILDIMAGES
# Run with platform:arm64 since no platform:armhf exists and arm64 should be backwards compatible
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["linux_armhf_go_deps"]
variables:
PACKAGE_ARCH: armhf
DESTINATION_DEB: 'datadog-iot-agent_7_armhf.deb'
<<: *iot_agent_build_common_deb
.agent_build_common_rpm: &agent_build_common_rpm
script:
- echo "About to build for $RELEASE_VERSION"
# remove artifacts from previous pipelines that may come from the cache
- rm -rf $OMNIBUS_PACKAGE_DIR/*
# Artifacts and cache must live within project directory but we run omnibus in a neutral directory.
# Thus, we move the artifacts at the end in a gitlab-friendly dir.
- set +x
- RPM_GPG_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.rpm_signing_private_key_e09422b3 --with-decryption --query "Parameter.Value" --out text)
- printf -- "$RPM_GPG_KEY" | gpg --import --batch
- export RPM_SIGNING_PASSPHRASE=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.rpm_signing_key_passphrase_e09422b3 --with-decryption --query "Parameter.Value" --out text)
- set -x
- mkdir -p /tmp/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/system-probe.${PACKAGE_ARCH} /tmp/system-probe/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/tracer-ebpf.o.${PACKAGE_ARCH} /tmp/system-probe/tracer-ebpf.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/tracer-ebpf-debug.o.${PACKAGE_ARCH} /tmp/system-probe/tracer-ebpf-debug.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/offset-guess.o.${PACKAGE_ARCH} /tmp/system-probe/offset-guess.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/offset-guess-debug.o.${PACKAGE_ARCH} /tmp/system-probe/offset-guess-debug.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/runtime-security.o.${PACKAGE_ARCH} /tmp/system-probe/runtime-security.o
- $S3_CP_CMD $S3_ARTIFACTS_URI/runtime-security-syscall-wrapper.o.${PACKAGE_ARCH} /tmp/system-probe/runtime-security-syscall-wrapper.o
- chmod 755 /tmp/system-probe/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-${PACKAGE_ARCH}.tar.xz /tmp/libbcc.tar.xz
# use --skip-deps since the deps are installed by `before_script`
- inv -e agent.omnibus-build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --system-probe-bin=/tmp/system-probe --libbcc-tarball=/tmp/libbcc.tar.xz
- find $OMNIBUS_BASE_DIR/pkg -type f -name '*.rpm' ! -name '*dbg*.rpm' -print0 | xargs -0 -I '{}' rpm -i '{}'
- find $OMNIBUS_BASE_DIR/pkg -type f -name '*dbg*.rpm' -print0 | xargs -0 -I '{}' rpm -i '{}'
- mkdir -p $OMNIBUS_PACKAGE_DIR && cp $OMNIBUS_BASE_DIR/pkg/*.{rpm,metadata.json} $OMNIBUS_PACKAGE_DIR
# TODO: enabling the cache cause builds to be slower and slower on `master`. Re-enable once this is investigated/fixed
# cache:
# # cache per branch
# key: $CI_COMMIT_REF_NAME
# paths:
# - $OMNIBUS_BASE_DIR
artifacts:
expire_in: 2 weeks
paths:
- $OMNIBUS_PACKAGE_DIR
# build Agent package for rpm-x64
agent_rpm-x64-a6:
rules:
- <<: *if_version_6
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/rpm_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
needs: ["tests_rpm-x64-py2", "tests_rpm-x64-py3", "build_system-probe-x64", "linux_x64_go_deps"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
PACKAGE_ARCH: amd64
CONDA_ENV: ddpy3
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate $CONDA_ENV
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *agent_build_common_rpm
# build Agent package for rpm-x64
agent_rpm-x64-a7:
rules:
- <<: *if_version_7
stage: package_build
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/rpm_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
needs: ["tests_rpm-x64-py3", "build_system-probe-x64", "linux_x64_go_deps"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
PACKAGE_ARCH: amd64
CONDA_ENV: ddpy3
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc && conda activate $CONDA_ENV
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *agent_build_common_rpm
# build Agent package for rpm-arm64
agent_rpm-arm64-a6:
rules:
- <<: *if_version_6
stage: package_build
needs: ["go_mod_tidy_check", "build_system-probe-arm64", "linux_arm64_go_deps"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/rpm_arm64:$DATADOG_AGENT_ARMBUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
variables:
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
PACKAGE_ARCH: arm64
before_script:
- *retrieve_linux_go_deps
- source /root/.bashrc
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *agent_build_common_rpm
# build Agent package for rpm-arm64
agent_rpm-arm64-a7:
rules:
- <<: *if_version_7
stage: package_build
needs: ["go_mod_tidy_check", "build_system-probe-arm64", "linux_arm64_go_deps"]