Skip to content

Commit

Permalink
Work around Amazon Linux 2 repository issue (#176)
Browse files Browse the repository at this point in the history
* Work around Amazon Linux 2 repository issus
* Not actually managed by Puppetsync (yet)
* Also re-adding some gem-specific .gitignore contents
* Remove errant Ruby code

Looks like an accidental copypasta from `lib/simp/beaker_helpers.rb`
and was failing the `.gitlab-ci.yml` checks

Closes #175
Co-authored-by: op-ct <[email protected]>
  • Loading branch information
trevor-vaughan authored May 6, 2022
1 parent fa042df commit fa5b6b9
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 6 deletions.
23 changes: 19 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
.*.sw?
.yardoc
.idea/
.fips_fixtures.yml
*.gem
*.swp
Gemfile.lock
.bundle/
*.old
.vagrant
dist
/pkg
# Read everything in fixtures
/spec/fixtures/*
# Un-ignore hieradata
!/spec/fixtures/hieradata/*
# Except this one, which is auto-generated
/spec/fixtures/hieradata/hiera.yaml
/spec/rp_env
/.rspec_system
/.vagrant
/.bundle
/.vendor
/vendor
/junit
/log
/spec/fixtures
/doc
6 changes: 6 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ default:
script:
- bundle exec rake beaker:suites[default]

default-amzn2:
<<: *pup_6_x
<<: *acceptance_base
script:
- bundle exec rake beaker:suites[default,amzn2]

default-fips:
<<: *pup_6_x
<<: *acceptance_base
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.24.5 / 2022-05-06
* Fixed:
* Added a workaround for Amazon Linux 2 testing

### 1.24.4 / 2022-04-28
* Fixed:
* Workaround for [MODULES-11315] in `puppet-agent-versions.yaml`
Expand Down
11 changes: 11 additions & 0 deletions lib/simp/beaker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1498,14 +1498,25 @@ def install_simp_repos(suts, disable = [])
block_on(suts, :run_in_parallel => parallel) do |sut|
install_package_unless_present_on(sut, 'yum-utils')

os = fact_on(sut, 'os.name')
release = fact_on(sut, 'os.release.major')

# Work around Amazon 2 compatibility
if (( os == 'Amazon' ) && ( "#{release}" == '2' ))
release = '7'
end

install_package_unless_present_on(
sut,
'simp-release-community',
"https://download.simp-project.com/simp-release-community.el#{release}.rpm"
)

# TODO: Remove this hack-around when there's a version for AL2
if ( os == 'Amazon' )
on(sut, %(sed -i 's/$releasever/#{release}/g' /etc/yum.repos.d/simp*))
end

to_disable = disable.dup
to_disable += ENV.fetch('BEAKER_SIMP_disable_repos', '').split(',').map(&:strip)

Expand Down
2 changes: 1 addition & 1 deletion lib/simp/beaker_helpers/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Simp; end

module Simp::BeakerHelpers
VERSION = '1.24.4'
VERSION = '1.24.5'
end
24 changes: 24 additions & 0 deletions spec/acceptance/nodesets/amzn2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<%
if ENV['BEAKER_HYPERVISOR']
hypervisor = ENV['BEAKER_HYPERVISOR']
else
hypervisor = 'vagrant'
end
-%>
HOSTS:
amzn2:
roles:
- master
- default
platform: el-7-x86_64
box: gbailey/amzn2
hypervisor: <%= hypervisor %>

CONFIG:
log_level: verbose
synced_folder : disabled
type: aio
vagrant_memsize: 512
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
<% end -%>
34 changes: 33 additions & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,40 @@

RSpec.configure do |c|
# ensure that environment OS is ready on each host
fix_errata_on(hosts)
fix_errata_on hosts

# Detect cases in which no examples are executed (e.g., nodeset does not
# have hosts with required roles)
c.fail_if_no_examples = true

# Readable test descriptions
c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do
begin
# Install modules and dependencies from spec/fixtures/modules
copy_fixture_modules_to( hosts )
begin
server = only_host_with_role(hosts, 'server')
rescue ArgumentError =>e
server = only_host_with_role(hosts, 'default')
end

# Generate and install PKI certificates on each SUT
Dir.mktmpdir do |cert_dir|
run_fake_pki_ca_on(server, hosts, cert_dir )
hosts.each{ |sut| copy_pki_to( sut, cert_dir, '/etc/pki/simp-testing' )}
end

# add PKI keys
copy_keydist_to(server)
rescue StandardError, ScriptError => e
if ENV['PRY']
require 'pry'; binding.pry
else
raise e
end
end
end
end

0 comments on commit fa5b6b9

Please sign in to comment.