forked from magma/magma
-
Notifications
You must be signed in to change notification settings - Fork 0
1014 lines (1011 loc) · 44.4 KB
/
build_all.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
# Copyright 2022 The Magma Authors.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: build-all
on:
workflow_dispatch: null
push:
branches:
- master
- 'v1.*'
pull_request:
branches:
- master
- 'v1.*'
types: [ opened, reopened, synchronize ]
jobs:
build_publish_helm_charts:
if: github.repository_owner == 'magma'
env:
HELM_CHART_ARTIFACTORY_URL: "https://artifactory.magmacore.org:443/artifactory/"
HELM_CHART_MUSEUM_REPO: helm-test
HELM_CHART_MUSEUM_USERNAME: "${{ secrets.HELM_CHART_MUSEUM_USERNAME }}"
HELM_CHART_MUSEUM_TOKEN: "${{ secrets.HELM_CHART_MUSEUM_TOKEN }}"
MAGMA_ROOT: "${{ github.workspace }}"
EVENT_NAME: "${{ github.event_name }}"
ISSUE_NUMBER: "${{ github.event.number }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
# Version is github job run number when running on master
# Or is branch name when on release branch
- name: Set Helm chart version
run: |
if [ "${GITHUB_REF##*/}" = "master" ] ;then
echo "VERSION=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
elif [ "${EVENT_NAME}" = "pull_request" ]; then
echo "VERSION=${ISSUE_NUMBER}" >> $GITHUB_ENV
fi
- name: Launch build and publish script
run: |
if [ "${GITHUB_REF##*/}" = "master" ] ;then
orc8r/tools/helm/package.sh --deployment-type all --version $VERSION --only-package
elif [ "${EVENT_NAME}" = "pull_request" ] ;then
mkdir charts
orc8r/tools/helm/package.sh --deployment-type all --version $VERSION --only-package
else
orc8r/tools/helm/package.sh --deployment-type all
fi
- name: Upload charts as artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: helm-charts
path: charts
# Need to save PR number as Github action does not propagate it with workflow_run event
# Used as version for PR builds
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/pr_number
echo "false" > ./pr/skipped
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
with:
name: pr
path: pr/
- name: Extract commit title
id: commit
if: failure() && github.event_name == 'push'
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
# Notify ci channel when failing
# Plugin info: https://github.com/marketplace/actions/slack-notify
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }}
SLACK_TITLE: "Github action Push helm charts to artifactory failed"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to Slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "*Helm charts have been published*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ' '
- name: Only keep the last 20 uploaded versions
if: github.event_name == 'push'
run: |
pip install artifactory
python ci-scripts/helm_repo_rotation.py
agw-build:
if: github.event_name == 'push' && github.repository_owner == 'magma'
runs-on: macos-12
outputs:
artifacts: ${{ steps.publish_packages.outputs.artifacts }}
magma_package: ${{ steps.publish_packages.outputs.magma_package }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
with:
fetch-depth: 0
- name: Cache magma-dev-box
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129 # pin@v3
with:
path: ~/.vagrant.d/boxes/magmacore-VAGRANTSLASH-magma_dev
key: vagrant-box-magma-dev-v1.2.20221012
- name: Log in to vagrant cloud
run: |
if [[ -n "${{ secrets.VAGRANT_TOKEN }}" ]]
then
echo "Logging in to vagrant cloud to mitigate rate limiting."
vagrant cloud auth login --token "${{ secrets.VAGRANT_TOKEN }}"
else
echo "Vagrant cloud token is not configured. Skipping login."
fi
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # [email protected]
with:
python-version: '3.8.10'
- name: Install pre requisites
run: |
pip3 install --upgrade pip
pip3 install ansible fabric3 jsonpickle requests PyYAML
vagrant plugin install vagrant-disksize vagrant-vbguest vagrant-mutate vagrant-reload
- name: Open up network interfaces for VM
run: |
sudo mkdir -p /etc/vbox/
sudo touch /etc/vbox/networks.conf
sudo sh -c "echo '* 192.168.0.0/16' > /etc/vbox/networks.conf"
sudo sh -c "echo '* 3001::/64' >> /etc/vbox/networks.conf"
- name: Build AGW
run: |
export MAGMA_DEV_MEMORY_MB=4096
cd lte/gateway
fab release package:destroy_vm=True
mkdir magma-packages
vagrant ssh -c "cp -r magma-packages /vagrant"
- name: Publish debian packages
id: publish_packages
if: github.event_name == 'push'
run: |
cd lte/gateway/magma-packages
ARTIFACTS='{"packages":[],"valid":false}'
PUBLISH_ERROR="false"
for i in `ls -a1 *.deb`
do
echo "Pushing package $i to JFROG artifiactory: https://artifactory.magmacore.org/artifactory/debian-test/pool"
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -uci-bot:${{ secrets.JFROG_CIBOT_APIKEYS }} -XPUT "https://artifactory.magmacore.org/artifactory/debian-test/pool/focal-ci/$i;deb.distribution=focal-ci;deb.component=main;deb.architecture=amd64" -T $i)
echo "$HTTP_RESPONSE"
# extract the body and download uri
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
URI=$(echo $HTTP_BODY | jq -r '.uri')
if [[ "$URI" != "null" ]]; then
ARTIFACTS=$(echo $ARTIFACTS | jq --arg uri $URI '.packages += [$uri]')
else
PUBLISH_ERROR="true"
fi
# extract and check status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
if [[ "$HTTP_STATUS" != "2"* ]]; then
PUBLISH_ERROR="true"
fi
# extract magma debian package version
match="magma_[0-9]+\.[0-9]+\.[0-9]+-[0-9]+-[a-z0-9]+_[a-z0-9]+.deb"
if [[ $i =~ $match ]]; then
magma_package=${i#magma_}
magma_package=${magma_package%_[a-z0-9]*.deb}
magma_package='magma='${magma_package}
echo "::set-output name=magma_package::${magma_package}"
fi
done
# set output
if [[ "$PUBLISH_ERROR" != "true" ]]; then
ARTIFACTS=$(echo $ARTIFACTS | jq '. += {"valid":true}')
fi
echo "::set-output name=artifacts::$(echo $ARTIFACTS)"
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: magma-packages
path: lte/gateway/magma-packages/*.deb
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
name: Export sentry executables
if: github.event_name == 'push'
with:
name: sentry-exec
path: lte/gateway/magma-packages
- name: Extract commit title
# yamllint enable
if: github.event_name == 'push'
id: commit
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: "Github action agw build failed"
SLACK_AVATAR: ":boom:"
uses: Ilshidur/action-slack@689ad44a9c9092315abd286d0e3a9a74d31ab78a # [email protected]
with:
args: "AGW build failed on [${{github.sha}}](${{github.event.repository.owner.html_url}}/magma/commit/${{github.sha}}): ${{ steps.commit.outputs.title}}"
# Notify ci channel when push succeeds
- name: Notify success to Slack
if: success() && github.event_name == 'push'
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_USERNAME: "Github action agw build got published"
uses: Ilshidur/action-slack@689ad44a9c9092315abd286d0e3a9a74d31ab78a # [email protected]
with:
args: "AGW build succeeded on [${{github.sha}}](${{github.event.repository.owner.html_url}}/magma/commit/${{github.sha}}): ${{ steps.commit.outputs.title}}"
sentry_release:
if: always() && github.event_name == 'push'
needs: [ agw-build ]
env:
MAGMA_ROOT: "${{ github.workspace }}"
SENTRY_ENVIRONMENT: "staging"
SENTRY_ORG: "lf-9c"
PATH_TO_EXEC: "./executables"
MAGMA_VERSION: ${{ needs.agw-build.outputs.magma_version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@f023be2c48cc18debc3bacd34cb396e0295e2869 # pin@v2
with:
name: sentry-exec
- uses: geekyeggo/delete-artifact@b73cb986740e466292a536d0e32e2666c56fdeb3 # pin@v1
with:
name: sentry-exec
- run: ls -R
- run: curl -sL https://sentry.io/get-cli/ | bash
- uses: ./.github/workflows/composite/sentry-create-and-upload-artifacts
with:
EXECUTABLE_NAME: sessiond
SENTRY_ORG: lf-9c
PATH_TO_EXEC: "./executables"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
- uses: ./.github/workflows/composite/sentry-create-and-upload-artifacts
with:
EXECUTABLE_NAME: mme
SENTRY_ORG: lf-9c
PATH_TO_EXEC: "./executables"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
- uses: ./.github/workflows/composite/sentry-create-and-upload-artifacts
with:
EXECUTABLE_NAME: sctpd
SENTRY_ORG: lf-9c
PATH_TO_EXEC: "./executables"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
- uses: ./.github/workflows/composite/sentry-create-and-upload-artifacts
with:
EXECUTABLE_NAME: connectiond
SENTRY_ORG: lf-9c
PATH_TO_EXEC: "./executables"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
- uses: ./.github/workflows/composite/sentry-create-and-upload-artifacts
with:
EXECUTABLE_NAME: liagentd
SENTRY_ORG: lf-9c
PATH_TO_EXEC: "./executables"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
- name: Create a release in Sentry.io with the commit hash
env:
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
run: |
COMMIT_HASH_WITH_VERSION="[email protected].$(git rev-list --count HEAD)-${GITHUB_SHA:0:8}"
sentry-cli --log-level=info releases new -p lab-agws-python -p lab-agws-native -p magma-staging-native ${COMMIT_HASH_WITH_VERSION}
sentry-cli --log-level=info releases set-commits --auto --ignore-missing ${COMMIT_HASH_WITH_VERSION}
sentry-cli --log-level=info releases finalize ${COMMIT_HASH_WITH_VERSION}
orc8r-build:
if: github.repository_owner == 'magma'
name: orc8r build job
runs-on: ubuntu-latest
outputs:
artifacts: ${{ steps.publish_artifacts.outputs.artifacts }}
env:
MAGMA_ROOT: "${{ github.workspace }}"
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Run apt-get update
run: sudo apt-get update
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # [email protected]
with:
python-version: '3.8.10'
- name: Run build.py
run: |
cd ${MAGMA_ROOT}/orc8r/cloud/docker
python3 build.py --all --nocache --parallel
- name: Export docker images to deploy them
if: github.event_name == 'pull_request'
run: |
mkdir images
cd images
docker save orc8r_nginx | gzip > nginx.tar.gz
docker save orc8r_controller | gzip > controller.tar.gz
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: docker-images-orc8r
path: images
- name: Create release Tag
if: github.event_name == 'push'
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push to Jfrog Registry
id: publish_artifacts
if: github.event_name == 'push'
env:
DOCKER_REGISTRY: "orc8r-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
./ci-scripts/tag-push-docker.sh --images 'nginx|controller' --tag "${TAG}" --tag-latest true --project orc8r
ARTIFACTS="{\"packages\":[\"$DOCKER_REGISTRY/nginx:${TAG}\", \"$DOCKER_REGISTRY/controller:${TAG}\"],\"valid\":true}"
echo "::set-output name=artifacts::$(echo $ARTIFACTS)"
- name: Extract commit title
if: github.event_name == 'push'
id: commit
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
- name: Notify failure to Slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
# yamllint enable
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "Github action orc8r-build failed"
SLACK_USERNAME: "Build workflow"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to Slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "*Orchestrator images have been published*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ' '
agw-container-build:
if: github.repository_owner == 'magma'
name: agw container build
runs-on: ubuntu-latest
env:
MAGMA_ROOT: "${{ github.workspace }}"
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Run agw docker compose
id: agw-docker-compose
continue-on-error: true
# yamllint disable rule:line-length
run: |
cd ${MAGMA_ROOT}/lte/gateway/docker
docker-compose --file docker-compose.yaml --file docker-compose.override.yaml build --parallel
- name: Retry docker agw compose on failure
id: retry-agw-docker-compose
continue-on-error: true
if: steps.agw-docker-compose.outcome=='failure'
run: |
cd ${MAGMA_ROOT}/lte/gateway/docker
docker-compose --file docker-compose.yaml --file docker-compose.override.yaml build --parallel
- name: Set the agw docker build status
if: always()
run: |
if ${{ steps.agw-docker-compose.outcome=='success' || steps.retry-agw-docker-compose.outcome=='success' }}; then
echo "AGW Docker compose completed successfully"
else
echo "Docker compose failed"
exit 1
fi
- name: Run ghz docker compose
id: ghz-docker-compose
continue-on-error: true
# yamllint disable rule:line-length
run: |
cd ${MAGMA_ROOT}/lte/gateway/docker/ghz
docker-compose --file docker-compose.yaml --file docker-compose.override.yaml build --parallel
- name: Retry ghz docker compose on failure
id: retry-ghz-docker-compose
continue-on-error: true
if: steps.ghz-docker-compose.outcome=='failure'
run: |
cd ${MAGMA_ROOT}/lte/gateway/docker/ghz
docker-compose --file docker-compose.yaml --file docker-compose.override.yaml build --parallel
- name: Set the ghz docker build status
if: always()
run: |
if ${{ steps.ghz-docker-compose.outcome=='success' || steps.retry-ghz-docker-compose.outcome=='success' }}; then
echo "GHZ Docker compose completed successfully"
else
echo "Docker compose failed"
exit 1
fi
- name: Export docker images to deploy them on pull_request
if: github.event_name == 'pull_request'
run: |
mkdir images
cd images
docker save agw_gateway_c | gzip > agw_gateway_c.tar.gz
docker save agw_gateway_python | gzip > agw_gateway_python.tar.gz
docker save ghz_gateway_c | gzip > ghz_gateway_c.tar.gz
docker save ghz_gateway_python | gzip > ghz_gateway_python.tar.gz
- name: Upload docker images as artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: docker-images-agw
path: images
# Need to save PR number as Github action does not propagate it with workflow_run event
# Used as version for PR builds
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
with:
name: pr
path: pr/
- name: Create release Tag
if: github.event_name == 'push'
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push agw containers to Jfrog Registry
id: publish_artifacts
if: github.event_name == 'push'
env:
DOCKER_REGISTRY: "agw-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
./ci-scripts/tag-push-docker.sh --images 'ghz_gateway_c|ghz_gateway_python|agw_gateway_c|agw_gateway_python' --tag "${TAG}" --tag-latest true
cloud-upload:
name: cloud upload job
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository_owner == 'magma'
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Install SwaggerHub CLI
run: npm install --global swaggerhub-cli
- name: Publish SwaggerHub API
env:
MAGMA_ROOT: "${{ github.workspace }}"
SWAGGERHUB_API_KEY: "${{ secrets.SWAGGERHUB_API_KEY }}"
run: |
swaggerhub api:unpublish MagmaCore/Magma/1.0.0
swaggerhub api:update MagmaCore/Magma/1.0.0 --file ${MAGMA_ROOT}/orc8r/cloud/go/services/obsidian/swagger/v1/swagger.yml --published=publish --visibility=public --setdefault
- name: Extract commit title
id: commit
if: github.event_name == 'push'
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
- name: Notify failure to Slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }}
SLACK_TITLE: "Github action cloud-upload failed"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to Slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "*SwaggerHub Updated*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ' '
cwag-deploy:
if: github.repository_owner == 'magma'
name: cwag deploy job
runs-on: ubuntu-latest
outputs:
artifacts: ${{ steps.publish_artifacts.outputs.artifacts }}
env:
MAGMA_ROOT: "${{ github.workspace }}"
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Run docker compose
id: cwag-docker-compose
continue-on-error: true
# yamllint disable rule:line-length
env:
DOCKER_REGISTRY: cwf_
run: |
cd ${MAGMA_ROOT}/cwf/gateway/docker
docker-compose --file docker-compose.yml --file docker-compose.override.yml build --parallel
- name: Retry docker compose on failure
id: retry-cwag-docker-compose
continue-on-error: true
if: steps.cwag-docker-compose.outcome=='failure'
env:
DOCKER_REGISTRY: cwf_
run: |
cd ${MAGMA_ROOT}/cwf/gateway/docker
docker-compose --file docker-compose.yml --file docker-compose.override.yml build --parallel
- name: Set the job status
if: always()
run: |
if ${{ steps.cwag-docker-compose.outcome=='success' || steps.retry-cwag-docker-compose.outcome=='success' }}; then
echo "Docker compose completed successfully"
else
echo "Docker compose failed"
exit 1
fi
- name: Export docker images to deploy them on pull_request
if: github.event_name == 'pull_request'
run: |
mkdir images
cd images
docker save cwf_cwag_go | gzip > cwag_go.tar.gz
docker save cwf_gateway_go | gzip > gateway_go.tar.gz
docker save cwf_gateway_sessiond | gzip > gateway_sessiond.tar.gz
docker save cwf_gateway_python | gzip > gateway_python.tar.gz
docker save cwf_gateway_pipelined | gzip > gateway_pipelined.tar.gz
- name: Upload docker images as artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: docker-images-cwag
path: images
# Need to save PR number as Github action does not propagate it with workflow_run event
# Used as version for PR builds
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/pr_number
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
with:
name: pr
path: pr/
- name: Create release Tag
if: github.event_name == 'push'
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push to Jfrog Registry
id: publish_artifacts
if: github.event_name == 'push'
env:
DOCKER_REGISTRY: "cwf-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
./ci-scripts/tag-push-docker.sh --images 'cwag_go|gateway_go|gateway_python|gateway_sessiond|gateway_pipelined' --tag "${TAG}" --tag-latest true --project cwf
ARTIFACTS="{\"packages\":[\"$DOCKER_REGISTRY/cwag_go:${TAG}\", \"$DOCKER_REGISTRY/gateway_go:${TAG}\", \"$DOCKER_REGISTRY/gateway_python:${TAG}\", \"$DOCKER_REGISTRY/gateway_sessiond:${TAG}\",\"$DOCKER_REGISTRY/gateway_pipelined:${TAG}\"],\"valid\":true}"
echo "::set-output name=artifacts::$(echo $ARTIFACTS)"
- name: Extract commit title
id: commit
if: github.event_name == 'push'
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
# Notify ci channel when failing
# Plugin info: https://github.com/marketplace/actions/slack-notify
# yamllint enable
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }}
SLACK_TITLE: "CWAG-deploy failed"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "*CWAG Artifact Has Been Published*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ' '
cwf-operator-build:
if: github.repository_owner == 'magma'
name: cwf operator build job
runs-on: ubuntu-latest
env:
MAGMA_ROOT: "${{ github.workspace }}"
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Run docker compose build
env:
DOCKER_REGISTRY: cwf_
run: |
cd ${MAGMA_ROOT}/cwf/k8s/cwf_operator/docker
DOCKER_REGISTRY=cwf_ docker-compose build --parallel
- name: Export docker images to deploy them on pull_request
if: github.event_name == 'pull_request'
run: |
mkdir images
cd images
docker save cwf_operator | gzip > operator.tar.gz
- name: Upload docker images as artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: docker-images-cwf
path: images
# Need to save PR number as Github action does not propagate it with workflow_run event
# Used as version for PR builds
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/pr_number
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
with:
name: pr
path: pr/
- name: Create release Tag
if: github.event_name == 'push'
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push to Jfrog Registry
id: publish_artifacts
if: github.event_name == 'push'
env:
DOCKER_REGISTRY: "cwf-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
./ci-scripts/tag-push-docker.sh --images 'operator' --tag "${TAG}" --tag-latest true --project cwf
- name: Extract commit title
id: commit
if: github.event_name == 'push'
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
# Notify ci channel when failing
# Plugin info: https://github.com/marketplace/actions/slack-notify
# yamllint enable
- name: Notify failure to slack
if: failure() && github.ref == 'refs/heads/master'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }}
SLACK_TITLE: "CWF-operator-build failed"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ''
# Notify ci channel when push succeeds
- name: Notify success to slack
if: success() && github.ref == 'refs/heads/master'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_TITLE: "*CWF Artifact Has Been Published*"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ''
feg-build:
if: github.repository_owner == 'magma'
name: feg-build
runs-on: ubuntu-latest
outputs:
artifacts: ${{ steps.publish_artifacts.outputs.artifacts }}
env:
MAGMA_ROOT: "${{ github.workspace }}"
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # [email protected]
with:
python-version: '3.8.10'
- name: generate test certs and snowflake
run: |
# TODO add rootCA.pem and snowflake files in the ubuntu-1604:201903-01 image
# create directories
cd ${MAGMA_ROOT} && mkdir -p .cache/test_certs/ && mkdir -p .cache/feg/
# create test certs
cd ${MAGMA_ROOT}/.cache/test_certs/
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365000 -out rootCA.pem -subj "/C=US/CN=rootca.magma.test"
# create snowflake
cd ${MAGMA_ROOT}/.cache/feg/ && touch snowflake
- name: Build docker images
env:
DOCKER_REGISTRY: feg_
run: |
cd ${MAGMA_ROOT}/feg/gateway/docker
python3 build.py
- name: run docker containers and check health
env:
DOCKER_REGISTRY: feg_
run: |
cd ${MAGMA_ROOT}/feg/gateway/docker
python3 build.py -e
- name: Export docker images to deploy them on pull_request
if: github.event_name == 'pull_request'
run: |
mkdir images
cd images
docker save feg_gateway_go | gzip > feg_gateway_go.tar.gz
docker save feg_gateway_python | gzip > feg_gateway_python.tar.gz
- name: Upload docker images as artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: docker-images-feg
path: images
- name: Create release Tag
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push to Jfrog Registry
id: publish_artifacts
if: github.event_name == 'push'
env:
DOCKER_REGISTRY: "feg-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
./ci-scripts/tag-push-docker.sh --images 'gateway_go|gateway_python' --tag "${TAG}" --tag-latest true --project feg
ARTIFACTS="{\"packages\":[\"$DOCKER_REGISTRY/gateway_go:${TAG}\", \"$DOCKER_REGISTRY/gateway_python:${TAG}\"],\"valid\":true}"
echo "::set-output name=artifacts::$(echo $ARTIFACTS)"
- name: Extract commit title
if: github.event_name == 'push'
id: commit
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
# Notify ci channel when failing
# Plugin info: https://github.com/marketplace/actions/slack-notify
# yamllint enable
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }}
SLACK_TITLE: "FeG-precommit tests failed"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "*FeG Artifact Has Been Published*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ' '
nms-build:
if: github.repository_owner == 'magma'
name: nms-build job
runs-on: ubuntu-latest
outputs:
artifacts: ${{ steps.publish_artifacts.outputs.artifacts }}
env:
MAGMA_ROOT: "${{ github.workspace }}"
NMS_ROOT: "${{ github.workspace }}/nms"
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Run docker compose
id: nms-docker-compose
# yamllint disable rule:line-length
run: |
cd ${MAGMA_ROOT}/nms
COMPOSE_PROJECT_NAME=magmalte docker-compose build magmalte
- name: Export docker images to deploy them on pull_request
if: github.event_name == 'pull_request'
run: |
mkdir images
cd images
docker save magmalte_magmalte | gzip > magmalte.tar.gz
- name: Upload docker images as artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
if: github.event_name == 'pull_request'
with:
name: docker-images-nms
path: images
- name: Create release Tag
if: github.event_name == 'push'
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push to Jfrog Registry
id: publish_artifacts
if: github.event_name == 'push'
env:
DOCKER_REGISTRY: "orc8r-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
./ci-scripts/tag-push-docker.sh --images 'magmalte' --tag "${TAG}" --tag-latest true --project magmalte
ARTIFACTS="{\"packages\":[\"$DOCKER_REGISTRY/magmalte:${TAG}\"],\"valid\":true}"
echo "::set-output name=artifacts::$(echo $ARTIFACTS)"
- name: Extract commit title
id: commit
if: github.event_name == 'push'
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
# Notify ci channel when failing
# Plugin info: https://github.com/marketplace/actions/slack-notify
# yamllint enable
- name: Notify failure to slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "Github action nms-build failed"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "NMS Artifact Has Been Published*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"
SLACK_COLOR: "#00FF00"
SLACK_FOOTER: ' '
Publish_to_firebase:
name: Publish to firebase
if: always() && github.event_name == 'push' && github.repository_owner == 'magma'
runs-on: ubuntu-latest
needs:
[
agw-build,
feg-build,
orc8r-build,
cwag-deploy,
nms-build
]
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # [email protected]
with:
python-version: '3.8.10'
- name: Publish to
env:
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
WORKERS: "wl_lab_5g,feg_integ_test" # all workers for post-merge pipeline. Comma separated
BUILD_ID: "${{ github.sha }}"
BUILD_METADATA: '{"github:workflow": "${{ github.workflow }}", "github:run_id": "${{ github.run_id }}", "github:actor": "${{ github.actor }}", "github:repository": "${{ github.repository }}",
"github:event_name": "${{ github.event_name }}", "github:sha": "${{ github.sha }}", "github:sha:url": "${{github.event.repository.owner.html_url}}/magma/commit/${{github.sha}}",
"github:ref": "${{ github.ref }}"}'
AGW_ARTIFACTS: ${{ needs.agw-build.outputs.artifacts }}
FEG_ARTIFACTS: ${{ needs.feg-build.outputs.artifacts }}
ORC8R_ARTIFACTS: ${{ needs.orc8r-build.outputs.artifacts }}
CWAG_ARTIFACTS: ${{ needs.cwag-deploy.outputs.artifacts }}
NMS_ARTIFACTS: ${{ needs.nms-build.outputs.artifacts }}
run: |
python -m pip install --upgrade pip
pip install Pyrebase
python ci-scripts/firebase_publish.py
domain-proxy-build:
if: github.repository_owner == 'magma'
name: domain proxy build job
runs-on: ubuntu-latest
outputs:
artifacts: ${{ steps.publish_artifacts.outputs.artifacts }}
env:
MAGMA_ROOT: "${{ github.workspace }}"
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Prepare tools
working-directory: "${{ github.workspace }}/dp"
run: |
make _install_skaffold_ci
- name: Create release Tag
if: github.event_name == 'push'
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
echo TAG="${GITHUB_SHA:0:8}" >> $GITHUB_ENV
else
GIT_BRANCH_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo TAG="${GIT_BRANCH_VERSION:1}" >> $GITHUB_ENV
fi
- name: Tag and push to Jfrog Registry
if: github.event_name == 'push'
working-directory: "${{ github.workspace }}/dp"
env:
DOCKER_REGISTRY: "orc8r-test.artifactory.magmacore.org"
DOCKER_USERNAME: "${{ secrets.JFROG_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.JFROG_PASSWORD }}"
run: |
docker login "${DOCKER_REGISTRY}" -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
skaffold build --default-repo="${DOCKER_REGISTRY}" --tag="${TAG}" --push --profile=remote-push
- name: Extract commit title
if: github.event_name == 'push'
id: commit
run: |
str="$(jq '.head_commit.message' $GITHUB_EVENT_PATH)" # get the head_commit message
echo ::set-output name=title::${str%%\\n*} | tr -d '"'
- name: Notify failure to Slack
if: failure() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
# yamllint enable
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "Github action domain-proxy-build failed"
SLACK_USERNAME: "Build workflow"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_ICON_EMOJI: ":boom:"
SLACK_COLOR: "#FF0000"
SLACK_FOOTER: ' '
# Notify ci channel when push succeeds
- name: Notify success to Slack
if: success() && github.event_name == 'push'
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected]
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ARTIFACTS }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_OSS }}
SLACK_TITLE: "*Domain proxy images have been published*"
SLACK_MESSAGE: "${{ steps.commit.outputs.title}}"
SLACK_USERNAME: "Build workflow"
SLACK_ICON_EMOJI: ":heavy_check_mark:"