From 363df9ba7e0a667ac149535e276d7d6087d78d7c Mon Sep 17 00:00:00 2001 From: Ramesh Sencha Date: Wed, 12 Jul 2023 09:44:13 +0530 Subject: [PATCH] (CONT-1203) - Updating reusable github workflow --- .github/workflows/ci.yml | 101 +++------------------------ .github/workflows/nightly.yml | 89 +---------------------- metadata.json | 57 +-------------- spec/spec_helper_acceptance_local.rb | 2 +- 4 files changed, 16 insertions(+), 233 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70ee26273..c0e8aeb8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,96 +7,17 @@ on: workflow_dispatch: jobs: - Spec: - uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" + # Spec: + # uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" + # with: + # runs_on: "ubuntu-20.04" + # secrets: "inherit" + + Acceptance: + # needs: Spec + uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@CONT-1203-ci-pipeline-fixes" with: + disable_apparmor: true + docker_options: '' runs_on: "ubuntu-20.04" secrets: "inherit" - - setup_matrix: - name: "Setup Test Matrix" - needs: "Spec" - runs-on: ubuntu-20.04 - outputs: - matrix: ${{ steps.get-matrix.outputs.matrix }} - - steps: - - name: Checkout Source - uses: actions/checkout@v3 - - - name: Activate Ruby 2.7 - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.7" - bundler-cache: true - - - name: Print bundle environment - run: | - echo ::group::bundler environment - bundle env - echo ::endgroup:: - - - name: Setup Acceptance Test Matrix - id: get-matrix - run: | - bundle exec matrix_from_metadata_v2 - - Acceptance: - name: "${{matrix.platforms.label}}, ${{matrix.collection}}" - needs: - - setup_matrix - if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} - - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} - - env: - PUPPET_GEM_VERSION: '~> 7.24' - FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' - - steps: - - name: Checkout Source - uses: actions/checkout@v3 - - - name: Activate Ruby 2.7 - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.7" - bundler-cache: true - - - name: Print bundle environment - run: | - bundle env - - - name: "Disable mysqld apparmor profile" - if: matrix.platforms.provider == 'provision::docker' - run: | - sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ - sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld - - - name: Provision test environment - run: | - bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' - FILE='spec/fixtures/litmus_inventory.yaml' - sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true - - - name: Install agent - run: | - bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' - - - name: Install module - run: | - bundle exec rake 'litmus:install_module' - - - name: Run acceptance tests - run: | - bundle exec rake 'litmus:acceptance:parallel' - - - name: Remove test environment - if: ${{ always() }} - continue-on-error: true - run: | - bundle exec rake 'litmus:tear_down' - diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 29f22a679..c6b613f97 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,90 +12,7 @@ jobs: runs_on: "ubuntu-20.04" secrets: "inherit" - setup_matrix: - name: "Setup Test Matrix" - needs: "Spec" - runs-on: ubuntu-20.04 - outputs: - matrix: ${{ steps.get-matrix.outputs.matrix }} - - steps: - - name: Checkout Source - uses: actions/checkout@v3 - - - name: Activate Ruby 2.7 - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.7" - bundler-cache: true - - - name: Print bundle environment - run: | - echo ::group::bundler environment - bundle env - echo ::endgroup:: - - - name: Setup Acceptance Test Matrix - id: get-matrix - run: | - bundle exec matrix_from_metadata_v2 - Acceptance: - name: "${{matrix.platforms.label}}, ${{matrix.collection}}" - needs: - - setup_matrix - if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} - - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} - - env: - PUPPET_GEM_VERSION: '~> 7.24' - FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' - - steps: - - name: Checkout Source - uses: actions/checkout@v3 - - - name: Activate Ruby 2.7 - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.7" - bundler-cache: true - - - name: Print bundle environment - run: | - bundle env - - - name: "Disable mysqld apparmor profile" - if: matrix.platforms.provider == 'provision::docker' - run: | - sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ - sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld - - - name: Provision test environment - run: | - bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' - FILE='spec/fixtures/litmus_inventory.yaml' - sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true - - - name: Install agent - run: | - bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' - - - name: Install module - run: | - bundle exec rake 'litmus:install_module' - - - name: Run acceptance tests - run: | - bundle exec rake 'litmus:acceptance:parallel' - - - name: Remove test environment - if: ${{ always() }} - continue-on-error: true - run: | - bundle exec rake 'litmus:tear_down' - + needs: Spec + uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" + secrets: "inherit" diff --git a/metadata.json b/metadata.json index 60da24778..782ae1c1c 100644 --- a/metadata.json +++ b/metadata.json @@ -14,65 +14,10 @@ } ], "operatingsystem_support": [ - { - "operatingsystem": "RedHat", - "operatingsystemrelease": [ - "7", - "8", - "9" - ] - }, - { - "operatingsystem": "CentOS", - "operatingsystemrelease": [ - "7", - "8" - ] - }, - { - "operatingsystem": "OracleLinux", - "operatingsystemrelease": [ - "7" - ] - }, { "operatingsystem": "Debian", "operatingsystemrelease": [ - "10", - "11" - ] - }, - { - "operatingsystem": "Scientific", - "operatingsystemrelease": [ - "7" - ] - }, - { - "operatingsystem": "SLES", - "operatingsystemrelease": [ - "12", - "15" - ] - }, - { - "operatingsystem": "Ubuntu", - "operatingsystemrelease": [ - "18.04", - "20.04", - "22.04" - ] - }, - { - "operatingsystem": "Rocky", - "operatingsystemrelease": [ - "8" - ] - }, - { - "operatingsystem": "AlmaLinux", - "operatingsystemrelease": [ - "8" + "10" ] } ], diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 1896fc458..5cad805a4 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -11,7 +11,7 @@ def mysql_version shell_output = LitmusHelper.instance.run_shell('mysql --version', expect_failures: true) if shell_output.stdout.match(%r{\d+\.\d+\.\d+}).nil? # mysql is not yet installed, so we apply this class to install it - LitmusHelper.instance.apply_manifest('include mysql::server', debug: true, catch_failures: true) + LitmusHelper.instance.apply_manifest('include mysql::server', catch_failures: true) shell_output = LitmusHelper.instance.run_shell('mysql --version') raise _('unable to get mysql version') if shell_output.stdout.match(%r{\d+\.\d+\.\d+}).nil? end