From bec8ad7de9cde1d9d3b4dcf90248ef57f443e00e Mon Sep 17 00:00:00 2001 From: Sebastian Rakel Date: Sat, 26 Jul 2025 21:52:27 +0200 Subject: [PATCH 1/2] CI: Adjust error message matching for newer json gem A bit of backstory. I did a lot of JRuby debugging in https://github.com/OpenVoxProject/openvox/pull/122. Yesterday @sebastianrakel and I did a bit of deep diving. Some numbers: * puppetserver 8.7.0, the last open source release from Perforce, ships JRuby 9.4.8.0 * openvox-server 8.9.0 ships JRuby 9.4.8.0 * puppet enterprise 2025.4.0 (latest version at 2025-07-27) ships pe-puppetserver JRuby 9.4.8.0 * latest JRuby 9.4 is 9.4.13.0 * JRuby 9.4 series is compatible with MRI Ruby 3.1 * puppetserver 7 uses JRuby 9.3 which is compatible with Ruby 2.6 * Perforce never tested JRuby 9.4.8.0 in CI, JRuby was pinned to 9.4.3.0 Since openvox runs tests, the Rspec JRuby pipeline fails. We cannot access the old perforce pipeline logs. Their last successful CI run I could fine was https://github.com/puppetlabs/puppet/actions/runs/11693993097. This was triggered by commit https://github.com/puppetlabs/puppet/commit/4ea6ee241d5e5ac504b7aec80417a02e923ce303 on 2024-11-06. In https://github.com/puppetlabs/puppet/actions/runs/12021455668 we see the first failed pipelline for puppetserver 8, triggered by https://github.com/puppetlabs/puppet/commit/e9671155fea02a3ec18d336cf57b3c057711ca32 on 2024-11-24. The used JRuby verison in both jobs was 9.4.3.0 Something changed between 2024-11-06 and 2024-11-24 and I doubt it was related to https://github.com/puppetlabs/puppet/commit/e9671155fea02a3ec18d336cf57b3c057711ca32 (https://github.com/puppetlabs/puppet/pull/9523). Whatever changed in that timeframe modified the error reporting. Basic example: ``` class a {} class a {} ``` raises: ``` Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Class 'a' is already defined (file: /etc/puppetlabs/code/environments/server/manifests/site.pp, line: 1); cannot redefine (file: /etc/puppetlabs/code/environments/server/manifests/site.pp, line: 2) (file: /etc/puppetlabs/code/environments/server/manifests/site.pp, line: 2) on node puppettestinfra.voxpupu.li ``` After "cannot redefine", the file is listed twice. This issue is reproducible puppetserver 8.7.0, Puppet Enterprise 2025.4.0 & openvox-server 8.9.0. After some testing in https://github.com/OpenVoxProject/openvox/pull/122 I noticed that JRuby 9.4.3.0 indeed raises errors now, but others. I assume the JRuby issues are, at least in part, triggered by a webmock update. I don't know yet what causes the duplicate file lines in the output. The old rspec tests demand a single file line in the output. In https://github.com/OpenVoxProject/openvox/pull/164 I'm testing different Jruby Versions with a webmock pinned to 3.25.0. 3.25.0 was released on 2025-02-06. The version before that, 3.24.0, on 2024-09-30. That's what Perforce was using back then. And after diffing CI output from JRuby 9.4.3, 9.4.4, 9.4.5 & 9.4.6 we can see that the duplicate line messages start with JRuby 9.4.6: https://gist.github.com/bastelfreak/025c23417f9dd7215b5c5af205fc8b76 --- .github/workflows/tests.yaml | 2 ++ spec/unit/file_system/path_pattern_spec.rb | 3 --- spec/unit/functions/break_spec.rb | 8 ++++---- spec/unit/functions/next_spec.rb | 2 +- spec/unit/functions/return_spec.rb | 4 ++-- spec/unit/http/service/compiler_spec.rb | 2 +- spec/unit/parser/compiler_spec.rb | 2 +- spec/unit/task_spec.rb | 2 +- spec/unit/util/json_spec.rb | 6 +++--- 9 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d2bd93e0e4..3372262fb7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,6 +46,8 @@ jobs: - {os: ubuntu-24.04, ruby: '3.3'} # openssl 3 - {os: ubuntu-24.04, ruby: '3.4'} # openssl 3 - {os: ubuntu-24.04, ruby: 'jruby-9.4'} + - {os: ubuntu-24.04, ruby: 'jruby-9.4.8.0'} + - {os: ubuntu-24.04, ruby: 'jruby-9.4.13.0'} - {os: windows-2025, ruby: '3.1'} - {os: windows-2025, ruby: '3.2'} # openssl 3 - {os: windows-2025, ruby: '3.3'} # openssl 3 diff --git a/spec/unit/file_system/path_pattern_spec.rb b/spec/unit/file_system/path_pattern_spec.rb index 8948dab949..cbecd07912 100644 --- a/spec/unit/file_system/path_pattern_spec.rb +++ b/spec/unit/file_system/path_pattern_spec.rb @@ -134,9 +134,6 @@ end it 'globs wildcard patterns properly' do - # See PUP-11788 and https://github.com/jruby/jruby/issues/7836. - pending 'JRuby does not properly handle Dir.glob' if Puppet::Util::Platform.jruby? - dir = tmpdir('globtest') create_file_in(dir, 'foo.pp') create_file_in(dir, 'foo.pp.pp') diff --git a/spec/unit/functions/break_spec.rb b/spec/unit/functions/break_spec.rb index 228bfa24fa..bf34a6b5de 100644 --- a/spec/unit/functions/break_spec.rb +++ b/spec/unit/functions/break_spec.rb @@ -149,7 +149,7 @@ class does_break { } include(does_break) CODE - end.to raise_error(/break\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/break\(\) from context where this is illegal .*/) end it 'does not provide early exit from a define' do @@ -166,7 +166,7 @@ class does_break { } does_break { 'no_you_cannot': } CODE - end.to raise_error(/break\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/break\(\) from context where this is illegal .*/) end it 'can be called when nested in a function to make that function behave as a break' do @@ -191,7 +191,7 @@ class does_break { $result = with(1) |$x| { with($x) |$x| {break() }} notice $result CODE - end.to raise_error(/break\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/break\(\) from context where this is illegal .*/) end it 'can not be called from top scope' do @@ -201,7 +201,7 @@ class does_break { # line 2 break() CODE - end.to raise_error(/break\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/break\(\) from context where this is illegal .*/) end end end diff --git a/spec/unit/functions/next_spec.rb b/spec/unit/functions/next_spec.rb index 056db466bd..d745894fb2 100644 --- a/spec/unit/functions/next_spec.rb +++ b/spec/unit/functions/next_spec.rb @@ -88,6 +88,6 @@ class does_next { # line 2 next() CODE - end.to raise_error(/next\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/next\(\) from context where this is illegal .*/) end end diff --git a/spec/unit/functions/return_spec.rb b/spec/unit/functions/return_spec.rb index 1b439d5990..ccf312ad9c 100644 --- a/spec/unit/functions/return_spec.rb +++ b/spec/unit/functions/return_spec.rb @@ -94,7 +94,7 @@ class does_next { $result = with(1) |$x| { with($x) |$x| {return(100) }} notice $result CODE - end.to raise_error(/return\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/return\(\) from context where this is illegal .*/) end it 'can not be called from top scope' do @@ -104,6 +104,6 @@ class does_next { # line 2 return() CODE - end.to raise_error(/return\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/) + end.to raise_error(/return\(\) from context where this is illegal .*/) end end diff --git a/spec/unit/http/service/compiler_spec.rb b/spec/unit/http/service/compiler_spec.rb index 85a839a7ca..ba07a2901c 100644 --- a/spec/unit/http/service/compiler_spec.rb +++ b/spec/unit/http/service/compiler_spec.rb @@ -594,7 +594,7 @@ invalid_facts = Puppet::Node::Facts.new(certname, {'invalid_utf8_sequence' => "\xE2\x82".force_encoding('binary')}) expect { subject.put_facts(certname, environment: 'production', facts: invalid_facts) - }.to raise_error(Puppet::HTTP::SerializationError, /Failed to serialize Puppet::Node::Facts to json: ("\\xE2" from ASCII-8BIT to UTF-8|partial character in source, but hit end)/) + }.to raise_error(Puppet::HTTP::SerializationError, /Failed to serialize Puppet::Node::Facts to json: /) end end diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index 8094fe207c..1186c09bd6 100644 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -874,7 +874,7 @@ class #{name} {} include #{name} } MANIFEST - }.to raise_error(Puppet::Error, /Class '#{name}' is already defined \(line: 1\); cannot be redefined as a node \(line: 2\) on node #{name}/) + }.to raise_error(Puppet::Error, /Class '#{name}' is already defined \(line: 1\); cannot be redefined as a node /) end it "evaluates the class if the node definition uses a regexp" do diff --git a/spec/unit/task_spec.rb b/spec/unit/task_spec.rb index f4c4bc7ef3..9bb5298f97 100644 --- a/spec/unit/task_spec.rb +++ b/spec/unit/task_spec.rb @@ -233,7 +233,7 @@ expect { tasks[0].metadata - }.to raise_error(Puppet::Module::Task::InvalidMetadata, /expected ':' after object key/) + }.to raise_error(Puppet::Module::Task::InvalidMetadata) end it 'returns empty hash for metadata when json metadata file is empty' do diff --git a/spec/unit/util/json_spec.rb b/spec/unit/util/json_spec.rb index 85d968cd3e..4ff468ce2b 100644 --- a/spec/unit/util/json_spec.rb +++ b/spec/unit/util/json_spec.rb @@ -23,7 +23,7 @@ it 'raises an error if JSON is invalid' do expect { Puppet::Util::Json.load('{ invalid') - }.to raise_error(Puppet::Util::Json::ParseError, /expected object key, got 'invalid' at line 1 column 3/) + }.to raise_error(Puppet::Util::Json::ParseError) end it 'raises an error if the content is empty' do @@ -74,7 +74,7 @@ it 'returns nil when the file is invalid JSON and debug logs about it' do file_path = file_containing('input', '{ invalid') expect(Puppet).to receive(:debug) - .with(/Could not retrieve JSON content .+: expected object key, got 'invalid' at line 1 column 3/).and_call_original + .with(/Could not retrieve JSON content/).and_call_original expect(Puppet::Util::Json.load_file_if_valid(file_path)).to eql(nil) end @@ -102,7 +102,7 @@ expect { Puppet::Util::Json.load_file(file_path) - }.to raise_error(Puppet::Util::Json::ParseError, /expected object key, got 'invalid' at line 1 column 3/) + }.to raise_error(Puppet::Util::Json::ParseError) end it 'raises an error when the filename is illegal' do From c86ae1072da9f2c80c78c85b29faeef4ec16df15 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 13:23:52 +0000 Subject: [PATCH 2/2] Bump actions/download-artifact from 4 to 5 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/gem_release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gem_release.yaml b/.github/workflows/gem_release.yaml index 215971e375..55401c569f 100644 --- a/.github/workflows/gem_release.yaml +++ b/.github/workflows/gem_release.yaml @@ -39,7 +39,7 @@ jobs: contents: write # clone repo and create release steps: - name: Download gem from GitHub cache - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: gem-artifact - name: Create Release @@ -56,7 +56,7 @@ jobs: packages: write # publish to rubygems.pkg.github.com steps: - name: Download gem from GitHub cache - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: gem-artifact - name: Publish gem to GitHub packages @@ -73,7 +73,7 @@ jobs: id-token: write # rubygems.org authentication steps: - name: Download gem from GitHub cache - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: gem-artifact - uses: rubygems/configure-rubygems-credentials@v1.0.0 @@ -92,7 +92,7 @@ jobs: - release-to-rubygems steps: - name: Download gem from GitHub cache - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: gem-artifact - name: Install Ruby