diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..da6f5dff --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,117 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +jobs: + unit: + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allow_failure }} + strategy: + fail-fast: false + matrix: + include: + - ruby: 2.4.9 + puppet: 5 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 2.5.7 + puppet: 6 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 2.4.9 + puppet: 5 + fixtures: .fixtures-latest.yml + allow_failure: true + - ruby: 2.5.7 + puppet: 6 + fixtures: .fixtures-latest.yml + allow_failure: true + env: + BUNDLE_WITHOUT: system_tests:release + PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}.0" + FACTER_GEM_VERSION: "< 4.0" + FIXTURES_YML: ${{ matrix.fixtures }} + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Validate + run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint + - name: Run tests + run: bundle exec rake parallel_spec + acceptance: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + set: + - "centos-7" + - "centos-8" + - "debian-9" + - "debian-10" + - "ubuntu-1804" + puppet: + - "puppet5" + - "puppet6" + keycloak_version: + - "8.0.1" + - "10.0.1" + keycloak_full: + - "no" + include: + - set: "centos-7" + puppet: "puppet5" + keycloak_version: "8.0.1" + keycloak_full: "yes" + - set: "centos-7" + puppet: "puppet5" + keycloak_version: "10.0.1" + keycloak_full: "yes" + - set: "centos-7" + puppet: "puppet6" + keycloak_version: "8.0.1" + keycloak_full: "yes" + - set: "centos-7" + puppet: "puppet6" + keycloak_version: "10.0.1" + keycloak_full: "yes" + env: + BUNDLE_WITHOUT: development:release + BEAKER_debug: true + name: ${{ matrix.puppet }} ${{ matrix.set }} (keycloak=${{ matrix.keycloak_version }} full=${{ matrix.keycloak_full }}) + steps: + - name: Enable IPv6 on docker + run: | + echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json + sudo service docker restart + - name: apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} + BEAKER_set: ${{ matrix.set }} + BEAKER_keycloak_version: ${{ matrix.keycloak_version }} + BEAKER_keycloak_full: ${{ matrix.keycloak_full }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..e508b269 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.sync.yml b/.sync.yml index 8cf5bbc8..853ee0e2 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,89 +1,47 @@ --- -.travis.yml: - dist: xenial - extras: - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.5 - stage: spec - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.3 - stage: spec - allow_failures: - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.5 - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.3 - docker_defaults: - dist: xenial - docker_sets: +.github/workflows/ci.yaml: + unit_name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) + unit_includes: + - ruby: '2.4.9' + puppet: '5' + fixtures: .fixtures-latest.yml + allow_failure: true + - ruby: '2.5.7' + puppet: '6' + fixtures: .fixtures-latest.yml + allow_failure: true + acceptance_name: '${{ matrix.puppet }} ${{ matrix.set }} (keycloak=${{ matrix.keycloak_version }} full=${{ matrix.keycloak_full }})' + acceptance_matrix: + set: + - centos-7 + - centos-8 + - debian-9 + - debian-10 + - ubuntu-1804 + puppet: + - puppet5 + - puppet6 + keycloak_version: + - '8.0.1' + - '10.0.1' + keycloak_full: ['no'] + acceptance_includes: - set: centos-7 - collection: puppet5 - extra_envs: - - BEAKER_keycloak_full: yes + puppet: puppet5 + keycloak_version: 8.0.1 + keycloak_full: 'yes' - set: centos-7 - collection: puppet5 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - BEAKER_keycloak_full: yes + puppet: puppet5 + keycloak_version: 10.0.1 + keycloak_full: 'yes' - set: centos-7 - collection: puppet6 - extra_envs: - - BEAKER_keycloak_full: yes + puppet: puppet6 + keycloak_version: 8.0.1 + keycloak_full: 'yes' - set: centos-7 - collection: puppet6 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - BEAKER_keycloak_full: yes - - set: centos-8 - collection: puppet5 - - set: centos-8 - collection: puppet5 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: centos-8 - collection: puppet6 - - set: centos-8 - collection: puppet6 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: debian-9 - collection: puppet5 - - set: debian-9 - collection: puppet5 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: debian-9 - collection: puppet6 - - set: debian-9 - collection: puppet6 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: debian-10 - collection: puppet5 - - set: debian-10 - collection: puppet5 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: debian-10 - collection: puppet6 - - set: debian-10 - collection: puppet6 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: ubuntu-1804 - collection: puppet5 - - set: ubuntu-1804 - collection: puppet5 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - - set: ubuntu-1804 - collection: puppet6 - - set: ubuntu-1804 - collection: puppet6 - extra_envs: - - BEAKER_keycloak_version: 10.0.1 - user: treydock - secure: "u4N3WOhiO4X0mmEF7I+ARGpcw4Wrmt1xA8cmG2Qlnvr+r3c7RgWfc6GoabLicGKoN/OqVPD1b6lXJ+Xrg8VAJb9NmFjXYkowbTYgyyPsx6fSIshaquThkrEUsaF1C5hWx1rADXCz8hkpvX537xye/uKQlvDjwHyHaJWu3rpCfsDApYwYZhIkKtsSk2hOlcX9jfI1LE/H6YYo44uRBxg2lyUusScJQcDe023mBYOOSet3C4w4UpPBqR0mu9XvjJHk0KJzBE2Jk6g7W+02/ZkVW9qDXh70mCE562uQN/CE8rjcM5V1M6L69YzG5rv0LSuV4rnrjNtkNz6GZPDKIpuwOLEkA0M+jBr+F2d4tPHyMVDGLQHIIl5/TxXU2A9+gDe9yZFeZ7KEOSkkYfEgKgHcPHMZQJhs7Xkj2ab+F3AFjrSbjWngX892NQXp9XK4EXBZzogdsEp+wHULc9ybb9BKUNS0FIbCOjJoqBuwe7Is8vfVQ+OXAxVnP1POEoAgmgD3gQVHtedBAYrT7Ge+uxILua+KaPYkxBh/Cg9TYYSJeO/y0LH8pV3zSOQ3oU3MGZRbZrLbNkFAq9sYu3Klw52NEgfgXNRaE5AIpC0Tjf/BHZuaGGPyZML4A14tctwzFCFmG8SXkN2fFtpS5LAfLzbizi2KecPMyEjSpHJATJ/6HuQ=" + puppet: puppet6 + keycloak_version: 10.0.1 + keycloak_full: 'yes' .gitlab-ci.yml: delete: true appveyor.yml: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 07df794e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,256 +0,0 @@ ---- -os: linux -dist: xenial -language: ruby -cache: bundler -before_install: - - bundle -v - - rm -f Gemfile.lock - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v -script: - - 'bundle exec rake $CHECK' -bundler_args: --without system_tests -rvm: - - 2.5.7 -env: - global: - - FACTER_GEM_VERSION="< 4.0" -stages: - - static - - spec - - acceptance - - - if: tag =~ ^v\d - name: deploy -jobs: - fast_finish: true - include: - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=centos-7 BEAKER_TESTMODE=apply BEAKER_keycloak_full=true - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=centos-7 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 BEAKER_keycloak_full=true - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=centos-7 BEAKER_TESTMODE=apply BEAKER_keycloak_full=true - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=centos-7 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 BEAKER_keycloak_full=true - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=centos-8 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=centos-8 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=centos-8 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=centos-8 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=debian-9 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=debian-9 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=debian-9 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=debian-9 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=debian-10 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=debian-10 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=debian-10 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=debian-10 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=ubuntu-1804 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=ubuntu-1804 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=ubuntu-1804 BEAKER_TESTMODE=apply - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - bundler_args: --with system_tests - dist: xenial - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=ubuntu-1804 BEAKER_TESTMODE=apply BEAKER_keycloak_version=10.0.1 - rvm: 2.5.7 - script: bundle exec rake beaker - services: docker - stage: acceptance - sudo: required - - - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" - stage: static - - - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec - rvm: 2.4.9 - stage: spec - - - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec - rvm: 2.5.7 - stage: spec - - - env: DEPLOY_TO_FORGE=yes - stage: deploy - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.5 - stage: spec - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.3 - stage: spec - allow_failures: - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 5" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.4.5 - - - env: CHECK="parallel_spec" PUPPET_GEM_VERSION="~> 6" FIXTURES_YML=".fixtures-latest.yml" - rvm: 2.5.3 -branches: - only: - - master - - /^v\d/ -notifications: - email: treydock@gmail.com -deploy: - provider: puppetforge - username: treydock - password: - secure: "u4N3WOhiO4X0mmEF7I+ARGpcw4Wrmt1xA8cmG2Qlnvr+r3c7RgWfc6GoabLicGKoN/OqVPD1b6lXJ+Xrg8VAJb9NmFjXYkowbTYgyyPsx6fSIshaquThkrEUsaF1C5hWx1rADXCz8hkpvX537xye/uKQlvDjwHyHaJWu3rpCfsDApYwYZhIkKtsSk2hOlcX9jfI1LE/H6YYo44uRBxg2lyUusScJQcDe023mBYOOSet3C4w4UpPBqR0mu9XvjJHk0KJzBE2Jk6g7W+02/ZkVW9qDXh70mCE562uQN/CE8rjcM5V1M6L69YzG5rv0LSuV4rnrjNtkNz6GZPDKIpuwOLEkA0M+jBr+F2d4tPHyMVDGLQHIIl5/TxXU2A9+gDe9yZFeZ7KEOSkkYfEgKgHcPHMZQJhs7Xkj2ab+F3AFjrSbjWngX892NQXp9XK4EXBZzogdsEp+wHULc9ybb9BKUNS0FIbCOjJoqBuwe7Is8vfVQ+OXAxVnP1POEoAgmgD3gQVHtedBAYrT7Ge+uxILua+KaPYkxBh/Cg9TYYSJeO/y0LH8pV3zSOQ3oU3MGZRbZrLbNkFAq9sYu3Klw52NEgfgXNRaE5AIpC0Tjf/BHZuaGGPyZML4A14tctwzFCFmG8SXkN2fFtpS5LAfLzbizi2KecPMyEjSpHJATJ/6HuQ=" - on: - tags: true - all_branches: true - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/Gemfile b/Gemfile index 2c83084a..cb973297 100644 --- a/Gemfile +++ b/Gemfile @@ -50,6 +50,8 @@ hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} +gems['rake'] = [require: false] +gems['puppetlabs_spec_helper'] = [require: false] gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment diff --git a/spec/spec_helper_acceptance_setup.rb b/spec/spec_helper_acceptance_setup.rb index 71ed1de7..c10b8440 100644 --- a/spec/spec_helper_acceptance_setup.rb +++ b/spec/spec_helper_acceptance_setup.rb @@ -1,6 +1,11 @@ RSpec.configure do |c| c.add_setting :keycloak_version - c.keycloak_version = (ENV['BEAKER_keycloak_version'] || '8.0.1') + keycloak_version = if ENV['BEAKER_keycloak_version'].nil? || ENV['BEAKER_keycloak_version'].empty? + '8.0.1' + else + ENV['BEAKER_keycloak_version'] + end + c.keycloak_version = keycloak_version c.add_setting :keycloak_full c.keycloak_full = (ENV['BEAKER_keycloak_full'] == 'true' || ENV['BEAKER_keycloak_full'] == 'yes') end