forked from DataDog/datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
3012 lines (2701 loc) · 134 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'
stages:
- fail_on_tag
- deps_build
- source_test
- binary_build
- integration_test
- package_build
- internal_deploy
- check_deploy
- testkitchen_deploy
- testkitchen_testing
- pkg_metrics
- image_build
- image_deploy
- deploy6
- deploy7
- deploy_invalidate
- 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
SYSTEM_PROBE_BINARIES_DIR: bin/system-probe
DEB_S3_BUCKET: apt.datad0g.com
RPM_S3_BUCKET: yum.datad0g.com
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: v2195996-580f7f3
DATADOG_AGENT_BUILDERS: v2235609-1baad87
DATADOG_AGENT_WINBUILDIMAGES: v2123666-a884483
DATADOG_AGENT_ARMBUILDIMAGES: v2195996-580f7f3
DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v2251287-69dedcf
BCC_VERSION: v0.12.0
#
# Trigger conditions
#
# run job only when triggered by an external tool (ex: Jenkins). This is used
# for jobs that run both on nightlies and tags
.run_when_triggered: &run_when_triggered
only:
- triggers
# 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)
# - triggers (as above, when triggered by an external tool like jenkins)
# - 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)
#
.run_when_testkitchen_triggered: &run_when_testkitchen_triggered
only:
- master
- tags
- triggers
- web
# run job only when triggered by an external tool (ex: Jenkins) 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.
.run_when_triggered_on_tag_6: &run_when_triggered_on_tag_6
only:
refs:
- triggers
except: # we have to use except since gitlab doens't handle '!=' operator
variables:
- $RELEASE_VERSION_6 == "nightly"
- $RELEASE_VERSION_6 == "" # no RELEASE_VERSION means a nightly build for omnibus
.run_when_triggered_on_tag_7: &run_when_triggered_on_tag_7
only:
refs:
- triggers
except: # we have to use except since gitlab doens't handle '!=' operator
variables:
- $RELEASE_VERSION_7 == "nightly-a7"
- $RELEASE_VERSION_7 == "" # no RELEASE_VERSION means a nightly build for omnibus
# run job only when triggered by an external tool (ex: Jenkins) and when
# RELEASE_VERSION_X is "nightly". In this setting we build from master and update
# the nightly build for windows, linux and docker.
.run_when_triggered_on_nightly: &run_when_triggered_on_nightly
only:
refs:
- triggers
variables:
- $RELEASE_VERSION_6 == "nightly"
- $RELEASE_VERSION_7 == "nightly-a7"
# run job only when triggered on nightly AND when it's a merge to master
.run_when_triggered_on_nightly_or_master: &run_when_triggered_on_nightly_or_master
only:
refs:
- triggers
- master
variables:
- $RELEASE_VERSION_6 == "nightly"
- $RELEASE_VERSION_7 == "nightly-a7"
# skip job only when triggered by an external tool (ex: Jenkins) and when
# BUILD_AGENT_X is set to "no".
.skip_when_unwanted_on_6: &skip_when_unwanted_on_6
except:
variables:
- $RELEASE_VERSION_6 == ""
.skip_when_unwanted_on_7: &skip_when_unwanted_on_7
except:
variables:
- $RELEASE_VERSION_7 == ""
# Fail if we're running a pipeline on a non-triggered tag build
# NOTE: All jobs with 'needs' dependencies should also 'need' this to workaround a Gitlab issue: https://gitlab.com/gitlab-org/gitlab/issues/31526
fail_on_non_triggered_tag:
stage: fail_on_tag
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64:$DATADOG_AGENT_BUILDIMAGES
tags: [ "runner:main", "size:2xlarge" ]
script:
- echo CI_PIPELINE_SOURCE=$CI_PIPELINE_SOURCE CI_COMMIT_TAG=$CI_COMMIT_TAG
- '[ "$CI_COMMIT_TAG" == "" -o "$CI_PIPELINE_SOURCE" != "push" ]'
#
# deps_build
#
#
# build libbcc
.build_libbcc_common:
stage: deps_build
needs: ["fail_on_non_triggered_tag"]
script:
- git clone -b "$BCC_VERSION" --depth=1 https://github.com/iovisor/bcc.git /tmp/bcc
- mkdir /tmp/bcc/build
- cd /tmp/bcc/build
- cmake .. -DCMAKE_INSTALL_PREFIX=/opt/libbcc -DCMAKE_EXE_LINKER_FLAGS='-Wl,-rpath,/opt/datadog-agent/embedded/lib' -DCMAKE_SHARED_LINKER_FLAGS='-Wl,-rpath,/opt/datadog-agent/embedded/lib'
- make -j 4 #"$(nproc)"
- make install
- cd /opt/libbcc
- chmod go-rwx lib/libbcc*
- rm share/bcc/introspection/bps
- 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
#
#
# run tests for windows-64
.run_tests_windows_base:
stage: source_test
needs: ["fail_on_non_triggered_tag"]
tags: ["runner:windows-docker", "windowsversion:1809"]
script:
- docker run --rm -m 4096M -v "$(Get-Location):c:\mnt" -e IS_AWS_CONTAINER=true -e SIGN_WINDOWS=true -e PY_RUNTIMES="$PYTHON_RUNTIMES" 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/windows_${ARCH}:$Env:DATADOG_AGENT_WINBUILDIMAGES c:\mnt\tasks\winbuildscripts\unittests.bat
run_tests_windows-x64:
# temporarily allow failure for tests
extends: .run_tests_windows_base
allow_failure: true
variables:
PYTHON_RUNTIMES: 3
ARCH: "x64"
run_tests_windows-x86:
<<: *run_when_triggered_on_nightly_or_master
# temporarily allow failure for tests
extends: .run_tests_windows_base
allow_failure: true
variables:
PYTHON_RUNTIMES: 3
ARCH: "x86"
.run_tests_preparation: &run_tests_preparation
needs: ["fail_on_non_triggered_tag"]
before_script:
- source /root/.bashrc && conda activate $CONDA_ENV
- pip install wheel
- pip install -r requirements.txt
- go get gopkg.in/yaml.v2
- 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
- inv -e deps --verbose --dep-vendor-only
# run tests for deb-x64
run_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
<<: *run_tests_preparation
script:
- inv -e test --race --profile --python-runtimes "$PYTHON_RUNTIMES" --cpus 4
run_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
<<: *run_tests_preparation
script:
- inv -e test --race --profile --python-runtimes "$PYTHON_RUNTIMES" --cpus 4
# run tests for rpm-x64
run_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
<<: *run_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_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
<<: *run_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
run_tests_ebpf:
stage: source_test
needs: ["fail_on_non_triggered_tag", "build_libbcc_x64"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_x64:$DATADOG_AGENT_BUILDIMAGES
before_script:
- cd $SRC_PATH
- pip3 install distro -c requirements.txt # needed for some of our invoke tasks until the builders image contain it
- inv -e deps --verbose --dep-vendor-only
# 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
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
# scan the dependencies for security vulnerabilities with snyk
run_security_scan_test:
stage: source_test
needs: ["fail_on_non_triggered_tag"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/snyk:latest
tags: ["runner:main", "size:large"]
only:
- master
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
- 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
- pip install -r requirements.txt
- inv -e deps --dep-vendor-only
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 --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-gopkg.lock --file=Gopkg.lock
# check consistency of Gopkg.lock
run_dep_check_lock:
stage: source_test
needs: ["fail_on_non_triggered_tag"]
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:
- cd $SRC_PATH
- pip install --upgrade --ignore-installed pip setuptools
- pip install -r requirements.txt
- inv -e deps --no-dep-ensure --no-checks
script:
# Print a message and fail if dep check fails
- dep check --skip-vendor || (echo "Gopkg.lock is out of sync with Gopkg.toml and project imports. Please run 'inv deps' and commit the change on Gopkg.lock." && 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: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3"]
before_script:
- source /root/.bashrc && conda activate ddpy3
- inv -e deps --verbose --dep-vendor-only
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: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3"]
before_script:
- source /root/.bashrc && conda activate ddpy3
- inv -e deps --verbose --dep-vendor-only
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_BUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3"]
variables:
ARCH: arm64
before_script:
- 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
- inv -e deps --verbose --dep-vendor-only
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_BUILDIMAGES
tags: ["runner:docker-arm", "platform:arm64"]
needs: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3"]
variables:
ARCH: arm64
before_script:
- 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
- inv -e deps --verbose --dep-vendor-only
script:
- inv -e dogstatsd.build --major-version 7
- $S3_CP_CMD $SRC_PATH/$DOGSTATSD_BINARIES_DIR/dogstatsd $S3_ARTIFACTS_URI/dogstatsd/dogstatsd.$ARCH
# build puppy agent for deb-x64, to make sure the build is not broken because of build flags
build_puppy_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: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3"]
before_script:
- source /root/.bashrc && conda activate ddpy3
- inv -e deps --verbose --dep-vendor-only --no-checks
script:
- inv -e agent.build --puppy --major-version 7
- $S3_CP_CMD $SRC_PATH/$AGENT_BINARIES_DIR/agent $S3_ARTIFACTS_URI/puppy/agent
# build puppy agent for ARM, to make sure the build is not broken because of build targets
build_puppy_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: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3"]
variables:
ARCH: arm64
before_script:
- 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
- inv -e deps --verbose --dep-vendor-only --no-checks
script:
- GOOS=linux GOARCH=arm inv -e agent.build --puppy --major-version 7
.cluster_agent-build_common: &cluster_agent-build_common
stage: binary_build
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock"]
script:
- inv -e cluster-agent.build
- $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
# 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" ]
variables:
ARCH: amd64
before_script:
- source /root/.bashrc && conda activate ddpy3
- inv -e deps --verbose --dep-vendor-only
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"]
variables:
ARCH: arm64
before_script:
- 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
- inv -e deps --verbose --dep-vendor-only
#
# integration_test
#
# run benchmarks on deb
# run_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
run_dogstatsd_size_test:
stage: integration_test
needs: ["fail_on_non_triggered_tag", "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
run_dogstatsd_arm_size_test:
stage: integration_test
needs: ["fail_on_non_triggered_tag", "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
- inv -e deps --verbose --dep-vendor-only
# Retrieve libbcc from S3
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-$ARCH.tar.xz /tmp/libbcc.tar.xz
- mkdir -p /opt/datadog-agent/embedded
- tar -xvf /tmp/libbcc.tar.xz -C /opt/datadog-agent/embedded
script:
- CGO_CFLAGS='-I/opt/datadog-agent/embedded/include' CGO_LDFLAGS='-Wl,-rpath,/opt/datadog-agent/embedded/lib -L/opt/datadog-agent/embedded/lib' inv -e system-probe.build
- 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
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: ["fail_on_non_triggered_tag", "build_libbcc_x64", "run_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: ["fail_on_non_triggered_tag", "build_libbcc_arm64", "run_dep_check_lock"]
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.
# Use --skip-deps since the deps are installed by `before_script`.
- $S3_CP_CMD $S3_ARTIFACTS_URI/system-probe.${PACKAGE_ARCH} /tmp/system-probe
- chmod 755 /tmp/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-${PACKAGE_ARCH}.tar.xz /tmp/libbcc.tar.xz
- 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:
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: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py2", "run_tests_deb-x64-py3", "build_system-probe-x64"]
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:
- source /root/.bashrc && conda activate $CONDA_ENV
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *skip_when_unwanted_on_6
<<: *agent_build_common_deb
agent_deb-x64-a7:
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: ["fail_on_non_triggered_tag", "run_tests_deb-x64-py3", "build_system-probe-x64"]
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:
- source /root/.bashrc && conda activate $CONDA_ENV
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *skip_when_unwanted_on_7
<<: *agent_build_common_deb
agent_deb-arm-a6:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock", "build_system-probe-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:
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:
- source /root/.bashrc
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *skip_when_unwanted_on_6
<<: *agent_build_common_deb
agent_deb-arm-a7:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock", "build_system-probe-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:
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:
- source /root/.bashrc
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *skip_when_unwanted_on_7
<<: *agent_build_common_deb
# build Agent package for deb-x64
puppy_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: ["fail_on_non_triggered_tag", "build_puppy_agent-deb_x64", "build_system-probe-x64"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
PACKAGE_ARCH: amd64
before_script:
- source /root/.bashrc && conda activate ddpy3
- inv -e deps --verbose --dep-vendor-only --no-checks
<<: *skip_when_unwanted_on_7
script:
# 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`.
- $S3_CP_CMD $S3_ARTIFACTS_URI/system-probe.${PACKAGE_ARCH} /tmp/system-probe
- chmod 755 /tmp/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-${PACKAGE_ARCH}.tar.xz /tmp/libbcc.tar.xz
- inv -e agent.omnibus-build --puppy --log-level debug --release-version "$RELEASE_VERSION_7" --major-version 7 --base-dir $OMNIBUS_BASE_DIR --skip-deps --system-probe-bin=/tmp/system-probe --libbcc-tarball=/tmp/libbcc.tar.xz
- find $OMNIBUS_BASE_DIR/pkg -name "datadog-puppy*_amd64.deb" -exec dpkg -c {} \;
- $S3_CP_CMD $OMNIBUS_BASE_DIR/pkg/datadog-puppy*_amd64.deb $S3_ARTIFACTS_URI/datadog-puppy_amd64.deb
- mkdir -p $OMNIBUS_PACKAGE_DIR && cp $OMNIBUS_BASE_DIR/pkg/datadog-puppy*_amd64.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
.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
# use --skip-deps since the deps are installed by `before_script`
- $S3_CP_CMD $S3_ARTIFACTS_URI/system-probe.${PACKAGE_ARCH} /tmp/system-probe
- chmod 755 /tmp/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-${PACKAGE_ARCH}.tar.xz /tmp/libbcc.tar.xz
- 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:
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: ["fail_on_non_triggered_tag", "run_tests_rpm-x64-py2", "run_tests_rpm-x64-py3", "build_system-probe-x64"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
PACKAGE_ARCH: amd64
CONDA_ENV: ddpy3
before_script:
- source /root/.bashrc && conda activate $CONDA_ENV
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *skip_when_unwanted_on_6
<<: *agent_build_common_rpm
# build Agent package for rpm-x64
agent_rpm-x64-a7:
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: ["fail_on_non_triggered_tag", "run_tests_rpm-x64-py3", "build_system-probe-x64"]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
PACKAGE_ARCH: amd64
CONDA_ENV: ddpy3
before_script:
- source /root/.bashrc && conda activate $CONDA_ENV
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *skip_when_unwanted_on_7
<<: *agent_build_common_rpm
# build Agent package for rpm-arm64
agent_rpm-arm-a6:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock", "build_system-probe-arm64"]
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:
- source /root/.bashrc
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_6
<<: *skip_when_unwanted_on_6
<<: *agent_build_common_rpm
# build Agent package for rpm-arm64
agent_rpm-arm-a7:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock", "build_system-probe-arm64"]
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: 7
PYTHON_RUNTIMES: '3'
PACKAGE_ARCH: arm64
before_script:
- source /root/.bashrc
- inv -e deps --verbose --dep-vendor-only
- export RELEASE_VERSION=$RELEASE_VERSION_7
<<: *skip_when_unwanted_on_7
<<: *agent_build_common_rpm
.agent_build_common_suse_rpm: &agent_build_common_suse_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_SUSE/*
# 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
# use --skip-deps since the deps are installed by `before_script`
- $S3_CP_CMD $S3_ARTIFACTS_URI/system-probe.${PACKAGE_ARCH} /tmp/system-probe
- chmod 755 /tmp/system-probe
- $S3_CP_CMD $S3_ARTIFACTS_URI/libbcc-${PACKAGE_ARCH}.tar.xz /tmp/libbcc.tar.xz
- inv -e agent.omnibus-build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --base-dir $OMNIBUS_BASE_DIR_SUSE ${USE_S3_CACHING} --skip-deps --system-probe-bin=/tmp/system-probe --libbcc-tarball=/tmp/libbcc.tar.xz
- find $OMNIBUS_BASE_DIR_SUSE/pkg -type f -name '*.rpm' ! -name '*dbg*.rpm' -print0 | xargs -0 -I '{}' zypper in '{}'
- find $OMNIBUS_BASE_DIR_SUSE/pkg -type f -name '*dbg*.rpm' -print0 | xargs -0 -I '{}' zypper in '{}'
- mkdir -p $OMNIBUS_PACKAGE_DIR_SUSE && cp $OMNIBUS_BASE_DIR_SUSE/pkg/*.{rpm,metadata.json} $OMNIBUS_PACKAGE_DIR_SUSE
# FIXME: skip the installation step until we fix the preinst/postinst scripts in the rpm package
# to also work with SUSE11
# - rpm -i $OMNIBUS_PACKAGE_DIR_SUSE/*.rpm
# 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_SUSE
artifacts:
expire_in: 2 weeks
paths:
- $OMNIBUS_PACKAGE_DIR_SUSE
# build Agent package for suse-x64
agent_suse-x64-a6:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_tests_rpm-x64-py2", "run_tests_rpm-x64-py3", "build_system-probe-x64"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/suse_x64:$DATADOG_AGENT_BUILDERS
tags: [ "runner:main", "size:2xlarge" ]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
PACKAGE_ARCH: amd64
before_script:
- export RELEASE_VERSION=$RELEASE_VERSION_6
- inv -e deps --verbose --dep-vendor-only
<<: *skip_when_unwanted_on_6
<<: *agent_build_common_suse_rpm
# build Agent package for suse-x64
agent_suse-x64-a7:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_tests_rpm-x64-py3", "build_system-probe-x64"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/suse_x64:$DATADOG_AGENT_BUILDERS
tags: [ "runner:main", "size:2xlarge" ]
variables:
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: /credentials
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
PACKAGE_ARCH: amd64
before_script:
- export RELEASE_VERSION=$RELEASE_VERSION_7
- inv -e deps --verbose --dep-vendor-only
<<: *skip_when_unwanted_on_7
<<: *agent_build_common_suse_rpm
# cloudfoundry puppy build/windows
windows_zip_agent_binaries_x64:
stage: package_build
tags: ["runner:windows-docker", "windowsversion:1809"]
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock"]
variables:
ARCH: "x64"
AGENT_MAJOR_VERSION: 7
OMNIBUS_TARGET: agent_binaries
before_script:
- set RELEASE_VERSION $RELEASE_VERSION_7
script:
- if (Test-Path .omnibus) { remove-item -recurse -force .omnibus }
- if (Test-Path build-out) { remove-item -recurse -force build-out }
- mkdir .omnibus\pkg
- docker run --rm -m 4096M -v "$(Get-Location):c:\mnt" -e OMNIBUS_TARGET=${OMNIBUS_TARGET} -e WINDOWS_BUILDER=true -e RELEASE_VERSION="$RELEASE_VERSION" -e MAJOR_VERSION="$AGENT_MAJOR_VERSION" -e PY_RUNTIMES="$PYTHON_RUNTIMES" -e IS_AWS_CONTAINER=true -e SIGN_WINDOWS=true 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/windows_${ARCH}:$Env:DATADOG_AGENT_WINBUILDIMAGES c:\mnt\tasks\winbuildscripts\buildwin.bat
- copy build-out\*.zip .omnibus\pkg
artifacts:
expire_in: 2 weeks
paths:
- .omnibus/pkg
##
## windows dockerized builds
##
.windows_msi_base:
stage: package_build
needs: ["fail_on_non_triggered_tag", "run_dep_check_lock"]
tags: ["runner:windows-docker", "windowsversion:1809"]
# Unavailable on gitlab < 12.3
# timeout: 2h 00m
script:
- if (Test-Path .omnibus) { remove-item -recurse -force .omnibus }
- if (Test-Path build-out) { remove-item -recurse -force build-out }
- mkdir .omnibus\pkg
- docker run --rm -m 4096M -v "$(Get-Location):c:\mnt" -e CI_JOB_ID=${CI_JOB_ID} -e OMNIBUS_TARGET=${OMNIBUS_TARGET} -e WINDOWS_BUILDER=true -e RELEASE_VERSION="$RELEASE_VERSION" -e MAJOR_VERSION="$AGENT_MAJOR_VERSION" -e PY_RUNTIMES="$PYTHON_RUNTIMES" -e IS_AWS_CONTAINER=true -e SIGN_WINDOWS=true 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/windows_${ARCH}:$Env:DATADOG_AGENT_WINBUILDIMAGES c:\mnt\tasks\winbuildscripts\buildwin.bat
- copy build-out\${CI_JOB_ID}\*.msi .omnibus\pkg
- if (Test-Path build-out\${CI_JOB_ID}\*.zip) { copy build-out\${CI_JOB_ID}\*.zip .omnibus\pkg }
- remove-item -recurse -force build-out\${CI_JOB_ID}
- get-childitem build-out
- get-childitem .omnibus\pkg
artifacts:
expire_in: 2 weeks
paths:
- .omnibus/pkg
.windows_main_agent_base:
extends: .windows_msi_base
variables:
OMNIBUS_TARGET: main
windows_msi_x64-a7:
extends: .windows_main_agent_base
variables:
ARCH: "x64"
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
before_script:
- set RELEASE_VERSION $RELEASE_VERSION_7
<<: *skip_when_unwanted_on_7
windows_msi_x86-a7:
extends: .windows_main_agent_base
variables:
ARCH: "x86"
AGENT_MAJOR_VERSION: 7
PYTHON_RUNTIMES: '3'
before_script:
- set RELEASE_VERSION $RELEASE_VERSION_7
<<: *skip_when_unwanted_on_7
<<: *run_when_triggered_on_nightly_or_master
windows_msi_x64-a6:
extends: .windows_main_agent_base
variables:
ARCH: "x64"
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
before_script:
- set RELEASE_VERSION $RELEASE_VERSION_6
<<: *skip_when_unwanted_on_6
windows_msi_x86-a6:
extends: .windows_main_agent_base
variables:
ARCH: "x86"
AGENT_MAJOR_VERSION: 6
PYTHON_RUNTIMES: '2,3'
before_script:
- set RELEASE_VERSION $RELEASE_VERSION_6
<<: *skip_when_unwanted_on_6
<<: *run_when_triggered_on_nightly_or_master