-
Notifications
You must be signed in to change notification settings - Fork 592
/
config.yml
1287 lines (1206 loc) · 39 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
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
version: 2.1
aliases:
- &appdir
working_directory: "nms/app"
- &only_master
filters:
branches:
only: master
- &master_and_develop
filters:
branches:
only:
- master
- develop
- <e_build_verify
paths: "orc8r lte"
- &c_cpp_build_verify
paths: "orc8r/gateway/c orc8r/protos lte/gateway/c lte/protos"
- &federated_build_verify
paths: "orc8r lte feg"
- &all_gateways_build_verify
paths: "orc8r lte feg cwf"
- &nms_build_verify
paths: "nms"
- &orc8r_build_verify
paths: "orc8r"
- &cwf_build_verify
paths: "cwf"
- &docs_only
paths: "docs"
executors:
node:
docker:
- image: circleci/node:10-buster-browsers-legacy
orbs:
artifactory: circleci/artifactory@0.0.7
codecov: codecov/codecov@1.1.3
python:
commands:
set_version:
parameters:
python_version:
description: Valid Python version to set
type: string
default: "3.7.0"
steps:
- run:
name: Set Python version
command: pyenv global <<parameters.python_version>>
- run:
name: Upgrade Pip
command: pip install --upgrade pip
docker:
commands:
install-dc:
parameters:
compose_version:
description: Docker-compose version to install
type: string
default: "1.25.4"
steps:
- run:
name: Install Docker Compose
command: |
sudo curl -L https://github.com/docker/compose/releases/download/<<parameters.compose_version>>/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
sudo chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
build:
commands:
determinator:
parameters:
paths:
description: Space seperated list of paths to tests against.
type: string
steps:
- run:
name: Checking for changes
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then
echo "Determinator does not run on master"
exit 0
fi
paths=".circleci circleci <<parameters.paths>>"
echo "Checking paths [$paths]"
for path in $paths; do
if [[ $(git diff master^ --name-only $path) ]]; then
echo "Found changes in $path"
exit 0
fi
done
echo "No changes in [$paths]"
circleci step halt
commands:
install-go:
description: Install go from sources
parameters:
go-version:
description: go version default 1.15.7
type: string
default: "1.15.7"
steps:
- run: |
sudo rm -rf /usr/local/go
GO_VERSION=<< parameters.go-version >>
wget "https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz" -O ./go.tar
sudo tar -C /usr/local -xzf go.tar
export PATH=$PATH:/usr/local/go/bin
run-with-retry:
description: Run command with retry
parameters:
command:
description: Command to run
type: string
workdir:
description: Path to cd into
type: string
retry-count:
description: Number of retry
type: integer
default: 3
sleep:
description: Wait duration until next retry
type: integer
default: 5
steps:
- run: |
retry() {
MAX_RETRY=<< parameters.retry-count >>
n=0
until [ $n -ge $MAX_RETRY ]
do
"$@" && break
n=$[$n+1]
sleep << parameters.sleep >>
done
if [ $n -ge $MAX_RETRY ]; then
echo "failed: ${@}" >&2
exit 1
fi
}
cd << parameters.workdir >>
retry << parameters.command >>
yarn-install:
steps:
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "nms/app/yarn.lock" }}
- run:
name: Install Dependencies
<<: *appdir
command: |
if [ $(node -v) == 'v6.1.0' ]; then
source $NVM_DIR/nvm.sh
nvm install stable
fi
yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "nms/app/yarn.lock" }}
paths:
- ~/.cache/yarn
apt-install-yarn:
steps:
- run:
<<: *appdir
command: |
sudo apt-get install -y apt-transport-https
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update -y
sudo apt-get install -y yarn
apt-install-chrome:
steps:
- run:
<<: *appdir
command: |
# Install latest chrome dev package
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
curl -sS https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google.list
sudo apt-get update -y
sudo apt-get install -y google-chrome-stable libxss1 --no-install-recommends
sudo rm -rf /var/lib/apt/lists/*
tag-push-docker:
description: Tag docker image and push it
parameters:
tag:
description: Containers to tag and push
type: string
default: ${CIRCLE_SHA1:0:8}
registry:
description: Registry to push to
type: string
default: ${DOCKER_REGISTRY}
username:
description: Username to log in as
type: string
default: ${DOCKER_USERNAME}
password:
description: Password to log in using
type: string
default: ${DOCKER_PASSWORD}
project:
description: Project images are linked to
type: string
default: ""
images:
description: Images you want to tag and push separated by |
type: string
tag-latest:
default: false
type: boolean
steps:
- run: |
if [ "${CIRCLE_BRANCH}" != "master" ]; then
echo "Push only happens for master branch"
exit 0
fi
DOCKER_REGISTRY="<< parameters.registry >>"
DOCKER_USERNAME="<< parameters.username >>"
DOCKER_PASSWORD="<< parameters.password >>"
docker login "${DOCKER_REGISTRY}" -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
IMAGES="<< parameters.images >>"
IMAGES_ARRAY=($(echo $IMAGES | tr "|" "\n"))
PROJECT=<< parameters.project >>
TAG=<< parameters.tag >>
TAG_LATEST=<< parameters.tag-latest >>
function tag_and_push {
docker tag "$IMAGE_ID" "${DOCKER_REGISTRY}/$IMAGE:$1"
echo "Pushing ${DOCKER_REGISTRY}/$IMAGE:$1"
docker push "${DOCKER_REGISTRY}/$IMAGE:$1"
}
for IMAGE in "${IMAGES_ARRAY[@]}"; do
IMAGE_TOSEARCH=$IMAGE
if [ ! -z $PROJECT ]; then
IMAGE_TOSEARCH="${PROJECT}_${IMAGE}"
fi
IMAGE_ID=$(docker images "$IMAGE_TOSEARCH:latest" --format "{{.ID}}")
tag_and_push "$TAG"
if [ "$TAG_LATEST" = true ]; then
tag_and_push "latest"
fi
done
magma_integ_test:
parameters:
stack:
description: Which stack to run integ tests for (cwf, lte)
type: string
test:
description: Should run tests (True, False)
type: string
build:
description: Should build deployment artifacts (True, False)
type: string
deploy:
description: Should deploy artifacts (True, False)
type: string
steps:
- checkout
- build/determinator:
<<: *lte_build_verify
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run:
name: Install tools
command: |
sudo apt-get update
sudo apt-get install -y openvpn
- run:
name: Configure and start VPN client
command: |
echo $MAGMA_OVPN_CONF | base64 -d - > ciworker.conf
sudo mv ciworker.conf /etc/openvpn/client.conf
sudo service openvpn@client restart
- run:
name: Decode and set secrets
command: |
cd ${MAGMA_ROOT}/circleci
echo $MAGMA_NODE_PKEY | base64 -d - > ci_node.pem
chmod 0400 ci_node.pem
echo $CI_OPERATOR_KEY | base64 -d - > ci_operator.key.pem
echo $CI_OPERATOR | base64 -d - > ci_operator.pem
echo $MAGMA_ROOTCA | base64 -d - > rootCA.pem
echo $MAGMA_CONTROL_PROXY | base64 -d - > control_proxy.yml
echo export AWS_DEFAULT_REGION="us-east-1" >> $BASH_ENV
echo export AWS_ACCESS_KEY_ID="$(printenv MAGMA_DEPLOY_AWS_ACCESS_KEY_ID)" >> $BASH_ENV
echo export AWS_SECRET_ACCESS_KEY="$(printenv MAGMA_DEPLOY_AWS_SECRET_ACCESS_KEY)" >> $BASH_ENV
- python/set_version
- run:
name: Install python prerequisites
command: pip3 install fabric3 jsonpickle requests PyYAML awscli
# sleep 10 just in case the vpn client takes time to spin up
- run:
name: Run remote integ test
command: |
sleep 10
cd ${MAGMA_ROOT}/circleci
fab <<parameters.stack>> integ_test:repo=${CIRCLE_REPOSITORY_URL},branch=${CIRCLE_BRANCH},sha1=${CIRCLE_SHA1},run_integ_test=<<parameters.test>>,build_package=<<parameters.build>>,deploy_artifacts=<<parameters.deploy>>
mkdir -p versions
cp *_version versions || true
no_output_timeout: 20m
- store_artifacts:
path: /tmp/logs
- store_test_results:
path: /tmp/test-results
- run:
name: Double-check that the node is freed
command: |
cd ${MAGMA_ROOT}/circleci
lease_id=$(cat lease_id.out)
lease_node=$(cat lease_node.out)
curl -X POST "https://api-staging.magma.etagecom.io/magma/v1/ci/nodes/${lease_node}/release/${lease_id}" -k --key ci_operator.key.pem --cert ci_operator.pem || true
when: always
- magma_slack_notify
magma_slack_notify:
description: Notify Slack on magma job failure
steps:
- run:
command: |
echo 'export SLACK_BUILD_STATUS="fail"' >> $BASH_ENV
name: Slack - Setting Failure Condition
when: on_fail
- run:
command: |
echo 'export SLACK_BUILD_STATUS="success"' >> $BASH_ENV
name: Slack - Setting Success Condition
when: on_success
- run:
name: Send message to Slack
command: |
if [ "$SLACK_BUILD_STATUS" != "fail" ] || [ "$CIRCLE_BRANCH" != "master" ]; then
echo "This command will only execute on failure on master."
exit 0
fi
author=$(git show -s --format='%an')
email=$(git show -s --format='%ae')
rel_time=$(git show -s --format='%cr')
abs_time=$(git show -s --format='%cd')
gh_text="<https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commit/${CIRCLE_SHA1}|${CIRCLE_SHA1:0:8}> by ${author} <${email}> ${rel_time} (${abs_time})"
pretext="Job \`${CIRCLE_JOB}\` #${CIRCLE_BUILD_NUM} on branch \`${CIRCLE_BRANCH}\` of ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} failed. Check the <${CIRCLE_BUILD_URL}|build logs> for details."
color="#8b0902"
slack_data=$(cat \<<EOF
{
"channel": "${SLACK_CHANNEL_CI}",
"text": "*CircleCI Job Failure*",
"attachments": [
{
"color": "${color}",
"pretext": "${pretext}",
"fallback": "CircleCI job failure notification",
"fields": [
{
"title": "Revision",
"value": "${gh_text}",
"short": false
}
]
}
]
}
EOF
)
echo $slack_data
curl -X POST -H 'Content-type: application/json' --data "${slack_data}" "${SLACK_WEBHOOK_OSS}"
when: always
persist-githash-version:
parameters:
file_prefix:
type: string
steps:
- run:
name: Create version file
command: |
cd ${MAGMA_ROOT}/circleci
mkdir -p versions
echo "${CIRCLE_SHA1:0:8}" > versions/<< parameters.file_prefix >>_version
notify-magma:
description: Notify Slack when an artifact is published
parameters:
artifact_name:
description: Name of the artifact to include in the message
type: string
version_path:
description: Path to file that will contain the artifact version
type: string
steps:
- run:
name: Send slack message
command: |
if [ "${CIRCLE_BRANCH}" != "master" ]; then
exit 0
fi
author=$(git show -s --format='%an')
email=$(git show -s --format='%ae')
rel_time=$(git show -s --format='%cr')
abs_time=$(git show -s --format='%cd')
gh_text="<https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commit/${CIRCLE_SHA1}|${CIRCLE_SHA1:0:8}> by ${author} <${email}> ${rel_time} (${abs_time})"
if [ -f ${MAGMA_ROOT}/circleci/<< parameters.version_path >> ]; then
ver=$(cat ${MAGMA_ROOT}/circleci/<< parameters.version_path >>)
else
ver="Unknown artifact version (this should never happen!)"
fi
pretext="Production artifact has been published. Promote or deploy it by following the appropriate oncall procedures."
slack_data=$(cat \<<EOF
{
"channel": "${SLACK_CHANNEL_ARTIFACTS}",
"text": "*<< parameters.artifact_name >> Artifact Has Been Published*",
"attachments": [
{
"color": "#36a64f",
"pretext": "${pretext}",
"fallback": "CircleCI workflow success notification",
"fields": [
{
"title": "Artifact Version",
"value": "\`${ver}\`",
"short": false
},
{
"title": "Revision",
"value": "${gh_text}",
"short": false
}
]
}
]
}
EOF
)
curl -X POST -H 'Content-type: application/json' --data "${slack_data}" "${SLACK_WEBHOOK_OSS}"
jobs:
### CLOUD
cloud-test:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
<<: *all_gateways_build_verify
- docker/install-dc
- python/set_version
- run:
command: |
cd ${MAGMA_ROOT}/orc8r/cloud/docker
python3 build.py --tests --up
no_output_timeout: 15m
- magma_slack_notify
# Fail if code doesn't pass formatting requirements.
# Upload test coverage statistics.
cloud_lint:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
<<: *all_gateways_build_verify
- docker/install-dc
- python/set_version
- run:
name: Lint cloud Go code
command: |
cd ${MAGMA_ROOT}/orc8r/cloud/docker
python3 build.py --lint
- run:
name: Generate test coverage
command: |
cd ${MAGMA_ROOT}/orc8r/cloud/docker
python3 build.py --coverage
- codecov/upload:
file: /home/circleci/project/orc8r/cloud/coverage/all.gocov
flags: cloud_lint
- magma_slack_notify
# Fail if checked-in generated code doesn't match output from
# generation command.
insync-checkin:
machine:
image: ubuntu-1604:201903-01
#docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
<<: *all_gateways_build_verify
- docker/install-dc
- run: sudo apt-get update
- python/set_version
- run:
command: |
cd ${MAGMA_ROOT}/orc8r/cloud/docker
python3 build.py --generate
- run: sudo chown -R circleci $MAGMA_ROOT/*
- run: git add .
- run: git status
- run: git diff-index --quiet HEAD
- magma_slack_notify
orc8r-build:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
environment:
MODULE_DIR: /home/circleci/project
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
<<: *all_gateways_build_verify
- docker/install-dc
- run: sudo apt-get update
- python/set_version
- run:
command: |
cd ${MAGMA_ROOT}/orc8r/cloud/docker
python3 build.py --all --nocache --parallel
- tag-push-docker:
project: orc8r
images: "nginx|controller"
tag-latest: true
# - tag-push-docker:
# project: orc8r
# images: "nginx|controller"
# tag-latest: true
# registry: $JFROG_DOCKER_ORC8R_REGISTRY
# username: $JFROG_USERNAME
# password: $JFROG_PASSWORD
- persist-githash-version:
file_prefix: orc8r
- notify-magma:
artifact_name: Orchestrator Images
version_path: versions/orc8r_version
- magma_slack_notify
### GATEWAY
orc8r-gateway-test:
docker:
- image: circleci/golang:1.13-buster-node-browsers-legacy
environment:
GO111MODULE: 'on'
steps:
- checkout
- build/determinator:
<<: *orc8r_build_verify
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run-with-retry:
command: go mod download
workdir: ${MAGMA_ROOT}/cwf/gateway
- run:
command: |
cd ${MAGMA_ROOT}/orc8r/gateway/go
go test ./...
go vet ./...
- magma_slack_notify
feg-lint:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
resource_class: large
environment:
GO111MODULE: 'on'
steps:
- checkout
- build/determinator:
<<: *federated_build_verify
- install-go
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run: ./circleci/golang_before_install.sh
- run-with-retry:
command: go mod download
workdir: ${MAGMA_ROOT}/cwf/gateway
- run:
name: Generate test coverage
command: |
cd ${MAGMA_ROOT}/feg/gateway
make -C ${MAGMA_ROOT}/feg/gateway cover
- codecov/upload:
file: /home/circleci/project/feg/gateway/coverage/feg.gocov
flags: feg-lint
- magma_slack_notify
feg-precommit:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
resource_class: large
environment:
GO111MODULE: 'on'
steps:
- checkout
- build/determinator:
<<: *federated_build_verify
- install-go
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run: ./circleci/golang_before_install.sh
- run-with-retry:
command: go mod download
workdir: ${MAGMA_ROOT}/cwf/gateway
- run:
name: make feg precommit
command: |
cd ${MAGMA_ROOT}/feg/gateway
make -C ${MAGMA_ROOT}/feg/gateway precommit
- magma_slack_notify
feg-build:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
resource_class: large
environment:
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
<<: *federated_build_verify
- run:
command: |
cd ${MAGMA_ROOT}/feg/gateway/docker
DOCKER_REGISTRY=feg_ docker-compose build --parallel
- tag-push-docker:
project: feg
images: "gateway_go|gateway_python"
registry: $DOCKER_FEG_REGISTRY
# - tag-push-docker:
# project: feg
# images: "gateway_go|gateway_python"
# registry: $JFROG_DOCKER_FEG_REGISTRY
# username: $JFROG_USERNAME
# password: $JFROG_PASSWORD
- persist-githash-version:
file_prefix: feg
- notify-magma:
artifact_name: FeG
version_path: versions/feg_version
- magma_slack_notify
cwag-precommit:
docker:
- image: circleci/golang:1.13-buster-node-browsers-legacy
environment:
GO111MODULE: 'on'
steps:
- checkout
- build/determinator:
<<: *all_gateways_build_verify
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run: ./circleci/golang_before_install.sh
- run-with-retry:
command: go mod download
workdir: ${MAGMA_ROOT}/cwf/gateway
- run:
command: |
cd ${MAGMA_ROOT}/cwf/gateway
make -C ${MAGMA_ROOT}/cwf/gateway precommit
cd ${MAGMA_ROOT}/cwf/gateway
make -C ${MAGMA_ROOT}/cwf/gateway/integ_tests precommit
- magma_slack_notify
cwf-integ-test:
machine:
image: ubuntu-1604:201903-01
steps:
- build/determinator:
<<: *all_gateways_build_verify
- magma_integ_test:
stack: cwf
test: 'True'
build: 'False'
deploy: 'False'
cwag-deploy:
parameters:
tag:
description: Containers tag
type: string
default: ${CIRCLE_SHA1:0:8}
images:
description: Images to deploy
type: string
default: 'cwag_go|gateway_go|gateway_python|gateway_sessiond|gateway_pipelined'
tag-latest:
default: false
type: boolean
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
DOCKER_REGISTRY: cwf_
steps:
- checkout
- build/determinator:
<<: *cwf_build_verify
- docker/install-dc
- run:
name: Build CWAG containers
command: |
cd ${MAGMA_ROOT}/cwf/gateway/docker
docker-compose -f docker-compose.yml -f docker-compose.override.yml build --parallel
- tag-push-docker:
project: cwf
images: <<parameters.images>>
tag: <<parameters.tag>>
registry: $DOCKER_MAGMA_REGISTRY
tag-latest: <<parameters.tag-latest>>
# - tag-push-docker:
# project: cwf
# images: <<parameters.images>>
# tag: <<parameters.tag>>
# tag-latest: <<parameters.tag-latest>>
# registry: $JFROG_DOCKER_CWF_REGISTRY
# username: $JFROG_USERNAME
# password: $JFROG_PASSWORD
- persist-githash-version:
file_prefix: cwag
- notify-magma:
artifact_name: CWAG
version_path: versions/cwag_version
- magma_slack_notify
mme-clang-tidy:
machine:
image: ubuntu-2004:202010-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
BRANCH: << pipeline.git.branch >>
REVISION: << pipeline.git.revision >>
steps:
- checkout
- build/determinator:
<<: *c_cpp_build_verify
- run:
command: |
cd $MAGMA_ROOT/lte/gateway/docker/mme
docker build -t magma-mme-build -f Dockerfile.ubuntu20.04 ../../../../
docker run --env BRANCH=$BRANCH --env REVISION=$REVISION -v $MAGMA_ROOT:/magma -i -t magma-mme-build:latest /bin/bash -c 'cd /magma/lte/gateway;make clang_tidy_oai_upload'
- magma_slack_notify
c-cpp-codecov:
machine:
image: ubuntu-2004:202010-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
<<: *c_cpp_build_verify
- run:
command: |
cd $MAGMA_ROOT/lte/gateway/docker/mme
docker build -t magma/c_cpp_build -f Dockerfile.ubuntu20.04 ../../../../
ci_env=`bash <(curl -s https://codecov.io/env)`
docker run $ci_env -e CI=true -v /home/circleci/project:/magma -v /home/circleci/project/lte/gateway/configs:/etc/magma -i -t magma/c_cpp_build:latest /bin/bash -c "cd /magma/lte/gateway;make coverage;ls -al /tmp/;bash <(curl -s https://codecov.io/bash) -f /build/c/coverage.info -F c_cpp"
- magma_slack_notify
mme-clang-warnings:
machine:
image: ubuntu-2004:202010-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
BRANCH: << pipeline.git.branch >>
REVISION: << pipeline.git.revision >>
steps:
- checkout
- run:
command: |
cd $MAGMA_ROOT/lte/gateway/docker/mme
docker build -t magma-mme-build -f Dockerfile.ubuntu20.04 ../../../../
docker run --env BRANCH=$BRANCH --env REVISION=$REVISION -v /home/circleci/project:/magma -v /home/circleci/project/lte/gateway/configs:/etc/magma -i -t magma-mme-build:latest /bin/bash -c "cd /magma/lte/gateway;make clang_warning_oai_upload"
- magma_slack_notify
lte-test:
machine:
image: ubuntu-1604:201903-01
environment:
MAGMA_ROOT: /home/circleci/project
PYTHON_BUILD: ${MAGMA_ROOT}/build
PIP_CACHE_HOME: ${MAGMA_ROOT}/.pipcache
MAGMA_DEV_MODE: 1
SKIP_SUDO_TESTS: 1
CODEGEN_ROOT: /home/circleci/project/.codegen
SWAGGER_CODEGEN_JAR: /home/circleci/project/.codegen/swagger-codegen-cli.jar
steps:
- checkout
- build/determinator:
<<: *lte_build_verify
- run: mkdir -p /var/tmp/test_results
- run: mkdir -p /var/tmp/codecovs
- run: sudo apt-get update -y
- run: sudo apt-get install -y libsystemd-dev pkg-config curl zip unzip
- run: sudo apt-get install -y virtualenv python-babel python-dev build-essential python3-setuptools python-setuptools autogen autoconf libtool python3-apt python3-aioeventlet python3-requests python3-pip python-protobuf
- run:
command: |
sudo curl -Lfs https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip -o protoc3.zip
sudo unzip protoc3.zip -d protoc3
sudo mv protoc3/bin/protoc /bin/protoc
sudo chmod a+rx /bin/protoc
sudo mv protoc3/include/google /usr/include/
sudo chmod -R a+Xr /usr/include/google
sudo rm -rf protoc3.zip protoc3
mkdir ${CODEGEN_ROOT}
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar -O $SWAGGER_CODEGEN_JAR
make -C $MAGMA_ROOT/lte/gateway/python test_all
- store_test_results:
path: /var/tmp/test_results
- codecov/upload:
file: /var/tmp/codecovs/cover_lte.xml
flags: lte-test
- codecov/upload:
file: /var/tmp/codecovs/cover_orc8r.xml
flags: lte-test
- magma_slack_notify
lte-integ-test:
machine:
image: ubuntu-1604:201903-01
steps:
- build/determinator:
<<: *lte_build_verify
- magma_integ_test:
stack: lte
test: 'True'
build: 'False'
deploy: 'False'
lte-agw-deploy:
machine:
image: ubuntu-1604:201903-01
steps:
- build/determinator:
<<: *lte_build_verify
- magma_integ_test:
stack: lte
test: 'False'
build: 'True'
deploy: 'True'
- notify-magma:
artifact_name: LTE AGW
version_path: versions/magma_version
## CWF OPERATOR
cwf-operator-precommit:
docker:
- image: circleci/golang:1.13-buster-node-browsers-legacy
environment:
GO111MODULE: 'on'
steps:
- checkout
- build/determinator:
paths: "cwf/k8s"
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run: ./circleci/golang_before_install.sh
- run-with-retry:
command: go mod download
workdir: ${MAGMA_ROOT}/cwf/k8s/cwf_operator
- run:
command: |
cd ${MAGMA_ROOT}/cwf/k8s/cwf_operator
make -C ${MAGMA_ROOT}/cwf/k8s/cwf_operator precommit
- magma_slack_notify
cwf-operator-build:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
environment:
MAGMA_ROOT: /home/circleci/project
steps:
- checkout
- build/determinator:
paths: "cwf/k8s"
- docker/install-dc
- run:
command: |
cd ${MAGMA_ROOT}/cwf/k8s/cwf_operator/docker
DOCKER_REGISTRY=cwf_ docker-compose build --parallel
- tag-push-docker:
project: cwf
images: "operator"
registry: $DOCKER_MAGMA_REGISTRY
# - tag-push-docker:
# project: cwf
# images: "operator"
# registry: $JFROG_DOCKER_CWF_REGISTRY
# username: $JFROG_USERNAME
# password: $JFROG_PASSWORD
- persist-githash-version:
file_prefix: cwf_operator
- notify-magma:
artifact_name: CWF Operator
version_path: versions/cwf_operator_version
- magma_slack_notify
### NMS
nms-flow-test:
executor: node
steps:
- checkout
- build/determinator:
<<: *nms_build_verify
- run:
name: install flow
<<: *appdir
# Extract the specified flow version from the .flowconfig
command: yarn add --dev -W flow-bin@$(x=$(grep "\[version\]" .flowconfig -A 1 | tail -n 1); echo ${x:1})
- yarn-install
- run:
name: flow typecheck
<<: *appdir
command: yarn run flow
- magma_slack_notify
eslint:
executor: node
steps:
- checkout
- build/determinator:
<<: *nms_build_verify
- yarn-install
- run:
name: eslint
<<: *appdir
command: yarn run eslint ./
- magma_slack_notify
nms-yarn-test:
executor: node
steps:
- checkout
- build/determinator:
<<: *nms_build_verify
- yarn-install
- run:
name: yarn test
<<: *appdir
command: yarn test:ci
- magma_slack_notify
nms-e2e-test:
machine:
image: ubuntu-1604:201903-01
environment:
NMS_ROOT: ${MAGMA_ROOT}/nms/app/packages/magmalte
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome-stable
steps:
- checkout
- build/determinator: