Skip to content

Commit 33be576

Browse files
committed
ci: add test matrix
1 parent b94a428 commit 33be576

11 files changed

Lines changed: 117 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ jobs:
5050
beaker_staging_url: ${{ inputs.beaker_staging_url }}
5151
beaker_collection: ${{ inputs.beaker_collection }}
5252
beaker_staging_version: ${{ inputs.beaker_staging_version }}
53+
beaker_facter: 'rabbitmq_version:RabbitMQ:3.8,3.13'

.rubocop_todo.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RSpec/BeEq:
1818
# Offense count: 13
1919
RSpec/LeakyLocalVariable:
2020
Exclude:
21+
- 'spec/acceptance/class_spec.rb'
2122
- 'spec/classes/rabbitmq_spec.rb'
2223
- 'spec/unit/puppet/provider/rabbitmq_binding/rabbitmqadmin_spec.rb'
2324
- 'spec/unit/puppet/provider/rabbitmq_cli_spec.rb'

REFERENCE.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* `rabbitmq::install`: Ensures that rabbitmq-server exists
1717
* `rabbitmq::install::rabbitmqadmin`: Install rabbitmq admin
1818
* `rabbitmq::management`: Manage presence / absence of user resource for guest management user.
19-
* `rabbitmq::repo::apt`: requires puppetlabs-apt puppetlabs-stdlib
19+
* `rabbitmq::repo::apt`
2020
* `rabbitmq::repo::rhel`: Makes sure that the Packagecloud repo is installed
2121
* `rabbitmq::service`: This class manages the rabbitmq server service itself.
2222

@@ -274,6 +274,7 @@ The following parameters are available in the `rabbitmq` class:
274274
* [`node_ip_address`](#-rabbitmq--node_ip_address)
275275
* [`package_apt_pin`](#-rabbitmq--package_apt_pin)
276276
* [`package_ensure`](#-rabbitmq--package_ensure)
277+
* [`rabbitmq_version`](#-rabbitmq--rabbitmq_version)
277278
* [`package_gpg_key`](#-rabbitmq--package_gpg_key)
278279
* [`package_source`](#-rabbitmq--package_source)
279280
* [`package_provider`](#-rabbitmq--package_provider)
@@ -819,9 +820,18 @@ Default value: `undef`
819820
Data type: `String`
820821

821822
Determines the ensure state of the package. Set to installed by default, but could be changed to latest.
823+
Use rabbitmq_version parameter to handle correctly installed version and dependencies.
822824

823825
Default value: `'installed'`
824826

827+
##### <a name="-rabbitmq--rabbitmq_version"></a>`rabbitmq_version`
828+
829+
Data type: `String`
830+
831+
Version of RabbitMQ to install in major.minor format (3.13, 3.8, etc.) or 'latest'.
832+
833+
Default value: `'latest'`
834+
825835
##### <a name="-rabbitmq--package_gpg_key"></a>`package_gpg_key`
826836

827837
Data type: `Optional[String]`
@@ -949,7 +959,7 @@ Defaults to false (use system packages). This does not ensure that soft dependen
949959
It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the
950960
different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788
951961

952-
Default value: `false`
962+
Default value: `true`
953963

954964
##### <a name="-rabbitmq--service_ensure"></a>`service_ensure`
955965

data/family/Debian.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
rabbitmq::python_package: 'python3'
33
rabbitmq::package_name: 'rabbitmq-server'
44
rabbitmq::service_name: 'rabbitmq-server'
5-
rabbitmq::package_gpg_key: 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey'
5+
rabbitmq::package_apt_pin: 1001

data/os/Debian-11.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
rabbitmq::repo::apt::location:
3+
- https://deb1.rabbitmq.com/rabbitmq-erlang/debian/bullseye
4+
- https://deb2.rabbitmq.com/rabbitmq-erlang/debian/bullseye
5+
- https://deb1.rabbitmq.com/rabbitmq-server/debian/bullseye
6+
- https://deb2.rabbitmq.com/rabbitmq-server/debian/bullseye

data/os/Debian-12.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
rabbitmq::repo::apt::location:
3+
- https://deb1.rabbitmq.com/rabbitmq-erlang/debian/bookworm
4+
- https://deb2.rabbitmq.com/rabbitmq-erlang/debian/bookworm
5+
- https://deb1.rabbitmq.com/rabbitmq-server/debian/bookworm
6+
- https://deb2.rabbitmq.com/rabbitmq-server/debian/bookworm

manifests/init.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@
252252
# Whether to pin the package to a particular source
253253
# @param package_ensure
254254
# Determines the ensure state of the package. Set to installed by default, but could be changed to latest.
255+
# Use rabbitmq_version parameter to handle correctly installed version and dependencies.
256+
# @param rabbitmq_version
257+
# Version of RabbitMQ to install in major.minor format (3.13, 3.8, etc.) or 'latest'.
255258
# @param package_gpg_key
256259
# RPM package GPG key to import. Uses source method. Should be a URL for Debian/RedHat OS family, or a file name for
257260
# RedHat OS family. Set to https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
@@ -435,6 +438,7 @@
435438
Optional[String] $node_ip_address = undef,
436439
Optional[Variant[Numeric, String[1]]] $package_apt_pin = undef,
437440
String $package_ensure = 'installed',
441+
String $rabbitmq_version = 'latest',
438442
Optional[String] $package_gpg_key = undef,
439443
Optional[Integer] $quorum_cluster_size = undef,
440444
Optional[Boolean] $quorum_membership_reconciliation_enabled = undef,
@@ -446,7 +450,7 @@
446450
Variant[String, Array] $package_name = 'rabbitmq',
447451
Optional[String] $package_source = undef,
448452
Optional[String] $package_provider = undef,
449-
Boolean $repos_ensure = false,
453+
Boolean $repos_ensure = true,
450454
Boolean $manage_python = true,
451455
String $python_package = 'python',
452456
String $rabbitmq_user = 'rabbitmq',

manifests/repo/apt.pp

Lines changed: 75 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,97 @@
1-
# requires
2-
# puppetlabs-apt
3-
# puppetlabs-stdlib
4-
#
51
# @api private
62
#
73
# @param location
84
# @param repos
95
# @param include_src
10-
# @param key
116
# @param key_source
127
# @param key_content
138
# @param architecture
149
#
1510
class rabbitmq::repo::apt (
16-
String[1] $location = 'https://packagecloud.io/rabbitmq/rabbitmq-server',
17-
String[1] $repos = 'main',
18-
Boolean $include_src = false,
19-
String[1] $key = '8C695B0219AFDEB04A058ED8F4E789204D206F89',
20-
String[1] $key_source = $rabbitmq::package_gpg_key,
11+
Array[String[1]] $location = ["'"], # See Hiera
12+
Array[String[1]] $repos = ['main'],
13+
Boolean $include_src = false,
14+
# String[1] $key_source = $rabbitmq::package_gpg_key,
2115
Optional[String[1]] $key_content = $rabbitmq::key_content,
2216
Optional[String[1]] $architecture = undef,
2317
) {
24-
$osname = downcase($facts['os']['name'])
18+
# https://github.com/puppetlabs/puppetlabs-apt/issues/1184
19+
include apt
20+
2521
$pin = $rabbitmq::package_apt_pin
2622

23+
# Uses legacy trusted.gpg, because apt::keyring does not de-armor the key
24+
apt::key { 'com.rabbitmq.team.gpg':
25+
id => '0A9AF2115F4687BD29803A206B73A36E6026DFCA',
26+
server => 'keys.openpgp.org',
27+
}
28+
2729
apt::source { 'rabbitmq':
28-
ensure => present,
29-
location => "${location}/${osname}",
30-
repos => $repos,
31-
include => { 'src' => $include_src },
32-
key => {
33-
'id' => $key,
34-
'source' => $key_source,
35-
'content' => $key_content,
36-
},
37-
architecture => $architecture,
30+
source_format => 'sources',
31+
location => $location,
32+
repos => $repos,
33+
release => [$facts['os']['distro']['codename']],
34+
types => ['deb'],
35+
architecture => $architecture,
36+
keyring => '/etc/apt/trusted.gpg',
37+
comment => 'Modern Erlang/OTP and RabbitMQ releases',
3838
}
3939

4040
if $pin {
41-
apt::pin { 'rabbitmq':
42-
packages => '*',
43-
priority => $pin,
44-
origin => inline_template('<%= require \'uri\'; URI(@location).host %>'),
41+
# Determine the Erlang compatible with RabbitMQ one, otherwise dependencies
42+
# install fails
43+
# https://www.rabbitmq.com/docs/which-erlang
44+
case $rabbitmq::rabbitmq_version {
45+
'3.13': {
46+
$erlang_pin_version = '1:26.*'
47+
$rabbitmq_pin_version = '3.13.*'
48+
}
49+
'3.12': {
50+
$erlang_pin_version = '1:26.*'
51+
$rabbitmq_pin_version = '3.12.*'
52+
}
53+
'3.11': {
54+
$erlang_pin_version = '1:25.*'
55+
$rabbitmq_pin_version = '3.11.*'
56+
}
57+
'3.10': {
58+
$erlang_pin_version = '1:25.*'
59+
$rabbitmq_pin_version = '3.10.*'
60+
}
61+
'3.9': {
62+
$erlang_pin_version = '1:25.*'
63+
$rabbitmq_pin_version = '3.9.*'
64+
}
65+
'3.8': {
66+
$erlang_pin_version = '1:24.*'
67+
$rabbitmq_pin_version = '3.8.*'
68+
}
69+
'3.7': {
70+
$erlang_pin_version = '1:22.*'
71+
$rabbitmq_pin_version = '3.7.*'
72+
}
73+
default: {
74+
$erlang_pin_version = false
75+
$rabbitmq_pin_version = false
76+
}
77+
}
78+
79+
if $rabbitmq_pin_version {
80+
apt::pin { 'rabbitmq':
81+
packages => 'rabbitmq*',
82+
explanation => "Pin RabbitMQ packages to ${rabbitmq::rabbitmq_version}",
83+
priority => $pin,
84+
version => $rabbitmq_pin_version,
85+
}
86+
}
87+
88+
if $erlang_pin_version {
89+
apt::pin { 'erlang':
90+
packages => 'erlang*',
91+
explanation => "Pin Erlang packages to versions compatible with RabbitMQ ${rabbitmq::rabbitmq_version}",
92+
priority => $pin,
93+
version => $erlang_pin_version,
94+
}
4595
}
4696
}
4797
}

metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
{
7171
"name": "puppet/systemd",
7272
"version_requirement": ">= 6.0.0 < 10.0.0"
73+
},
74+
{
75+
"name": "puppetlabs/apt",
76+
"version_requirement": ">= 10.0.0 < 12.0.0"
7377
}
7478
],
7579
"tags": [

spec/acceptance/class_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require 'spec_helper_acceptance'
44

55
describe 'rabbitmq class:' do
6+
rabbitmq_version = ENV.fetch('BEAKER_FACTER_rabbitmq_version', '3.13')
7+
68
case fact('os.family')
79
when 'RedHat', 'SUSE', 'Debian'
810
package_name = 'rabbitmq-server'
@@ -12,10 +14,12 @@
1214
service_name = 'rabbitmq'
1315
end
1416

15-
context 'default class inclusion' do
17+
context "default class inclusion with RabbitMQ #{rabbitmq_version}" do
1618
let(:pp) do
1719
<<-EOS
18-
include rabbitmq
20+
class { 'rabbitmq':
21+
rabbitmq_version => '#{rabbitmq_version}',
22+
}
1923
EOS
2024
end
2125

0 commit comments

Comments
 (0)