-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
838 lines (764 loc) · 16.4 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
image: cincproject/omnibus-debian
stages:
- patch
- package
- test
- cleanup
- deploy
- publish
variables:
ORIGIN: https://github.com/inspec/inspec.git
REF: main
CHANNEL: unstable
CINC_PRODUCT: cinc-auditor
GIT_CACHE: "false"
OMNIBUS_FIPS_MODE: "true"
workflow:
rules:
# Run if we trigger a pipeline from the web
- if: $CI_PIPELINE_SOURCE == "web"
# Run if we trigger a pipeline from another project (i.e. upstream/inspec)
- if: $CI_PIPELINE_SOURCE == "pipeline"
# Run if this is a merge request
- if: $CI_MERGE_REQUEST_ID
include:
- local: .gitlab/package.yml
- local: .gitlab/test.yml
patch:
stage: patch
tags:
- docker-x86_64
script:
- echo "Cloning from $ORIGIN"
- ./patch.sh
artifacts:
expire_in: 1mo
paths:
- inspec/
.bio_setup:
before_script:
- scripts/install-biome.sh
variables:
HAB_ORIGIN: cinc
HAB_NONINTERACTIVE: "true"
# Package stage
package:amazonlinux-2023:x86_64:
extends: .package:amazonlinux
image: cincproject/omnibus-amazonlinux:2023
cache:
key: amazonlinux:2023:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "2023"
package:amazonlinux-2023:aarch64:
extends: .package:amazonlinux
image: cincproject/omnibus-amazonlinux:2023
cache:
key: amazonlinux:2023:aarch64
tags:
- docker-aarch64-v8.2-a
needs:
- patch
variables:
PLATFORM_VER: "2023"
OMNIBUS_FIPS_MODE: "false"
# Needs HAB_AUTH_TOKEN and HAB_ORIGIN environment variables set.
package:bio:linux:
stage: package
extends:
- .bio_setup
allow_failure: true
tags:
- docker-x86_64
needs:
- patch
script:
- bio pkg build ./inspec
artifacts:
paths:
- results/*.hart
package:centos-8:x86_64:
extends: .package:centos
image: cincproject/omnibus-almalinux:8
cache:
key: centos:8:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "8"
package:centos-8:aarch64:
extends: .package:centos
image: cincproject/omnibus-almalinux:8
cache:
key: centos:8:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "8"
OMNIBUS_FIPS_MODE: "false"
package:centos-8:s390x:
extends: .package:centos
image: cincproject/omnibus-almalinux:8
cache:
key: centos:8:s390x
tags:
- docker-s390x
needs:
- patch
variables:
PLATFORM_VER: "8"
package:centos-9:s390x:
extends: .package:centos
image: cincproject/omnibus-almalinux:9
cache:
key: centos:9:s390x
tags:
- docker-s390x
needs:
- patch
variables:
PLATFORM_VER: "9"
package:centos-9:x86_64:
extends: .package:centos
image: cincproject/omnibus-almalinux:9
cache:
key: centos:9:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "9"
package:centos-9:aarch64:
extends: .package:centos
image: cincproject/omnibus-almalinux:9
cache:
key: centos:9:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "9"
OMNIBUS_FIPS_MODE: "false"
package:debian-11:x86_64:
extends: .package:debian
image: cincproject/omnibus-debian:11
cache:
key: debian:11:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "11"
package:debian-11:aarch64:
extends: .package:debian
image: cincproject/omnibus-debian:11
cache:
key: debian:11:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "11"
OMNIBUS_FIPS_MODE: "false"
package:debian-12:x86_64:
extends: .package:debian
image: cincproject/omnibus-debian:12
cache:
key: debian:12:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "12"
package:debian-12:aarch64:
extends: .package:debian
image: cincproject/omnibus-debian:12
cache:
key: debian:12:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "12"
OMNIBUS_FIPS_MODE: "false"
package:macos-11:
extends: .package:macos
cache:
key: macos:11
tags:
- macos-11
needs:
- patch
variables:
PLATFORM_VER: "11"
package:macos-12:
extends: .package:macos
cache:
key: macos:12
tags:
- macos-12
needs:
- patch
variables:
PLATFORM_VER: "12"
package:macos-12:aarch64:
extends: .package:macos
cache:
key: macos:12:aarch64
tags:
- macos-12-aarch64
needs:
- patch
variables:
PLATFORM_VER: "12"
package:macos-13:
extends: .package:macos
cache:
key: macos:13
tags:
- macos-13
needs:
- patch
variables:
PLATFORM_VER: "13"
package:macos-13:aarch64:
extends: .package:macos
cache:
key: macos:13:aarch64
tags:
- macos-13-aarch64
needs:
- patch
variables:
PLATFORM_VER: "13"
package:opensuse-15:x86_64:
extends: .package:opensuse
image: cincproject/omnibus-opensuse:15
cache:
key: opensuse:15:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "15"
package:opensuse-15:aarch64:
extends: .package:opensuse
image: cincproject/omnibus-opensuse:15
cache:
key: opensuse:15:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "15"
OMNIBUS_FIPS_MODE: "false"
package:windows-2012r2:
extends: .package:windows
cache:
key: windows-2012r2
tags:
- windows-x64-ucrt64
needs:
- patch
variables:
PLATFORM_VER: "2012r2"
package:ubuntu-20.04:x86_64:
extends: .package:ubuntu
image: cincproject/omnibus-ubuntu:20.04
cache:
key: ubuntu:20.04:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "20.04"
package:ubuntu-20.04:aarch64:
extends: .package:ubuntu
image: cincproject/omnibus-ubuntu:20.04
cache:
key: ubuntu:20.04:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "20.04"
OMNIBUS_FIPS_MODE: "false"
package:ubuntu-22.04:x86_64:
extends: .package:ubuntu
image: cincproject/omnibus-ubuntu:22.04
cache:
key: ubuntu:22.04:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "22.04"
package:ubuntu-22.04:aarch64:
extends: .package:ubuntu
image: cincproject/omnibus-ubuntu:22.04
cache:
key: ubuntu:22.04:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "22.04"
OMNIBUS_FIPS_MODE: "false"
package:ubuntu-24.04:x86_64:
extends: .package:ubuntu
image: cincproject/omnibus-ubuntu:24.04
cache:
key: ubuntu:24.04:x86_64
tags:
- docker-x86_64
needs:
- patch
variables:
PLATFORM_VER: "24.04"
package:ubuntu-24.04:aarch64:
extends: .package:ubuntu
image: cincproject/omnibus-ubuntu:24.04
cache:
key: ubuntu:24.04:aarch64
tags:
- docker-aarch64
needs:
- patch
variables:
PLATFORM_VER: "24.04"
OMNIBUS_FIPS_MODE: "false"
# Test stage
test:amazonlinux-2023:x86_64:
extends: .test:amazonlinux
image: cincproject/omnibus-amazonlinux:2023
needs:
- package:amazonlinux-2023:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "2023"
test:amazonlinux-2023:aarch64:
extends: .test:amazonlinux
image: cincproject/omnibus-amazonlinux:2023
needs:
- package:amazonlinux-2023:aarch64
tags:
- docker-aarch64-v8.2-a
variables:
PLATFORM_VER: "2023"
OMNIBUS_FIPS_MODE: "false"
test:bio:linux:
stage: test
extends:
- .bio_setup
allow_failure: true
tags:
- docker-x86_64
needs:
- package:bio:linux
variables:
HAB_TEST: "true"
script:
- bio install results/*.hart --binlink
- export CINC_PATH=$(bio pkg path cincproject/cinc-auditor)
- export GEM_PATH=${CINC_PATH}/vendor:$GEM_PATH
- ln -s $CINC_PATH /opt/cinc-auditor
- mkdir /opt/cinc-auditor/embedded
- ln -s /opt/cinc-auditor/bin /opt/cinc-auditor/embedded/bin
- ln -s $(bio pkg path core/ruby30)/bin/ruby /opt/cinc-auditor/embedded/bin/ruby
- cinc-auditor version
- cinc-auditor detect
- cinc-auditor exec test-baseline --no-distinct-exit --reporter cli junit:junit.xml
artifacts:
reports:
junit: junit.xml
test:centos-8:x86_64:
extends: .test:centos
image: cincproject/omnibus-almalinux:8
needs:
- package:centos-8:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "8"
test:centos-8:aarch64:
extends: .test:centos
image: cincproject/omnibus-almalinux:8
needs:
- package:centos-8:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "8"
test:centos-8:s390x:
extends: .test:centos
image: cincproject/omnibus-almalinux:8
needs:
- package:centos-8:s390x
tags:
- docker-s390x
variables:
PLATFORM_VER: "8"
test:centos-9:s390x:
extends: .test:centos
image: cincproject/omnibus-almalinux:9
needs:
- package:centos-9:s390x
tags:
- docker-s390x
variables:
PLATFORM_VER: "9"
test:centos-9:x86_64:
extends: .test:centos
image: cincproject/omnibus-almalinux:9
needs:
- package:centos-9:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "9"
test:centos-9:aarch64:
extends: .test:centos
image: cincproject/omnibus-almalinux:9
needs:
- package:centos-9:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "9"
test:debian-11:x86_64:
extends: .test:debian
image: cincproject/omnibus-debian:11
needs:
- package:debian-11:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "11"
test:debian-11:aarch64:
extends: .test:debian
image: cincproject/omnibus-debian:11
needs:
- package:debian-11:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "11"
test:debian-12:x86_64:
extends: .test:debian
image: cincproject/omnibus-debian:12
needs:
- package:debian-12:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "12"
test:debian-12:aarch64:
extends: .test:debian
image: cincproject/omnibus-debian:12
needs:
- package:debian-12:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "12"
test:macos-11:
extends: .test:macos
tags:
- macos-11
needs:
- package:macos-11
variables:
PLATFORM_VER: "11"
test:macos-12:
extends: .test:macos
tags:
- macos-12
needs:
- package:macos-12
variables:
PLATFORM_VER: "12"
test:macos-12:aarch64:
extends: .test:macos
tags:
- macos-12-aarch64
needs:
- package:macos-12:aarch64
variables:
PLATFORM_VER: "12"
test:macos-13:
extends: .test:macos
tags:
- macos-13
needs:
- package:macos-13
variables:
PLATFORM_VER: "13"
test:macos-13:aarch64:
extends: .test:macos
tags:
- macos-13-aarch64
needs:
- package:macos-13:aarch64
variables:
PLATFORM_VER: "13"
test:opensuse-15:x86_64:
extends: .test:opensuse
image: cincproject/omnibus-opensuse:15
needs:
- package:opensuse-15:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "15"
test:opensuse-15:aarch64:
extends: .test:opensuse
image: cincproject/omnibus-opensuse:15
needs:
- package:opensuse-15:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "15"
test:ubuntu-20.04:x86_64:
extends: .test:ubuntu
image: cincproject/omnibus-ubuntu:20.04
needs:
- package:ubuntu-20.04:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "20.04"
test:ubuntu-20.04:aarch64:
extends: .test:ubuntu
image: cincproject/omnibus-ubuntu:20.04
needs:
- package:ubuntu-20.04:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "20.04"
test:ubuntu-22.04:x86_64:
extends: .test:ubuntu
image: cincproject/omnibus-ubuntu:22.04
needs:
- package:ubuntu-22.04:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "22.04"
test:ubuntu-22.04:aarch64:
extends: .test:ubuntu
image: cincproject/omnibus-ubuntu:22.04
needs:
- package:ubuntu-22.04:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "22.04"
test:ubuntu-24.04:x86_64:
extends: .test:ubuntu
image: cincproject/omnibus-ubuntu:24.04
needs:
- package:ubuntu-24.04:x86_64
tags:
- docker-x86_64
variables:
PLATFORM_VER: "24.04"
test:ubuntu-24.04:aarch64:
extends: .test:ubuntu
image: cincproject/omnibus-ubuntu:24.04
needs:
- package:ubuntu-24.04:aarch64
tags:
- docker-aarch64
variables:
PLATFORM_VER: "24.04"
test:windows-2012r2:
extends: .test:windows
needs:
- package:windows-2012r2
variables:
PLATFORM_VER: "2012r2"
.ssh-setup:
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "${SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
deploy:
allow_failure: false
stage: deploy
extends: .ssh-setup
# Only run if this is triggered from the web
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: manual
- when: never
tags:
- docker-x86_64
dependencies:
- package:amazonlinux-2023:x86_64
- package:amazonlinux-2023:aarch64
- package:centos-8:aarch64
- package:centos-8:s390x
- package:centos-8:x86_64
- package:centos-9:aarch64
- package:centos-9:x86_64
- package:centos-9:s390x
- package:debian-11:x86_64
- package:debian-11:aarch64
- package:debian-12:x86_64
- package:debian-12:aarch64
- package:macos-11
- package:macos-12
- package:macos-12:aarch64
- package:macos-13
- package:macos-13:aarch64
- package:opensuse-15:x86_64
- package:opensuse-15:aarch64
- package:ubuntu-20.04:x86_64
- package:ubuntu-20.04:aarch64
- package:ubuntu-22.04:x86_64
- package:ubuntu-22.04:aarch64
- package:ubuntu-24.04:x86_64
- package:ubuntu-24.04:aarch64
- package:windows-2012r2
script:
- ssh cinc@${DOWNLOADS_HOST} "mkdir -p /data/incoming/files/${CHANNEL}/cinc-auditor/$(cat VERSION)/"
- rsync -avH --delete data/ cinc@${DOWNLOADS_HOST}:/data/incoming/files/${CHANNEL}/cinc-auditor/$(cat VERSION)/
- ssh cinc@${DOWNLOADS_HOST} "chmod 755 /data/incoming/files/${CHANNEL}/cinc-auditor/$(cat VERSION)/"
deploy:bio:linux:
stage: deploy
allow_failure: true
# Only run if this is triggered from the web
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: manual
- when: never
extends:
- .bio_setup
tags:
- docker-x86_64
dependencies:
- package:bio:linux
script:
- bio pkg upload results/*.hart
deploy-gems:
stage: deploy
# Only run if this is triggered from the web
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: manual
- when: never
tags:
- docker-x86_64
dependencies:
- patch
script:
- ./deploy-gems.sh
publish:
stage: publish
extends: .ssh-setup
dependencies: []
# Only run if this is triggered from the web
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: on_success
- when: never
tags:
- downloads
script:
- sudo mkdir -p /data/mirror/files/${CHANNEL}/cinc-auditor
- sudo /usr/bin/rsync -avH /data/incoming/files/${CHANNEL}/cinc-auditor/ /data/mirror/files/${CHANNEL}/cinc-auditor/
- sudo -E -u cinc /usr/local/bin/update-cinc-api
- ssh -q cinc@${MIRROR_HOST} "~/sync-from-master"
publish-docker:
image: docker:latest
services:
- docker:dind
stage: publish
# Only run if this is triggered from the web
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: on_success
- when: never
tags:
- docker-x86_64
dependencies:
- patch
- deploy-gems
before_script:
- apk add curl bash
script:
- bash docker.sh
variables:
DOCKER_TLS_CERTDIR: "/certs"
publish:bio:linux:
# Only run if this is triggered from the web
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: on_success
- when: never
tags:
- docker-x86_64
dependencies:
- package:bio:linux
- deploy:bio:linux
extends:
- .bio_setup
stage: publish
script:
- bio pkg install core/jq-static -b
- export PKG=$(bio pkg info results/*.hart -j | jq -r '[.origin,.name,.version,.release] | join("/")')
- bio pkg promote $PKG $CHANNEL
.cleanup:
stage: cleanup
dependencies: []
variables:
GIT_CHECKOUT: "false"
when: always
script:
- sudo rm -rf inspec/
- sudo rm -rf ${CI_PROJECT_DIR}/cinc-project/distribution/auditor/
cleanup:macos-11:
extends: .cleanup
tags:
- macos-11
cleanup:macos-12:
extends: .cleanup
tags:
- macos-12
cleanup:macos-12-aarch64:
extends: .cleanup
tags:
- macos-12-aarch64
cleanup:macos-13:
extends: .cleanup
tags:
- macos-13
cleanup:macos-13-aarch64:
extends: .cleanup
tags:
- macos-13-aarch64