From 289bb2cb3b2155009311d2bd7714bd2c497385e5 Mon Sep 17 00:00:00 2001
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
Date: Thu, 3 Oct 2019 14:44:50 +0300
Subject: [PATCH] build: add CentOS 8 into CI / CD

Added build + test jobs in GitLab-CI and build + test + deploy jobs on
Travis-CI for CentOS 8.

Updated testing dependencies in the RPM spec to follow the new Python 2
package naming scheme that was introduced in CentOS 8: it uses
'python2-' prefix rather then 'python-'.

CentOS 8 does not provide python2-gevent and python2-greenlet packages,
so they were pushed to https://packagecloud.io/packpack/backports
repository. This repository is enabled in our build image
(packpack/packpack:el-8) by default. Those dependencies are build-time,
so nothing was changed for a user. The source RPM packages were gathered
from https://cbs.centos.org.

Disabled app-tap/pwd.test.lua on CentOS 8 due to systemd-nss issue,
which was not worked around properly. Filed #4592 to resolved it in the
future.

Eliminated libunwind runtime dependency (and libunwind-devel build
dependency) on CentOS 8, because the base system does not provide it.
fiber.info() backtraces and printing of a backtrace after a crash will
not be available on this system. Hopefully we'll fix it in the future,
filed #4611 on this.

Closes #4543

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
Reviewed-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit e3d9d8c97edd39438cbc98fccac996e61ce4984c)
---
 .gitlab-ci.yml            |  6 ++++++
 .travis.yml               |  3 +++
 rpm/tarantool.spec        | 17 +++++++++++++++--
 test/app-tap/pwd.skipcond | 11 +++++++++++
 4 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 test/app-tap/pwd.skipcond

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7f1684596e..bea6402a5f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -152,6 +152,12 @@ centos_7:
     OS: 'el'
     DIST: '7'
 
+centos_8:
+  <<: *deploy_test_definition
+  variables:
+    OS: 'el'
+    DIST: '8'
+
 fedora_28:
   <<: *deploy_test_definition
   variables:
diff --git a/.travis.yml b/.travis.yml
index f416ef83f6..6ebaf1de2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -43,6 +43,9 @@ jobs:
       - name: "CentOS 7 build + test + deploy RPM"
         env: OS=el DIST=7
         if: branch = "2.2"
+      - name: "CentOS 8 build + test + deploy RPM"
+        env: OS=el DIST=8
+        if: branch = "2.2"
       - name: "Fedora 28 build + test + deploy RPM"
         env: OS=fedora DIST=28
         if: branch = "2.2"
diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index b837214a6a..edce391154 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -44,7 +44,14 @@ Requires(preun): chkconfig
 Requires(preun): initscripts
 %endif
 
-%bcond_without backtrace # enabled by default
+%if 0%{?rhel} >= 8
+# gh-4611: Disable backtraces on CentOS 8 by default due to lack
+# of libunwind package in the base system.
+%bcond_with backtrace
+%else
+# Enable backtraces by default.
+%bcond_without backtrace
+%endif
 
 %if %{with backtrace}
 BuildRequires: libunwind-devel
@@ -63,12 +70,18 @@ BuildRequires: libunwind-devel
 %endif
 
 # For tests
-%if (0%{?fedora} >= 22 || 0%{?rhel} >= 7)
+%if (0%{?fedora} >= 22 || 0%{?rhel} == 7)
 BuildRequires: python >= 2.7
 BuildRequires: python-six >= 1.9.0
 BuildRequires: python-gevent >= 1.0
 BuildRequires: python-yaml >= 3.0.9
 %endif
+%if 0%{?rhel} >= 8
+BuildRequires: python2 >= 2.7
+BuildRequires: python2-six >= 1.9.0
+BuildRequires: python2-gevent >= 1.0
+BuildRequires: python2-yaml >= 3.0.9
+%endif
 
 Name: tarantool
 # ${major}.${major}.${minor}.${patch}, e.g. 1.6.8.175
diff --git a/test/app-tap/pwd.skipcond b/test/app-tap/pwd.skipcond
new file mode 100644
index 0000000000..cf97461bcb
--- /dev/null
+++ b/test/app-tap/pwd.skipcond
@@ -0,0 +1,11 @@
+import subprocess
+
+# Disable the test on CentOS 8 until gh-4592 will be resolved.
+try:
+    cmd = ['rpm', '--eval', '%{centos_ver}']
+    if subprocess.check_output(cmd).strip() == '8':
+        self.skip = 1
+except:
+    pass
+
+# vim: set ft=python:
-- 
GitLab