Skip to content

Commit 30c39b7

Browse files
authored
use shared GHA workflow (#64)
* use shared GHA workflow * use Katello::SimplePackage Katello::Pulp::SimplePackage is gone since commit c6df8726cad96bc3d67de1e65c78eb0f236d8524 Author: ianballou <[email protected]> Date: Thu Jan 5 21:54:38 2023 +0000 Refs #35006 - Remove Pulp service classes This bumps the minimum required Katello version to 4.8
1 parent b715d18 commit 30c39b7

File tree

6 files changed

+19
-93
lines changed

6 files changed

+19
-93
lines changed

.github/workflows/rubocop.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/unit_tests.yaml

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,25 @@
11
name: Unit tests
2+
23
on:
34
push:
45
branches: [ "master" ]
56
pull_request:
67
branches: [ "master" ]
78

8-
defaults:
9-
run:
10-
working-directory: /projects/foreman
9+
concurrency:
10+
group: ${{ github.ref_name }}-${{ github.workflow }}
11+
cancel-in-progress: true
1112

1213
jobs:
13-
test_ruby:
14-
defaults:
15-
run:
16-
working-directory: /projects/foreman
17-
env:
18-
PGHOST: postgres
19-
PGUSER: foreman
20-
PGPASS: foreman
21-
RAILS_ENV: test
22-
host: postgres
23-
WORKDIR: /projects/foreman
24-
BUNDLE_PATH: vendor/bundle
25-
GIT_COMMITTER_NAME: "gh_actions"
26-
GIT_COMMITTER_EMAIL: "gh_actions@rh_cloud.foreman"
27-
strategy:
28-
fail-fast: false
29-
matrix:
30-
image_version: [6.0.43]
31-
32-
runs-on: ubuntu-latest
33-
container:
34-
image: ghcr.io/theforeman/tfm_plugin_test:${{ matrix.image_version }}
35-
36-
services:
37-
postgres:
38-
image: quay.io/jomitsch/postgres-with-evr
39-
options: >-
40-
--health-cmd pg_isready
41-
--health-interval 10s
42-
--health-timeout 5s
43-
--health-retries 5
44-
env:
45-
POSTGRES_USER: foreman
46-
POSTGRES_PASSWORD: foreman
14+
rubocop:
15+
name: Rubocop
16+
uses: theforeman/actions/.github/workflows/rubocop.yml@v0
4717

48-
steps:
49-
- name: Checkout foreman_kernel_care repo
50-
uses: actions/checkout@v3
51-
with:
52-
path: ${{ github.workspace }}/projects/foreman_kernel_care
53-
- name: Fix git config
54-
run: |
55-
cp -Rf $GITHUB_WORKSPACE/projects/foreman_kernel_care /projects/
56-
cd /projects/foreman
57-
echo "gemspec :path => '../foreman_kernel_care'" > bundler.d/foreman_kernel_care.local.rb
58-
/usr/bin/entrypoint.sh git config --global user.name $GIT_COMMITTER_NAME
59-
/usr/bin/entrypoint.sh git config --global user.email $GIT_COMMITTER_EMAIL
60-
- name: remove foreman_rh_cloud and dependencies
61-
working-directory: /projects/foreman
62-
run: |
63-
rm bundler.d/foreman_rh_cloud.local.rb
64-
- name: Run tests suite
65-
run: |
66-
cd /projects/foreman
67-
ls -al /usr/bin
68-
/usr/bin/entrypoint.sh chmod +rx /usr/bin/run_tests.sh
69-
/usr/bin/entrypoint.sh touch /usr/bin/setup_env.sh
70-
/usr/bin/entrypoint.sh chmod +rx /usr/bin/setup_env.sh
71-
/usr/bin/entrypoint.sh head -n -10 /usr/bin/run_tests.sh > /usr/bin/setup_env.sh
72-
/usr/bin/entrypoint.sh /usr/bin/setup_env.sh
73-
- name: Run foreman_kernel_care tests
74-
working-directory: /projects/foreman
75-
run: |
76-
/usr/bin/entrypoint.sh bundle exec rake test:foreman_kernel_care
18+
test:
19+
name: Ruby
20+
needs: rubocop
21+
uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0
22+
with:
23+
plugin: foreman_kernel_care
24+
postgresql_container: ghcr.io/theforeman/postgresql-evr
25+
test_existing_database: false

app/models/concerns/foreman_kernel_care/host_managed_extensions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def delete_yum_pkgs(packages)
8686

8787
def create_new_yum_kernel_packages(packages, version, release)
8888
new_kernels = packages.map do |p|
89-
::Katello::Pulp::SimplePackage.new({
89+
::Katello::SimplePackage.new({
9090
arch: p.arch,
9191
epoch: p.epoch,
9292
version: version,

foreman_kernel_care.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
1616
s.required_ruby_version = '>= 2.5.0'
1717

1818
s.add_dependency 'foreman_remote_execution', '>= 1.5.6'
19-
s.add_dependency 'katello', '>= 3.8.0'
19+
s.add_dependency 'katello', '>= 4.8.0'
2020

2121
s.add_development_dependency 'rdoc', '~> 6', '>= 6.3.1'
2222
s.add_development_dependency 'rubocop', '>= 0.87.0'

test/factories/foreman_kernel_care_factories.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:epoch => '1',
2020
:nvra => 'kernelcare-2.54-1.el7.x86_64'
2121
}
22-
host.import_package_profile([::Katello::Pulp::SimplePackage.new(package_json)])
22+
host.import_package_profile([::Katello::SimplePackage.new(package_json)])
2323
end
2424
end
2525
end

test/unit/host_managed_extensions_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_update_kernel_version
1818
package_json = { :name => 'kernel', :version => '1',
1919
:release => '1.el7', :arch => 'x86_64', :epoch => '1',
2020
:nvra => 'kernel-1-1.el7.x86_64' }
21-
host.import_package_profile([::Katello::Pulp::SimplePackage.new(package_json)])
21+
host.import_package_profile([::Katello::SimplePackage.new(package_json)])
2222
nvra = 'kernel-1-1.el7.x86_64'
2323
host.reload
2424
version = '2'

0 commit comments

Comments
 (0)