diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1534990..d4d86b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,9 +32,7 @@ jobs: contents: read packages: write env: - BUNDLE_WITHOUT: release BEAKER_HYPERVISOR: docker - BEAKER_DEBUG: true strategy: fail-fast: false matrix: @@ -50,7 +48,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 }}} --log-level debug + run: bundle exec beaker --provision --preserve-hosts always --hosts ${{ matrix.env.BEAKER_SETFILE }}{tag=${{ github.repository }}} --log-level debug --helper install_puppet.rb env: ${{ matrix.env }} - name: List images run: docker images @@ -62,9 +60,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Add tag - run: docker image tag ${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${{ matrix.env.BEAKER_SETFILE }}-${{ matrix.env.BEAKER_PUPPET_COLLECTION }} - - name: Add more tag + - name: Add tag to image run: docker image tag ${{ github.repository }}:latest ghcr.io/${{ github.repository_owner }}/${{ matrix.env.BEAKER_SETFILE }}-${{ matrix.env.BEAKER_PUPPET_COLLECTION }}:latest - name: Extract metadata (tags, labels) for Docker id: meta diff --git a/Gemfile b/Gemfile index 895eb0c..da8c5da 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' -gem 'puppet_metadata' +gem 'puppet_metadata' # generates the beaker matrix gem 'json' gem 'beaker' gem 'beaker-docker' -gem 'beaker-rspec' # used for parsing BEAKER_SETFILE env var -gem 'rake' +gem 'beaker-rspec' # used for providing `hosts` in install_puppet.rb +gem 'beaker_puppet_helpers' # used to install puppet diff --git a/Rakefile b/Rakefile deleted file mode 100644 index a8440dc..0000000 --- a/Rakefile +++ /dev/null @@ -1 +0,0 @@ -require 'beaker-rspec/rake_task' 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/metadata.json b/metadata.json index 1edf6f0..62591c6 100644 --- a/metadata.json +++ b/metadata.json @@ -5,12 +5,7 @@ "version": "0.2.1", "summary": " An example Puppet repository to test out automation and coding styles", "source": "https://github.com/voxpupuli/puppet-example", - "dependencies": [ - { - "name": "puppetlabs-stdlib", - "version_requirement": ">= 4.25.0 < 9.0.0" - } - ], + "dependencies": [ ], "requirements": [ { "name": "puppet",