From 1484a930c8a405fe30901e20ce04cfb5a79508e8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 18 Feb 2024 00:58:56 +0100 Subject: [PATCH] updates --- .github/workflows/build.yml | 2 +- install_puppet.rb | 20 ++++++++++++++++++++ spec/acceptance/dummy_spec.rb | 4 ---- 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 install_puppet.rb delete mode 100644 spec/acceptance/dummy_spec.rb diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45287b5..5ef7b13 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: cache-version: ${{ inputs.cache-version }} working-directory: ${{ inputs.working-directory }} - name: Run beaker - run: bundle exec beaker --provision --preserve-hosts always --hosts ${{ matrix.env.BEAKER_SETFILE }}{tag=${{ github.repository_name }}} --log-level debug --helper spec/spec_helper_acceptance.rb + run: bundle exec beaker --provision --preserve-hosts always --hosts ${{ matrix.env.BEAKER_SETFILE }}{tag=${{ github.repository_name }}} --log-level debug --helper install_puppet.rb # run: bundle exec rake beaker env: ${{ matrix.env }} - name: List images diff --git a/install_puppet.rb b/install_puppet.rb new file mode 100644 index 0000000..af46b94 --- /dev/null +++ b/install_puppet.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# this is inspired by https://github.com/voxpupuli/voxpupuli-acceptance/blob/397055f9d9ff1d7da17a7955430ddcf35619d641/lib/voxpupuli/acceptance/spec_helper_acceptance.rb + +require 'beaker_puppet_helpers' +require 'beaker-rspec' + +collection = ENV['BEAKER_PUPPET_COLLECTION'] || 'puppet' + +block_on hosts, run_in_parallel: true do |host| + unless %w[none preinstalled].include?(collection) + BeakerPuppetHelpers::InstallUtils.install_puppet_release_repo_on(host, collection) + end + package_name = ENV.fetch('BEAKER_PUPPET_PACKAGE_NAME', BeakerPuppetHelpers::InstallUtils.puppet_package_name(host, prefer_aio: collection != 'none')) + host.install_package(package_name) + + # by default, puppet-agent creates /etc/profile.d/puppet-agent.sh which adds /opt/puppetlabs/bin to PATH + # in our non-interactive ssh sessions we manipulate PATH in ~/.ssh/environment, we need to do this step here as well + host.add_env_var('PATH', '/opt/puppetlabs/bin') +end diff --git a/spec/acceptance/dummy_spec.rb b/spec/acceptance/dummy_spec.rb deleted file mode 100644 index ca1670a..0000000 --- a/spec/acceptance/dummy_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -#require 'spec_helper_acceptance' - -#context 'dummy' do -#end