Skip to content

Commit

Permalink
(CONT-1203) - Updating reusable github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramesh7 committed Jul 13, 2023
1 parent 3f8ece0 commit 363df9b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 233 deletions.
101 changes: 11 additions & 90 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
89 changes: 3 additions & 86 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
57 changes: 1 addition & 56 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 363df9b

Please sign in to comment.