-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
134 lines (121 loc) · 6.54 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
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
stages:
- prepare
- build
- package
- test
prepare_files:
stage: prepare
script:
- opsi-dev-cli -l info binary pull
- version=$(opsi-dev-cli opsi-package get-value productVersion)
- package=$(opsi-dev-cli opsi-package get-value packageVersion)
- newpackage="$package"
- '[ "$CI_COMMIT_TAG" = "" ] && newpackage="$package.$CI_JOB_ID"'
- opsi-dev-cli opsi-package set-value packageVersion "$newpackage"
- echo "$version-$newpackage" > CLIENT_DATA/files/opsi-client-agent.version
artifacts:
name: prepared_files
paths:
- OPSI/control
- CLIENT_DATA/
windows-x86-installer:
stage: build
tags:
- windows
script:
# Speedup Invoke-WebRequest
- $ProgressPreference = 'SilentlyContinue'
- Invoke-WebRequest -UseBasicParsing -Uri "$OPSIDEVTOOLS_URL_WINDOWS_X86" -OutFile opsi-dev-tools.zip
- Expand-Archive opsi-dev-tools.zip -DestinationPath .
- Copy-Item .\opsi-dev-tool.exe -Destination .\opsi-dev-cli.exe
# Download ziplaunch for windows
- .\opsi-dev-cli.exe binary pull ziplaunch
# Get version from control file and patch ziplaunch.ini
- $version = .\opsi-dev-cli.exe opsi-package get-value productVersion
- ((Get-Content -path .\oca-installer\ziplaunch.ini -Raw) -replace "{version}",$version) | Set-Content -Path .\oca-installer\ziplaunch.ini
# Build installer
- Start-Process ".\ziplaunch\ziplaunch.exe" -ArgumentList "CLIENT_DATA",".\oca-installer\ziplaunch.ini","opsi-client-agent-installer.exe" -Wait
# Sign exe
- .\opsi-dev-tool.exe -l info --signserver-sign opsi-client-agent-installer.exe
# Push to binaryindex
- if (! $CI_COMMIT_TAG) {.\opsi-dev-cli.exe -l info binary push opsi-client-agent-installer.exe --product=opsi-client-agent-installer --system=windows --architecture=x86 --version=$version --prerelease="$CI_JOB_ID"}
- if ($CI_COMMIT_TAG) {.\opsi-dev-cli.exe -l info binary push opsi-client-agent-installer.exe --product=opsi-client-agent-installer --system=windows --architecture=x86 --version=$version }
artifacts:
name: opsi-client-agent-installer
paths:
- opsi-client-agent-installer.exe
linux_make_msi:
# wixl sometimes produces a corrupt cab file in msi
when: manual
image: debian:bullseye
stage: package
script:
- apt update
- apt -y install wget cpio unar wixl uuid-runtime
- version=$(grep OPSI/control -A 10 -e "\[Product\]" | grep "version:" | tr -d "^a-zA-Z :")
#- product_id=$(uuidgen | tr a-z A-Z)
#- sed "s/{version}/${version}/g;s/{product_id}/${product_id}/g" msi/opsi-client-agent.wxs > opsi-client-agent.wxs
- sed "s/{version}/${version}/g" msi/opsi-client-agent.wxs > opsi-client-agent.wxs
- cat opsi-client-agent.wxs
- wixl -v opsi-client-agent.wxs
- opsi-dev-tool -l info --signserver-sign opsi-client-agent.msi
# Push to binaryindex
- '[ "$CI_COMMIT_TAG" = "" ] && opsi-dev-cli -l info binary push opsi-client-agent.msi --product=opsi-client-agent-msi --system=windows --architecture=x86 --version="$version" --prerelease"$CI_JOB_ID"'
- '[ "$CI_COMMIT_TAG" = "" ] || opsi-dev-cli -l info binary push opsi-client-agent.msi --product=opsi-client-agent-msi --system=windows --architecture=x86 --version="$version"'
- '[ "$CI_COMMIT_TAG" = "" ] || opsi-dev-cli -l info release-service register-package-version opsi-client-agent-msi TOOL --files=opsi-client-agent.msi --version="$version" --changelog-file=OPSI/CHANGELOG.md'
artifacts:
name: opsi-client-agent-msi
paths:
- opsi-client-agent.msi
windows_make_msi:
stage: package
tags:
- windows
script:
- Invoke-WebRequest -UseBasicParsing -Uri "$OPSIDEVTOOLS_URL_WINDOWS_X86" -OutFile opsi-dev-tools.zip
- Expand-Archive opsi-dev-tools.zip -DestinationPath .
- Copy-Item .\opsi-dev-tool.exe -Destination .\opsi-dev-cli.exe
- Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" -OutFile wix-binaries.zip
- Expand-Archive wix-binaries.zip -DestinationPath wix
# Get version from control file
- $version = .\opsi-dev-cli.exe opsi-package get-value productVersion
# Patch version
- ((Get-Content -path msi\\opsi-client-agent.wxs -Raw) -replace "{version}",$version) | Set-Content -Path opsi-client-agent.wxs
- Get-Content opsi-client-agent.wxs
# Build msi
- wix\\candle.exe opsi-client-agent.wxs
- wix\\light.exe opsi-client-agent.wixobj
# Sign msi
- .\opsi-dev-tool.exe -l info --signserver-sign opsi-client-agent.msi
# Push to binaryindex
- if (! $CI_COMMIT_TAG) {.\opsi-dev-cli.exe -l info binary push opsi-client-agent.msi --product=opsi-client-agent-msi --system=windows --architecture=x86 --version=$version --prerelease="$CI_JOB_ID"}
- if ($CI_COMMIT_TAG) {.\opsi-dev-cli.exe -l info binary push opsi-client-agent.msi --product=opsi-client-agent-msi --system=windows --architecture=x86 --version=$version }
- if ($CI_COMMIT_TAG) {.\opsi-dev-cli.exe -l info release-service register-package-version opsi-client-agent-msi TOOL --files=opsi-client-agent.msi --version=$version --changelog-file=OPSI\\CHANGELOG.md}
make_opsi_package:
stage: package
script:
- mv opsi-client-agent-installer.exe CLIENT_DATA/
- opsi-makepackage --no-set-rights -l 6
- upload-package opsi-client-agent_*.opsi
test_windows_versions:
stage: test
when: manual
script:
- OLDVERSION="4.1.1.0-1"
- version=$(opsi-dev-cli opsi-package get-value productVersion)
- package=$(opsi-dev-cli opsi-package get-value packageVersion)
- version="$version-$(echo $package | tr '.' '~')"
- opsi-dev-cli -l info jenkins test --systems=win10-21h1,win10-x64-21h1,win7,win7-x64,win81,win81-x64,win2012,win2022 --versions="$OLDVERSION,$version,$version"
- opsi-dev-cli -l info jenkins test --versions="$version,1.0-1" --systems=win11-x64-23h2 --products=opsi-client-agent,oca-access-test --actionrequest=setup,setup --productsources=opsi-client-agent,oca-access-test
test_tagged:
stage: test
only:
- tags
script:
- OLDVERSION="4.1.1.0-1"
- version=$(opsi-dev-cli opsi-package get-value productVersion)
- package=$(opsi-dev-cli opsi-package get-value packageVersion)
- version="$version-$(echo $package | tr '.' '~')"
- opsi-dev-cli -l info jenkins test --versions="$OLDVERSION,$version,$version"
- opsi-dev-cli -l info jenkins test --versions="$version,1.0-1" --systems=win11-x64-23h2 --products=opsi-client-agent,oca-access-test --actionrequest=setup,setup --productsources=opsi-client-agent,oca-access-test