From 7ac764a7bd8d44f9de421816e00b457bf0ee7b0e Mon Sep 17 00:00:00 2001 From: rusher Date: Mon, 22 Jul 2019 10:32:28 +0200 Subject: [PATCH] MENT-27 Adding Azure CI testing Incomplete - tests are still not run due to error with driver installation --- .gitignore | 1 + .idea/vcs.xml | 6 - .travis.yml | 11 +- .travis/build/Dockerfile | 33 +++-- README.md | 5 +- appveyor.yml | 2 +- azure-pipelines.yml | 284 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 321 insertions(+), 21 deletions(-) delete mode 100644 .idea/vcs.xml create mode 100644 azure-pipelines.yml diff --git a/.gitignore b/.gitignore index b748f980..e245cdd7 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ ipch *.bak *.so *.dylib +.idea/ Makefile CPackConfig.cmake CPackSourceConfig.cmake diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index d0ea49c8..f3234fb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ before_install: - mkdir tmp - .travis/gen-ssl.sh mariadb.example.com tmp - export SSLCERT=$PROJ_PATH/tmp - - export CONNECTOR_C_VERSION=v_2.3.3 matrix: allow_failures: @@ -34,6 +33,8 @@ matrix: env: DB=mysql:5.6 - os: linux env: DB=mysql:5.7 + - os: linux + env: DB=build include: - os: linux env: DB=build @@ -46,14 +47,16 @@ matrix: - os: linux env: DB=mariadb:10.2 - os: linux - compiler: gcc env: DB=mariadb:10.3 + - os: linux + compiler: gcc + env: DB=mariadb:10.4 - os: linux compiler: clang - env: DB=mariadb:10.3 + env: DB=mariadb:10.4 - os: osx compiler: gcc - env: DB=mariadb:10.3 + env: DB=mariadb:10.4 - os: linux env: DB=mariadb:10.2 PACKET=8M MAXSCALE_VERSION=2.1.8 - os: linux diff --git a/.travis/build/Dockerfile b/.travis/build/Dockerfile index 7742fa1c..d5b0296d 100644 --- a/.travis/build/Dockerfile +++ b/.travis/build/Dockerfile @@ -1,8 +1,22 @@ -FROM debian:jessie +# vim:set ft=dockerfile: +FROM ubuntu:bionic # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql +# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg) +RUN set -ex; \ + apt-get update; \ + if ! which gpg; then \ + apt-get install -y --no-install-recommends gnupg; \ + fi; \ +# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr +# so, if we're not running gnupg 1.x, explicitly install dirmngr too + if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \ + apt-get install -y --no-install-recommends dirmngr; \ + fi; \ + rm -rf /var/lib/apt/lists/* + # add gosu for easy step-down from root ENV GOSU_VERSION 1.10 RUN set -ex; \ @@ -21,8 +35,9 @@ RUN set -ex; \ \ # verify the signature export GNUPGHOME="$(mktemp -d)"; \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \ \ chmod +x /usr/local/bin/gosu; \ @@ -37,27 +52,29 @@ RUN mkdir /docker-entrypoint-initdb.d # install "apt-transport-https" for Percona's repo (switched to https-only) RUN apt-get update && apt-get install -y --no-install-recommends \ apt-transport-https ca-certificates \ + tzdata \ pwgen \ && rm -rf /var/lib/apt/lists/* RUN { \ - echo "mariadb-server-10.3" mysql-server/root_password password 'unused'; \ - echo "mariadb-server-10.3" mysql-server/root_password_again password 'unused'; \ + echo "mariadb-server-10.4" mysql-server/root_password password 'unused'; \ + echo "mariadb-server-10.4" mysql-server/root_password_again password 'unused'; \ } | debconf-set-selections RUN apt-get update -y RUN apt-get install -y software-properties-common wget RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db -RUN echo 'deb http://yum.mariadb.org/galera/repo/deb jessie main' > /etc/apt/sources.list.d/galera-test-repo.list +RUN apt-key adv --recv-keys --keyserver ha.pool.sks-keyservers.net F1656F24C74CD1D8 +RUN echo 'deb http://yum.mariadb.org/galera/repo/deb bionic main' > /etc/apt/sources.list.d/galera-test-repo.list RUN apt-get update -y -RUN apt-get install -y curl libdbi-perl rsync socat galera3 libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1 libcrack2 +RUN apt-get install -y curl libdbi-perl rsync socat galera3 libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2 COPY *.deb /root/ RUN chmod 777 /root/* -RUN dpkg -R --install /root/mysql-common* -RUN dpkg -R --install /root/mariadb-common* +RUN dpkg --install /root/mysql-common* +RUN dpkg --install /root/mariadb-common* RUN dpkg -R --unpack /root/ RUN apt-get install -f -y diff --git a/README.md b/README.md index d6ab0380..8200065e 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ ## Status [![License (LGPL version 2.1)](https://img.shields.io/badge/license-GNU%20LGPL%20version%202.1-green.svg?style=flat-square)](http://opensource.org/licenses/LGPL-2.1) -[![Travis CI status](https://secure.travis-ci.org/MariaDB/mariadb-connector-odbc.png?branch=master)](https://travis-ci.org/MariaDB/seaver) travis-ci.org (master branch) -[![Appveyor CI status](https://ci.appveyor.com/api/projects/status/1fv21j33a6mpkxq5/branch/master?svg=true)](https://ci.appveyor.com/project/LawrinNovitsky/mariadb-connector-odbc) ci.aapveyor.com(master branch) +[![Linux Build](https://secure.travis-ci.org/MariaDB/mariadb-connector-odbc.png?branch=master)](https://travis-ci.org/MariaDB/mariadb-connector-odbc) +[![Windows status](https://ci.appveyor.com/api/projects/status/1fv21j33a6mpkxq5/branch/master?svg=true)](https://ci.appveyor.com/project/LawrinNovitsky/mariadb-connector-odbc) + This is a GA release of the MariaDB Connector/ODBC. MariaDB Connector/ODBC is released under version 2.1 of the diff --git a/appveyor.yml b/appveyor.yml index 062576c8..56b17b4f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -38,7 +38,7 @@ before_build: after_build: # download and install MariaDB Server - - set FILE=http://mariadb.mirrors.ovh.net/MariaDB/mariadb-%DB%/winx64-packages/mariadb-%DB%-winx64.msi + - cmd: set FILE=http://ftp.hosteurope.de/mirror/archive.mariadb.org//mariadb-%DB%/winx64-packages/mariadb-%DB%-winx64.msi - ps: Start-FileDownload $Env:FILE -FileName server.msi -Timeout 900000 - msiexec /i server.msi INSTALLDIR=c:\mariadb-server SERVICENAME=mariadb /qn # create test database diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..2a38c987 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,284 @@ +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: + source: 'specific' + project: '550599d3-6165-4abd-8c86-e3f7e53a1847' + artifact: 'Windows' + pipeline: 3 + runVersion: 'latestFromBranch' + runBranch: 'refs/heads/10.4-enterprise' + downloadPath: $(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: 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 "testo" + 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)\mariadb-connector-odbc*.msi | Select-Object -First 1 + Push-AppveyorArtifact $msifile.FullName -FileName $msifile.Name + Write $msifile + msiexec /i $msifile INSTALLDIR=c:\mariadb-odbc /qn + displayName: 'install odbc' + + - script: | + set MARIADB_PLUGIN_DIR=$(System.DefaultWorkingDirectory)\libmariadb\plugins\lib\RelWithDebInfo + + 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)' + pipeline: 3 + 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' + pipeline: 2 + 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 <> 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 .. + 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 + + 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'