Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Puppet into images #2

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ jobs:
contents: read
packages: write
env:
BUNDLE_WITHOUT: release
BEAKER_HYPERVISOR: docker
BEAKER_DEBUG: true
strategy:
fail-fast: false
matrix:
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion Rakefile

This file was deleted.

20 changes: 20 additions & 0 deletions install_puppet.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading