Skip to content

Commit

Permalink
Add zabbix 7.0 support in CI
Browse files Browse the repository at this point in the history
skip zabbixapi resource check do to the gem was not compatible with zabbix 7.0 api
  • Loading branch information
Valantin committed Jun 27, 2024
1 parent 6122ab6 commit a13fd17
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 9 deletions.
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
2 changes: 2 additions & 0 deletions spec/acceptance/zabbix_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_host type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
next if zabbix_version >= '7.0'

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
2 changes: 2 additions & 0 deletions spec/acceptance/zabbix_hostgroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

describe 'zabbix_hostgroup type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
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
2 changes: 2 additions & 0 deletions spec/acceptance/zabbix_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_proxy type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
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
2 changes: 2 additions & 0 deletions spec/acceptance/zabbix_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

describe 'zabbix_template type' do
supported_server_versions(default[:platform]).each do |zabbix_version|
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

0 comments on commit a13fd17

Please sign in to comment.