|
| 1 | +--- |
| 2 | +# This Gitlab-CI pipeline offers basic validation that a commit did not |
| 3 | +# introduce easily detectable regressions. Builds run primairly on a new Fedora, |
| 4 | +# which has all the latest upstream build dependencies and thus is the primary |
| 5 | +# testing target, as eventually everything in Fedora becomes the next CentOS and |
| 6 | +# Red Hat releases. |
| 7 | +# |
| 8 | +# In addition test building on CentOS 7 and 8 to ensure that the code base |
| 9 | +# remains reasonably backwards compatible. |
| 10 | +# |
| 11 | +# This is now intentionally simple, to keep it fast and accurate with minimal |
| 12 | +# false positive failures. If one wants to extend it, see debian/salsa-ci.yml |
| 13 | +# for inspiration on more integration tests to run. |
| 14 | +# |
| 15 | +# Also make sure the pipeline stays within the bounds of what CI workers on |
| 16 | +# Gitlab-CI are capable of executing, thus ensuring that any potential |
| 17 | +# contributor can at any point in time fork to their own Gitlab account and |
| 18 | +# start working towards meaningful contributions! |
| 19 | +# |
| 20 | +# NOTE TO MERGERS: Most of the contents in the Gitlab-CI configuration has been |
| 21 | +# tailored for a specific release or MariaDB. As a general rule, do not merge |
| 22 | +# changes in this file across MariaDB branches to avoid breaking the CI. Updates |
| 23 | +# the Gitlab-CI pipeline are most of the time better done manually per major |
| 24 | +# release branch. |
| 25 | + |
| 26 | +stages: |
| 27 | + - build |
| 28 | + - test |
| 29 | + - Salsa-CI |
| 30 | + |
| 31 | +# Base image for builds and tests unless otherwise defined |
| 32 | +# @TODO: Fedora 34 is latest, but fails to start on Gitlab.com with error "shell not found" |
| 33 | +image: fedora:33 |
| 34 | + |
| 35 | +# Define common CMAKE_FLAGS for all builds. Skim down build by omitting all |
| 36 | +# submodules (a commit in this repo does not affect their builds anyway) and |
| 37 | +# many components that are otherwise slow to build. |
| 38 | +variables: |
| 39 | + CMAKE_FLAGS: "-DWITH_SSL=system -DPLUGIN_COLUMNSTORE=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_S3=NO -DPLUGIN_MROONGA=NO -DPLUGIN_CONNECT=NO -DPLUGIN_MROONGA=NO -DPLUGIN_TOKUDB=NO -DPLUGIN_PERFSCHEMA=NO -DWITH_WSREP=OFF" |
| 40 | + # Major version dictates which branches share the same ccache |
| 41 | + MARIADB_MAJOR_VERSION: "10.6" |
| 42 | + # Most steps don't need the source code, only artifacts |
| 43 | + GIT_STRATEGY: none |
| 44 | + # Hack to satisfy directory name length requirement by CPackRPM in CMake 3.x |
| 45 | + # https://cmake.org/cmake/help/v3.7/module/CPackRPM.html#variable:CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX |
| 46 | + GIT_CLONE_PATH: $CI_BUILDS_DIR/CPACK_BUILD_SOURCE_DIRS_LONG_NAME_REQUIREMENT |
| 47 | + |
| 48 | +# Define once, use many times |
| 49 | +.rpm_listfiles: &rpm_listfiles |
| 50 | + - | |
| 51 | + echo "Generating rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log ..." |
| 52 | + for package in *.rpm |
| 53 | + do |
| 54 | + echo "$package" |
| 55 | + rpm -qlpv "$package" | awk '{print $1 " " $3 "/" $4 " ." $9 " " $10 " " $11}' | sort -k 3 |
| 56 | + echo "------------------------------------------------" |
| 57 | + done >> ../rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 58 | + # CPackRPM lists contents in build log, so no need to show the output of this, |
| 59 | + # just store it as a build artifact that can be downloaded and diffed against |
| 60 | + # other builds to detect which files where added/removed/moved |
| 61 | + |
| 62 | +fedora: |
| 63 | + stage: build |
| 64 | + variables: |
| 65 | + GIT_STRATEGY: fetch |
| 66 | + GIT_SUBMODULE_STRATEGY: normal |
| 67 | + script: |
| 68 | + - yum install -y yum-utils rpm-build ccache openssl-devel |
| 69 | + - source /etc/profile.d/ccache.sh |
| 70 | + - export CCACHE_DIR="$(pwd)/.ccache"; ccache -s |
| 71 | + # Accelerate builds with unsafe disk access, as we can afford to loose the entire build anyway |
| 72 | + - yum install -y https://github.com/stewartsmith/libeatmydata/releases/download/v129/libeatmydata-129-1.fc33.x86_64.rpm |
| 73 | + # This repository does not have any .spec files, so install dependencies based on Fedora spec file |
| 74 | + - yum-builddep -y mariadb-server |
| 75 | + - mkdir builddir; cd builddir |
| 76 | + - cmake -DRPM=$CI_JOB_NAME $CMAKE_FLAGS .. 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 77 | + - eatmydata make package 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 78 | + # @TODO: Don't use -j on Gitlab.com as builds just get stuck when running |
| 79 | + # multi-proc, needs more debugging |
| 80 | + - make test || true # Unit tests constantly fail, see https://jira.mariadb.org/browse/MDEV-25820 |
| 81 | + # - make test-force || true # mysql-test-runner takes too long, run it in a separate job instead |
| 82 | + - *rpm_listfiles |
| 83 | + - mkdir ../rpm; mv *.rpm ../rpm |
| 84 | + - ccache -s |
| 85 | + artifacts: |
| 86 | + when: always # Must be able to see logs |
| 87 | + paths: |
| 88 | + - build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 89 | + - rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 90 | + - rpm |
| 91 | + - builddir/_CPack_Packages/Linux/RPM/SPECS/ |
| 92 | + cache: |
| 93 | + key: $MARIADB_MAJOR_VERSION-$CI_JOB_NAME |
| 94 | + paths: |
| 95 | + - .ccache |
| 96 | + # policy: pull |
| 97 | + # @TODO: It would be enough to only download the cache. There is no need for |
| 98 | + # every job to upload a new cache every time. A monthly or weekly scheduled |
| 99 | + # run could update the cache for all other builds to us. |
| 100 | + |
| 101 | +centos8: |
| 102 | + stage: build |
| 103 | + image: centos:8 |
| 104 | + variables: |
| 105 | + GIT_STRATEGY: fetch |
| 106 | + GIT_SUBMODULE_STRATEGY: normal |
| 107 | + script: |
| 108 | + - yum install -y yum-utils rpm-build openssl-devel |
| 109 | + - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm |
| 110 | + # dnf --enablerepo=powertools install Judy-devel #--> not found |
| 111 | + - dnf config-manager --set-enabled powertools |
| 112 | + # Error: |
| 113 | + # Problem: conflicting requests |
| 114 | + # - package Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.i686 is filtered out by modular filtering |
| 115 | + # - package Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64 is filtered out by modular filtering |
| 116 | + # Solution: install Judy-devel directly from downloaded rpm file: |
| 117 | + - yum install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64.rpm |
| 118 | + # Use eatmydata to speed up build |
| 119 | + - yum install -y https://github.com/stewartsmith/libeatmydata/releases/download/v129/libeatmydata-129-1.fc33.x86_64.rpm |
| 120 | + - yum install -y ccache # From EPEL |
| 121 | + - source /etc/profile.d/ccache.sh |
| 122 | + - export CCACHE_DIR="$(pwd)/.ccache"; ccache -s |
| 123 | + # This repository does not have any .spec files, so install dependencies based on CentOS spec file |
| 124 | + - yum-builddep -y mariadb-server |
| 125 | + - mkdir builddir; cd builddir |
| 126 | + - cmake -DRPM=$CI_JOB_NAME $CMAKE_FLAGS .. 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 127 | + - eatmydata make package 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 128 | + # @TODO: Don't use -j on Gitlab.com as builds just get stuck when running |
| 129 | + # multi-proc and out of memory, see https://jira.mariadb.org/browse/MDEV-25968 |
| 130 | + - make test || true # Unit tests constantly fail, see https://jira.mariadb.org/browse/MDEV-25820 |
| 131 | + # - make test-force || true # mysql-test-runner takes too long, run it in a separate job instead |
| 132 | + - *rpm_listfiles |
| 133 | + - mkdir ../rpm; mv *.rpm ../rpm |
| 134 | + - ccache -s |
| 135 | + artifacts: |
| 136 | + when: always # Must be able to see logs |
| 137 | + paths: |
| 138 | + - build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 139 | + - rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 140 | + - rpm |
| 141 | + - builddir/_CPack_Packages/Linux/RPM/SPECS/ |
| 142 | + cache: |
| 143 | + key: $MARIADB_MAJOR_VERSION-$CI_JOB_NAME |
| 144 | + paths: |
| 145 | + - .ccache |
| 146 | + |
| 147 | +centos7: |
| 148 | + stage: build |
| 149 | + image: centos:7 |
| 150 | + variables: |
| 151 | + GIT_STRATEGY: fetch |
| 152 | + GIT_SUBMODULE_STRATEGY: normal |
| 153 | + script: |
| 154 | + # This repository does not have any .spec files, so install dependencies based on Fedora spec file |
| 155 | + - yum-builddep -y mariadb-server |
| 156 | + # ..with a few extra ones, as CentOS 7 is very old and these are added in newer MariaDB releases |
| 157 | + - yum install -y yum-utils rpm-build gcc gcc-c++ bison libxml2-devel libevent-devel openssl-devel |
| 158 | + - mkdir builddir; cd builddir |
| 159 | + - cmake -DRPM=$CI_JOB_NAME $CMAKE_FLAGS .. 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 160 | + - make package 2>&1 | tee -a ../build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 161 | + # @TODO: Don't use -j on Gitlab.com as builds just get stuck when running |
| 162 | + # multi-proc and out of memory, see https://jira.mariadb.org/browse/MDEV-25968 |
| 163 | + - make test || true # Unit tests constantly fail, see https://jira.mariadb.org/browse/MDEV-25820 |
| 164 | + # - make test-force || true # mysql-test-runner takes too long, run it in a separate job instead |
| 165 | + - *rpm_listfiles |
| 166 | + - mkdir ../rpm; mv *.rpm ../rpm |
| 167 | + artifacts: |
| 168 | + when: always # Must be able to see logs |
| 169 | + paths: |
| 170 | + - build-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 171 | + - rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 172 | + - rpm |
| 173 | + - builddir/_CPack_Packages/Linux/RPM/SPECS/ |
| 174 | + |
| 175 | +mysql-test-run: |
| 176 | + stage: test |
| 177 | + dependencies: |
| 178 | + - fedora |
| 179 | + script: |
| 180 | + # Install packages so tests and the dependencies install |
| 181 | + # @TODO: RPM missing 'patch' as dependency, so installing it manually for now |
| 182 | + - yum install -y rpm/*.rpm patch |
| 183 | + # @TODO: Fix on packaging level for /usr/share/mariadb to work and errormsg.sys be found |
| 184 | + - rm -rf /usr/share/mariadb; ln -s /usr/share/mysql /usr/share/mariadb |
| 185 | + # mtr expects to be launched in-place and with write access to it's own directories |
| 186 | + - cd /usr/share/mysql-test |
| 187 | + - | |
| 188 | + echo " |
| 189 | + main.mysqldump : flaky on Gitlab-CI |
| 190 | + main.flush_logs_not_windows : flaky in containers in general |
| 191 | + main.mysql_upgrade_noengine : requires diff but diffutils is not a dependency |
| 192 | + " > skiplist |
| 193 | + # @TODO: Flaky tests are skipped for now, but should be fixed |
| 194 | + - ./mtr --suite=main --force --xml-report=$CI_PROJECT_DIR/junit.xml --skip-test-list=skiplist |
| 195 | + artifacts: |
| 196 | + when: always # Also show results when tests fail |
| 197 | + reports: |
| 198 | + junit: |
| 199 | + - junit.xml |
| 200 | + |
| 201 | +rpmlint: |
| 202 | + stage: test |
| 203 | + dependencies: |
| 204 | + - fedora |
| 205 | + script: |
| 206 | + - yum install -y rpmlint |
| 207 | + - rm -f rpm/*debuginfo* # Not relevant in this test |
| 208 | + # Limit output to 1000 lines as Gitlab-CI max output is 4194304 bytes |
| 209 | + # Save everything in a log file so it can be viewed in full via artifacts |
| 210 | + - rpmlint --info rpm/*.rpm | tee -a rpmlint-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 211 | + artifacts: |
| 212 | + when: always # Also show results when tests fail |
| 213 | + paths: |
| 214 | + - rpmlint-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log |
| 215 | + allow_failure: true |
| 216 | + # @TODO: The package is not rpmlint clean, must allow failure for now |
| 217 | + |
| 218 | +fedora install: |
| 219 | + stage: test |
| 220 | + dependencies: |
| 221 | + - fedora |
| 222 | + script: |
| 223 | + - rm -f rpm/*debuginfo* # Not relevant in this test |
| 224 | + # Nothing provides galera-4 on Fedora, so this step fails if built with wsrep |
| 225 | + - yum install -y rpm/*.rpm |
| 226 | + # Fedora does not support running services in Docker (like Debian packages do) so start it manually |
| 227 | + - /usr/bin/mariadb-install-db -u mysql |
| 228 | + - sudo -u mysql /usr/sbin/mariadbd & sleep 10 |
| 229 | + # @TODO: Since we did a manual start, we also need to run upgrade manually |
| 230 | + - /usr/bin/mariadb-upgrade -u root --socket /var/lib/mysql/mysql.sock |
| 231 | + - | |
| 232 | + mysql --skip-column-names -e "SELECT @@version, @@version_comment" | tee /tmp/version |
| 233 | + grep $MARIADB_MAJOR_VERSION /tmp/version || echo "MariaDB didn't upgrade properly" |
| 234 | +
|
| 235 | +fedora upgrade: |
| 236 | + stage: test |
| 237 | + dependencies: |
| 238 | + - fedora |
| 239 | + script: |
| 240 | + - yum install -y mariadb-server |
| 241 | + # Fedora does not support running services in Docker (like Debian packages do) so start it manually |
| 242 | + - /usr/libexec/mysql-check-socket |
| 243 | + - /usr/libexec/mysql-prepare-db-dir |
| 244 | + - sudo -u mysql /usr/libexec/mysqld --basedir=/usr & sleep 10 |
| 245 | + - /usr/libexec/mysql-check-upgrade |
| 246 | + - mysql --skip-column-names -e "SELECT @@version, @@version_comment" # Show version |
| 247 | + # @TODO: Upgrade from Fedora 33 MariaDB 10.4 to MariaDB.org latest does not work |
| 248 | + # so do this manual step to remove conflicts until packaging is fixed |
| 249 | + - > |
| 250 | + yum remove -y mariadb-server-utils mariadb-gssapi-server mariadb-cracklib-password-check |
| 251 | + mariadb-backup mariadb-connector-c-config |
| 252 | + - rm -f rpm/*debuginfo* # Not relevant in this test |
| 253 | + - yum install -y rpm/*.rpm procps # procps provides pkill |
| 254 | + # nothing provides galera-4 on Fedora, so this step fails if built with wsrep |
| 255 | + - pkill mysqld || true; sleep 5; pkill mysqld || true; sleep 5 |
| 256 | + - /usr/bin/mariadb-install-db -u mysql |
| 257 | + - sudo -u mysql /usr/sbin/mariadbd & sleep 10 |
| 258 | + # @TODO: Since we did a manual start, we also need to run upgrade manually |
| 259 | + - /usr/bin/mariadb-upgrade -u root --socket /var/lib/mysql/mysql.sock |
| 260 | + - | |
| 261 | + mysql --skip-column-names -e "SELECT @@version, @@version_comment" | tee /tmp/version |
| 262 | + grep $MARIADB_MAJOR_VERSION /tmp/version || echo "MariaDB didn't upgrade properly" |
| 263 | +
|
| 264 | +# Once all RPM builds and tests have passed, also run the DEB builds and tests |
| 265 | +# @NOTE: This is likely to work well only on salsa.debian.org as the Gitlab.com |
| 266 | +# runners are too small for everything this stage does. |
| 267 | +# build_deb: |
| 268 | +# stage: Salsa-CI |
| 269 | +# trigger: |
| 270 | +# include: debian/salsa-ci.yml |
0 commit comments