forked from openshiftio/openshiftio-cico-jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devtools-ci-index.yaml
2819 lines (2726 loc) · 105 KB
/
devtools-ci-index.yaml
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
- defaults:
name: global
timeout: '15m'
jobdescription: "Managed by Jenkins Job Builder, do not edit manually! Update via https://github.com/almighty/almighty-jobs"
git_organization: fabric8-services
github_user: almighty-bot
github_hooks: true
branch: master
- admin_list_defaults: &admin_list_defaults
name: 'admin_list_defaults'
admin-list:
- aditya-konarde
- akurinnoy
- alexeykazakov
- andrewazores
- anmolbabu
- aptmac
- arunkumars08
- ashumilova
- aslakknutsen
- baijum
- bartoszmajsak
- c-koehler
- chrislessard
- corinnekrych
- debloper
- dgutride
- DhritiShikhar
- dlabrecq
- ebaron
- edewit
- fabric8cd
- fche
- fridex
- gastaldi
- hectorj2f
- hferentschik
- ibuziuk
- inoxx03
- invincibleJai
- jarifibrahim
- jarifibrahim
- jiekang
- joshuawilson
- jstrachan
- Katka92
- kbsingh
- kishansagathiya
- kwk
- l0rd
- lavernw1
- ldimaggi
- maxandersen
- mharpur
- michaelkleinhenz
- mindreeper2420
- msrb
- neugens
- nimishamukherjee
- pkajaba
- pmuir
- ppitonak
- pranavgore09
- Preeticp
- rawlingsj
- rhoads-zach
- rhopp
- Ritsyy
- sanbornsen
- sbose78
- sbryzak
- ScrewTSW
- SMahil
- stooke
- surajssd
- tradej
- tsmaeder
- vikram-raj
- VineetReynolds
- vpavlin
- xcoulon
- github_pull_request_defaults: &github_pull_request_defaults
name: 'github_pull_request_defaults'
<<: *admin_list_defaults
cron: '* * * * *'
github-hooks: '{github_hooks}'
permit-all: false
trigger-phrase: '.*\[test\].*'
allow-whitelist-orgs-as-admins: true
status-context: "ci.centos.org PR build"
- trigger:
name: githubprb
triggers:
- github-pull-request:
<<: *github_pull_request_defaults
- scm:
name: git-scm
scm:
- git:
credentials-id: "c4872223-4024-4cd4-8e09-1bbdc7d6e971"
url: "{git_url}"
skip-tag: True
git-tool: ci-git
refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
branches:
- '${{ghprbActualCommit}}'
- wrapper:
name: npm-build-deliver-creds
wrappers:
- credentials-binding:
- text:
credential-id: a9450b57-2492-4c47-9bd1-cabf87f74bb1
variable: GH_TOKEN
- text:
credential-id: f8f7db1d-87c8-4f64-bae7-584142e44f8e
variable: NPM_TOKEN
- wrapper:
name: che_credentials_wrapper
wrappers:
- credentials-binding:
- username-password-separated:
credential-id: b2ae0d9a-307a-4df3-b027-9aa0c22e29dd
username: RHCHEBOT_DOCKER_HUB_USERNAME
password: RHCHEBOT_DOCKER_HUB_PASSWORD
- file:
credential-id: 93da78ec-7785-49ab-a1ef-586424b3e94f
variable: creds_config_file
- wrapper:
name: che_functional_tests_credentials_wrapper
wrappers:
- credentials-binding:
- text:
credential-id: de793dce-5821-4182-af4f-6c7b42b5c21d
variable: KEYCLOAK_TOKEN
- username-password-separated:
credential-id: ac51aeb0-a436-4a50-a71d-aa6f99075398
username: OSIO_USERNAME
password: OSIO_PASSWORD
- job_template_defaults: &job_template_defaults
name: 'job_template_defaults'
description: |
{jobdescription}
node: "{ci_project}"
concurrent: true
properties:
- github:
url: https://github.com/{git_organization}/{git_repo}/
scm:
- git-scm:
git_url: https://{github_user}@github.com/{git_organization}/{git_repo}.git
triggers:
- githubprb:
github_hooks: '{github_hooks}'
builders:
- shell: |
# testing out the cico client
set +e
cp ~/artifacts.key .
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
env > jenkins-env
$ssh_cmd yum -y install rsync
if [ -n "${{ghprbTargetBranch}}" ]; then
git rebase --preserve-merges origin/${{ghprbTargetBranch}}
else
echo "Not a PR build, using master"
fi
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload \
&& /usr/bin/timeout {timeout} $ssh_cmd -t "cd payload && {ci_cmd}"
rtn_code=$?
if [ $rtn_code -eq 0 ]; then
cico node done $CICO_ssid
else
if [[ $rtn_code -eq 124 ]]; then
echo "BUILD TIMEOUT";
cico node done $CICO_ssid
else
# fail mode gives us 12 hrs to debug the machine
curl "http://admin.ci.centos.org:8080/Node/fail?key=$CICO_API_KEY&ssid=$CICO_ssid"
fi
fi
exit $rtn_code
- job-template:
name: '{ci_project}-{git_repo}'
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-jjb-test'
builders:
- shell: |
git rebase --preserve-merges origin/${{ghprbTargetBranch}}
{ci_cmd}
exit $?
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-coverage'
triggers:
- github-pull-request:
status-context: "ci.centos.org PR build (coverage)"
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-wit-go-benchmarks'
triggers:
- timed: '59 23 * * 6'
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-fabric8-analytics'
image_name: 'MISSING_IMAGE_NAME'
wrappers:
- registry_devshift_credentials
- ansicolor
triggers:
- github-pull-request:
status-context: "ci.centos.org PR build (fabric8-analytics)"
org-list:
- fabric8-analytics
success-comment: "$ghprbPullAuthorLoginMention Your image is available in the registry: `docker pull registry.devshift.net/{image_name}:SNAPSHOT-PR-$ghprbPullId`"
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-fabric8-analytics-copr-mercator'
wrappers:
- copr_mercator_api_token
- ansicolor
triggers:
- github-pull-request:
status-context: "ci.centos.org PR (copr) build (fabric8-analytics)"
org-list:
- fabric8-analytics
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-fabric8-hdd'
image_name: 'MISSING_IMAGE_NAME'
wrappers:
- registry_devshift_credentials
- ansicolor
triggers:
- github-pull-request:
status-context: "ci.centos.org PR build (fabric8-hdd)"
org-list:
- fabric8-hdd
success-comment: "$ghprbPullAuthorLoginMention Your image is available in the registry: `docker pull registry.devshift.net/{image_name}:SNAPSHOT-PR-$ghprbPullId`"
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-fabric8-hdd-eslint'
wrappers:
- ansicolor
git_organization: fabric8-hdd
ci_project: 'devtools'
ci_cmd: '/bin/bash cico_run_eslint.sh'
timeout: '20m'
triggers:
- github-pull-request:
status-context: "ci.centos.org eslint run (fabric8-hdd)"
org-list:
- fabric8-hdd
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-fabric8-analytics-pylint'
wrappers:
- ansicolor
git_organization: fabric8-analytics
ci_project: 'devtools'
ci_cmd: '/bin/bash cico_run_pylint.sh'
timeout: '20m'
triggers:
- github-pull-request:
status-context: "ci.centos.org pylint run (fabric8-analytics)"
org-list:
- fabric8-analytics
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template:
name: '{ci_project}-{git_repo}-fabric8-analytics-pydoc'
git_organization: fabric8-analytics
ci_project: 'devtools'
ci_cmd: '/bin/bash cico_run_pydoc.sh'
timeout: '20m'
triggers:
- github-pull-request:
status-context: "ci.centos.org check-style run (fabric8-analytics)"
org-list:
- fabric8-analytics
<<: *github_pull_request_defaults
<<: *job_template_defaults
- job-template: &job_template_build_defaults
name: 'job_template_build_defaults'
subdir: ''
description: |
{jobdescription}
node: "{ci_project}"
properties:
- github:
url: https://github.com/{git_organization}/{git_repo}/
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- '{branch}'
triggers:
- github
svc_name: none
prj_name: dsaas-preview
saas_git: none
saasherder_prepare: |
if [ "$SAAS_GIT" != "none" ]; then
SAAS_ENV=staging
PATH=$PATH:~/.local/bin/
CONTEXT=$(echo $SAAS_GIT | sed 's/.*://')
SAAS_GIT=$(echo $SAAS_GIT | sed 's/:.*//')
SAAS_SERVICE_NAME=$GIT_REPO
if [ "$SUBDIR" != "" ]; then
SAAS_SERVICE_NAME=$SAAS_SERVICE_NAME"-"$SUBDIR
fi
git clone --depth 1 https://github.com/openshiftio/$SAAS_GIT saas.git
cd saas.git
[ "$CONTEXT" != "$SAAS_GIT" ] && saasherder --context $CONTEXT config get-contexts > /dev/null
export DEVSHIFT_TAG_LEN=$(saasherder --environment $SAAS_ENV get hash_length $SAAS_SERVICE_NAME)
cd ..
fi
saasherder_deploy: |
if [ "$SVC_NAME" != "none" ]; then
oc deploy $SVC_NAME --latest -n $PRJ_NAME
rtn_code=$?
fi
if [ "$SAAS_GIT" != "none" ]; then
cd saas.git
saasherder --environment $SAAS_ENV update hash $SAAS_SERVICE_NAME $GIT_COMMIT
saasherder --environment $SAAS_ENV pull $SAAS_SERVICE_NAME
saasherder --environment $SAAS_ENV template --filter Route --output-dir $GIT_REPO-processed tag $SAAS_SERVICE_NAME
oc apply -f $GIT_REPO-processed/$SAAS_SERVICE_NAME.yaml -n $PRJ_NAME
rtn_code=$?
cd ..
fi
builders:
- shell: |
# testing out the cico client
set +e
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
# Verify Job configuration
if [ "{svc_name}" == "none" -a "{saas_git}" == "none" ]; then
echo "Not part of SAAS"
else
#Prepare values for deployment
SVC_NAME={svc_name}
SUBDIR="{subdir}"
GIT_REPO={git_repo}
PRJ_NAME={prj_name}
SAAS_GIT={saas_git}
{saasherder_prepare}
fi
if [ -z "$DEVSHIFT_TAG_LEN" ]; then
export DEVSHIFT_TAG_LEN=7
fi
env > jenkins-env
$ssh_cmd yum -y install rsync
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload
$ssh_cmd -t "cd payload && {ci_cmd}"
rtn_code=$?
if [ $rtn_code -eq 0 ]; then
cico node done $CICO_ssid
#Deploy preview
# Verify Job configuration
if [ "{svc_name}" == "none" -a "{saas_git}" == "none" ]; then
echo "Not part of SAAS, skipping deployment"
else
{saasherder_deploy}
fi
else
# fail mode gives us 12 hrs to debug the machine
curl "http://admin.ci.centos.org:8080/Node/fail?key=$CICO_API_KEY&ssid=$CICO_ssid"
fi
exit $rtn_code
- job-template: &job_template_publish_branch_defaults
name: 'job_template_publish_branch_defaults'
description: |
{jobdescription}
node: "{ci_project}"
properties:
- github:
url: https://github.com/{git_organization}/{git_repo}/
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- '{branch}'
triggers:
- githubprb:
github_hooks: '{github_hooks}'
svc_name: none
builders:
- shell: |
# testing out the cico client
set +e
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
env > jenkins-env
$ssh_cmd yum -y install rsync
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload
$ssh_cmd -t "cd payload && {ci_cmd}"
rtn_code=$?
if [ $rtn_code -eq 0 ]; then
cico node done $CICO_ssid
if [ "{svc_name}" != "none" ]; then
oc deploy {svc_name} --latest
fi
else
# fail mode gives us 12 hrs to debug the machine
curl "http://admin.ci.centos.org:8080/Node/fail?key=$CICO_API_KEY&ssid=$CICO_ssid"
fi
exit $rtn_code
- wrapper:
name: registry_devshift_credentials
wrappers:
- credentials-binding:
- username-password-separated:
credential-id: 1e87842e-7bb7-42f3-aad0-9431acb55c01
username: DEVSHIFT_USERNAME
password: DEVSHIFT_PASSWORD
- wrapper:
name: recommender_api_token
wrappers:
- credentials-binding:
- text:
credential-id: 2fc94f6b-dfef-49a4-a217-fe47aaeea056
variable: RECOMMENDER_API_TOKEN
- wrapper:
name: recommender_api_token_prod
wrappers:
- credentials-binding:
- text:
credential-id: a08f984d-b9f9-4ba8-afa1-4aff10b6da6d
variable: RECOMMENDER_API_TOKEN
- wrapper:
name: copr_mercator_api_token
wrappers:
- credentials-binding:
- text:
credential-id: 9553a3e6-a315-4d6a-9a58-559271b7e39c
variable: COPR_LOGIN_MERCATOR
- text:
credential-id: fecaa647-2720-47f8-99d2-722cb1bce850
variable: COPR_TOKEN_MERCATOR
- job-template: &job_template_build_master
name: '{ci_project}-{git_repo}-build-master'
wrappers:
- registry_devshift_credentials
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- master
<<: *job_template_build_defaults
- job-template:
name: '{ci_project}-{git_repo}-{subdir}-build-master'
<<: *job_template_build_master
- job-template:
name: '{ci_project}-{git_repo}-f8a-build-master'
wrappers:
- registry_devshift_credentials
- ansicolor
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- master
skip_deploy: 0
deployment_units: ''
deployment_configs: ''
builders:
- shell: |
# testing out the cico client
set +e
set +x
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
echo 'Using Host' $CICO_hostname
set -x
env > jenkins-env
cat $creds_config_file >> jenkins-env
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
$ssh_cmd yum -y install rsync
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload
$ssh_cmd -t "cd payload && {ci_cmd}"
rtn_code=$?
# We want to reuse the node for running E2E tests,
# but only if we are not doomed already.
if [[ $rtn_code -ne 0 || {skip_deploy} -ne 0 ]]; then
cico node done $CICO_ssid
fi
cat > deploy-e2e-test-params << EOF
GIT_ORGANIZATION={git_organization}
UPSTREAM_GIT_COMMIT=$GIT_COMMIT
SAAS_GIT={saas_git}
DEPLOYMENT_UNITS={deployment_units}
DEPLOYMENT_CONFIGS={deployment_configs}
CICO_HOSTNAME=$CICO_hostname
CICO_SSID=$CICO_ssid
EOF
exit $rtn_code
- conditional-step:
condition-kind: shell
condition-command: |
[[ {skip_deploy} -eq 0 ]] && exit 0 || exit 1
steps:
- trigger-builds:
- project:
- "devtools-f8a-master-deploy-e2e-test"
property-file: deploy-e2e-test-params
block: true
<<: *job_template_build_defaults
- job-template:
name: '{ci_project}-e2e-fabric8-analytics'
triggers:
- github-pull-request:
status-context: "ci.centos.org PR build (fabric8-analytics)"
org-list:
- fabric8-analytics
<<: *github_pull_request_defaults
wrappers:
- recommender_api_token
- ansicolor
concurrent: false
builders:
- shell: |
set -x
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
echo 'Using Host' $CICO_hostname
env > integration-tests/jenkins-env
gc() {{
rtn_code=$?
cico node done $CICO_ssid || :
exit $rtn_code
}}
trap gc EXIT SIGINT
set -e
# Run E2E tests
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
$ssh_cmd yum -y install rsync
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload-tests
$ssh_cmd -t "cd payload-tests/integration-tests && /bin/bash cico_run_tests.sh"
<<: *job_template_defaults
- job-template:
name: '{ci_project}-test-end-to-end-prod-fabric8-analytics'
triggers:
- timed: '@hourly'
wrappers:
- recommender_api_token_prod
- ansicolor
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- master
concurrent: false
builders:
- shell: |
set -x
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
echo 'Using Host' $CICO_hostname
# We have to point other endpoints to production too
export F8A_API_URL={f8a_api_url}
env > integration-tests/jenkins-env
gc() {{
rtn_code=$?
cico node done $CICO_ssid || :
exit $rtn_code
}}
trap gc EXIT SIGINT
set -e
# Run E2E tests
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
$ssh_cmd yum -y install rsync
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload-tests
$ssh_cmd -t "cd payload-tests/integration-tests && /bin/bash cico_run_tests.sh --tags=production"
<<: *job_template_defaults
- job-template:
name: '{ci_project}-f8a-master-deploy-e2e-test'
publishers:
- email:
recipients: [email protected]
notify-every-unstable-build: true
send-to-individuals: true
wrappers:
- recommender_api_token
- ansicolor
concurrent: false
parameters:
- string:
name: GIT_ORGANIZATION
default: fabric8-analytics
- string:
name: UPSTREAM_GIT_COMMIT
- string:
name: SAAS_GIT
default: '{saas_git}'
- string:
name: PRJ_NAME
default: '{prj_name}'
- string:
name: SVC_NAME
default: none
- string:
name: DEPLOYMENT_UNITS
- string:
name: DEPLOYMENT_CONFIGS
- string:
name: CICO_HOSTNAME
- string:
name: CICO_SSID
- string:
name: BUILD_URL
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- master
builders:
- shell: |
# Verify Job configuration
if [ "$SVC_NAME" == "none" -a "$SAAS_GIT" == "none" ]; then
echo "require either svc_name or saas_git to be set"
exit 1
fi
env > integration-tests/jenkins-env
export GIT_COMMIT=$UPSTREAM_GIT_COMMIT
{saasherder_prepare}
export DEVSHIFT_TAG_LEN=7
for DEPLOYMENT_UNIT in $DEPLOYMENT_UNITS; do
export SAAS_SERVICE_NAME=$DEPLOYMENT_UNIT
export GIT_REPO=$DEPLOYMENT_UNIT
# Deploy preview
{saasherder_deploy}
done
export CICO_API_KEY=$(cat ~/duffy.key )
gc() {{
rtn_code=$?
for DEPLOYMENT_CONFIG in $DEPLOYMENT_CONFIGS; do
if [ $rtn_code -ne 0 ]; then
# Tests failed, rollback
oc rollback dc/$DEPLOYMENT_CONFIG -n $PRJ_NAME || :
fi
done
cico node done $CICO_SSID || :
exit $rtn_code
}}
trap gc EXIT SIGINT
set -e
# Wait for deployment to start and then wait for it to be ready (yeah, this is pretty fragile)
sleep 5
LAST_DC=${{DEPLOYMENT_CONFIGS##* }}
oc logs -f dc/$LAST_DC -n $PRJ_NAME
# Run E2E tests
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_HOSTNAME"
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_HOSTNAME:payload-tests
$ssh_cmd -t "cd payload-tests/integration-tests && /bin/bash cico_run_tests.sh"
<<: *job_template_build_defaults
- job-template: &build_che_template
name: '{ci_project}-{git_repo}-build-che-credentials-{branch}'
wrappers:
- che_credentials_wrapper
- registry_devshift_credentials
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- '{branch}'
builders:
- shell: |
# testing out the cico client
set +e
set +x
export CICO_API_KEY=$(cat ~/duffy.key )
# get node
n=1
while true
do
cico_output=$(cico node get -f value -c ip_address -c comment)
if [ $? -eq 0 ]; then
read CICO_hostname CICO_ssid <<< $cico_output
if [ ! -z "$CICO_hostname" ]; then
# we got hostname from cico
break
fi
echo "'cico node get' succeed, but can't get hostname from output"
fi
if [ $n -gt 5 ]; then
# give up after 5 tries
echo "giving up on 'cico node get'"
exit 1
fi
echo "'cico node get' failed, trying again in 60s ($n/5)"
n=$[$n+1]
sleep 60
done
echo 'Using Host' $CICO_hostname
set -x
#Prepare values for deployment
SVC_NAME={svc_name}
GIT_REPO={git_repo}
PRJ_NAME={prj_name}
SAAS_GIT={saas_git}
{saasherder_prepare}
if [ -z "$DEVSHIFT_TAG_LEN" ]; then
export DEVSHIFT_TAG_LEN=7
fi
env > jenkins-env
cat $creds_config_file >> jenkins-env
sshopts="-t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root"
ssh_cmd="ssh $sshopts $CICO_hostname"
$ssh_cmd yum -y install rsync
rsync -e "ssh $sshopts" -Ha $(pwd)/ $CICO_hostname:payload
$ssh_cmd -t "cd payload && {ci_cmd}"
rtn_code=$?
if [ $rtn_code -eq 0 ]; then
#Deploy preview
{saasherder_deploy}
fi
cico node done $CICO_ssid
exit $rtn_code
<<: *job_template_build_defaults
- job-template:
name: '{ci_project}-{git_repo}-build-che-credentials-pr-check'
wrappers:
- che_functional_tests_credentials_wrapper
- che_credentials_wrapper
triggers:
- github-pull-request:
<<: *github_pull_request_defaults
<<: *build_che_template
- job-template:
name: '{ci_project}-{git_repo}-publish-branch'
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- '{branch}'
triggers:
- github-pull-request:
white-list-target-branches:
- '{branch}'
<<: *github_pull_request_defaults
<<: *job_template_publish_branch_defaults
- job-template:
name: '{ci_project}-{git_repo}-build-master-coverage'
scm:
- git:
url: https://github.com/{git_organization}/{git_repo}.git
shallow_clone: true
branches:
- master
<<: *job_template_build_defaults
- job-template:
name: '{ci_project}-{git_repo}-npm-publish-build-master'
description: |
{jobdescription}
If all goes well, npm is published
node: "{ci_project}"
wrappers:
- npm-build-deliver-creds
- registry_devshift_credentials
properties:
- github:
url: https://github.com/{git_organization}/{git_repo}/
- inject:
properties-content: |
JENKINS_URL=https://ci.centos.org
scm:
- git:
url: https://{github_user}@github.com/{git_organization}/{git_repo}.git
credentials-id: "c4872223-4024-4cd4-8e09-1bbdc7d6e971"
git-tool: ci-git
shallow_clone: false
skip-tag: True
branches:
- master
triggers:
- github
<<: *job_template_build_defaults
- job-template:
name: '{ci_project}-fabric8-devdoc-build-master'
description: |
{jobdescription}
If all goes well, gh-pages is pushed
node: "{ci_project}"
properties:
- github: