Commit f526b755 authored by Michal Nowikowski's avatar Michal Nowikowski

hammer: added support for debian-10, some other various fixes

parent 01f68612
...@@ -44,7 +44,7 @@ SYSTEMS = { ...@@ -44,7 +44,7 @@ SYSTEMS = {
'centos': ['7'], 'centos': ['7'],
'rhel': ['8'], 'rhel': ['8'],
'ubuntu': ['16.04', '18.04', '18.10', '19.04'], 'ubuntu': ['16.04', '18.04', '18.10', '19.04'],
'debian': ['8', '9'], 'debian': ['8', '9', '10'],
'freebsd': ['11.2', '12.0'], 'freebsd': ['11.2', '12.0'],
} }
...@@ -73,6 +73,8 @@ IMAGE_TEMPLATES = { ...@@ -73,6 +73,8 @@ IMAGE_TEMPLATES = {
'debian-8-virtualbox': {'bare': 'debian/jessie64', 'kea': 'godfryd/kea-debian-8'}, 'debian-8-virtualbox': {'bare': 'debian/jessie64', 'kea': 'godfryd/kea-debian-8'},
'debian-9-lxc': {'bare': 'godfryd/lxc-debian-9', 'kea': 'godfryd/kea-debian-9'}, 'debian-9-lxc': {'bare': 'godfryd/lxc-debian-9', 'kea': 'godfryd/kea-debian-9'},
'debian-9-virtualbox': {'bare': 'debian/stretch64', 'kea': 'godfryd/kea-debian-9'}, 'debian-9-virtualbox': {'bare': 'debian/stretch64', 'kea': 'godfryd/kea-debian-9'},
'debian-10-lxc': {'bare': 'godfryd/lxc-debian-10', 'kea': 'godfryd/kea-debian-10'},
'debian-10-virtualbox': {'bare': 'debian/buster64', 'kea': 'godfryd/kea-debian-10'},
'freebsd-11.2-virtualbox': {'bare': 'generic/freebsd11', 'kea': 'godfryd/kea-freebsd-11.2'}, 'freebsd-11.2-virtualbox': {'bare': 'generic/freebsd11', 'kea': 'godfryd/kea-freebsd-11.2'},
'freebsd-12.0-virtualbox': {'bare': 'generic/freebsd12', 'kea': 'godfryd/kea-freebsd-12.0'}, 'freebsd-12.0-virtualbox': {'bare': 'generic/freebsd12', 'kea': 'godfryd/kea-freebsd-12.0'},
} }
...@@ -153,7 +155,7 @@ def get_system_revision(): ...@@ -153,7 +155,7 @@ def get_system_revision():
if system == 'Linux': if system == 'Linux':
system, revision, _ = platform.dist() # pylit: disable=deprecated-method system, revision, _ = platform.dist() # pylit: disable=deprecated-method
if system == 'debian': if system == 'debian':
revision = revision[0] revision = revision.split('.')[0]
elif system == 'redhat': elif system == 'redhat':
system = 'rhel' system = 'rhel'
revision = revision[0] revision = revision[0]
...@@ -535,23 +537,17 @@ class VagrantEnv(object): ...@@ -535,23 +537,17 @@ class VagrantEnv(object):
def package(self): def package(self):
"""Package Vagrant system into Vagrant box.""" """Package Vagrant system into Vagrant box."""
execute('vagrant halt', cwd=self.vagrant_dir, dry_run=self.dry_run, raise_error=False)
if self.provider == 'virtualbox': box_path = os.path.join(self.vagrant_dir, 'kea-%s-%s.box' % (self.system, self.revision))
box_path = "kea-%s-%s.box" % (self.system, self.revision) if os.path.exists(box_path):
full_box_path = os.path.join(self.vagrant_dir, box_path) os.unlink(box_path)
if os.path.exists(full_box_path):
os.unlink(full_box_path)
if self.provider == 'virtualbox':
cmd = "vagrant package --output %s" % box_path cmd = "vagrant package --output %s" % box_path
execute(cmd, cwd=self.vagrant_dir, timeout=4 * 60, dry_run=self.dry_run) execute(cmd, cwd=self.vagrant_dir, timeout=4 * 60, dry_run=self.dry_run)
elif self.provider == 'lxc': elif self.provider == 'lxc':
execute('vagrant halt', cwd=self.vagrant_dir, dry_run=self.dry_run, raise_error=False)
box_path = os.path.join(self.vagrant_dir, 'kea-%s-%s.box' % (self.system, self.revision))
if os.path.exists(box_path):
os.unlink(box_path)
lxc_box_dir = os.path.join(self.vagrant_dir, 'lxc-box') lxc_box_dir = os.path.join(self.vagrant_dir, 'lxc-box')
if os.path.exists(lxc_box_dir): if os.path.exists(lxc_box_dir):
execute('sudo rm -rf %s' % lxc_box_dir) execute('sudo rm -rf %s' % lxc_box_dir)
...@@ -892,7 +888,7 @@ def _configure_pgsql(system, features): ...@@ -892,7 +888,7 @@ def _configure_pgsql(system, features):
cmd += "GRANT ALL PRIVILEGES ON DATABASE keatest TO keatest;\n" cmd += "GRANT ALL PRIVILEGES ON DATABASE keatest TO keatest;\n"
cmd += "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES to keatest_readonly;\n" cmd += "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES to keatest_readonly;\n"
cmd += "EOF\n\"" cmd += "EOF\n\""
execute(cmd) execute(cmd, cwd='/tmp') # CWD to avoid: could not change as posgres user directory to "/home/jenkins": Permission denied
if 'forge' in features: if 'forge' in features:
cmd = "bash -c \"cat <<EOF | sudo -u postgres psql postgres\n" cmd = "bash -c \"cat <<EOF | sudo -u postgres psql postgres\n"
...@@ -902,7 +898,7 @@ def _configure_pgsql(system, features): ...@@ -902,7 +898,7 @@ def _configure_pgsql(system, features):
cmd += "CREATE DATABASE keadb;\n" cmd += "CREATE DATABASE keadb;\n"
cmd += "GRANT ALL PRIVILEGES ON DATABASE keauser TO keadb;\n" cmd += "GRANT ALL PRIVILEGES ON DATABASE keauser TO keadb;\n"
cmd += "EOF\n\"" cmd += "EOF\n\""
execute(cmd) execute(cmd, cwd='/tmp') # CWD to avoid: could not change as posgres user directory to "/home/jenkins": Permission denied
# TODO: in /etc/postgresql/10/main/pg_hba.conf # TODO: in /etc/postgresql/10/main/pg_hba.conf
# change: # change:
# local all all peer # local all all peer
...@@ -933,6 +929,9 @@ def _install_cassandra_deb(system, revision, env, check_times): ...@@ -933,6 +929,9 @@ def _install_cassandra_deb(system, revision, env, check_times):
env=env, check_times=check_times) env=env, check_times=check_times)
execute('wget http://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.11.0/cassandra-cpp-driver_2.11.0-1_amd64.deb', execute('wget http://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.11.0/cassandra-cpp-driver_2.11.0-1_amd64.deb',
env=env, check_times=check_times) env=env, check_times=check_times)
if system == 'debian' and revision == '10':
install_pkgs('multiarch-support', env=env, check_times=check_times)
execute('sudo dpkg -i cassandra-cpp-driver-dev_2.11.0-1_amd64.deb cassandra-cpp-driver_2.11.0-1_amd64.deb', execute('sudo dpkg -i cassandra-cpp-driver-dev_2.11.0-1_amd64.deb cassandra-cpp-driver_2.11.0-1_amd64.deb',
env=env, check_times=check_times) env=env, check_times=check_times)
execute('rm -rf cassandra-cpp-driver-dev_2.11.0-1_amd64.deb cassandra-cpp-driver_2.11.0-1_amd64.deb', execute('rm -rf cassandra-cpp-driver-dev_2.11.0-1_amd64.deb cassandra-cpp-driver_2.11.0-1_amd64.deb',
...@@ -1016,6 +1015,7 @@ def prepare_system_local(features, check_times): ...@@ -1016,6 +1015,7 @@ def prepare_system_local(features, check_times):
packages.extend(['libxslt', 'elinks', 'docbook-style-xsl']) packages.extend(['libxslt', 'elinks', 'docbook-style-xsl'])
if 'mysql' in features: if 'mysql' in features:
execute('sudo dnf remove -y community-mysql-devel || true')
packages.extend(['mariadb', 'mariadb-server', 'mariadb-connector-c-devel']) packages.extend(['mariadb', 'mariadb-server', 'mariadb-connector-c-devel'])
if 'pgsql' in features: if 'pgsql' in features:
...@@ -1186,9 +1186,13 @@ def prepare_system_local(features, check_times): ...@@ -1186,9 +1186,13 @@ def prepare_system_local(features, check_times):
if 'mysql' in features: if 'mysql' in features:
if revision == '8': if revision == '8':
packages.extend(['mysql-client', 'libmysqlclient-dev', 'mysql-server']) packages.extend(['mysql-client', 'libmysqlclient-dev'])
else: else:
packages.extend(['default-mysql-client-core', 'default-libmysqlclient-dev', 'mysql-server']) packages.extend(['default-mysql-client-core', 'default-libmysqlclient-dev'])
if revision in ['8', '9']:
packages.append('mysql-server')
else:
packages.append('mariadb-server')
if 'pgsql' in features: if 'pgsql' in features:
packages.extend(['postgresql-client', 'libpq-dev', 'postgresql-all']) packages.extend(['postgresql-client', 'libpq-dev', 'postgresql-all'])
...@@ -1237,7 +1241,7 @@ def prepare_system_local(features, check_times): ...@@ -1237,7 +1241,7 @@ def prepare_system_local(features, check_times):
if 'pgsql' in features: if 'pgsql' in features:
_configure_pgsql(system, features) _configure_pgsql(system, features)
if 'radius' in features: if 'radius' in features and 'native-pkg' not in features:
_install_freeradius_client(system, revision, features, env, check_times) _install_freeradius_client(system, revision, features, env, check_times)
#execute('sudo rm -rf /usr/share/doc') #execute('sudo rm -rf /usr/share/doc')
...@@ -1447,6 +1451,9 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times ...@@ -1447,6 +1451,9 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times
elif system == 'fedora' and revision == '29': elif system == 'fedora' and revision == '29':
frc.append('freeradius-client-1.1.7-isc20190408101030.fc29') frc.append('freeradius-client-1.1.7-isc20190408101030.fc29')
frc.append('freeradius-client-devel-1.1.7-isc20190408101030.fc29') frc.append('freeradius-client-devel-1.1.7-isc20190408101030.fc29')
elif system == 'fedora' and revision == '30':
frc.append('freeradius-client-1.1.7-isc201906181200.fc30')
frc.append('freeradius-client-devel-1.1.7-isc201906181200.fc30')
elif system == 'centos': elif system == 'centos':
frc.append('freeradius-client-1.1.7-isc20190408140511.el7') frc.append('freeradius-client-1.1.7-isc20190408140511.el7')
frc.append('freeradius-client-devel-1.1.7-isc20190408140511.el7') frc.append('freeradius-client-devel-1.1.7-isc20190408140511.el7')
...@@ -1497,7 +1504,9 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times ...@@ -1497,7 +1504,9 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times
elif system in ['ubuntu', 'debian']: elif system in ['ubuntu', 'debian']:
# install our freeradius-client but now from deb # install our freeradius-client but now from deb
execute("echo 'deb %s kea main' | sudo tee /etc/apt/sources.list.d/isc.list" % repo_url) execute("echo 'deb %s kea main' | sudo tee /etc/apt/sources.list.d/isc.list" % repo_url)
execute("sudo apt-key adv --fetch-keys %s/repository/repo-keys/repo-key.gpg" % repository_url) key_url = "%s/repository/repo-keys/repo-key.gpg" % repository_url
execute('wget -qO- %s | sudo apt-key add -' % key_url,
env=env, check_times=check_times)
# try apt update for up to 10 times if there is an error # try apt update for up to 10 times if there is an error
for _ in range(10): for _ in range(10):
_, out = execute('sudo apt update', capture=True) _, out = execute('sudo apt update', capture=True)
...@@ -1540,6 +1549,7 @@ def build_local(features, tarball_path, check_times, jobs, dry_run, ccache_dir, ...@@ -1540,6 +1549,7 @@ def build_local(features, tarball_path, check_times, jobs, dry_run, ccache_dir,
env['LANGUAGE'] = env['LANG'] = env['LC_ALL'] = 'C' env['LANGUAGE'] = env['LANG'] = env['LC_ALL'] = 'C'
system, revision = get_system_revision() system, revision = get_system_revision()
log.info('Building for %s %s', system, revision)
execute('df -h', dry_run=dry_run) execute('df -h', dry_run=dry_run)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment