-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.onedev-buildspec.yml
1218 lines (1218 loc) · 56.9 KB
/
.onedev-buildspec.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: 35
jobs:
- name: Deploy VM
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git config --global --add safe.directory /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:VM_PROFILE@ == \"freeipa\" ] || [ @param:VM_PROFILE@ == \"vyos-router\" ];\nthen \n export VM_NAME=\"@param:VM_PROFILE@\"\nelse\n export VM_NAME=\"@param:VM_PROFILE@-$(echo $RANDOM | md5sum | head -c 5; echo;)\"\nfi \nexport ACTION=\"@param:ACTION@\" # create, delete\necho \"Current VM PROFILE ${VM_PROFILE}\"\necho \"Current VM NAME ${VM_NAME}\"\necho \"********************************\"\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy VM
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:VM_PROFILE@ == \"freeipa\" ] || [ @param:VM_PROFILE@ == \"vyos-router\" ] ;\nthen \n export VM_NAME=\"@param:VM_PROFILE@\"\nelse\n export VM_NAME=\"@param:VM_PROFILE@-$(echo $RANDOM | md5sum | head -c 5; echo;)\"\nfi \n\nif [[ \"@param:ACTION@\" == \"delete\" && ( \"@param:VM_PROFILE@\" == \"freeipa\" || \"@param:VM_PROFILE@\" == \"vyos-router\" ) ]]; then\n export VM_NAME=\"@param:VM_PROFILE@\"\nelif [ \"@param:ACTION@\" == \"delete\" ]; then \n export VM_NAME=\"@param:VM_NAME_INSTANCE@\"\nelse\n\techo \"Skipping delete\"\nfi\n\n\nexport ACTION=\"@param:ACTION@\" # create, delete\necho \"Current VM PROFILE ${VM_PROFILE}\"\necho \"Current VM NAME ${VM_NAME}\"\necho \"********************************\"\ncd /opt/kcli-pipelines/\n./deploy-vm.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
paramSpecs:
- !TextParam
name: GIT_REPO
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://github.com/tosin2013/kcli-pipelines.git
- !TextParam
name: CICD_PIPELINE
description: 'CICD_PIPELINE '
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !TextParam
name: TARGET_SERVER
description: TARGET_SERVER
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: rhel9-equinix
- !ChoiceParam
name: VM_PROFILE
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: freeipa
color: '#0d87e9'
- value: vyos-router
color: '#0d87e9'
- value: rhel8
color: '#0d87e9'
- value: rhel9
color: '#0d87e9'
- value: openshift-jumpbox
color: '#0d87e9'
- value: fedora39
color: '#0d87e9'
- value: ubuntu
color: '#0d87e9'
- value: jupyterlab
color: '#0d87e9'
- value: centos9stream
color: '#0d87e9'
- !ChoiceParam
name: ACTION
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: create
color: '#0d87e9'
- value: delete
color: '#0d87e9'
- !TextParam
name: VM_NAME_INSTANCE
description: Only use when you want to delete a vm
allowEmpty: true
multiline: false
- !ChoiceParam
name: COMMUNITY_VERSION
description: "Set to true if you do not have access to Red Hat Activation Keys\r\n\r\nhttps://access.redhat.com/articles/1378093"
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 3600
- name: Internal - kcli-openshift4-baremetal
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:VM_PROFILE@ == \"freeipa\" ];\nthen \n export VM_NAME=\"@param:VM_PROFILE@\"\nelse\n export VM_NAME=\"@param:VM_PROFILE@-$(echo $RANDOM | md5sum | head -c 5; echo;)\"\nfi \nexport ACTION=\"@param:ACTION@\" # create, delete\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy OpenShift
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
export TARGET_SERVER=@param:TARGET_SERVER@
export VM_NAME=@param:VM_PROFILE@
export VM_PROFILE=@param:VM_PROFILE@
export ACTION=@param:ACTION@
export DEPLOY_OPENSHIFT=@param:DEPLOY_OPENSHIFT@
export LAUNCH_STEPS=@param:LAUNCH_STEPS@
export TAG=@param:TAG@
export DISCONNECTED_INSTALL=@param:DISCONNECTED_INSTALL@
export DEPLOYMENT_CONFIG=@param:DEPLOYMENT_CONFIG@
export COMMUNITY_VERSION=@param:COMMUNITY_VERSION@
cd /opt/kcli-pipelines/
./deploy-vm.sh
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy DNS Server
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export TARGET_SERVER=@param:TARGET_SERVER@\nexport VM_NAME=freeipa\nexport VM_PROFILE=freeipa\nexport ACTION=@param:ACTION@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:ACTION@ == \"create\" ];\nthen \n\tcd /opt/kcli-pipelines/\n\t./deploy-vm.sh\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure DNS
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export TARGET_SERVER=@param:TARGET_SERVER@\n export VM_NAME=@param:VM_PROFILE@\n export VM_PROFILE=@param:VM_PROFILE@\n export ACTION=@param:ACTION@\n export DEPLOY_OPENSHIFT=@param:DEPLOY_OPENSHIFT@\n export LAUNCH_STEPS=@param:LAUNCH_STEPS@\n export TAG=@param:TAG@\n export DISCONNECTED_INSTALL=@param:DISCONNECTED_INSTALL@\n export DEPLOYMENT_CONFIG=@param:DEPLOYMENT_CONFIG@\n \nif [ @param:ACTION@ == \"create\" ];\nthen \n\tcd /opt/kcli-pipelines/\n\t./kcli-openshift4-baremetal/configure_dns_entries.sh\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
paramSpecs:
- !TextParam
name: GIT_REPO
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://github.com/tosin2013/kcli-pipelines.git
- !TextParam
name: CICD_PIPELINE
description: 'CICD_PIPELINE '
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !TextParam
name: TARGET_SERVER
description: TARGET_SERVER
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: rhel9-equinix
- !ChoiceParam
name: VM_PROFILE
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: kcli-openshift4-baremetal
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: kcli-openshift4-baremetal
- !ChoiceParam
name: ACTION
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: create
color: '#0d87e9'
- value: delete
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: create
- !ChoiceParam
name: DEPLOY_OPENSHIFT
description: '''Deploy The OpenShit Cluster on Launch'
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !ChoiceParam
name: LAUNCH_STEPS
description: Auto deploy Steps
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !ChoiceParam
name: TAG
description: OpenShift Version
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: '4.14'
color: '#0d87e9'
- value: '4.15'
color: '#0d87e9'
- value: '4.16'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: '4.16'
- !ChoiceParam
name: DISCONNECTED_INSTALL
description: Enable Disconnected Install
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
- !ChoiceParam
name: DEPLOYMENT_CONFIG
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: cnv-kcli-openshift4-baremetal.yml
color: '#0d87e9'
- value: convereged-kcli-openshift4-baremetal.yml
color: '#0d87e9'
- value: kcli-openshift4-baremetal.yml
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: cnv-kcli-openshift4-baremetal.yml
- !ChoiceParam
name: COMMUNITY_VERSION
description: "Set to true if you do not have access to Red Hat Activation Keys\r\n\r\nhttps://access.redhat.com/articles/1378093\r\n"
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 7200
- name: External - kcli-openshift4-baremetal
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:VM_PROFILE@ == \"freeipa\" ];\nthen \n export VM_NAME=\"@param:VM_PROFILE@\"\nelse\n export VM_NAME=\"@param:VM_PROFILE@-$(echo $RANDOM | md5sum | head -c 5; echo;)\"\nfi \nexport ACTION=\"@param:ACTION@\" # create, delete\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Download ansible-role-update-ip-route53
runInContainer: false
interpreter: !DefaultInterpreter
commands: "cat >/tmp/requirements.yml<<EOF\n---\ncollections:\n - amazon.aws\nroles: \n - name: ansible_role_update_ip_route53\n src: https://github.com/tosin2013/ansible-role-update-ip-route53.git\n version: master\nEOF\nansible-galaxy install -r /tmp/requirements.yml --force -vv\npip3 install boto3 botocore\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Populate DNS Zone
runInContainer: false
interpreter: !DefaultInterpreter
commands: "CLUSTER_NAME=$(yq eval '. | .cluster' /opt/qubinode_navigator/inventories/@param:TARGET_SERVER@/group_vars/control/@param:DEPLOYMENT_CONFIG@)\ncat >/tmp/playbook.yml<<EOF\n- name: Populate OpenShift DNS Entries\n hosts: localhost\n connection: local\n become: yes\n\n vars:\n - update_ip_r53_aws_access_key: @param:AWS_ACCESS_KEY@\n - update_ip_r53_aws_secret_key: @param:AWS_SECRET_KEY@\n - use_public_ip: true\n - private_ip: \"@param:IP_ADDRESS@\"\n - update_ip_r53_records:\n - zone: @param:ZONE_NAME@\n record: api.${CLUSTER_NAME}.@param:GUID@.@param:ZONE_NAME@\n - zone: @param:ZONE_NAME@\n record: \"*.apps.${CLUSTER_NAME}.@param:GUID@.@param:ZONE_NAME@\"\n roles:\n - ansible_role_update_ip_route53\nEOF\n\nif [ \"@param:ACTION@\" != \"delete\" ]; then \n ansible-playbook /tmp/playbook.yml @param:VERBOSE_LEVEL@ || exit $?\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy OpenShift
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
export TARGET_SERVER=@param:TARGET_SERVER@
export VM_NAME=@param:VM_PROFILE@
export VM_PROFILE=@param:VM_PROFILE@
export ACTION=@param:ACTION@
export DEPLOY_OPENSHIFT=@param:DEPLOY_OPENSHIFT@
export LAUNCH_STEPS=@param:LAUNCH_STEPS@
export TAG=@param:TAG@
export DISCONNECTED_INSTALL=@param:DISCONNECTED_INSTALL@
export DEPLOYMENT_CONFIG=@param:DEPLOYMENT_CONFIG@
export COMMUNITY_VERSION=@param:COMMUNITY_VERSION@
export ZONE_NAME=@param:ZONE_NAME@
cd /opt/kcli-pipelines/
./deploy-vm.sh
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Download openshift-forwarder
runInContainer: false
interpreter: !DefaultInterpreter
commands: "cat >/tmp/requirements.yml<<EOF\n---\nroles: \n - name: openshift-forwarder\n src: https://github.com/tosin2013/openshift-forwarder.git\n version: main\nEOF\nansible-galaxy install -r /tmp/requirements.yml --force -vv\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure openshift-forwarder
runInContainer: false
interpreter: !ShellInterpreter
shell: bash
commands: "cat >/tmp/openshift-forwarder.yml<<EOF\n- hosts: localhost\n become: true\n roles:\n - openshift-forwarder\nEOF\n\n# Path to the original YAML file\ninput_file=\"/opt/qubinode_navigator/inventories/@param:TARGET_SERVER@/group_vars/control/@param:DEPLOYMENT_CONFIG@\"\n\n# Output directory\noutput_dir=\"$HOME/vars\"\nmkdir -p $output_dir\n\n# Extract IPs using yq\nips=($(yq e '.baremetal_ips[]' $input_file))\n\n# Start writing the output vars file\ncat > $output_dir/vars.yml <<EOF\n---\n# defaults file for openshift-forwarder\nhaproxy_log_address: \"127.0.0.1\"\nhaproxy_chroot_directory: \"/var/lib/haproxy\"\nhaproxy_pidfile: \"/var/run/haproxy.pid\"\nhaproxy_max_connections: 4000\nhaproxy_stats_socket: \"/var/lib/haproxy/stats\"\ndefault_retries: 3\ndefault_timeout_http_request: \"10s\"\ndefault_timeout_queue: \"1m\"\ndefault_timeout_connect: \"10s\"\ndefault_timeout_client: \"1m\"\ndefault_timeout_server: \"1m\"\ndefault_timeout_http_keep_alive: \"10s\"\ndefault_timeout_check: \"10s\"\ndefault_max_connections: 3000\nmasters:\nEOF\n\n# Decide how many masters and workers based on the number of IPs\nnum_ips=${#ips[@@]}\nif [ $num_ips -ge 3 ]; then\n for i in {0..2}; do\n echo \" - ip: \\\"${ips[$i]}\\\"\" >> $output_dir/vars.yml\n done\n if [ $num_ips -gt 3 ]; then\n echo \"workers:\" >> $output_dir/vars.yml\n for (( i=3; i<$num_ips; i++ )); do\n echo \" - ip: \\\"${ips[$i]}\\\"\" >> $output_dir/vars.yml\n done\n fi\nelif [ $num_ips -eq 1 ]; then\n echo \" - ip: \\\"${ips[0]}\\\"\" >> $output_dir/vars.yml\n echo \"workers:\" >> $output_dir/vars.yml\n echo \" - ip: \\\"${ips[0]}\\\"\" >> $output_dir/vars.yml\nfi\n\necho \"EOF\" \n\nif [ \"@param:ACTION@\" != \"delete\" ]; then \n\tansible-playbook /tmp/openshift-forwarder.yml --extra-vars \"@@$output_dir/vars.yml\" -e \"ansible_python_interpreter=/usr/libexec/platform-python\" -v\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
paramSpecs:
- !TextParam
name: GIT_REPO
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://github.com/tosin2013/kcli-pipelines.git
- !TextParam
name: CICD_PIPELINE
description: 'CICD_PIPELINE '
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !ChoiceParam
name: ACTION
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: create
color: '#0d87e9'
- value: delete
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: create
- !TextParam
name: GUID
description: Server GUID from demo.redhat.com
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: x0c0f
- !TextParam
name: IP_ADDRESS
description: Equinix Metal baremetal IP
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 192.168.10.100
- !TextParam
name: ZONE_NAME
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: sandbox000.opentlc.com
- !SecretParam
name: AWS_ACCESS_KEY
- !SecretParam
name: AWS_SECRET_KEY
- !TextParam
name: TARGET_SERVER
description: TARGET_SERVER
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: rhel9-equinix
- !ChoiceParam
name: DEPLOY_OPENSHIFT
description: '''Deploy The OpenShit Cluster on Launch'
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !ChoiceParam
name: VM_PROFILE
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: kcli-openshift4-baremetal
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: kcli-openshift4-baremetal
- !ChoiceParam
name: LAUNCH_STEPS
description: Auto deploy Steps
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !ChoiceParam
name: TAG
description: OpenShift Version
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: '4.14'
color: '#0d87e9'
- value: '4.15'
color: '#0d87e9'
- value: '4.16'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: '4.16'
- !ChoiceParam
name: DISCONNECTED_INSTALL
description: Enable Disconnected Install
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
- !ChoiceParam
name: DEPLOYMENT_CONFIG
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: cnv-kcli-openshift4-baremetal.yml
color: '#0d87e9'
- value: convereged-kcli-openshift4-baremetal.yml
color: '#0d87e9'
- value: kcli-openshift4-baremetal.yml
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: cnv-kcli-openshift4-baremetal.yml
- !ChoiceParam
name: COMMUNITY_VERSION
description: "Set to true if you do not have access to Red Hat Activation Keys\r\n\r\nhttps://access.redhat.com/articles/1378093\r\n"
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
- !TextParam
name: VERBOSE_LEVEL
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: -v
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 7200
- name: step-ca server
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport VM_NAME=\"@param:VM_PROFILE@\"\nexport ACTION=\"@param:ACTION@\" # create, delete\nexport DOMAIN=@param:DOMAIN@\nexport INITIAL_PASSWORD=@param:INITIAL_PASSWORD@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nexport CUSTOM_PROFILE=true\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy VM
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
export TARGET_SERVER=@param:TARGET_SERVER@
export VM_NAME=@param:VM_PROFILE@
export VM_PROFILE=@param:VM_PROFILE@
export ACTION=@param:ACTION@
cd /opt/kcli-pipelines/
./deploy-vm.sh
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
paramSpecs:
- !TextParam
name: GIT_REPO
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://github.com/tosin2013/kcli-pipelines.git
- !TextParam
name: CICD_PIPELINE
description: 'CICD_PIPELINE '
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !TextParam
name: TARGET_SERVER
description: TARGET_SERVER
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: rhel9-equinix
- !ChoiceParam
name: VM_PROFILE
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: step-ca-server
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: step-ca-server
- !ChoiceParam
name: ACTION
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: create
color: '#0d87e9'
- value: delete
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: create
- !TextParam
name: DOMAIN
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: example.com
- !SecretParam
name: INITIAL_PASSWORD
- !ChoiceParam
name: COMMUNITY_VERSION
description: "Set to true if you do not have access to Red Hat Activation Keys\r\n\r\nhttps://access.redhat.com/articles/1378093"
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 7200
- name: Deploy Registry
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport VM_NAME=\"@param:VM_PROFILE@\"\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nexport HARBOR_VERSION=@param:HARBOR_VERSION@\nexport QUAY_VERSION=@param:QUAY_VERSION@\nexport CA_URL=@param:CA_URL@\nexport FINGERPRINT=@param:FINGERPRINT@\nexport STEP_CA_PASSWORD=@param:STEP_CA_PASSWORD@\nexport ACTION=\"@param:ACTION@\" # create, delete\nexport CUSTOM_PROFILE=true\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy VM
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport VM_NAME=\"@param:VM_PROFILE@\"\nexport ACTION=\"@param:ACTION@\" # create, delete\ncd /opt/kcli-pipelines/\n./deploy-vm.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
paramSpecs:
- !TextParam
name: GIT_REPO
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://github.com/tosin2013/kcli-pipelines.git
- !TextParam
name: CICD_PIPELINE
description: 'CICD_PIPELINE '
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !TextParam
name: TARGET_SERVER
description: TARGET_SERVER
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: rhel9-equinix
- !ChoiceParam
name: VM_PROFILE
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: harbor
color: '#0d87e9'
- value: mirror-registry
color: '#0d87e9'
- !ChoiceParam
name: ACTION
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: create
color: '#0d87e9'
- value: delete
color: '#0d87e9'
- !ChoiceParam
name: COMMUNITY_VERSION
description: "Set to true if you do not have access to Red Hat Activation Keys\r\n\r\nhttps://access.redhat.com/articles/1378093"
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
- !ChoiceParam
name: HARBOR_VERSION
description: 'Harbor Version: '
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: v2.10.1
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: v2.10.1
- !TextParam
name: QUAY_VERSION
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: v1.3.10
- !TextParam
name: CA_URL
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://step-ca-server.example.com:443
- !SecretParam
name: FINGERPRINT
- !SecretParam
name: STEP_CA_PASSWORD
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 3600
postBuildActions:
- !RunJobAction
condition: '"VM_PROFILE" is "mirror-registry"'
jobName: Configure Mirror Registry
- name: Configure Mirror Registry
jobExecutor: default-executor
steps:
- !CommandStep
name: install mirror-registry
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
kcli ssh root@@mirror-registry /tmp/install-quay.sh
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
retryCondition: '"Log" contains "failed"'
maxRetries: 3
retryDelay: 30
timeout: 3600
- name: Internal - OpenShift Agent Based Installer Helper
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:VM_PROFILE@ == \"freeipa\" ];\nthen \n export VM_NAME=\"@param:VM_PROFILE@\"\nelse\n export VM_NAME=\"@param:VM_PROFILE@-$(echo $RANDOM | md5sum | head -c 5; echo;)\"\nfi \nexport ACTION=\"@param:ACTION@\" # create, delete\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy DNS Server
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export TARGET_SERVER=@param:TARGET_SERVER@\nexport VM_NAME=freeipa\nexport VM_PROFILE=freeipa\nexport ACTION=@param:ACTION@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:ACTION@ == \"create\" ];\nthen \n\tcd /opt/kcli-pipelines/\n\t./deploy-vm.sh\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy Vyos-Router
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
export TARGET_SERVER=@param:TARGET_SERVER@
export VM_NAME=vyos-router
export VM_PROFILE=vyos-router
export ACTION=@param:ACTION@
export COMMUNITY_VERSION=@param:COMMUNITY_VERSION@
if ! sudo kcli list vms | grep -q ${VM_NAME}; then
if [ "@param:ACTION@" == "create" ]; then
cd /opt/kcli-pipelines/
./deploy-vm.sh
else
echo "Skipping deployment as vyos-router VM does not exist and ACTION is not create"
fi
else
echo "vyos-router VM exists, skipping deployment"
fi
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Wait for Vyos Router Configuration
runInContainer: false
interpreter: !ShellInterpreter
shell: bash
commands: "#!/bin/bash\n\nif [ @param:ACTION@ == \"delete\" ];\nthen \n echo \"Skipping vyos check\"\n exit 0\nfi \n\n\n# Function to check if the IP is accessible\ncheck_ip() {\n ping -c 1 $1 > /dev/null 2>&1\n return $?\n}\n\nif [ \"@param:ACTION@\" == \"create\" ]; then\n\t# Set the IP address to check\n\tIP_ADDRESS=\"192.168.122.2\"\n\tMAX_WAIT_TIME=1800 # 30 minutes in seconds\n\tWAIT_INTERVAL=300 # 5 minutes in seconds\n\n\t# Start the timer\n\tstart_time=$(date +%s)\n\tend_time=$((start_time + MAX_WAIT_TIME))\n\n\techo \"Waiting for $IP_ADDRESS to be accessible...\"\n\n\twhile true; do\n\t\t# Check if the IP is accessible\n\t\tcheck_ip $IP_ADDRESS\n\n\t\tif [ $? -eq 0 ]; then\n\t\t\techo \"Router is accessible now. Continuing...\"\n\t\t\tbreak\n\t\telse\n\t\t\tcurrent_time=$(date +%s)\n\t\t\tremaining_time=$((end_time - current_time))\n\n\t\t\tif [ $remaining_time -gt 0 ]; then\n\t\t\t\techo \"Router is not accessible yet. Please access this page to manually configure the router: https://github.com/tosin2013/demo-virt/blob/rhpds/demo.redhat.com/docs/step1.md\"\n\t\t\t\techo \"Remaining time: $((remaining_time / 60)) minutes\"\n\t\t\t\tsleep $WAIT_INTERVAL\n\t\t\telse\n\t\t\t\techo \"Timeout reached. Router is still not accessible.\"\n\t\t\t\texit 1\n\t\t\tfi\n\t\tfi\n\tdone\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure Vyos Routes
runInContainer: false
interpreter: !ShellInterpreter
shell: bash
commands: "#!/bin/bash\nnetworks=(\n \"192.168.49.0/24\"\n \"192.168.50.0/24\"\n \"192.168.51.0/24\"\n\t\"192.168.52.0/24\"\n\t\"192.168.53.0/24\"\n\t\"192.168.54.0/24\"\n\t\"192.168.55.0/24\"\n\t\"192.168.56.0/24\"\n\t\"192.168.57.0/24\"\n\t\"192.168.58.0/24\"\n)\n\ngateway=\"192.168.122.2\"\n\nfor net in \"${networks[@@]}\"; do\n if ! ip route show | grep -q \"$net\"; then # Check if route DOES NOT exist\n sudo ip route add \"$net\" via \"$gateway\"\n echo \"Route for $net added.\"\n else\n echo \"Route for $net already exists.\"\n fi\ndone\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Wait for Vyos Route 192.168.50.1
runInContainer: false
interpreter: !ShellInterpreter
shell: bash
commands: "#!/bin/bash\n\n# Function to check if the IP is accessible\ncheck_ip() {\n ping -c 1 $1 > /dev/null 2>&1\n return $?\n}\nif [ \"@param:ACTION@\" == \"create\" ]; then\n\t# Set the IP address to check\n\tIP_ADDRESS=\"192.168.50.1\"\n\tMAX_WAIT_TIME=1800 # 30 minutes in seconds\n\tWAIT_INTERVAL=300 # 5 minutes in seconds\n\n\t# Start the timer\n\tstart_time=$(date +%s)\n\tend_time=$((start_time + MAX_WAIT_TIME))\n\n\techo \"Waiting for $IP_ADDRESS to be accessible...\"\n\n\twhile true; do\n\t\t# Check if the IP is accessible\n\t\tcheck_ip $IP_ADDRESS\n\n\t\tif [ $? -eq 0 ]; then\n\t\t\techo \"192.168.50.1 is accessible now. Continuing...\"\n\t\t\tbreak\n\t\telse\n\t\t\tcurrent_time=$(date +%s)\n\t\t\tremaining_time=$((end_time - current_time))\n\n\t\t\tif [ $remaining_time -gt 0 ]; then\n\t\t\t\techo \"Router is not accessible yet. Please access this page to manually configure the router: https://github.com/tosin2013/demo-virt/blob/rhpds/demo.redhat.com/docs/step1.md\"\n\t\t\t\techo \"Remaining time: $((remaining_time / 60)) minutes\"\n\t\t\t\tsleep $WAIT_INTERVAL\n\t\t\telse\n\t\t\t\techo \"Timeout reached. Router is still not accessible.\"\n\t\t\t\texit 1\n\t\t\tfi\n\t\tfi\n\tdone\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure DNS Entries
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export TARGET_SERVER=@param:TARGET_SERVER@\nexport VM_NAME=@param:VM_PROFILE@\nexport VM_PROFILE=@param:VM_PROFILE@\nexport ACTION=@param:ACTION@\nexport DEPLOY_OPENSHIFT=@param:DEPLOY_OPENSHIFT@\nexport FOLDER_NAME=@param:FOLDER_NAME@\n\nif [ @param:ACTION@ == \"create\" ];\nthen \n\tcd /opt/kcli-pipelines/\n\t./openshift-agent-install/configure_dns_entries.sh\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure oc binary
runInContainer: false
interpreter: !ShellInterpreter
shell: bash
commands: "#!/bin/bash\n\n# Check if oc is installed\nif ! command -v oc &>/dev/null; then\n echo \"oc is not installed, downloading and running OpenShift package configuration script...\"\n \n # Download the configuration script\n curl -OL https://raw.githubusercontent.com/tosin2013/openshift-4-deployment-notes/master/pre-steps/configure-openshift-packages.sh\n \n # Make the script executable\n chmod +x configure-openshift-packages.sh\n \n # Run the script with the -i flag\n ./configure-openshift-packages.sh -i\nelse\n echo \"oc is already installed, skipping OpenShift package configuration.\"\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy OpenShift
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
export TARGET_SERVER=@param:TARGET_SERVER@
export VM_NAME=@param:VM_PROFILE@
export VM_PROFILE=@param:VM_PROFILE@
export ACTION=@param:ACTION@
export DEPLOY_OPENSHIFT=@param:DEPLOY_OPENSHIFT@
export COMMUNITY_VERSION=@param:COMMUNITY_VERSION@
export FOLDER_NAME=@param:FOLDER_NAME@
cd /opt/kcli-pipelines/
./deploy-vm.sh
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
paramSpecs:
- !TextParam
name: GIT_REPO
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: https://github.com/tosin2013/kcli-pipelines.git
- !TextParam
name: CICD_PIPELINE
description: 'CICD_PIPELINE '
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !TextParam
name: TARGET_SERVER
description: TARGET_SERVER
allowEmpty: false
multiline: false
defaultValueProvider: !SpecifiedDefaultValue
value: rhel9-equinix
- !ChoiceParam
name: VM_PROFILE
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: openshift-agent-install
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: openshift-agent-install
- !ChoiceParam
name: FOLDER_NAME
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: cnv-bond0-signal-vlan
color: '#0d87e9'
- value: bond0-signal-vlan
color: '#0d87e9'
- value: sno-bond0-signal-vlan
color: '#0d87e9'
- value: sno-2-bond0-signal-vlan
color: '#0d87e9'
- value: sno-3-bond0-signal-vlan
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: cnv-bond0-signal-vlan
- !ChoiceParam
name: ACTION
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: create
color: '#0d87e9'
- value: delete
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: create
- !ChoiceParam
name: DEPLOY_OPENSHIFT
description: '''Deploy The OpenShit Cluster on Launch'
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'true'
- !ChoiceParam
name: DISCONNECTED_INSTALL
description: Enable Disconnected Install
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
- !ChoiceParam
name: COMMUNITY_VERSION
description: "Set to true if you do not have access to Red Hat Activation Keys\r\n\r\nhttps://access.redhat.com/articles/1378093\r\n"
allowMultiple: false
allowEmpty: false
choiceProvider: !SpecifiedChoices
choices:
- value: 'true'
color: '#0d87e9'
- value: 'false'
color: '#0d87e9'
defaultValueProvider: !SpecifiedDefaultValue
value: 'false'
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 7200
- name: External - OpenShift Agent Based Installer Helper
jobExecutor: default-executor
steps:
- !CommandStep
name: Download kcli-pipelines
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/kcli-pipelines ];\nthen \n cd /opt/\n git clone @param:GIT_REPO@\nelse\n cd /opt/kcli-pipelines\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Configure KCLI Profiles
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export CICD_PIPELINE=\"@param:CICD_PIPELINE@\" \nexport TARGET_SERVER=\"@param:TARGET_SERVER@\" # equinix \nexport VM_PROFILE=@param:VM_PROFILE@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nif [ @param:VM_PROFILE@ == \"freeipa\" ];\nthen \n export VM_NAME=\"@param:VM_PROFILE@\"\nelse\n export VM_NAME=\"@param:VM_PROFILE@-$(echo $RANDOM | md5sum | head -c 5; echo;)\"\nfi \nexport ACTION=\"@param:ACTION@\" # create, delete\ncd /opt/kcli-pipelines/\n./configure-kcli-profiles.sh\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Download openshift-agent-install
runInContainer: false
interpreter: !DefaultInterpreter
commands: "if [ ! -d /opt/openshift-agent-install ];\nthen \n cd /opt/\n git clone https://github.com/tosin2013/openshift-agent-install.git\nelse\n cd /opt/openshift-agent-install\n git pull\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Download ansible-role-update-ip-route53
runInContainer: false
interpreter: !DefaultInterpreter
commands: "cat >/tmp/requirements.yml<<EOF\n---\ncollections:\n - amazon.aws\nroles: \n - name: ansible_role_update_ip_route53\n src: https://github.com/tosin2013/ansible-role-update-ip-route53.git\n version: master\nEOF\nansible-galaxy install -r /tmp/requirements.yml --force -vv\npip3 install boto3 botocore\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Populate DNS Zone
runInContainer: false
interpreter: !DefaultInterpreter
commands: "CLUSTER_FILE_PATH=\"/opt/openshift-agent-install/examples/@param:FOLDER_NAME@/cluster.yml\"\nCLUSTER_NAME=$(yq e '.cluster_name' ${CLUSTER_FILE_PATH})\necho \"Setting DNS Records below\"\necho \"api.${CLUSTER_NAME}.@param:GUID@.@param:ZONE_NAME@\"\necho \"*.apps.${CLUSTER_NAME}.@param:GUID@.@param:ZONE_NAME@\"\ncat >/tmp/playbook.yml<<EOF\n- name: Populate OpenShift DNS Entries\n hosts: localhost\n connection: local\n become: yes\n\n vars:\n - update_ip_r53_aws_access_key: @param:AWS_ACCESS_KEY@\n - update_ip_r53_aws_secret_key: @param:AWS_SECRET_KEY@\n - use_public_ip: true\n - private_ip: \"@param:IP_ADDRESS@\"\n - update_ip_r53_records:\n - zone: @param:ZONE_NAME@\n record: api.${CLUSTER_NAME}.@param:GUID@.@param:ZONE_NAME@\n - zone: @param:ZONE_NAME@\n record: \"*.apps.${CLUSTER_NAME}.@param:GUID@.@param:ZONE_NAME@\"\n roles:\n - ansible_role_update_ip_route53\nEOF\n\nif [ \"@param:ACTION@\" != \"delete\" ]; then \n ansible-playbook /tmp/playbook.yml @param:VERBOSE_LEVEL@ || exit $?\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy DNS Server
runInContainer: false
interpreter: !DefaultInterpreter
commands: "export TARGET_SERVER=@param:TARGET_SERVER@\nexport VM_NAME=freeipa\nexport VM_PROFILE=freeipa\nexport ACTION=@param:ACTION@\nexport COMMUNITY_VERSION=@param:COMMUNITY_VERSION@\nexport ZONE_NAME=@param:ZONE_NAME@\nCLUSTER_FILE_PATH=\"/opt/openshift-agent-install/examples/@param:FOLDER_NAME@/cluster.yml\"\nif [ ! -z ${ZONE_NAME} ];\nthen\n DOMAIN=@param:GUID@.@param:ZONE_NAME@\n yq e -i '.domain = \"'${DOMAIN}'\"' /opt/qubinode_navigator/inventories/@param:TARGET_SERVER@/group_vars/all.yml\n yq e -i '.base_domain = \"'${DOMAIN}'\"' ${CLUSTER_FILE_PATH}\n yq e -i '.dns_search_domains[0] = \"'${DOMAIN}'\"' ${CLUSTER_FILE_PATH}\n yq e -i 'del(.dns_search_domains[1])' ${CLUSTER_FILE_PATH}\nelse\n DOMAIN=$(yq eval '.domain' \"${ANSIBLE_ALL_VARIABLES}\")\nfi\nif [ @param:ACTION@ == \"create\" ];\nthen \n\tcd /opt/kcli-pipelines/\n\t./deploy-vm.sh\nfi\n"
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Deploy Vyos-Router
runInContainer: false
interpreter: !DefaultInterpreter
commands: |
export TARGET_SERVER=@param:TARGET_SERVER@
export VM_NAME=vyos-router
export VM_PROFILE=vyos-router
export ACTION=@param:ACTION@
export COMMUNITY_VERSION=@param:COMMUNITY_VERSION@
if ! sudo kcli list vms | grep -q ${VM_NAME}; then
if [ "@param:ACTION@" == "create" ]; then
cd /opt/kcli-pipelines/
./deploy-vm.sh
else
echo "Skipping deployment as vyos-router VM does not exist and ACTION is not create"
fi
else
echo "vyos-router VM exists, skipping deployment"