-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
779 lines (731 loc) · 25.7 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
image: node:23.0.0-bookworm-slim
stages:
- check
- init
- test
- build
- upload
- publish
- release
.define_globals: &define_globals |
shopt -s expand_aliases
.install_playwright: &install_playwright |
npm i -D @playwright/test
npx playwright install --with-deps chromium
.start_storybook: &start_storybook |
PORT=3003 nohup npm run story > .storybook.log &
.start_webgui: &start_webgui |
PORT=8888 nohup npm run dev > .dev.log &
.install_tools: &install_tools |
export DEBIAN_FRONTEND=noninteractive
apt update
apt -y install debhelper osc zip
# wget http://binaryindex.uib.gmbh/development/opsi-dev-tools/linux/x64/opsi-dev-tools_linux_x64_1.0.79.tar.gz
# tar -xf opsi-dev-tools_linux_x64_1.0.79.tar.gz
curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_LINUX_X64"
tar -xvf opsi-dev-tools.tar.gz
cp opsi-dev-tool opsi-dev-cli
.prepare_backend_tests: &prepare_backend_tests |
apt update
echo "install stuff"
apt -y install git
apt -y install bc wget python3-pip python3-dev python3-venv iproute2 net-tools iputils-ping
git clone -b devel https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.uib.gmbh/uib/opsiconfd.git
cd opsiconfd
# Install debian packages
export DEBIAN_FRONTEND=noninteractive
apt update
apt -y install debhelper osc
apt -y install python3-dev
apt -y install mariadb-client bc
pip3 install --trusted-host pypi.uib.gmbh --index-url http://pypi.uib.gmbh:8080/simple opsi-dev-tools
pip3 install poetry
# Grant full database access to opsi user
mysql --host=mysql --user=root --password=${MYSQL_ROOT_PASSWORD} -e "GRANT ALL ON opsitest.* TO 'opsi'@'%';"
# Get config files from opsi-server package
[ -e /etc/opsi ] && rm -r /etc/opsi
[ -e ../opsi-server ] && rm -r ../opsi-server
url=$(git remote -v | grep fetch | cut -f2 | sed s'#/opsiconfd.git.*#/opsi-server.git#')
#branch=$(git rev-parse --abbrev-ref HEAD)
branch=master
GIT_TERMINAL_PROMPT=0 git clone --branch $branch $url ../opsi-server
cp -a ../opsi-server/opsi-server_data/etc /etc/opsi
# Configure opsiconfd
mkdir -p /var/lib/opsi/repository /var/lib/opsi/depot
echo "redis-internal-url = redis://redis" >> tests/data/default-opsiconfd.conf
echo "log-level-stderr = 0" >> tests/data/default-opsiconfd.conf
echo "log-level-file = 6" >> tests/data/default-opsiconfd.conf
echo "log-file = /tmp/opsiconfd.log" >> tests/data/default-opsiconfd.conf
echo "addon-dirs = [../backend/addon]" >> tests/data/default-opsiconfd.conf
# Installing opsi test modules file
mkdir -p /etc/opsi/licenses
wget --header="Authorization: Bearer ${OPSILICSRV_TOKEN}" "https://opsi-license-server.uib.gmbh/api/v1/licenses/test?usage=opsiconfd-gitlab-ci" -O /etc/opsi/licenses/test.opsilic
# linking python3 as python for compatibility
# ln -s /usr/bin/python3 /usr/bin/python
# Create dirs
mkdir -p /var/log/opsi/clientconnect
mkdir -p /var/lib/opsi/public
mkdir -p /tftpboot
# Install poetry
pip3 install poetry
poetry config experimental.new-installer false
poetry lock --no-update
poetry install
poetry run opsiconfd -c tests/data/default-opsiconfd.conf -l5 setup
# Create adminuser used in tests
useradd adminuser
echo "adminuser:adminuser" | chpasswd
adduser adminuser opsiadmin
# Start and wait for redis server
# redis-server /etc/redis/redis.conf &
sleep 20
.pytest: &pytest |
[ -e /tmp/opsiconfd.log ] && rm /tmp/opsiconfd.log
export OPSICONFD_MAX_SESSIONS_PER_IP=20000
poetry run opsiconfd -c tests/data/default-opsiconfd.conf &
sleep 60
curl -I https://adminuser:adminuser@localhost:4447/admin
echo "---------------------------------------"
echo "Run tests"
echo "---------------------------------------"
exit_code=0
pwd
ls -la
ls -la ../backend
ls -la ../backend/addon
# cp -R ../backend/tests
poetry run pytest --tb=short -v ../backend/tests || exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "---------------------------------------"
echo "opsiconfd log"
echo "---------------------------------------"
cat /tmp/opsiconfd.log
exit $exit_code
fi
.get_changed_files: &get_changed_files |
cd uib-components
changedFiles=$(git diff origin/v4.3 -r --no-commit-id --name-only | grep -i -P 'stories.js|test.component.js|test.unit.js|.vue' | grep -v 'test.component.js-snapshot')
echo "$changedFiles"
basenames=$(basename -s .stories.js $(basename -s .test.component.js $(basename -s .vue -a $changedFiles)))
echo "$basenames"
testfilesUnique=$(echo $basenames | tr ' ' '\n' | awk '!a[$0]++')
# todo checking if each file in testfilesUnique exists
echo "$testfilesUnique"
cd ..
# .prepare_tag: &prepare_tag |
# # "prepare tag"
# if git show-ref --tags $TAG --quiet; then echo "Tag '$TAG' already exists."; else echo "Tag not yet exists '$TAG'"; fi
# # if git show-ref --tags $TAG --quiet; then echo "Tag '$TAG' already exists."; exit 2; else echo "Tag not yet exists '$TAG'"; fi
# # LTAG=$(git describe --tags --abbrev=0 || git tag) # latest tag
# LTAG=$(git tag --sort=taggerdate | tail -1)
# echo "Latest tag... '$LTAG'"
# .push_tag: &push_tag |
# # post tag
# echo "ProjectURL: $CI_API_V4_URL"
# echo "ProjectID: $CI_PROJECT_ID"
# echo "ProjectTAG: $TAG"
# printf "ProjectMSG: \n$(cat $FILE)\n"
# printf "ProjectURL: $CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/tags?tag_name=$TAG&ref=v4.3\n"
# # if [ "$http_response" != "200" ]; then echo "$http_response: $(cat response.txt)"; exit $http_response; fi
# # echo ""
# .delete_tag: &delete_tag |
# # delete tag
# curl --request DELETE \
# --header "PRIVATE-TOKEN: $TOKEN_SUCHER" \
# --url "$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/tags?tag_name=$TAG" || exit_code_del2=$?
# echo ""
# git tag -d $TAG || exit_code_del=$?
# echo ""
# .prepare_git: &prepare_git |
# # "prepare git"
# git config --global user.name "${GITLAB_USER_NAME}"
# git config --global user.email "${GITLAB_USER_EMAIL}"
# git config --global http.postBuffer 52428800
# git fetch
#########################################################################
######################################################################### init
#########################################################################
check:versions:
stage: check
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11 # cause smaller then node...
script:
# download yq (yml parser) https://github.com/mikefarah/yq?tab=readme-ov-file
- wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq
- VERSION_YML=$(yq '.project.version' opsi-dev-tool.yml | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
# - VERSION_YML=$(grep opsi-dev-tool.yml -A 40 -e project | grep -m 1 -E "version:|version\":" | awk '{print $2}' | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
- echo $VERSION_YML
- echo "----------------------------------------------------------------"
- VERSION_YML2=$(yq '.pull-binaries[0].version' opsi-dev-tool.yml | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
# - VERSION_YML2=$(grep opsi-dev-tool.yml -A 30 -e pull-binaries | grep -m 1 -E "version:|version\":" | awk '{print $2}' | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
- VERSION_YML2=${VERSION_YML2//,/}
- echo $VERSION_YML2
- echo "----------------------------------------------------------------"
# - VERSION_JSN=$(cat frontend/package.json | grep "\"version\"" | awk '{print $2}' | sed -e "s/,//g")
- VERSION_JSN=$(yq '.version' opsiweb/package.json | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
# - VERSION_JSN=$(cat opsiweb/package.json | grep "\"version\"" | awk '{print $2}' | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
- VERSION_JSN=${VERSION_JSN//,/}
- echo $VERSION_JSN
- echo "----------------------------------------------------------------"
- VERSION_PY=$(cat backend/addon/webgui/python/const.py | grep "ADDON_VERSION =" | awk '{print $3}' | sed -e "s/,//g" | sed "s/\"//g" | sed "s/'//g")
- echo $VERSION_PY
- TAG=$VERSION_YML
- echo $TAG
- echo "----------------------------------------------------------------"
- if [ "$VERSION_YML" != "$VERSION_YML2" ]; then echo "Versions in opsi-dev-tool-yml doesnt match (project and pull-binaries section.. $VERSION_YML - $VERSION_YML2)"; exit 1; fi
- if [ "$VERSION_YML" != "$VERSION_JSN" ]; then echo "Versions do not match for opsi-dev-tool-yml and frontend/package.json ($VERSION_YML - $VERSION_JSN) "; exit 1; else echo "Versions are equal $VERSION_YML"; fi
- if [ "$VERSION_YML" != "$VERSION_PY" ]; then echo "Versions do not match for opsi-dev-tool-yml and backend/addon/webgui/python/const.py ($VERSION_YML - $VERSION_PY)"; exit 1; else echo "Versions are equal"; fi
init:npm:production:
stage: init
only:
- v4.3
- tags
script:
- cd opsiweb
- *define_globals
- npm --production --only=prod i # Todo: whats the difference between --production and --only=prod
- du -h --max-depth=0 node_modules # just for checking node_modules size (locally computed 251M; CICD: 360M)
artifacts:
paths:
- opsiweb/package.json
- opsiweb/node_modules/
expire_in: 1 day
init:npm:
stage: init
script:
- cd opsiweb
- *define_globals
- npm i
- du -h --max-depth=0 node_modules # just for checking node_modules size (locally computed: 674M; CICD: 801M)
artifacts:
paths:
- opsiweb/package.json
- opsiweb/node_modules/
expire_in: 1 day
init:transifex:
# this step have to be done before building webgui
stage: init
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
script:
- TRANSIFEX_MIN_TRANSLATION_RATE=0.0
- '[ "$CI_COMMIT_TAG" = "" ] || TRANSIFEX_MIN_TRANSLATION_RATE=1.0'
- opsi-dev-cli -l debug transifex upload-resource opsiweb/uib-components/locale/opsi-webgui_en.json --resource-name opsi-webgui-old.json
- opsi-dev-cli -l debug transifex download-translations opsi-webgui-old.json opsiweb/uib-components/locale/ --min-review-rate $TRANSIFEX_MIN_TRANSLATION_RATE -l de -l fr
- chmod 666 opsiweb/uib-components/locale/*
- echo "> rename files"
- cd opsiweb/uib-components/locale/
- find . -depth -name "opsi-webgui-old*" -exec bash -c 'mv -- "$0" "${0//-old/}"' {} \;
- ls -lah
- cat opsi-webgui_de.json # has to exist
- cd -
only:
- tags
- v4.3
artifacts:
name: "opsi-webgui-locale"
paths:
- opsiweb/uib-components/locale
expire_in: 3 day
init:changelogs:
# this step have to be done before building webgui
stage: init
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
script:
- opsi-dev-cli -l 5 changelog from-git output
# - cp -f output/changelog.md webgui/data/.
- chmod 666 output/*
only:
- tags
- v4.3
artifacts:
name: "opsi-webgui-changelogs"
paths:
- output
expire_in: 1 day
#########################################################################
######################################################################### test
#########################################################################
test:lint:
stage: test
dependencies:
- init:npm
- init:transifex
before_script:
- cd opsiweb
- *define_globals
script:
- npm run lint
# test:unit:
# stage: test
# dependencies:
# - init:npm
# script:
# - cd opsiweb
# - *define_globals
# - npm run test:unit
# allow_failure: true
# coverage: /All files\s*\|\s*([\d\.]+)/
# artifacts:
# expire_in: 1 day
# reports:
# coverage_report:
# coverage_format: cobertura
# path: opsiweb/coverage/clover.xmlci
test:accessibility:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
stage: test
dependencies:
- init:npm
before_script:
- cd opsiweb
- *start_webgui
script:
- npm run test:all:accessibility || exit_code=$?
- exit $exit_code
after_script:
- npm run test:all:delete-empty-results
allow_failure: true
only:
- v4.3
- tags
artifacts:
name: "opsi-webgui-test-result-accessibility"
when: on_failure
paths:
- ./**/*/test-results/
- opsiweb/.dev.log
reports:
junit: opsiweb/.config/test-result-pw-reporter-accessibility.xml
expire_in: 1 day
test:usecase:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
stage: test
dependencies:
- init:npm
before_script:
- cd opsiweb
- *define_globals
- *install_playwright
- *start_webgui
script:
- npm run test:all:usecase || exit_code=$?
- exit $exit_code
after_script:
- npm run test:all:delete-empty-results
allow_failure: true
only:
- v4.3
- tags
artifacts:
name: "opsi-webgui-test-result-usecase"
when: on_failure
paths:
- ./**/*/test-results/
- opsiweb/.dev.log
reports:
junit: opsiweb/.config/test-result-pw-reporter-usecase.xml
expire_in: 1 day
test:components:changes:
image: mcr.microsoft.com/playwright:v1.15.2-focal
stage: test
dependencies:
- init:npm
except:
- cicd
- tags # cause in tags we test all browsers (and all files)
- v4.3 # cause in main we test all files
only:
changes:
- opsiweb/pages/*
- opsiweb/components/*
- opsiweb/uib-components/*
before_script:
- cd opsiweb
- *define_globals
- *install_playwright
- *get_changed_files
- echo "$testfilesUnique"
- *start_storybook
- *start_webgui
- sleep 120
script:
- npm run test:all:components $testfilesUnique || exit_code=$?
- exit $exit_code
after_script:
- npm run test:all:delete-empty-results
allow_failure: true
artifacts:
name: "opsi-webgui-test-result-components"
when: on_failure
paths:
- ./**/*/test-results/
- opsiweb/.storybook.log
- opsiweb/.dev.log
reports:
junit: ./opsiweb/.config/test-result-pw-reporter-components.xml
expire_in: 1 day
test:components:
image: mcr.microsoft.com/playwright:v1.15.2-focal
stage: test
dependencies:
- init:npm
only:
- v4.3 # cause in main we test all files, but only chromium browser
- tags
before_script:
- cd opsiweb
- *define_globals
- *install_playwright
- *start_storybook
- *start_webgui
- sleep 60
script:
- npm run test:all:components | tee .tmpRESULT
- exit_code=${PIPESTATUS[0]}
- exit $exit_code
after_script:
- cd opsiweb
- scripts/playwright_coverage.sh .tmpRESULT
- npm run test:all:delete-empty-results
allow_failure: true
coverage: /TESTED FILES\s*:\s*([^%]+)/
artifacts:
name: "opsi-webgui-test-result-components"
when: on_failure
paths:
- ./**/*/test-results/
- opsiweb/.storybook.log
- opsiweb/.dev.log
- opsiweb/.tmpRESULT
reports:
junit: ./opsiweb/test-result-pw-reporter-components.xml
expire_in: 3 day
# test:test-components:all-variants:
# image: mcr.microsoft.com/playwright:v1.15.2-focal
# stage: test
# dependencies:
# - init:npm
# except:
# - cicd
# only:
# - tags # cause in tags we test each file and browser
# script:
# - cd opsiweb
# #- *define_globals
# - npm i -D @playwright/test
# - npx playwright install
# - npx playwright install-deps
# - PORT=3003 nohup npm run dev > .dev.log &
# - PORT=3003 nohup npm run story > .storybook.log &
# - sleep 60
# - npm run test:all:components-devices || exit_code=$?
# - npm run test:all:delete-empty-results
# - exit $exit_code
# # allow_failure: true
# artifacts:
# name: "opsi-webgui-test-result-components"
# when: on_failure
# paths:
# - ./**/*/test-results/
# - opsiweb/.storybook.log
# - opsiweb/.dev.log
# reports:
# junit: ./opsiweb/test-result-pw-reporter-components.xml
# expire_in: 2 day
test:backend-pytest:
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
services:
- name: mysql:latest
command:
- --max_connections=1000
- --default-authentication-plugin=mysql_native_password
- name: redislabs/redistimeseries:latest
alias: redis
variables:
MYSQL_ROOT_PASSWORD: "opsi"
MYSQL_DATABASE: "opsitest"
MYSQL_USER: "opsi"
MYSQL_PASSWORD: "opsi"
script:
- *prepare_backend_tests
- echo "##########################################"
- echo "##################pytest##################"
- echo "##########################################"
- *pytest
allow_failure: true ##### TODO remove again
#########################################################################
######################################################################### build
#########################################################################
build:screenshots:docs: # with transifex
image: mcr.microsoft.com/playwright:v1.15.2-focal
stage: build
dependencies:
- init:npm
- init:transifex
only:
- v4.3 # cause in main we test all files, but only chromium browser
- tags
before_script:
- cd opsiweb
- *define_globals
- *install_playwright
- *start_storybook
- *start_webgui
script:
- cd screenshots4Docs
- npx playwright test -c playwright-screenshots.config.js take_screenshots/ || exit_code=$?
after_script:
- exit $exit_code
allow_failure: true
artifacts:
name: "opsi-webgui-screenshots-docs-result"
when: always
paths:
- opsiweb/screenshots4Docs/screenshots
- ./**/*/test-results/
- opsiweb/.storybook.log
- opsiweb/.dev.log
expire_in: 7 day
build:static:app: # with transifex
stage: build
dependencies:
- init:npm:production
- init:transifex
# - test:lint # todo activate again for main
script:
- cd opsiweb
- npm i @nuxt/typescript-build
- *define_globals
- npm run generate-nossl
artifacts:
paths:
- opsiweb/dist # not used...?
expire_in: 3 day
only:
- v4.3
- tags
build:addon: # with transifex
stage: build
dependencies:
- init:npm:production # doesnt download artifacts from static-app
- init:transifex
- init:changelogs
# - build:static:app # already done in this job
script:
- *install_tools
- pwd && ls -la opsiweb
- cd opsiweb # generate dist
- npm i @nuxt/typescript-build # quick fix, cause this lib cant be found in
- cd ..
- *define_globals
# - npm run generate-nossl
- bash opsiweb/scripts/build_production_local.sh webgui Webgui $(pwd)
# - cd .. # copy to addon
# - mkdir -p backend/addon/webgui/data
# - mkdir -p backend/addon/webgui/data/app
# - cp -r opsiweb/dist/* backend/addon/webgui/data/app/
# - mkdir webgui
# - cp -r backend/addon/webgui/* webgui/
# path should be opsiweb/.. again
- mv opsiweb/webgui webgui
- cp -f output/changelog.md webgui/data/.
- ls -lah webgui # debug
- zip -r -q opsi-webgui.zip webgui
only:
- tags
- v4.3
artifacts:
name: "opsi-webgui-with-zip"
paths:
- webgui
- opsi-webgui.zip
expire_in: 3 day
build:zip: # with transifex
image: node:current-slim
stage: build
dependencies:
- init:npm:production # doesnt download artifacts from static-app
- build:static:app
- init:transifex
- init:changelogs
script:
- *install_tools
- pwd && ls -la opsiweb
- cd opsiweb # generate dist
- ls -lah uib-components/locale
- npm i @nuxt/typescript-build # quick fix, cause this lib cant be found in
- *define_globals
- npm run generate-nossl
- cd .. # copy to addon
- mkdir -p backend/addon/webgui/data
- mkdir -p backend/addon/webgui/data/app
- cp -r opsiweb/dist/* backend/addon/webgui/data/app/
- mkdir webgui
- cp -r backend/addon/webgui/* webgui/
- cp -f output/changelog.md webgui/data/.
- ls -lah webgui # debug
- ls -lah webgui/data # debug
- ls -lah opsiweb/uib-components/locale
only:
- tags
- v4.3
artifacts:
name: "opsi-webgui"
paths:
- webgui
expire_in: 7 day
#########################################################################
######################################################################### create tag
#########################################################################
# upload:gittag:
# image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
# stage: upload
# script:
# - FILE=".tmp_changelog"
# - *prepare_git
# - *install_tools
# - echo "all tags... $(git tag)"
# # - echo "delete Tag..."
# # - TAG=4.3.1.1
# # - *delete_tag
# # - TAG=4.3.14-test # on docker 4
# # - *delete_tag
# # - TAG=4.3.15 # on docker 4
# # - *delete_tag
# # - echo ""
# - *compare_versions
# - *prepare_tag
# - git log --oneline --pretty=format:"%s" ...$LTAG | grep -e "\[*pub*\]" | sort | tee $FILE || (echo "no changelog entries since $LTAG... Add at least one pub message"; exit 3)
# - CHANGELOG_MSG=$(cat $FILE)
# - *push_tag
# # - |
# # curl --request POST \
# # --header "PRIVATE-TOKEN: $TOKEN_SUCHER" \
# # --data-urlencode "message=$CHANGELOG_MSG" \
# # --url "https://gitlab.uib.gmbh/api/v4/projects/335/repository/tags?tag_name=$TAG&ref=main"
# # - echo "Git Tag created successfully"
# - echo "changelog since last tag collected:"
# - echo "$CHANGELOG_MSG"
# # --url "$CI_API_V4_URL/projects/335/repository/tags?tag_name=$TAG&ref=main"
# # -o response.txt \
# # - URL="$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/tags?tag_name=$TAG&ref=main"
# # - echo "$URL"
# # - |
# # curl --request POST --header "PRIVATE-TOKEN: $TOKEN_SUCHER" --data-urlencode "message=$(cat $FILE)" "$URL"
# # - printf "\nRESPONSE:\n $(cat response.txt)"
# - rm $FILE
# # when: manual
# allow_failure: false
# when: always
# only: # visible in this branches: (main!)
# - main
# - tag
#########################################################################
######################################################################### publish
#########################################################################
# .push_release: &push_release |
# # post release
# echo "ProjectURL: $CI_API_V4_URL"
# echo "ProjectID: $CI_PROJECT_ID"
# LTAG=$(git describe --tags --abbrev=0 || git tag) # latest tag
# echo "ProjectTAG: $TAG"
# printf "ProjectMSG: \n$(cat $FILE)\n"
# http_response=$(curl --request POST \
# -o response.txt \
# --fail-with-body \
# --header "PRIVATE-TOKEN: $TOKEN_SUCHER" \
# --url "$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases?tag_name=$TAG&ref=main" \
# --data-urlencode "message=$(cat $FILE)" )
# echo "$http_response: $(cat response.txt)"
# if [ "$http_response" != "200" ]; then echo "$http_response: $(cat response.txt)"; exit $http_response; fi
# echo ""
# upload:git:
# stage: upload
# image: registry.gitlab.com/gitlab-org/release-cli:latest
# needs:
# - job: build:zip
# artifacts: true
# rules:
# - if: $CI_COMMIT_TAG # Run this job when a tag is created
# script:
# - echo "Create Release $TAG, $CI_COMMIT_TAG, $JOB_ID"
# release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
# tag_name: '$CI_COMMIT_TAG'
# description: '$CI_COMMIT_TAG'
# release:
# name: 'Release $CI_COMMIT_TAG'
# tag_name: '$CI_COMMIT_TAG'
# ref: '$CI_COMMIT_TAG'
# description: 'Release $CI_COMMIT_TAG'
# assets:
# links:
# - name: "opsi-webgui"
# url: "https://gitlab.com/uib/opsiweb-ui/-/jobs/$JOB_ID/artifacts/download"
publish:obs_int:
stage: publish
dependencies:
- build:static:app
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
script:
- opsi-dev-tool -l debug --obs-update-package https://obs.uib.gmbh home:uibmz:opsi:4.3:development
only:
- tags
publish:obs_ext:
stage: publish
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
dependencies:
- init:changelogs
- build:addon # todo which is really needed?
- build:static:app # todo which is really needed?
script:
- ls -la
- ls -la opsiweb
- ls -la webgui
- ls -la output
# - opsi-dev-cli -l 5 changelog from-git output
- opsi-dev-tool -l debug --obs-update-package https://build.opensuse.org home:uibmz:opsi:4.3:development
- opsi-dev-cli -l 6 release-service register-package-version opsi-webgui SERVER_PACKAGE --changelog-file output/changelog.md
- opsi-dev-cli -l 6 release-service push-repository-state opsi-webgui SERVER_PACKAGE SERVER_PACKAGE-4.3-development
only:
- tags
artifacts:
name: "opsi-webgui-changelogs"
paths:
- output
expire_in: 1 day
# Copy to experimental via release-tui
publish:binary-index:
stage: publish
dependencies:
- build:addon
- init:changelogs
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
script:
- ls -la
- ls -la opsiweb
- ls -la webgui
- ls -la output
# - opsi-dev-cli -l 5 changelog from-git output # done during init
- cat output/changelog.md
- opsi-dev-cli -l 6 binary push opsi-webgui.zip --product=opsi-webgui.zip # pushing as opsi-webgui.zip now
- opsi-dev-cli -l 6 release-service register-package-version opsi-webgui.zip TOOL --changelog-file output/changelog.md --files=opsi-webgui.zip
only:
- tags
# release:experimental:
# stage: release
# when: manual
# before_script:
# - "which ssh-agent || (apt update && apt -y install openssh-client)"
# - mkdir -p ~/.ssh
# - eval $(ssh-agent -s)
# - ssh-add <(echo "$DOWNLOAD_UIB_PRIVATE_KEY")
# dependencies:
# - publish:obs_ext
# - publish:binary-index
# script:
# - *install_tools
# - ./opsi-dev-tool -l debug --binary-pull
# - scp -o StrictHostKeyChecking=no -r opsi-webgui_${CI_COMMIT_TAG}.zip "$DOWNLOAD_UIB_USER@download.uib.de:/var/www/opsi/htdocs/opsi4.2/experimental/opsiconfd-addons/"
# - ./opsi-dev-tool -l debug --obs-api-conf $OBS_EXT_URL $OBS_EXT_USERNAME $OBS_EXT_PASSWORD
# - osc -A https://api.opensuse.org copypac home:uibmz:opsi:4.2:development opsi-webgui home:uibmz:opsi:4.3:experimental
# only:
# - tags