Skip to content
This repository was archived by the owner on Jun 19, 2020. It is now read-only.
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
48 changes: 48 additions & 0 deletions .github/actions/presuite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh -x

export DEBIAN_DISABLE_RUBYGEMS_INTEGRATION=no_wornings
export PATH=/opt/puppetlabs/bin/:/opt/puppetlabs/puppet/bin:$PATH

cwd=$(pwd)

printf '\nInstall bundler\n\n'
gem install bundler

printf '\nInstall facter 3 acceptance dependencies\n\n'
cd $cwd/$FACTER_3_ROOT/acceptance && bundle install

printf '\nInstall custom beaker\n\n'
cd $cwd/$BEAKER_ROOT
gem build beaker.gemspec
gem install beaker-*.gem --bindir /bin

printf '\nBeaker provision\n\n'
cd $cwd/$FACTER_3_ROOT/acceptance
beaker init -h ubuntu1804-64a{hypervisor=none\,hostname=localhost} -o config/aio/options.rb
beaker provision

printf '\nBeaker pre-suite\n\n'
BP_ROOT=`bundle info beaker-puppet --path`
beaker exec pre-suite --pre-suite $BP_ROOT/setup/aio/010_Install_Puppet_Agent.rb

printf '\nConfigure facter 4 as facter 3\n\n'
puppet config set facterng true

cd $cwd/$FACTER_4_ROOT
puppet_gem_command=/opt/puppetlabs/puppet/bin/gem
$puppet_gem_command build agent/facter-ng.gemspec
$puppet_gem_command uninstall facter-ng
$puppet_gem_command install -f facter-ng-*.gem

cd /opt/puppetlabs/puppet/bin
mv facter-ng facter

Comment thread
Filipovici-Andrei marked this conversation as resolved.
printf "\nFacter version\n\n"
facter --version

printf "\Puppet facts facter version\n\n"
puppet facts | grep facterversion

printf '\nBeaker tests\n\n'
cd $cwd/$FACTER_3_ROOT/acceptance
beaker exec tests --test-tag-exclude=server,facter_3 --test-tag-or=risk:high,audit:high 2>&1
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: GitHub hosted facter CI

on: [pull_request]

jobs:
ci:
name: Run acceptance tests
runs-on: ubuntu-latest
env:
FACTER_3_ROOT: facter_3
FACTER_4_ROOT: facter_4
BEAKER_ROOT: beaker
SHA: latest

steps:
- name: Checkout current PR
uses: actions/checkout@v2
with:
path: facter_4

- name: Clone facter 3 repo
uses: actions/checkout@v2
with:
repository: puppetlabs/facter
ref: skip_failures_on_ng
path: facter_3

- name: Clone Mihai's beaker fork
uses: actions/checkout@v2
with:
repository: mihaibuzgau/beaker
ref: master
path: beaker

- name: Install Ruby 2.6.x
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'

- name: Fix permissions
run: |
sudo chmod a-w /opt /home/runner /usr/share
sudo chmod -R a-w /usr/share/rust /home/runner/.config

- name: Run acceptance tests
run: sudo -E bash -c facter_4/.github/actions/presuite.sh
4 changes: 2 additions & 2 deletions lib/facter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def version
#
# @api private
def to_user_output(cli_options, *args)
init_cli_options(cli_options)
init_cli_options(cli_options, args)
logger.info("executed with command line: #{ARGV.drop(1).join(' ')}")
log_blocked_facts

Expand Down Expand Up @@ -272,7 +272,7 @@ def logger
@logger ||= Log.new(self)
end

def init_cli_options(options)
def init_cli_options(options, args)
options = options.map { |(k, v)| [k.to_sym, v] }.to_h
Facter::Options.init_from_cli(options, args)
end
Expand Down