forked from mariadb-corporation/mariadb-connector-odbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
300 lines (255 loc) · 11.1 KB
/
azure-pipelines.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
resources:
containers:
- container: ubuntu-1804
image: ubuntu:18.04
options: "--name ubuntu-1804 --add-host=mariadb.example.com:127.0.0.1 -v /usr/bin/docker:/tmp/docker:ro"
jobs:
- job: SSLFiles
displayName: 'Creating SSL Files'
pool:
vmImage: 'ubuntu-16.04'
container: $[ variables['containerImage'] ]
steps:
- script: |
java --version
mkdir tmp
chmod 777 .travis/gen-ssl.sh
.travis/gen-ssl.sh mariadb.example.com tmp
cp -R tmp $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'create SSL certificates'
- task: PublishPipelineArtifact@0
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: ssl_certs
- job: windowsTest
displayName: 'test windows'
pool:
vmImage: 'windows-2019'
dependsOn:
- SSLFiles
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download SSL files'
inputs:
artifactName: ssl_certs
targetPath: $(System.DefaultWorkingDirectory)
- task: DownloadPipelineArtifact@2
displayName: 'Download 10.4 server'
inputs:
buildType: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
definition: '3'
buildVersionToDownload: 'latestFromBranch'
branchName: 'refs/heads/10.4-enterprise'
artifactName: 'Windows-Release'
targetPath: '$(System.DefaultWorkingDirectory)'
- script: |
for /f %%a in ('dir /B $(System.DefaultWorkingDirectory)\win_build\mariadb-enterprise-10.*-winx64.msi') do set servername=$(System.DefaultWorkingDirectory)\win_build\%%a
echo %servername%
msiexec /i %servername% INSTALLDIR=c:\projects\server SERVICENAME=mariadb ALLOWREMOTEROOTACCESS=true /qn
c:\projects\server\bin\mysql.exe -e "create database testo" --user=root
c:\projects\server\bin\mysql.exe -e "GRANT ALL on *.* to 'someUser'@'%' identified by 'Passw@rd2' with grant option;" --user=root
displayName: 'install server'
- script: |
echo 127.0.0.1 mariadb.example.com >> %WINDIR%\System32\Drivers\Etc\Hosts
displayName: 'set hostname'
- script: |
git submodule init
git submodule update
displayName: 'update submodule'
- script: |
cd libmariadb
cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build . --config RelWithDebInfo
cd ..
cmake -G "Visual Studio 16 2019" -DCONC_WITH_MSI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SIGNCODE=0 -DWITH_SSL=SCHANNEL -DWITH_OPENSSL=OFF
cmake --build . --config RelWithDebInfo
displayName: 'build connector'
- task: CopyFiles@2
inputs:
contents: 'wininstall/**.msi'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: msi_package
- task: PowerShell@2
inputs:
targetType: inline
script: |
New-Item -Path "HKCU:\Software\ODBC"
New-Item -Path "HKCU:\Software\ODBC\ODBC.INI"
$regPath = "HKCU:\Software\ODBC\ODBC.INI\test"
New-Item -Path $regPath
New-ItemProperty -Path $regPath -Name "CONN_TIMEOUT" -Value "0"
New-ItemProperty -Path $regPath -Name "DATABASE" -Value "test"
New-ItemProperty -Path $regPath -Name "DESCRIPTION" -Value "MariaDB ODBC test"
New-ItemProperty -Path $regPath -Name "Driver" -Value "MariaDB ODBC 3.1 Driver"
New-ItemProperty -Path $regPath -Name "OPTIONS" -Value "0"
New-ItemProperty -Path $regPath -Name "PORT" -Value "3306"
New-ItemProperty -Path $regPath -Name "PWD" -Value "Passw@rd2"
New-ItemProperty -Path $regPath -Name "SERVER" -Value "mariadb.example.com"
New-ItemProperty -Path $regPath -Name "SSLVERIFY" -Value "0"
New-ItemProperty -Path $regPath -Name "TCPIP" -Value "1"
New-ItemProperty -Path $regPath -Name "UID" -Value "someUser"
New-Item -Path "HKCU:\Software\ODBC\ODBC.INI\ODBC Data Sources"
New-ItemProperty -Path "HKCU:\Software\ODBC\ODBC.INI\ODBC Data Sources" -Name "test" -Value "MariaDB ODBC 3.1 Driver"
displayName: 'set registry'
- task: PowerShell@2
inputs:
targetType: inline
script: |
$msifile = Get-ChildItem $env:$(System.DefaultWorkingDirectory)\wininstall\mariadb-connector-odbc*.msi | Select-Object -First 1
Write $msifile
msiexec /i $msifile.fullname INSTALLDIR=c:\mariadb-odbc /qn
displayName: 'install odbc'
- script: |
set MARIADB_PLUGIN_DIR=$(System.DefaultWorkingDirectory)\libmariadb\plugins\lib\RelWithDebInfo
SET TEST_SCHEMA=test
timeout /T 1
cd test
ctest -V
if %ERRORLEVEL% EQU 0 (
echo Success
) else (
echo exit code is %errorlevel%
exit /b %errorlevel%
)
displayName: 'run tests'
- job: RunInContainer
pool:
vmImage: 'ubuntu-16.04'
displayName: 'test ubuntu bionic'
dependsOn:
- SSLFiles
strategy:
matrix:
ubuntu-1804:
containerImage: ubuntu-1804
containerName: bionic
container: $[variables['containerImage']]
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: ssl_certs
targetPath: $(System.DefaultWorkingDirectory)
- script: /tmp/docker exec -t -u 0 $(containerImage) sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
displayName: Set up sudo
- task: DownloadPipelineArtifact@2
displayName: 'Download 10.4 enterprise server artifact files'
inputs:
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: '$(containerImage)'
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/10.4-enterprise'
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadPipelineArtifact@2
displayName: 'Download galera server artifact files'
inputs:
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: $(containerImage)
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/es-mariadb-4.x'
downloadPath: $(System.DefaultWorkingDirectory)
- script: |
tar xf mariadb-enterprise*
sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates tzdata pwgen
export DEBIAN_FRONTEND="noninteractive"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password password P4ssw@rd"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password_again password P4ssw@rd"
sudo apt-get update -y
sudo apt-get install --allow-unauthenticated -f -y git libssl-dev libaio1 libaio-dev libxml2 libcurl4 curl libc-dev linux-libc-dev libc-dev-bin libdbi-perl rsync socat libnuma1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2 gawk lsof psmisc perl libreadline5
sudo apt-get install --allow-unauthenticated -y --force-yes -m unixodbc-dev
cd mariadb-enterprise*/
sudo groupadd mysql
sudo useradd -g mysql mysql
export PROJ_PATH=`pwd`
echo $PROJ_PATH
cat <<EOT >> my.cnf
[mysqld]
port=3306
max_allowed_packet=16M
datadir=$PROJ_PATH/data
socket=/tmp/mysql.sock
user=mysql
ssl-ca=$(System.DefaultWorkingDirectory)/tmp/ca.crt
ssl-cert=$(System.DefaultWorkingDirectory)/tmp/server.crt
ssl-key=$(System.DefaultWorkingDirectory)/tmp/server.key
EOT
sudo chown mysql $PROJ_PATH/my.cnf
sudo tail -n 5000 $PROJ_PATH/my.cnf
sudo chmod 777 $PROJ_PATH
sudo ln -s $PROJ_PATH /usr/local/mysql
sudo ./scripts/mysql_install_db --defaults-file=$PROJ_PATH/my.cnf --user=mysql
sudo chown -R root .
sudo chown -R mysql data
export PATH=$PATH:$PROJ_PATH/bin/
env:
WORKING_DIR: $(System.DefaultWorkingDirectory)
displayName: 'install server'
- script: |
git submodule init
git submodule update
displayName: 'update submodule'
- script: |
sudo apt-get install -f -y make cmake
#cd libmariadb
#cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL -DCERT_PATH=$(System.DefaultWorkingDirectory)/tmp
#make
#cd ..
export TEST_SCHEMA=testo
export TEST_DRIVER=maodbc_test
export TEST_DSN=maodbc_test
export TEST_SERVER=mariadb.example.com
export TEST_UID=someUser
export TEST_PASSWORD=Passw@rd2
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_OPENSSL=ON -DWITH_SSL=OPENSSL .
cmake --build . --config RelWithDebInfo
displayName: 'Build'
- script: |
cd mariadb-enterprise*/
sudo ./bin/mysqld --defaults-file=./my.cnf &
for i in {30..0}; do
if sudo ./bin/mysql -e "SELECT 1" &> /dev/null; then
echo 'MySQL connected...'
break
fi
echo 'MySQL init process in progress...'
sleep 1
done
if [ "$i" = 0 ]; then
echo >&2 'MySQL init process failed.'
sudo ./bin/mysql -e "SELECT 1"
exit 1
fi
sudo ./bin/mysql -e "CREATE USER 'someUser'@'%' identified by 'Passw@rd2';"
sudo ./bin/mysql -e "GRANT ALL on *.* to 'someUser'@'%' identified by 'Passw@rd2' with grant option;"
sudo ./bin/mysql -e "CREATE DATABASE testo;"
echo "Running tests"
cd ../test
export ODBCINI="$(System.DefaultWorkingDirectory)/test/odbc.ini"
export ODBCSYSINI=$(System.DefaultWorkingDirectory)/test
cat $ODBCINI
cat $ODBCSYSINI/odbcinst.ini
ctest -V
if [ $? -ne 0 ]; then
exit 1
fi
cd $(System.DefaultWorkingDirectory)/mariadb-enterprise*/
sudo ./bin/mysqladmin shutdown
env:
TEST_DRIVER: maodbc_test
TEST_DSN: maodbc_test
TEST_SERVER: mariadb.example.com
TEST_SOCKET:
TEST_SCHEMA: testo
TEST_UID: someUser
TEST_PASSWORD: Passw@rd2
TEST_SSL_CA_FILE: "$(System.DefaultWorkingDirectory)/tmp/server.crt"
TEST_SSL_CLIENT_KEY_FILE: "$(System.DefaultWorkingDirectory)/tmp/client.key"
TEST_SSL_CLIENT_CERT_FILE: "$(System.DefaultWorkingDirectory)/tmp/client.crt"
TEST_SSL_CLIENT_KEYSTORE_FILE: "$(System.DefaultWorkingDirectory)/tmp/client-keystore.p12"
displayName: 'run tests'