Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zabbix 7.0 support in CI #952

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
with:
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0'
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0,7.0'
10 changes: 9 additions & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
}
case $facts['os']['family'] {
'RedHat': {
if versioncmp(fact('os.release.major'), '9') >= 0 {
if (versioncmp(fact('os.release.major'), '7') >= 0 and $zabbix_version == '7.0') {
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'
} elsif versioncmp(fact('os.release.major'), '9') >= 0 {
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD'
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD'
} else {
Expand Down Expand Up @@ -139,6 +142,10 @@
id => 'A1848F5352D022B9471D83D0082AB56BA14FE591',
source => 'https://repo.zabbix.com/zabbix-official-repo.key',
}
apt::key { 'zabbix-4C3D6F2':
id => '4C3D6F2CC75F5146754FC374D913219AB5333005',
source => 'https://repo.zabbix.com/zabbix-official-repo.key',
}

# Debian 11 provides Zabbix 5.0 by default. This can cause problems for 4.0 versions
$pinpriority = $facts['os']['release']['major'] ? {
Expand All @@ -153,6 +160,7 @@
require => [
Apt_key['zabbix-FBABD5F'],
Apt_key['zabbix-A1848F5'],
Apt_key['zabbix-4C3D6F2'],
],
}

Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/zabbix_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_host type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
# Zabbix 7.0 removed the deprecated params 'user' in favor to 'username'
next if zabbix_version >= '7.0'
Valantin marked this conversation as resolved.
Show resolved Hide resolved

context "create zabbix_host resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/zabbix_hostgroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

describe 'zabbix_hostgroup type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
# Zabbix 7.0 removed the deprecated params 'user' in favor to 'username'
next if zabbix_version >= '7.0'

context "create zabbix_hostgroup resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/zabbix_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_proxy type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
# Zabbix 7.0 removed the deprecated params 'user' in favor to 'username'
next if zabbix_version >= '7.0'

context "create zabbix_proxy resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/zabbix_template_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
describe 'zabbix_template_host type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
# Zabbix 6.0 removed the ability to attach templates directly to hosts.
next if zabbix_version == '6.0'
next if zabbix_version >= '6.0'

context "create zabbix_template_host resources with zabbix version #{zabbix_version}" do
template = case zabbix_version
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/zabbix_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

describe 'zabbix_template type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
# Zabbix 7.0 removed the deprecated params 'user' in favor to 'username'
next if zabbix_version >= '7.0'

context "create zabbix_template resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests
Expand Down
3 changes: 1 addition & 2 deletions spec/classes/database_mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
'/usr/share/doc/zabbix-*-mysql*'
end

sql_server = case zabbix_version
when '6.0'
sql_server = if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'server.sql'
else
'create.sql'
Expand Down
3 changes: 1 addition & 2 deletions spec/classes/database_postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
'/usr/share/doc/zabbix-*-pgsql'
end

sql_server = case zabbix_version
when '6.0'
sql_server = if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'server.sql'
else
'create.sql'
Expand Down
3 changes: 3 additions & 0 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
target => '/bin/mkdir',
}
}
package { 'gnupg':
ensure => present,
}
}
'Ubuntu': {
# The Ubuntu 18.04+ docker image has a dpkg config that won't install docs, to keep used space low
Expand Down
5 changes: 3 additions & 2 deletions spec/support/acceptance/supported_versions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

def supported_versions
supported_versions = %w[5.0 6.0]
supported_versions = %w[5.0 6.0 7.0]
# this is a hack so that we don't have to rewrite the existing acceptance tests
if (beaker_zabbix_version = ENV.fetch('BEAKER_FACTER_zabbix_version', nil))
supported_versions &= [beaker_zabbix_version]
Expand All @@ -20,6 +20,7 @@ def supported_server_versions(platform)
supported_versions.reject do |version|
platform.start_with?('archlinux') ||
(version >= '5.2' && platform.start_with?('el-7')) ||
(version < '6.0' && platform.start_with?('el-9', 'ubuntu-22', 'debian-12'))
(version < '6.0' && platform.start_with?('el-9', 'ubuntu-22', 'debian-12')) ||
(version >= '7.0' && platform.start_with?('ubuntu-20', 'debian-11'))
end
end
Loading