diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..5dfe7a186f --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,146 @@ +name: "nightly" + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +env: + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 + HONEYCOMB_DATASET: litmus tests + +jobs: + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + steps: + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Activate Ruby 2.7 + uses: actions/setup-ruby@v1 + with: + ruby-version: "2.7" + + - name: Cache gems + uses: actions/cache@v2 + with: + path: vendor/gems + key: ${{ runner.os }}-nightly-${{ hashFiles('**/Gemfile') }} + restore-keys: | + ${{ runner.os }}-nightly- + ${{ runner.os }}- + + - name: Install gems + run: | + bundle config path vendor/gems + bundle config jobs 8 + bundle config retry 3 + bundle install + bundle clean + + - name: Setup Acceptance Test Matrix + id: get-matrix + run: "bundle exec matrix_from_metadata" + + Acceptance: + needs: + - setup_matrix + + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} + + steps: + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Activate Ruby 2.7 + uses: actions/setup-ruby@v1 + with: + ruby-version: "2.7" + + - name: Cache gems + uses: actions/cache@v2 + with: + path: vendor/gems + key: ${{ runner.os }}-nightly-${{ hashFiles('**/Gemfile') }} + restore-keys: | + ${{ runner.os }}-nightly- + ${{ runner.os }}- + + - name: Install gems + run: | + bundle config path vendor/gems + bundle config jobs 8 + bundle config retry 3 + bundle install + bundle clean + + - name: bundler environment + run: | + bundle env + + - name: Provision test environment + run: | + bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + echo ::group::=== INVENTORY === + sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true + echo ::endgroup:: + + # The provision service hands out machines as soon as they're provisioned. + # The GCP VMs might still take a while to spool up and configure themselves fully. + # This retry loop spins until all agents have been installed successfully. + - name: Install agent + uses: nick-invision/retry@v1 + with: + timeout_minutes: 30 + max_attempts: 5 + retry_wait_seconds: 90 + command: bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' + + # The agent installer on windows does not finish in time for this to work. To + # work around this for now, retry after a minute if installing the module failed. + - name: Install module + uses: nick-invision/retry@v1 + with: + timeout_minutes: 30 + max_attempts: 5 + retry_wait_seconds: 60 + command: bundle exec rake 'litmus:install_module' + + - name: Run acceptance tests + run: bundle exec rake 'litmus:acceptance:parallel' + + - name: Remove test environment + if: ${{ always() }} + run: | + bundle exec rake 'litmus:tear_down' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: + - Acceptance + runs-on: ubuntu-20.04 + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + # Required Input + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK}} + # Optional Input + channel: '#team-ia-bots' + name: 'GABot' diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml new file mode 100644 index 0000000000..7b47199fe2 --- /dev/null +++ b/.github/workflows/pr_test.yml @@ -0,0 +1,126 @@ +name: "PR Testing" + +on: [pull_request] + +env: + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 + HONEYCOMB_DATASET: litmus tests + +jobs: + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + steps: + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Activate Ruby 2.7 + uses: actions/setup-ruby@v1 + with: + ruby-version: "2.7" + + - name: Cache gems + uses: actions/cache@v2 + with: + path: vendor/gems + key: ${{ runner.os }}-pr-${{ hashFiles('**/Gemfile') }} + restore-keys: | + ${{ runner.os }}-pr- + ${{ runner.os }}- + + - name: Install gems + run: | + bundle config path vendor/gems + bundle config jobs 8 + bundle config retry 3 + bundle install + bundle clean + + - name: Setup Acceptance Test Matrix + id: get-matrix + run: "bundle exec matrix_from_metadata" + + Acceptance: + needs: + - setup_matrix + + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} + + steps: + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Activate Ruby 2.7 + uses: actions/setup-ruby@v1 + with: + ruby-version: "2.7" + + - name: Cache gems + uses: actions/cache@v2 + with: + path: vendor/gems + key: ${{ runner.os }}-pr-${{ hashFiles('**/Gemfile') }} + restore-keys: | + ${{ runner.os }}-pr- + ${{ runner.os }}- + + - name: Install gems + run: | + bundle config path vendor/gems + bundle config jobs 8 + bundle config retry 3 + bundle install + bundle clean + + - name: bundler environment + run: | + bundle env + + - name: Provision test environment + run: | + bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + echo ::group::=== INVENTORY === + sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true + echo ::endgroup:: + + # The provision service hands out machines as soon as they're provisioned. + # The GCP VMs might still take a while to spool up and configure themselves fully. + # This retry loop spins until all agents have been installed successfully. + - name: Install agent + uses: nick-invision/retry@v1 + with: + timeout_minutes: 30 + max_attempts: 5 + retry_wait_seconds: 90 + command: bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' + + # The agent installer on windows does not finish in time for this to work. To + # work around this for now, retry after a minute if installing the module failed. + - name: Install module + uses: nick-invision/retry@v1 + with: + timeout_minutes: 30 + max_attempts: 5 + retry_wait_seconds: 60 + command: bundle exec rake 'litmus:install_module' + + - name: Run acceptance tests + run: bundle exec rake 'litmus:acceptance:parallel' + + - name: Remove test environment + if: ${{ always() }} + run: | + bundle exec rake 'litmus:tear_down' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ced1d93e59..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: "release" - -on: - push: - branches: - - 'release' - -jobs: - LitmusAcceptancePuppet5: - env: - HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 - HONEYCOMB_DATASET: litmus tests - runs-on: self-hosted - strategy: - matrix: - ruby_version: [2.5.x] - puppet_gem_version: [~> 6.0] - platform: [release_checks_5] - agent_family: ['puppet5'] - - steps: - - uses: actions/checkout@v1 - - name: Litmus Parallel - uses: puppetlabs/action-litmus_parallel@main - with: - platform: ${{ matrix.platform }} - agent_family: ${{ matrix.agent_family }} - LitmusAcceptancePuppet6: - env: - HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 - HONEYCOMB_DATASET: litmus tests - runs-on: self-hosted - strategy: - matrix: - ruby_version: [2.5.x] - puppet_gem_version: [~> 6.0] - platform: [release_checks_6] - agent_family: ['puppet6'] - - steps: - - uses: actions/checkout@v1 - - name: Litmus Parallel - uses: puppetlabs/action-litmus_parallel@main - with: - platform: ${{ matrix.platform }} - agent_family: ${{ matrix.agent_family }} - - Spec: - runs-on: self-hosted - - strategy: - matrix: - check: [parallel_spec, 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop'] - ruby_version: [2.4.x, 2.5.x] - puppet_gem_version: [~> 5.0, ~> 6.0] - exclude: - - puppet_gem_version: ~> 5.0 - check: 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop' - - ruby_version: 2.4.x - puppet_gem_version: ~> 6.0 - - ruby_version: 2.5.x - puppet_gem_version: ~> 5.0 - - steps: - - uses: actions/checkout@v1 - - - name: Spec Tests - uses: puppetlabs/action-litmus_spec@main - with: - puppet_gem_versionm: ${{ matrix.puppet_gem_version }} - check: ${{ matrix.check }} diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml deleted file mode 100644 index 382b276116..0000000000 --- a/.github/workflows/weekly.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: "weekly" - -on: - schedule: - - cron: '0 4 * * 1' - -jobs: - LitmusAcceptancePuppet5: - env: - HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 - HONEYCOMB_DATASET: litmus tests - runs-on: self-hosted - strategy: - matrix: - ruby_version: [2.5.x] - puppet_gem_version: [~> 6.0] - platform: [release_checks_5] - agent_family: ['puppet5'] - - steps: - - uses: actions/checkout@v1 - - name: Litmus Parallel - uses: puppetlabs/action-litmus_parallel@main - with: - platform: ${{ matrix.platform }} - agent_family: ${{ matrix.agent_family }} - LitmusAcceptancePuppet6: - env: - HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 - HONEYCOMB_DATASET: litmus tests - runs-on: self-hosted - strategy: - matrix: - ruby_version: [2.5.x] - puppet_gem_version: [~> 6.0] - platform: [release_checks_6] - agent_family: ['puppet6'] - - steps: - - uses: actions/checkout@v1 - - name: Litmus Parallel - uses: puppetlabs/action-litmus_parallel@main - with: - platform: ${{ matrix.platform }} - agent_family: ${{ matrix.agent_family }} - Spec: - runs-on: self-hosted - strategy: - matrix: - check: [parallel_spec, 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop'] - ruby_version: [2.5.x] - puppet_gem_version: [~> 5.0, ~> 6.0] - exclude: - - puppet_gem_version: ~> 5.0 - check: 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop' - - ruby_version: 2.5.x - puppet_gem_version: ~> 5.0 - steps: - - uses: actions/checkout@v1 - - name: Spec Tests - uses: puppetlabs/action-litmus_spec@main - with: - puppet_gem_version: ${{ matrix.puppet_gem_version }} - check: ${{ matrix.check }} diff --git a/Gemfile b/Gemfile index 4f6e33b02d..46bffec87d 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,7 @@ group :development do gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') + gem "puppet_litmus", require: false, git: 'https://github.com/puppetlabs/puppet_litmus', ref: 'main' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.5.0') end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 865f1e155b..da144ae534 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -1199,12 +1199,12 @@ class { 'apache::mod::wsgi': } '8' => 'policycoreutils-python-utils', default => 'policycoreutils-python', } + package { $semanage_package: ensure => installed } exec { 'set_apache_defaults': command => 'semanage fcontext -a -t httpd_sys_content_t "/apache_spec(/.*)?"', path => '/bin:/usr/bin/:/sbin:/usr/sbin', require => Package[$semanage_package], } - package { $semanage_package: ensure => installed } exec { 'restorecon_apache': command => 'restorecon -Rv /apache_spec', path => '/bin:/usr/bin/:/sbin:/usr/sbin', @@ -1222,7 +1222,7 @@ class { 'apache': } } MANIFEST it 'applies cleanly' do - apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_failures: false) end describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 740248fa76..2922671e1d 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -33,6 +33,9 @@ def print_parsing_errors c.filter_run_excluding ipv6: true end c.before :suite do + # Make sure selinux is disabled so the tests work. + LitmusHelper.instance.run_shell('setenforce 0', expect_failures: true) if os[:family] =~ %r{redhat|oracle} + LitmusHelper.instance.run_shell('puppet module install stahnma/epel') pp = <<-PUPPETCODE # needed by tests @@ -69,9 +72,6 @@ class { 'epel': } } PUPPETCODE LitmusHelper.instance.apply_manifest(pp) - - # Make sure selinux is disabled so the tests work. - LitmusHelper.instance.run_shell('setenforce 0', expect_failures: true) if os[:family] =~ %r{redhat|oracle} end c.after :suite do