Skip to content

Commit

Permalink
Skip EOL operating systems in GHA acceptance tests
Browse files Browse the repository at this point in the history
With CentOS Linux 7 and CentOS Stream 8 going EOL soon, these will start
to fail because mirrors will no longer be available. This creates an
annotation and skips the OS release.

It introduces parameters to pretend it's a different date to keep the
test suite consistent and avoid breaking it automatically over time.
  • Loading branch information
ekohl committed May 7, 2024
1 parent 31c4a81 commit ea1bf54
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
29 changes: 21 additions & 8 deletions lib/puppet_metadata/github_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def initialize(metadata, options)
end

# @return [Hash[Symbol, Any]] The outputs for Github Actions
def outputs
def outputs(at = nil)
{
puppet_major_versions: puppet_major_versions,
puppet_unit_test_matrix: puppet_unit_test_matrix,
puppet_beaker_test_matrix: puppet_beaker_test_matrix,
puppet_beaker_test_matrix: puppet_beaker_test_matrix(at),
# Deprecated
github_action_test_matrix: github_action_test_matrix,
github_action_test_matrix: github_action_test_matrix(at),
}
end

Expand Down Expand Up @@ -47,7 +47,7 @@ def puppet_unit_test_matrix
end.compact
end

def beaker_os_releases
def beaker_os_releases(at = nil)
majors = puppet_major_versions

distro_puppet_version = {
Expand All @@ -62,6 +62,19 @@ def beaker_os_releases
yield [os, 'rolling', distro_puppet_version]
else
releases&.each do |release|
if PuppetMetadata::OperatingSystem.eol?(os, release, at)
message = "Skipping EOL operating system #{os} #{release}"

if ENV.key?('GITHUB_ACTIONS')
# TODO: determine file and position within the file
puts "::warning file=metadata.json::#{message}"
else
warn message
end

next
end

majors.each do |puppet_version|
if AIO.has_aio_build?(os, release, puppet_version[:value])
yield [os, release, puppet_version]
Expand All @@ -74,10 +87,10 @@ def beaker_os_releases
end
end

def puppet_beaker_test_matrix
def puppet_beaker_test_matrix(at)
matrix_include = []

beaker_os_releases do |os, release, puppet_version|
beaker_os_releases(at) do |os, release, puppet_version|
next if puppet_version_below_minimum?(puppet_version[:value])

setfile = os_release_to_beaker_setfile(os, release, puppet_version[:collection])
Expand Down Expand Up @@ -108,10 +121,10 @@ def puppet_beaker_test_matrix
matrix_include
end

def github_action_test_matrix
def github_action_test_matrix(at)
matrix_include = []

beaker_os_releases do |os, release, puppet_version|
beaker_os_releases(at) do |os, release, puppet_version|
next if puppet_version_below_minimum?(puppet_version[:value])

setfile = os_release_to_beaker_setfile(os, release, puppet_version[:collection])
Expand Down
3 changes: 2 additions & 1 deletion spec/github_actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe PuppetMetadata::GithubActions do

Check failure on line 3 in spec/github_actions_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5] (https://rspec.rubystyle.guide/#let-blocks, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers)
subject { described_class.new(PuppetMetadata::Metadata.new(JSON.parse(JSON.dump(metadata))), options) }

let(:at) { Date.new(2020, 1, 1) }
let(:beaker_pidfile_workaround) { false }
let(:beaker_use_fqdn) { false }
let(:minimum_major_puppet_version) { nil }
Expand Down Expand Up @@ -50,7 +51,7 @@

# rubocop:disable Layout/LineLength,RSpec/ExampleLength
describe 'outputs' do

Check failure on line 53 in spec/github_actions_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [6/5] (https://rspec.rubystyle.guide/#let-blocks, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers)
subject { super().outputs }
subject { super().outputs(at) }

let(:beaker_pidfile_workaround) { false }
let(:beaker_use_fqdn) { false }
Expand Down

0 comments on commit ea1bf54

Please sign in to comment.