-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
439 lines (407 loc) · 16.5 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
# Variable definitions
variables:
LAZ_PROJECT_FILE:
value: "opsiclientkiosk.lpi"
description: "Project file of the lazarus project."
BINARY_NAME_WINDOWS:
value: "opsiclientkiosk.exe"
BINARY_NAME_LINUX:
value: "opsiclientkiosk"
BINARY_NAME_MAC:
value: "OpsiClientKiosk"
SSL_LIB_VERSION:
value: "3.0.14"
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_FORCE_HTTPS: "true"
#GIT_SUBMODULE_UPDATE_FLAGS: --remote
stages:
- init
- build
- bundle
- binaryindex
- package
#**********************************************#
# Get the binary version from the #
# Lazarus Project file (opsiclientkiosk.lpi). #
# The file format is xml. #
#**********************************************#
get version:
stage: init
tags:
- laz-win10
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer erstellen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
- New-Item version.env
- $doc = [XML] (Get-Content -Path $LAZ_PROJECT_FILE)
- $MajorVersionNr = $doc.SelectSingleNode("//MajorVersionNr").Value
- if ($MajorVersionNr -eq $null) {$MajorVersionNr = 0}
- $MinorVersionNr = $doc.SelectSingleNode("//MinorVersionNr").Value
- if ($MinorVersionNr -eq $null) {$MinorVersionNr = 0}
- $RevisionNr = $doc.SelectSingleNode("//RevisionNr").Value
- if ($RevisionNr -eq $null) {$RevisionNr = 0}
- $BuildNr = $doc.SelectSingleNode("//BuildNr").Value
- if ($BuildNr -eq $null) {$BuildNr = 0}
- $BINARY_VERSION = $MajorVersionNr + "." + $MinorVersionNr + "." + $RevisionNr + "." + $BuildNr
- echo $BINARY_VERSION
- Add-Content version.env "BINARY_VERSION=${BINARY_VERSION}"
artifacts:
reports:
dotenv: version.env
#***************************************************#
# Upload opsiclientkiosk.pot file to transifex #
# Download opsiclientkiosk.po files from transifex #
#***************************************************#
transifex:
stage: init
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer erstellen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
- opsi-dev-cli --version
- opsi-dev-cli -l info transifex upload-resource ./locale/opsiclientkiosk.pot
- opsi-dev-cli -l info transifex download-translations opsiclientkiosk.pot ./locale --min-translation-rate 1.0 --language de --language en --language fr
- cd ./locale
- rm *.mo
- |-
for file in *_*.po
do
mv -- "$file" "${file//_/.}"
done
artifacts:
name: "locale"
paths:
- locale
#***************************************#
# compile and codesign Windows #
#***************************************#
compile opsi-client-kiosk windows:
stage: build
dependencies:
- get version
tags:
- laz-win10
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer bauen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
- echo "Compiling ${LAZ_PROJECT_FILE} (Version ${BINARY_VERSION}) for Windows (32 Bit)"
- C:\lazarus\lazbuild.exe $LAZ_PROJECT_FILE --build-all --build-mode=Release_Windows
- echo "Code signing ${BINARY_NAME_WINDOWS} (Version ${BINARY_VERSION}) for windows"
- opsi-dev-tool --version
- opsi-dev-tool -l info --signserver-sign builds\i386-win32\${BINARY_NAME_WINDOWS}
artifacts:
name: "$BINARY_NAME_WINDOWS $BINARY_VERSION Windows 32Bit"
paths:
- builds/i386-win32/${BINARY_NAME_WINDOWS}
#***************************************#
# compile linux #
#***************************************#
compile opsi-client-kiosk linux:
stage: build
dependencies:
- get version
tags:
- laz-linux
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer bauen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
- echo "Compiling ${LAZ_PROJECT_FILE} (Version ${BINARY_VERSION}) for Linux (64 Bit)"
- /usr/share/lazarus/3.4.0/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_Linux
artifacts:
name: "$BINARY_NAME_LINUX $BINARY_VERSION Linux 64Bit"
paths:
- builds/x86_64-linux/${BINARY_NAME_LINUX}
#***************************************#
# compile MacOS #
#***************************************#
compile opsi-client-kiosk macos:
stage: build
dependencies:
- get version
tags:
- laz-macos
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer bauen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
- echo "Compiling ${LAZ_PROJECT_FILE} (Version ${BINARY_VERSION}) for MacOS (Intel, 64 Bit)"
- /Applications/Lazarus/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_MacOS --ws=cocoa
artifacts:
name: "$BINARY_NAME_MAC $BINARY_VERSION MacOS 64Bit Intel"
paths:
- builds/x86_64-darwin/${BINARY_NAME_MAC}
#*********************************************#
# make opsi-client-kiosk bundle for Windows #
#*********************************************#
make opsi-client-kiosk bundle for Windows:
stage: bundle
dependencies:
- get version
- transifex
- compile opsi-client-kiosk windows
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer erstellen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
#- SSL_LIB_VERSION="1.1.1n"
- echo "Make opsi-client-kiosk bundle (Version ${BINARY_VERSION}) for Windows (32 Bit)"
- BundleDir="app_windows"
#- if [ -d $BundleDir ]; then rm -rf $BundleDir fi
- mkdir $BundleDir
- cd $BundleDir
- cp -r ../default .
- cp -r ../locale .
- cp -r ../ock_custom .
- cp -r ../opsiclientkiosk.conf .
- cp -r ../builds/i386-win32/${BINARY_NAME_WINDOWS} .
# Get libs from binaryindex
- opsi-dev-tool --version
# openssl libs
- opsi-dev-tool --binary-pull development openssl windows x86 $SSL_LIB_VERSION .
- cp -r ssl-libs/* .
- rm -r ssl-libs
# sqlite lib
- opsi-dev-tool --binary-pull development sqlite windows x86 3.0.0 .
artifacts:
name: "app_windows"
paths:
- app_windows
#*********************************************#
# make opsi-client-kiosk bundle for Linux #
#*********************************************#
make opsi-client-kiosk bundle for Linux:
stage: bundle
dependencies:
- get version
- transifex
- compile opsi-client-kiosk linux
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer erstellen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
script:
- echo "Make opsi-client-kiosk bundle (Version ${BINARY_VERSION}) for Linux (64 Bit)"
#- SSL_LIB_VERSION="1.1-oldlibc"
- BundleDir="app_linux"
#- if [ -d $BundleDir ]; then rm -rf $BundleDir fi
- mkdir $BundleDir
- cd $BundleDir
- cp -r ../default .
- cp -r ../locale .
- cp -r ../ock_custom .
- cp -r ../opsiclientkiosk.conf .
- cp -r ../builds/x86_64-linux/${BINARY_NAME_LINUX} .
# Get libs from binaryindex
- opsi-dev-tool --version
- opsi-dev-tool --binary-pull development openssl linux x64 $SSL_LIB_VERSION .
- cp -r ssl-libs/* .
- rm -r ssl-libs
artifacts:
name: "app_linux"
paths:
- app_linux
#*********************************************#
# make opsi-client-kiosk bundle for MacOS #
#*********************************************#
make opsi-client-kiosk bundle for MacOS:
stage: bundle
dependencies:
- get version
- transifex
- compile opsi-client-kiosk macos
tags:
- macos_catalina
rules:
# Wenn gepusht oder ein Merge Request erstellt wird immer erstellen
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
before_script:
- curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_DARWIN_X64"
- tar -xvf opsi-dev-tools.tar.gz
- cp opsi-dev-tool opsi-dev-cli
script:
- echo "Make opsi-client-kiosk bundle (Version ${BINARY_VERSION}) for MacOS (64 Bit)"
#- SSL_LIB_VERSION="1.1-unsigned"
- BundleDir="app_macos"
- mkdir $BundleDir
- cd $BundleDir
# Make Apple application structure
- mkdir OpsiClientKiosk.app
- mkdir OpsiClientKiosk.app/Contents
- mkdir OpsiClientKiosk.app/Contents/MacOS
- mkdir OpsiClientKiosk.app/Contents/Resources
- mkdir OpsiClientKiosk.app/Contents/Frameworks
# Patch Info.plist
- sed -i '' -e "/CFBundleShortVersionString/,/<\/string>/s/<string>.*<\/string>/<string>$BINARY_VERSION<\/string>/" ../Info.plist
- cp -r ../Info.plist OpsiClientKiosk.app/Contents
# make PkgInfo
- echo "APPL????" > PkgInfo
# Get libraries from binaryindex and copy them to Frameworks
- ./../opsi-dev-tool --version
# openssl libs
- ./../opsi-dev-tool --binary-pull development openssl darwin x64 $SSL_LIB_VERSION .
- cp -r ssl-libs/* OpsiClientKiosk.app/Contents/Frameworks
- rm -r ssl-libs
# set library paths in library header
- install_name_tool -id @executable_path/../Frameworks/libssl.3.dylib OpsiClientKiosk.app/Contents/Frameworks/libssl.3.dylib
- install_name_tool -change /usr/local/lib/libcrypto.3.dylib @executable_path/../Frameworks/libcrypto.3.dylib OpsiClientKiosk.app/Contents/Frameworks/libssl.3.dylib
- install_name_tool -add_rpath "@executable_path/../Frameworks/libssl.3.dylib" OpsiClientKiosk.app/Contents/Frameworks/libssl.3.dylib
- install_name_tool -id @executable_path/../Frameworks/libcrypto.3.dylib OpsiClientKiosk.app/Contents/Frameworks/libcrypto.3.dylib
# sqlite lib
- ./../opsi-dev-tool --binary-pull development sqlite darwin x64 3.0.0 OpsiClientKiosk.app/Contents/Frameworks
# copy opsiclientkiosk binary to OpsiClientKiosk.app/Contents/MacOS
- cp -r ../builds/x86_64-darwin/${BINARY_NAME_MAC} OpsiClientKiosk.app/Contents/MacOS
# copy resources to OpsiClientKiosk.app/Contents/Resource
- cp -r ../default OpsiClientKiosk.app/Contents/Resources
- cp -r ../locale OpsiClientKiosk.app/Contents/Resources
- cp -r ../opsiclientkiosk.ico OpsiClientKiosk.app/Contents/Resources
# Codesign and notarize application
- ./../opsi-dev-cli -l info apple sign-and-notarize --print-log OpsiClientKiosk.app
# copy files which could be changed by customer to app_macos folder
# they had to be not within the Application structure because the Application will be codesigned and files within could not be changed anymore
- cp -r ../ock_custom .
- cp -r ../opsiclientkiosk.conf .
artifacts:
name: "app_macos"
paths:
- app_macos
#***************************************#
# upload binaries to binaryindex #
#***************************************#
opsi-client-kiosk to binaryindex:
stage: binaryindex
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
- if: $CI_COMMIT_TAG != null
when: always
#- if: $CI_COMMIT_BRANCH == "main"
# when: manual
script:
- echo "deploy to binaryindex"
- opsi-dev-tool --version
- opsi-dev-tool -l info --binary-push builds/i386-win32/${BINARY_NAME_WINDOWS} opsi-client-kiosk windows x86 "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push builds/x86_64-linux/${BINARY_NAME_LINUX} opsi-client-kiosk linux x64 "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push builds/x86_64-darwin/${BINARY_NAME_MAC} opsi-client-kiosk darwin x64 "${BINARY_VERSION}"
#***************************************#
# make opsi-package for Windows #
#***************************************#
opsi-package windows:
stage: package
dependencies:
- get version
- compile opsi-client-kiosk windows
- make opsi-client-kiosk bundle for Windows
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
- if: $CI_COMMIT_TAG != null
when: always
- if: $CI_COMMIT_BRANCH == "main"
when: manual
script:
- set -ex
- echo "Building opsi-package (Version ${BINARY_VERSION}) for Windows (32 Bit)"
- opsiPackage_Path="opsi-packages/windows/opsi-client-kiosk"
- Files_Path="$opsiPackage_Path/CLIENT_DATA/files"
- mkdir -p $Files_Path
- mv app_windows $Files_Path/app
#- cp -r app $Files_Path
- opsi-dev-tool --version
- opsi-dev-tool --binary-pull development client-kiosk-icon-collection all all latest .
- mkdir -p $Files_Path/resources
- mv Collection64x64.zip $Files_Path/resources/Collection64x64.zip
- cd $opsiPackage_Path
# - export version=`grep OPSI/control -A 10 -e "\[Product\]" | grep "version:" | tr -d "^a-zA-Z :"`
- version=$BINARY_VERSION
- 'sed -i "/Product/,/version:/s/version: .*\$/version: $version/" OPSI/control'
- package=`grep OPSI/control -A 4 -e "\[Package\]" | grep "version:" | tr -d "^a-zA-Z :"`
- '[ "$CI_COMMIT_TAG" = "" ] && package="$package.$CI_JOB_ID"'
- 'sed -i "/Package/,/version:/s/version: .*\$/version: $package/" OPSI/control'
- echo "building version $version-$package"
- opsi-makepackage --no-set-rights -l 6
- upload-package opsi-client-kiosk*.opsi
#***************************************#
# make opsi-package for Linux #
#***************************************#
opsi-package linux:
stage: package
dependencies:
- get version
- compile opsi-client-kiosk linux
- make opsi-client-kiosk bundle for Linux
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
- if: $CI_COMMIT_TAG != null
when: always
- if: $CI_COMMIT_BRANCH == "main"
when: manual
script:
- set -ex
- echo "Building opsi-package (Version ${BINARY_VERSION}) for Linux (64 Bit)"
- opsiPackage_Path="opsi-packages/linux/l-opsi-client-kiosk"
- Files_Path="$opsiPackage_Path/CLIENT_DATA/files"
- mkdir -p $Files_Path
- mv app_linux $Files_Path/app
#- cp -r app $Files_Path
- opsi-dev-tool --version
- opsi-dev-tool --binary-pull development client-kiosk-icon-collection all all latest .
- mkdir -p $Files_Path/resources
- mv Collection64x64.zip $Files_Path/resources/Collection64x64.zip
- cd $opsiPackage_Path
# - export version=`grep OPSI/control -A 10 -e "\[Product\]" | grep "version:" | tr -d "^a-zA-Z :"`
- version=$BINARY_VERSION
- 'sed -i "/Product/,/version:/s/version: .*\$/version: $version/" OPSI/control'
- package=`grep OPSI/control -A 4 -e "\[Package\]" | grep "version:" | tr -d "^a-zA-Z :"`
- '[ "$CI_COMMIT_TAG" = "" ] && package="$package.$CI_JOB_ID"'
- 'sed -i "/Package/,/version:/s/version: .*\$/version: $package/" OPSI/control'
- echo "building version $version-$package"
- opsi-makepackage --no-set-rights -l 6
- upload-package l-opsi-client-kiosk*.opsi
#***************************************#
# make opsi-package for MacOS #
#***************************************#
opsi-package macos:
stage: package
dependencies:
- get version
- compile opsi-client-kiosk macos
- make opsi-client-kiosk bundle for MacOS
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
rules:
- if: $CI_COMMIT_TAG != null
when: always
- if: $CI_COMMIT_BRANCH == "main"
when: manual
script:
- set -ex
- echo "Building opsi-package (Version ${BINARY_VERSION}) for MacOS (64 Bit)"
- opsiPackage_Path="opsi-packages/macos/m-opsi-client-kiosk"
- Files_Path="$opsiPackage_Path/CLIENT_DATA/files"
- mkdir -p $Files_Path
- mv app_macos $Files_Path/app
#- cp -r app $Files_Path
- opsi-dev-tool --version
- opsi-dev-tool --binary-pull development client-kiosk-icon-collection all all latest .
- mkdir -p $Files_Path/resources
- mv Collection64x64.zip $Files_Path/resources/Collection64x64.zip
- cd $opsiPackage_Path
# - export version=`grep OPSI/control -A 10 -e "\[Product\]" | grep "version:" | tr -d "^a-zA-Z :"`
- version=$BINARY_VERSION
- 'sed -i "/Product/,/version:/s/version: .*\$/version: $version/" OPSI/control'
- package=`grep OPSI/control -A 4 -e "\[Package\]" | grep "version:" | tr -d "^a-zA-Z :"`
- '[ "$CI_COMMIT_TAG" = "" ] && package="$package.$CI_JOB_ID"'
- 'sed -i "/Package/,/version:/s/version: .*\$/version: $package/" OPSI/control'
- echo "building version $version-$package"
- opsi-makepackage --no-set-rights -l 6
- upload-package m-opsi-client-kiosk*.opsi