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
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
|
---
# Include Salsa-CI as a base
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
# Override Salsa-CI with MariaDB specific variations
variables:
BUILT_PACKAGES: "libmariadb-dev libmariadb-dev-compat libmariadb3 libmariadbd19 libmariadbd-dev mariadb-common mariadb-client mariadb-server mariadb-backup mariadb-plugin-connect mariadb-plugin-s3 mariadb-plugin-rocksdb mariadb-plugin-oqgraph mariadb-plugin-mroonga mariadb-plugin-spider mariadb-plugin-cracklib-password-check mariadb-test mariadb-test-data"
DEB_BUILD_OPTIONS: "nocheck noautodbgsym"
RELEASE: sid
# Reprotest works, but takes very long time and often fails due to timeouts.
# Thus is is best kept disabled and only occasionally manually enabled to
# test that reproducibility works, along with atomic reprotest to directly
# pinpoint what aspect of the build is broken if not reproducible.
SALSA_CI_DISABLE_REPROTEST: 1
SALSA_CI_ENABLE_ATOMIC_REPROTEST: 0
SALSA_CI_DISABLE_MISSING_BREAKS: 0
SALSA_CI_DISABLE_RC_BUGS: 0
# Extend Salsa-CI build jobs to have longer timeout as the default GitLab
# timeout (1h) is often not enough
.build-package:
timeout: 3h
stages:
- provisioning
- build
- test
- upgrade MariaDB
- upgrade MariaDB and distro
- upgrade MariaDB variant
- test extras
- publish # Stage referenced by Salsa-CI template aptly stanza, so must exist even though not used
gnitpick:
stage: provisioning
image: debian:sid-slim
script: |
# Bare minimal (<4MB) for apt-key and gnitpick to work
apt-get update -qq && apt-get -qq install --no-install-recommends --yes ca-certificates curl python3-minimal git
curl -sS https://raw.githubusercontent.com/Seravo/gnitpick/master/gnitpick.py -o /usr/bin/gnitpick; chmod +x /usr/bin/gnitpick
# Actual Gnitpick part
gnitpick --target-repository https://salsa.debian.org/mariadb-team/mariadb-server.git --target-branch debian/latest
except:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
allow_failure: true # Gnitpick does not fully support this branch naming scheme so ignore it for now
packaging-fix-checks:
stage: provisioning
image: debian:sid-slim
script:
- apt-get update -qq && apt-get -qq install --no-install-recommends --yes git devscripts python3-debian shellcheck make lsb-release
- |
if [ "$(find debian/patches/ -type f -not -name series | wc -l)" -eq "$(cat debian/patches/series | wc -l)" ]
then
echo "The directory debian/patches/ contents and debian/patches/series file match by count."
else
find debian/patches -type f -not -name series -printf "%P\n" | sort > /tmp/patches-directory-sorted
sort debian/patches/series > /tmp/patches-series-sorted
diff -y /tmp/patches-series-sorted /tmp/patches-directory-sorted
echo
echo "The directory debian/patches/ file count does not match that in debian/series. Check that there are no unaccounted patches!"
exit 1
fi
- |
wrap-and-sort -a
git checkout debian/tests/control # Revert touching this file, wrap-and-sort shouldn't do it
if [ "$(git diff --name-only | wc -l)" -eq 0 ]
then
echo "No uncommitted changes after 'wrap-and-sort -av', maintainer has done good job keeping files in order."
else
git diff
echo
echo "Debian packaging files are unordered! Please run 'wrap-and-sort -av'."
exit 1
fi
# Print syntax errors if found, otherwise continue silently
- make --dry-run --makefile=debian/rules > /dev/null
- |
shellcheck -x --shell=sh $(grep -Irnw debian/ -e '^#!.*/sh' | sort -u |cut -d ':' -f 1 | xargs)
shellcheck -x --shell=bash $(grep -Irnw debian/ -e '^#!.*/bash' | sort -u |cut -d ':' -f 1 | xargs)
except:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
build bullseye-backports:
extends: .build-package
variables:
RELEASE: bullseye-backports
# Buster only has libfmt 6.1 but 7.0 is required, so backport build for Buster
# is not possible unless somebody packages libfmt7-dev for Buster.
test-crossbuild-arm64:
stage: build
autopkgtest:
extends: .test-autopkgtest
artifacts:
reports:
junit: ${WORKING_DIR}/debci/artifacts/mysql-test-run-junit.xml
piuparts:
stage: test extras
blhc:
stage: test extras
# In addition to Salsa-CI, also run these fully MariaDB specific build jobs
# Define snippets used to construct jobs
.test-prepare-container: &test-prepare-container |
cd ${WORKING_DIR} # Don't repeat this step, it's just cd ./debian/output
# Enable automatic restarts from maint scripts
sed -i "s/101/0/g" -i /usr/sbin/policy-rc.d
# Fake /sbin/runlevel to avoid warnings of "invoke-rc.d: could not determine current runlevel"
echo -e '#!/bin/sh\necho "N 5"' > /sbin/runlevel; chmod +x /sbin/runlevel
# Avoid the warnings of "debconf: unable to initialize frontend: Dialog"
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Emit non-zero exit code also on warnings
echo 'APT::Update::Error-Mode "any";' > /etc/apt/apt.conf.d/non-zero-exit-on-warnings
# Prime the apt cache so later apt commands can run
apt-get update -qq
# Readline was removed from Debian Sid (and Bullseye) in Feb 2021. To be able to install older
# versions of MariaDB that depend on it, fetch and install it from Buster.
.test-install-readline-in-sid-for-backwards-compat: &test-install-readline-in-sid-for-backwards-compat |
curl -sS -O https://snapshot.debian.org/archive/debian/20190316T031117Z/pool/main/r/readline5/libreadline5_5.2%2Bdfsg-3%2Bb13_amd64.deb
apt-get -qq install --no-install-recommends --yes ./libreadline5_5.2%2Bdfsg-3%2Bb13_amd64.deb
# OpenSSL 1.1 was Debian Sid in Dec 2022 (as Bookworm will ship with OpenSSL 3.0
# only). To be able to install versions of MariaDB that depend on OpenSSL 1.1,
# fetch and install it manually.
.test-install-openssl1-in-sid-for-backwards-compat: &test-install-openssl1-in-sid-for-backwards-compat |
curl -sS -O https://snapshot.debian.org/archive/debian/20220507T034236Z/pool/main/o/openssl/libssl1.1_1.1.1o-1_amd64.deb
apt-get -qq install --no-install-recommends --yes ./libssl1.1_1.1.1o-1_amd64.deb
.test-verify-initial: &test-verify-initial |
dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
# MariaDB until 10.5 only had 'mysql', and since only 'mariadb', so try both
service mysql status || service mariadb status
mysql --skip-column-names -e "select @@version, @@version_comment" # Show version
mysql --table -e "SHOW DATABASES;" # List databases before upgrade
mysql --table -e "SELECT host,user,plugin,authentication_string FROM user;" mysql
mysql --table -e "SELECT * FROM plugin;" mysql
mysql --table -e "SHOW PLUGINS;" mysql
.test-enable-sid-repos: &test-enable-sid-repos
# Apply usrmerge workaround for Stretch/Buster/Bullseye to Bookworm/Sid upgrades
- echo 'this system will not be supported in the future' > /etc/unsupported-skip-usrmerge-conversion
# Replace any old repos with just Sid
- echo 'deb http://deb.debian.org/debian sid main' > /etc/apt/sources.list
# Upgrade minimal stack first
- apt-get update -qq
# Next step will fail on https://bugs.debian.org/993755
# /usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot
# open shared object file: No such file or directory
# dpkg: error processing package libc6:amd64 (--configure):
- apt-get install -y apt || true
# Apply workaround
- cd $(mktemp -d) # Use temp dir where apt can download and unpack files
- apt-get -y download libcrypt1
- dpkg-deb -x libcrypt1_*.deb .
- cp -ra lib/* /lib/ || true # libcryp1 < 1:4.4.36-3
- cp -ra usr/lib/* /lib/ || true # libxcrypt 1:4.4.36-3+
- cd - # Back to /builds/$USER/mariadb-server/debian/output
- find /lib/*/libcrypt.* -ls # Show that new libcrypt is there
- apt-get -y --fix-broken install
# Complete upgrade of minimal stack
- apt-get install -y apt
.test-enable-bullseye-backports-repos: &test-enable-bullseye-backports-repos |
# Enable bullseye-backports (assumes environment already Debian Bullseye)
echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/bullseye-backports.list
# Increase default backports priority policy from '100' to '500' so it can actually be used
cat << EOF > /etc/apt/preferences.d/enable-backports-to-satisfy-dependencies
Package: *
Pin: release n=bullseye-*
Pin-Priority: 500
EOF
apt-get update -qq
.test-enable-artifacts-repo: &test-enable-artifacts-repo |
apt-get install -y apt-utils
apt-ftparchive packages . > Packages
echo "deb [trusted=yes] file:$(pwd) ./" > /etc/apt/sources.list.d/mariadb-local.list
apt-get update
.test-install-all: &test-install-all
- *test-enable-artifacts-repo
- apt-get install -yq ${BUILT_PACKAGES}
# Verify installation of MariaDB built in this commit
- mariadb --version
- dpkg -l | grep -iE 'maria|mysql|galera'
- find /etc -name '*mariadb*' -ls -or -name '*mysql*' -ls | sort -k 11
# Purge old versions if they exist
- apt-get purge -y mariadb*10.?
- find /etc -name '*mariadb*' -ls -or -name '*mysql*' -ls | sort -k 11
.test-full-upgrade: &test-full-upgrade
- *test-enable-artifacts-repo
- apt-get full-upgrade -y
# Verify installation of MariaDB built in this commit
- mariadb --version
- dpkg -l | grep -iE 'maria|mysql|galera'
- find /etc -name '*mariadb*' -ls -or -name '*mysql*' -ls | sort -k 11
# Purge old versions if they exist
- apt-get purge -y mariadb*10.?
- find /etc -name '*mariadb*' -ls -or -name '*mysql*' -ls | sort -k 11
# Purging the old server might stop the running server, so restart it just in case
- service mariadb restart
.test-install-all-libs: &test-install-all-libs
- *test-enable-artifacts-repo
- apt-get install -yq --no-install-recommends libmariadb-dev-compat libmariadbd-dev
# Installs 31 packages, including:
# libmariadb3 libmariadb-dev libmariadb-dev-compat libmariadbd19 libmariadbd-dev
.test-full-upgrade-libs: &test-full-upgrade-libs
- *test-enable-artifacts-repo
- apt-get full-upgrade -y
- dpkg -l | grep -iE 'maria|mysql|galera'
# library tests don't have the mariadb client nor server, so don't check them
.test-verify-final: &test-verify-final |
mkdir -p debug # Ensure dir exists before using it
find /var/lib/mysql -ls > debug/var-lib-mysql.list || true # Ignore errors about "no such file or directory"
cp -ra /etc/mysql debug/etc-mysql
mariadb --skip-column-names -e "select @@version, @@version_comment" # Show version
mariadb --table -e "SHOW DATABASES;" # List databases
mariadb --table -e "SELECT host,user,plugin,authentication_string FROM user;" mysql
mariadb --table -e "SELECT * FROM plugin;" mysql
mariadb --table -e "SHOW PLUGINS;" mysql
# Test that InnoDB works and that command 'mysql' is also still usable
mysql -e "CREATE DATABASE test; USE test; CREATE TABLE t(a INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t VALUEs (1); SELECT * FROM t; DROP TABLE t; DROP DATABASE test;"
.test-verify-libs: &test-verify-libs
# Don't use a collapsed command as Gitlab-CI would hide each command from the output
- ldconfig -p | grep -e mariadb -e mysql
- pkg-config --list-all
- pkg-config --cflags --libs mysqlclient
- pkg-config --cflags --libs libmariadb
- pkg-config --cflags --libs mariadb
- apt-get install -y --no-install-recommends g++
- |
# Build a test binary that depends on libmysqlclient
cat > b933063.cpp <<EOF
#include <iostream>
#include <mysql/mysql.h>
#include <stdexcept>
int main()
{
MYSQL h;
if (!mysql_init(&h)
|| mysql_options(&h, MYSQL_READ_DEFAULT_GROUP, "")
// || mysql_options(&h, MYSQL_SET_CHARSET_NAME, "utf8mb4")
|| !mysql_real_connect(&h, "", "", NULL, "", 0, NULL, 0))
throw std::runtime_error(mysql_error(&h));
std::string q = "show variables like '%char%'";
if (mysql_real_query(&h, q.data(), q.size()))
throw std::runtime_error(mysql_error(&h));
MYSQL_RES* result = mysql_store_result(&h);
if (!result && mysql_errno(&h))
throw std::runtime_error(mysql_error(&h));
while (MYSQL_ROW row = mysql_fetch_row(result))
{
std::cout << row[0] << ": " << row[1] << "\n";
}
return 0;
}
EOF
apt-get install -y ./*.deb # Server must be installed for client to connect
echo "Testing -l mysqlclient"
g++ b933063.cpp -l mysqlclient && ./a.out | tee result
if grep --quiet latin result; then echo "ERROR: Charset latin found!"; exit 1; fi
echo "Testing -l mariadbclient"
g++ b933063.cpp -l mariadbclient && ./a.out | tee result
if grep --quiet latin result; then echo "ERROR: Charset latin found!"; exit 1; fi
- |
# Build a test binary to verify API version strings
cat > b1031863.cpp <<EOF
#include <cstring>
#include <iostream>
#include <mysql/mysql.h>
using namespace std;
void test_if_starts_with(const string expected, const string tested, const string name) {
int r = strncmp(tested.c_str(), expected.c_str(), expected.size());
if (r == 0) {
cout << name << ": " << tested << "\n";
} else {
cout << "ERROR: " << name << " started with " << tested << " instead of the expected " << expected << "!\n";
exit(1);
}
}
int main()
{
MYSQL h;
// Constants refer to server version
test_if_starts_with("1011", to_string(MARIADB_VERSION_ID), "MARIADB_VERSION_ID");
test_if_starts_with("1011", to_string(MYSQL_VERSION_ID), "MYSQL_VERSION_ID");
// Client ABI returns connector version
test_if_starts_with("303", to_string(mysql_get_client_version()), "mysql_get_client_version()");
test_if_starts_with("3.3", mysql_get_client_info(), "mysql_get_client_info()");
return 0;
}
EOF
g++ b1031863.cpp -l mysqlclient && ./a.out
.salsa-ci-template-for-mariadb:
stage: test
needs:
- job: build
image: debian:${RELEASE}
artifacts:
when: always
name: "$CI_BUILD_NAME"
paths:
- ${WORKING_DIR}/debug
script:
- echo "This script section must be overridden in each test" && exit 1
variables:
GIT_STRATEGY: none
except:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
.salsa-ci-template-for-mariadb-upgrade:
stage: test
needs:
- job: build
image: debian:${RELEASE}
artifacts:
when: always
name: "$CI_BUILD_NAME"
paths:
- ${WORKING_DIR}/debug
before_script:
- *test-prepare-container
- apt-get -qq install --no-install-recommends --yes ca-certificates curl
- |
[[ -d /etc/apt/keyrings ]] || mkdir /etc/apt/keyrings
curl -sS https://mariadb.org/mariadb_release_signing_key.pgp -o /etc/apt/keyrings/mariadb-keyring.pgp
cat >/etc/apt/sources.list.d/mariadb.sources <<EOF
X-Repolib-Name: MariaDB
Types: deb
URIs: https://archive.mariadb.org/mariadb-${MARIADB_VERSION}/repo/debian
Suites: ${RELEASE}
Components: main
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
EOF
- apt-get update -qq
script:
- echo "This script section must be overridden in each test" && exit 1
variables:
GIT_STRATEGY: none
MARIADB_VERSION: "10.0"
except:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
fresh install:
extends: .salsa-ci-template-for-mariadb
script:
- *test-prepare-container
- *test-install-all
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
simple upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB
script:
- *test-prepare-container
- apt-get install -y 'default-mysql*' ${BUILT_PACKAGES}
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb-10.5 with Bullseye backports upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB
needs:
- job: build bullseye-backports
image: debian:bullseye
script:
- *test-prepare-container
# Install everything MariaDB currently in Debian Bullseye
- apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadb*'
# Verify installation of MariaDB from Bullseye
- dpkg -l | grep -e "mariadb-server.*10.5"
- *test-verify-initial
- *test-enable-bullseye-backports-repos
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb-10.6 and Bookworm-20230208 upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB and distro
image: debian:bookworm-20230208
script:
- *test-prepare-container
- |
echo 'deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/20230208T130000Z bookworm main' > /etc/apt/sources.list.d/bookworm.list
rm /etc/apt/sources.list.d/debian.sources
apt-get update -qq
# In February 2023 Bookworm snapshot this will install MariaDB 10.6
- apt-get install -y mariadb-server
- dpkg -l | grep -e "mariadb-server.*10.6"
- *test-verify-initial
- *test-enable-sid-repos
# Ensure mariadbd will not crash on next shutdown for any reason
- service mariadb restart
- *test-enable-artifacts-repo
- apt-get install -y mariadb-server
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb-10.5 and Bullseye upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB and distro
image: debian:bullseye
script:
- *test-prepare-container
# Install everything MariaDB currently in Debian Bullseye
- apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadb*'
# Verify installation of MariaDB from Bullseye
- dpkg -l | grep -e "mariadb-server.*10.5"
- *test-verify-initial
- *test-enable-sid-repos
# Ensure mariadbd will not crash on next shutdown for any reason
- service mariadb restart
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb-10.3 and Buster upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB and distro
image: debian:buster
script:
- *test-prepare-container
# Install everything MariaDB currently in Debian Buster
- apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadb*'
# Verify installation of MariaDB from Buster
- dpkg -l | grep -e "mariadb-server.*10.3"
- *test-verify-initial
- *test-enable-sid-repos
# Ensure mariadbd will not crash on next shutdown for any reason
- service mysql restart # in 10.3 service name is still 'mysql'
- *test-full-upgrade
# mariadb-10.3 in Buster ships a /etc/init.d/mysql and it continues to exist
# after upgrade, but is be removed on purge
- service mysql status || service mariadb status
- *test-verify-final
# Similar to the Cacti install test, check that MariaDB consumer Zoph upgrades
default-mysql-server and Bullseye upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB and distro
image: debian:bullseye
script:
- *test-prepare-container
# Install everything MariaDB currently in Debian Bullseye
- apt-get install -y default-mysql-server zoph
# Verify installation of MariaDB from Bullseye
- *test-verify-initial
- *test-enable-sid-repos
- *test-enable-artifacts-repo
# Start with partial upgrade
- apt-get install -y default-mysql-server
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
test basic features:
extends: .salsa-ci-template-for-mariadb
script:
- *test-prepare-container
- *test-install-all
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
- |
# Print info about server
mariadb --skip-column-names -e "select @@version, @@version_comment"
mariadb --skip-column-names -e "select engine, support, transactions, savepoints from information_schema.engines order by engine" | sort
mariadb --skip-column-names -e "select plugin_name, plugin_status, plugin_type, plugin_library, plugin_license from information_schema.all_plugins order by plugin_name, plugin_library"
# Test various features
mariadb -e "CREATE DATABASE db"
mariadb -e "CREATE TABLE db.t_innodb(a1 SERIAL, c1 CHAR(8)) ENGINE=InnoDB; INSERT INTO db.t_innodb VALUES (1,'"'"'foo'"'"'),(2,'"'"'bar'"'"')"
mariadb -e "CREATE TABLE db.t_myisam(a2 SERIAL, c2 CHAR(8)) ENGINE=MyISAM; INSERT INTO db.t_myisam VALUES (1,'"'"'foo'"'"'),(2,'"'"'bar'"'"')"
mariadb -e "CREATE TABLE db.t_aria(a3 SERIAL, c3 CHAR(8)) ENGINE=Aria; INSERT INTO db.t_aria VALUES (1,'"'"'foo'"'"'),(2,'"'"'bar'"'"')"
mariadb -e "CREATE TABLE db.t_memory(a4 SERIAL, c4 CHAR(8)) ENGINE=MEMORY; INSERT INTO db.t_memory VALUES (1,'"'"'foo'"'"'),(2,'"'"'bar'"'"')"
mariadb -e "CREATE ALGORITHM=MERGE VIEW db.v_merge AS SELECT * FROM db.t_innodb, db.t_myisam, db.t_aria"
mariadb -e "CREATE ALGORITHM=TEMPTABLE VIEW db.v_temptable AS SELECT * FROM db.t_innodb, db.t_myisam, db.t_aria"
mariadb -e "CREATE PROCEDURE db.p() SELECT * FROM db.v_merge"
mariadb -e "CREATE FUNCTION db.f() RETURNS INT DETERMINISTIC RETURN 1"
# Test that the features still work (this step can be done e.g. after an upgrade)
mariadb -e "SHOW TABLES IN db"
mariadb -e "SELECT * FROM db.t_innodb; INSERT INTO db.t_innodb VALUES (3,'"'"'foo'"'"'),(4,'"'"'bar'"'"')"
mariadb -e "SELECT * FROM db.t_myisam; INSERT INTO db.t_myisam VALUES (3,'"'"'foo'"'"'),(4,'"'"'bar'"'"')"
mariadb -e "SELECT * FROM db.t_aria; INSERT INTO db.t_aria VALUES (3,'"'"'foo'"'"'),(4,'"'"'bar'"'"')"
mariadb -e "SELECT * FROM db.t_memory; INSERT INTO db.t_memory VALUES (3,'"'"'foo'"'"'),(4,'"'"'bar'"'"')"
mariadb -e "SELECT COUNT(*) FROM db.v_merge"
mariadb -e "SELECT COUNT(*) FROM db.v_temptable"
mariadb -e "CALL db.p()"
mariadb -e "SELECT db.f()"
- |
# Test TLS connections
dpkg -l | grep -i -e tls -e ssl
# Create user for TCP connection, must have password
mariadb -e "SET PASSWORD FOR 'mysql'@'localhost' = PASSWORD('asdf234');"
cat <<EOF > /root/.my.cnf
[client]
user=mysql
password=asdf234
protocol=tcp
EOF
export CERT_PATH=/usr/share/mysql/mysql-test/std_data
openssl verify -CAfile $CERT_PATH/cacert.pem $CERT_PATH/server-cert.pem
openssl x509 -subject -issuer -noout -in $CERT_PATH/cacert.pem
openssl x509 -subject -issuer -noout -in $CERT_PATH/server-cert.pem
cat <<EOF > /etc/mysql/mariadb.conf.d/tls.cnf
[client-server]
ssl = on
ssl-ca = $CERT_PATH/cacert.pem
ssl-cert = $CERT_PATH/server-cert.pem
ssl-key = $CERT_PATH/server-key.pem
[server]
require-secure-transport = on
[client]
ssl-verify-server-cert = on
EOF
service mariadb restart
mariadb -Bse 'STATUS' | tee result
# Ensure important values present, otherwise fail job
grep --quiet "localhost via TCP/IP" result
mariadb -Bse 'SHOW VARIABLES' | grep -e tls -e ssl | tee result
grep --quiet "have_ssl YES" result
grep --quiet TLSv1.3 result
mariadb -Bse 'SHOW SESSION STATUS' | grep -i -e tls -e ssl | tee result
grep --quiet TLSv1.3 result
# Install Cacti, which in uses dbconfig-common to configure the MariaDB user and
# connection automatically in order to validate that at least one downstream
# server consumer continues to work.
test consumer cacti:
extends: .salsa-ci-template-for-mariadb
script:
- *test-prepare-container
- *test-enable-artifacts-repo
- apt-get install -y cacti
- mariadb -E -e "SHOW CREATE TABLE version;" cacti
# Build a piece of software that was designed for libmysqlclient-dev but using the
# libmariadb-dev-compat layer. Should always end up using libmariadb.so.3 run-time.
build mariadbclient consumer Python-MySQLdb:
extends: .salsa-ci-template-for-mariadb
script:
- *test-prepare-container
- *test-install-all-libs
- apt-get install -y pkg-config python3-pip
# See what MySQLdb will build with
- pkg-config --cflags --libs mysqlclient
# MySQLdb is also available in Debian as package python3-mysqldb, but
# install it from pip to force that the client is compiled with
# libmariadb-dev-compat on-the-fly.
# Python 3.11 needs `--break-system-packages` to proceed with this.
- pip3 install --break-system-packages mysqlclient # Compiles module against libmysqlclient
- apt-get purge -y libmariadb-dev # Not needed for run-time
- python3 -c "import MySQLdb; print(MySQLdb.get_client_info())"
libmysql* to libmariadb* upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB
script:
- *test-prepare-container
# Install all libmysql* available in Debian unstable
- apt-get install -y pkg-config libmysqlclient-dev
- pkg-config --list-all
- pkg-config --cflags mysqlclient # mysqlclient.pc from original package
- *test-enable-artifacts-repo
- apt-get install -y libmariadb3
- pkg-config --list-all
- apt-get install -y libmariadb-dev
- pkg-config --list-all
- apt-get install -y libmariadb-dev-compat
- pkg-config --cflags mysqlclient # mysqlclient.pc from compat package
- pkg-config --list-all
- apt-get install -y libmariadbd19
- pkg-config --list-all
- apt-get install -y libmariadbd-dev
- pkg-config --list-all
- apt-get install -y default-libmysqlclient-dev default-libmysqld-dev
- *test-verify-libs
default-libmysqlclient-dev upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB
script:
- *test-prepare-container
- apt-get install -y pkg-config default-libmysqlclient-dev default-libmysqld-dev
- pkg-config --list-all
- *test-full-upgrade-libs
- *test-verify-libs
default-libmysqlclient-dev and Bullseye upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB and distro
image: debian:bullseye
script:
- *test-prepare-container
- apt-get install -y pkg-config default-libmysqlclient-dev
- pkg-config --list-all
- *test-enable-sid-repos
- *test-full-upgrade-libs
- *test-verify-libs
default-libmysqlclient-dev and Buster upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB and distro
image: debian:buster
script:
- *test-prepare-container
- apt-get install -y pkg-config default-libmysqlclient-dev
- pkg-config --list-all
- *test-enable-sid-repos
- *test-full-upgrade-libs
- *test-verify-libs
default-libmysqlclient-dev with Bullseye backports upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB
needs:
- job: build bullseye-backports
image: debian:bullseye
script:
- *test-prepare-container
- apt-get install -y pkg-config default-libmysqlclient-dev
- pkg-config --list-all
- *test-enable-bullseye-backports-repos
- *test-full-upgrade-libs
- *test-verify-libs
# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh.
mysql-8.0 in Sid upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB variant
image: debian:sid
script:
- *test-prepare-container
# The postinst fails often if 'ps' is missing from system, so install procps
- apt-get install -y procps mysql-server 'libmysqlc*'
# Ensure MySQL 8.0 package actually got installed
- dpkg -l | grep -e "mysql-server.*8.0"
- *test-verify-initial
- *test-install-all
# Due to some (currently unknown) changes in MySQL 8.0 packaging or apt
# behaviour changes, a system with a previous installation of MySQL 8.0 will
# on upgrades to MariaDB first fully remove MySQL, including the
# /etc/init.d/mysql file, so previous techniques in
# mariadb-server-10.6.postinst to maintain backwards compatibility with
# 'service mysql status' after installing MariaDB on top MySQL no longer
# works. Thus the step to test it now intentionally has a fallback to use
# the service name 'mariadb' instead, and the fallback is always used.
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
- service mysql status || service mariadb status
- *test-verify-final
# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh.
#
# Testing on Focal binaries on Buster works. Using Jammy binaries on Bullseye
# does not work as libc in Jammy is too new.
mysql-8.0 from Ubuntu 22.04 with Bullseye backports upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB variant
needs:
- job: build bullseye-backports
image: debian:bullseye
script:
- *test-prepare-container
# Add Ubuntu Focal archive keys and repository
- apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work
- apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 871920D1991BC93C 3B4FE6ACC0B21F32
- echo "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" > /etc/apt/sources.list.d/ubuntu.list
- apt-get update -qq
# First install often fail due to bug in mysql-8.0
- apt-get install -y mysql-server 'libmysqlc*' || true
# Ensure MySQL 8.0 package actually got installed
- dpkg -l | grep -e "mysql-server.*8.0"
- sleep 10 && apt-get install -f
- *test-verify-initial
# Enable backports to make galera-4 available
- echo "deb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list && apt-get update -qq
- *test-install-all
- service mysql status
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
- *test-verify-final
# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh.
mysql-community-cluster-8.0 from MySQL.com with Bullseye backports upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB variant
needs:
- job: build bullseye-backports
image: debian:bullseye
script:
- *test-prepare-container
- apt-get install --no-install-recommends --yes ca-certificates curl systemctl
- curl -sS "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xbca43417c3b485dd128ec6d4b7b3b788a8d3785c" -o /etc/apt/trusted.gpg.d/mysql.asc
- echo "deb https://repo.mysql.com/apt/debian/ bullseye mysql-cluster-8.0" > /etc/apt/sources.list.d/mysql.list
- apt-get update -qq
- apt-get install -y mysql-cluster-community-server
- sed 's/ExecStartPre=+/ExecStartPre=/' -i /lib/systemd/system/mysql.service # Hack to make file compatible with systemctl shim
- systemctl start mysql
- dpkg -l | grep -iE 'maria|mysql|galera'
- systemctl status mysql; mysql -e 'SELECT VERSION()'
- systemctl stop mysql # Stop manually as maintainer scripts don't handle this with systemctl shim
# Enable backports to make galera-4 available
- echo "deb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list && apt-get update -qq
- *test-install-all
# Ignore systemctl shim result as MariaDB systemd file is incompatible with it and yields:
# ERROR:systemctl:the ExecStartPre control process exited with error code
- systemctl status mysql || true
- mysql -e 'SELECT VERSION()' || true
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
- *test-verify-final
mariadb.org-10.11 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.11"
script:
- apt-get install -y mariadb-server
- *test-verify-initial
# Install MariaDB built in this commit
# Force downgrades so our version installs on top of upstream revision, e.g. 1:11.10.1-1 vs 1:11.10.1+mariadb~sid
- apt-get install -y --allow-downgrades ./*.deb
# Verify installation of MariaDB built in this commit
- dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
- mariadb --version # Client version
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb.org-10.10 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.10"
script:
# this should not use Sid to begin with
- apt-get install -y mariadb-server=1:10.10.2+maria~debunstable mariadb-client=1:10.10.2+maria~debunstable
- *test-verify-initial
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb.org-10.9 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.9"
script:
# this should not use Sid to begin with
- apt-get install -y mariadb-server=1:10.9.4+maria~debunstable mariadb-client=1:10.9.4+maria~debunstable
- *test-verify-initial
- *test-full-upgrade
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb.org-10.8 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.8"
script:
- apt-get install -y mariadb-server-10.8
- *test-verify-initial
- *test-install-all
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb.org-10.7 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.7"
script:
- apt-get install -y mariadb-server-10.7
- *test-verify-initial
- *test-install-all
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
mariadb.org-10.6 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.6"
script:
# Package libmariadbclient-dev from mariadb.org conflicts with libmariadb-dev in Sid, so cannot use wildcard that would include it
# Enable this line when there is a way to install them only from the mariadb.org repo
# - apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*'
- apt-get install -y mariadb-server-10.6
- *test-verify-initial
- *test-install-all
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
# archive.mariadb.org for Debian Sid latest is 10.5.13
mariadb.org-10.5 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.5"
script:
- *test-install-openssl1-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.5
- *test-verify-initial
- *test-install-all
- service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
# archive.mariadb.org for Debian Sid latest is 10.4.17
mariadb.org-10.4 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.4"
script:
- *test-install-readline-in-sid-for-backwards-compat
- *test-install-openssl1-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.4
# MariaDB.org version of 10.4 and early 10.5 do not install an init file, so
# it must be installed here manually
- cp /usr/share/mysql/mysql.init /etc/init.d/mysql; chmod +x /etc/init.d/mysql; service mysql start; sleep 5
- *test-verify-initial
- *test-install-all
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
- service mysql status
- service mariadb status
- *test-verify-final
# archive.mariadb.org for Debian Sid latest is 10.3.27
mariadb.org-10.3 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.3"
script:
- *test-install-readline-in-sid-for-backwards-compat
- *test-install-openssl1-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.3
- *test-verify-initial
- *test-install-all
# mariadb-10.3 in Buster ships a /etc/init.d/mysql and it continues to exist
# after upgrade, but is be removed on purge
- service mysql status || service mariadb status
# Give the mariadb-upgrade plenty of time to complete, otherwise next commands
# fail on non-existing mariadb.sys user
- sleep 15
- *test-verify-final
# archive.mariadb.org for Debian Sid latest is 10.2.21
mariadb.org-10.2 upgrade:
extends: .salsa-ci-template-for-mariadb-upgrade
stage: upgrade MariaDB variant
variables:
MARIADB_VERSION: "10.2"
script:
- *test-install-readline-in-sid-for-backwards-compat
- *test-install-openssl1-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.2
# Verify initial state before upgrade
- dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
- service mysql status
# prepending with --defaults-file=/etc/mysql/debian.cnf is needed in upstream 5.5–10.3
- |
mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names -e "SELECT @@version, @@version_comment"
mysql --defaults-file=/etc/mysql/debian.cnf --table -e "SHOW DATABASES;"
mysql --defaults-file=/etc/mysql/debian.cnf --table -e "SELECT * FROM mysql.user; SHOW CREATE USER root@localhost;"
mysql --defaults-file=/etc/mysql/debian.cnf --table -e "SELECT * FROM mysql.plugin; SHOW PLUGINS;"
- *test-install-all
# mariadb-10.2 in ships a /etc/init.d/mysql and it continues to exist
# after upgrade, but is be removed on purge
- service mysql status || service mariadb status
# Give the mariadb-upgrade plenty of time to complete, otherwise next commands
# fail on non-existing mariadb.sys user
- sleep 15
- *test-verify-final
mysql.com-5.7 with Buster upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB variant
needs:
- job: build
image: debian:buster
script:
- *test-prepare-container
- |
apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work
apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 B7B3B788A8D3785C
echo "deb https://repo.mysql.com/apt/debian/ buster mysql-5.7" > /etc/apt/sources.list.d/mysql.list
apt-get update -qq
apt-get install -y 'mysql*' 'libmysqlc*'
# Ensure MySQL 5.7 package actually got installed
- dpkg -l | grep -e "mysql-server.*5.7"
- *test-verify-initial
- *test-enable-sid-repos
- *test-install-all
# Due to some (currently unknown) changes in MySQL 5.7 packaging or apt
# behaviour changes, a system with a previous installation of MySQL will
# on upgrades to MariaDB first fully remove MySQL, including the
# /etc/init.d/mysql file, so previous techniques in
# mariadb-server-10.6.postinst to maintain backwards compatibility with
# 'service mysql status' after installing MariaDB on top MySQL no longer
# works. Thus the step to test it now intentionally has a fallback to use
# the service name 'mariadb' instead, and the fallback is always used.
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
- service mysql status || service mariadb status
- sleep 15 # Give the mysql_upgrade a bit of extra time to complete with MySQL 5.7 before querying the server
- *test-verify-final
percona-xtradb-5.7 with Bullseye backports upgrade:
extends: .salsa-ci-template-for-mariadb
stage: upgrade MariaDB variant
needs:
- job: build bullseye-backports
image: debian:bullseye
script:
- *test-prepare-container
- |
apt-get install --no-install-recommends --yes gpg gpg-agent dirmngr ca-certificates # Bare minimal (<4MB) for apt-key to work
apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 9334A25F8507EFA5
echo "deb https://repo.percona.com/apt/ bullseye main" > /etc/apt/sources.list.d/mysql.list
apt-get update -qq
apt-get install -y percona-xtradb-cluster-full-57 percona-xtrabackup-24 percona-toolkit pmm2-client
- service mysql status
- *test-verify-initial
# Enable backports to make galera-4 available
- echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list.d/backports.list && apt-get update -qq
- *test-install-all
- service mysql status
- sleep 15 # Give the mysql_upgrade a bit of extra time to complete with MySQL 5.7 before querying the server
- *test-verify-final
|