Skip to content

Commit

Permalink
Add missing fedora parts (#362)
Browse files Browse the repository at this point in the history
Update cicd testing

Signed-off-by: Mike van Goor <[email protected]>
  • Loading branch information
mvangoor authored Jul 31, 2024
1 parent 9f99d8d commit eb97c57
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
os:
- almalinux-8
- almalinux-9
- centos-stream-8
- centos-stream-9
- debian-11
- debian-12
- fedora-latest
- rockylinux-8
- rockylinux-9
- ubuntu-2004
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This file is used to list changes made in each version of the PHP cookbook.

## Unreleased

- Support fedora platform
- Update cicd platforms because of EOL

## 10.0.3 - *2024-07-29*

Standardise files with files in sous-chefs/repo-management
Expand Down
13 changes: 8 additions & 5 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ verifier:

platforms:
- name: almalinux-8
- name: amazonlinux-2
- name: centos-7
- name: centos-stream-8
- name: debian-10
- name: almalinux-9
- name: amazonlinux-2023
- name: centos-stream-9
- name: debian-11
- name: debian-12
- name: fedora-latest
- name: rockylinux-8
- name: rockylinux-9
- name: ubuntu-20.04
- name: ubuntu-22.04
- name: rockylinux-8
- name: ubuntu-24.04

suites:
- name: resource
Expand Down
40 changes: 19 additions & 21 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Php
module Cookbook
module Helpers
def php_conf_dir
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'/etc'
else
"/etc/php/#{php_version}/cli"
Expand All @@ -18,7 +18,7 @@ def php_enable_mod
end

def php_ext_conf_dir
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'/etc/php.d'
else
"/etc/php/#{php_version}/mods-available"
Expand All @@ -30,58 +30,55 @@ def php_ext_dir
end

def php_fpm_conf_dir
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'/etc/php-fpm.d'
else
"/etc/php/#{php_version}/fpm"
end
end

def php_fpm_default_conf
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'/etc/php-fpm.d/www.conf'
else
"/etc/php/#{php_version}/fpm/pool.d/www.conf"
end
end

def php_fpm_group
case node['platform_family']
when 'rhel', 'amazon'
if platform_family?('rhel', 'amazon', 'fedora')
'apache'
when 'debian'
else
'www-data'
end
end

def php_fpm_listen_group
case node['platform_family']
when 'rhel', 'amazon'
if platform_family?('rhel', 'amazon', 'fedora')
'apache'
when 'debian'
else
'www-data'
end
end

def php_fpm_listen_user
case node['platform_family']
when 'rhel', 'amazon'
if platform_family?('rhel', 'amazon', 'fedora')
'apache'
when 'debian'
else
'www-data'
end
end

def php_fpm_package
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'php-fpm'
else
"php#{php_version}-fpm"
end
end

def php_fpm_pool_dir
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'/etc/php-fpm.d'
else
"/etc/php/#{php_version}/fpm/pool.d"
Expand All @@ -93,26 +90,25 @@ def php_fpm_pool_template
end

def php_fpm_service
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
'php-fpm'
else
"php#{php_version}-fpm"
end
end

def php_fpm_socket
if platform_family?('rhel', 'amazon')
if platform_family?('rhel', 'amazon', 'fedora')
"/var/run/php#{php_version}-fpm.sock"
else
"/var/run/php/php#{php_version}-fpm.sock"
end
end

def php_fpm_user
case node['platform_family']
when 'rhel', 'amazon'
if platform_family?('rhel', 'amazon', 'fedora')
'apache'
when 'debian'
else
'www-data'
end
end
Expand All @@ -123,7 +119,7 @@ def php_ini_template

def php_installation_packages
case node['platform_family']
when 'rhel'
when 'rhel', 'fedora'
%w(php php-devel php-cli php-pear)
# Sometimes Amazon will default to different versions for each package,
# so versions are pinned here to avoid packages getting ahead of each
Expand Down Expand Up @@ -152,6 +148,8 @@ def php_version
else
'7.2'
end
when 'fedora'
'8.3'
when 'amazon'
'8.2'
when 'debian'
Expand Down
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
supports 'amazon', '>= 2.0'
supports 'centos', '>= 7.0'
supports 'debian', '>= 10.0'
supports 'fedora', '>= 39'
supports 'oracle', '>= 7.0'
supports 'redhat', '>= 7.0'
supports 'scientific', '>= 7.0'
Expand Down
2 changes: 1 addition & 1 deletion test/cookbooks/test/recipes/community.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
apt_update 'update'

# Start of the old community_package recipe ---
if platform_family?('rhel')
if platform_family?('rhel', 'fedora')
include_recipe 'yum-remi-chef::remi'
elsif platform?('ubuntu')
# ondrej no longer supports Ubuntu <20.04
Expand Down
2 changes: 1 addition & 1 deletion test/integration/resource/inspec/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
its('exit_status') { should eq 0 }
end

unless os[:family] == 'redhat'
unless os[:family] == 'redhat' || os[:family] == 'fedora'
describe command('php -i') do
its('stdout') { should match(/50-sync/) }
end
Expand Down

0 comments on commit eb97c57

Please sign in to comment.