Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ jobs:
matrix:
os:
- "almalinux-8"
- "centos-7"
- "centos-stream-8"
- "debian-10"
- "debian-11"
- "rockylinux-8"
- "ubuntu-1804"
- "ubuntu-2004"
- "ubuntu-2204"
suite:
Expand All @@ -39,7 +34,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v7
- name: Install Chef
uses: actionshub/chef-install@main
uses: sous-chefs/.github/.github/actions/install-workstation@8.0.2
- name: Dokken
uses: actionshub/test-kitchen@main
env:
Expand All @@ -56,7 +51,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v7
- name: Install Chef
uses: actionshub/chef-install@main
uses: sous-chefs/.github/.github/actions/install-workstation@8.0.2
- name: Kitchen Test
uses: actionshub/test-kitchen@main
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- name: Install Chef
uses: actionshub/chef-install@main
- name: Install cookbooks
run: berks install
run: chef install Policyfile.rb
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ AllCops:
Exclude:
- 'Dangerfile'
- 'resources/homebrew_update.rb'
- 'vendor/**/*'
# This will be moved into Chef Infra Core so I want to preserve the quotes
7 changes: 0 additions & 7 deletions Berksfile

This file was deleted.

131 changes: 131 additions & 0 deletions Policyfile.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"revision_id": "6acbaa01bc76e4e522f3971c561c32a551273ea043e58f425c907f0bf41eeec1",
"name": "ruby_build",
"run_list": [
"recipe[test::default]"
],
"named_run_lists": {
"default": [
"recipe[test::default]"
]
},
"included_policy_locks": [

],
"cookbook_locks": {
"homebrew": {
"version": "7.0.0",
"identifier": "456d1e381e87f21073968b4477cfdf06a4c42c57",
"dotted_decimal_identifier": "19541749951006706.4630690046179279.245219627117655",
"cache_key": "homebrew-f4a84d4e2e8bc6f17d7d4c5c439be4d29fbc34db",
"origin": "https://github.com/sous-chefs/homebrew.git",
"source_options": {
"git": "https://github.com/sous-chefs/homebrew.git",
"revision": "f4a84d4e2e8bc6f17d7d4c5c439be4d29fbc34db",
"branch": "main"
}
},
"ruby_build": {
"version": "2.5.12",
"identifier": "4d69fe0305af8d17f1deb92aa104860274568a83",
"dotted_decimal_identifier": "21790112900034445.6739863355957508.147345099885187",
"source": ".",
"cache_key": null,
"scm_info": {
"scm": "git",
"remote": "https://github.com/sous-chefs/ruby_build.git",
"revision": "07335944f462e81987610455906fc2f2591ea67c",
"working_tree_clean": false,
"published": true,
"synchronized_remote_branches": [
"origin/chore/migrate-to-policyfile"
]
},
"source_options": {
"path": "."
}
},
"test": {
"version": "1.0.0",
"identifier": "5e812c6fbd7fd07e16cfe87849d7bf64cf448377",
"dotted_decimal_identifier": "26600675664035792.35490929279781335.210439695008631",
"source": "test/cookbooks/test",
"cache_key": null,
"scm_info": {
"scm": "git",
"remote": "https://github.com/sous-chefs/ruby_build.git",
"revision": "07335944f462e81987610455906fc2f2591ea67c",
"working_tree_clean": false,
"published": true,
"synchronized_remote_branches": [
"origin/chore/migrate-to-policyfile"
]
},
"source_options": {
"path": "test/cookbooks/test"
}
},
"yum-epel": {
"version": "5.0.10",
"identifier": "3ffd59317825177023566a99bf5940e29163cfd4",
"dotted_decimal_identifier": "18011483056645399.31564051454213977.71341846024148",
"cache_key": "yum-epel-0ae39de8b609c2904012f4da4cf261b6e3361f74",
"origin": "https://github.com/sous-chefs/yum-epel.git",
"source_options": {
"git": "https://github.com/sous-chefs/yum-epel.git",
"revision": "0ae39de8b609c2904012f4da4cf261b6e3361f74",
"branch": "main"
}
}
},
"default_attributes": {

},
"override_attributes": {

},
"solution_dependencies": {
"Policyfile": [
[
"homebrew",
">= 0.0.0"
],
[
"ruby_build",
">= 0.0.0"
],
[
"test",
">= 0.0.0"
],
[
"yum-epel",
">= 0.0.0"
]
],
"dependencies": {
"homebrew (7.0.0)": [

],
"ruby_build (2.5.12)": [
[
"yum-epel",
">= 0.0.0"
],
[
"homebrew",
">= 0.0.0"
]
],
"test (1.0.0)": [
[
"ruby_build",
">= 0.0.0"
]
],
"yum-epel (5.0.10)": [

]
}
}
}
15 changes: 15 additions & 0 deletions Policyfile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

name 'ruby_build'

run_list 'test::default'

cookbook 'ruby_build', path: '.'
cookbook 'test', path: 'test/cookbooks/test'
cookbook 'homebrew', git: 'https://github.com/sous-chefs/homebrew.git', branch: 'main'
cookbook 'yum-epel', git: 'https://github.com/sous-chefs/yum-epel.git', branch: 'main'

Dir.entries('./test/cookbooks/test/recipes').select { |f| f.end_with?('.rb') }.each do |test|
test = test.delete_suffix('.rb')
named_run_list :"#{test}", "test::#{test}"
end
2 changes: 1 addition & 1 deletion kitchen.macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provisioner:
require_chef_omnibus: false
name: chef_zero
install_strategy: skip
chef_client_path: "/opt/chef-workstation/bin/chef-client"
chef_client_path: "/usr/local/bin/cinc-client"
deprecations_as_errors: false
sudo: true

Expand Down
4 changes: 2 additions & 2 deletions libraries/package_deps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Chef
module Rbenv
module MacOs
def openssl_prefix
`/usr/local/bin/brew --prefix openssl@1.1`.strip!
`brew --prefix openssl@3`.strip!
end
end

Expand Down Expand Up @@ -31,7 +31,7 @@ def cruby_package_deps
when 'suse'
%w( gcc make automake gdbm-devel libyaml-devel ncurses-devel readline-devel zlib-devel libopenssl-devel patch )
when 'mac_os_x'
%w( openssl@1.1 readline )
%w( openssl@3 readline )
end
end

Expand Down
2 changes: 1 addition & 1 deletion resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end
end

include_recipe 'yum-epel'
yum_epel 'default'
end

package %w(tar bash curl git) unless platform_family?('mac_os_x', 'freebsd')
Expand Down
17 changes: 17 additions & 0 deletions spec/resources/install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe 'test::default' do
context 'AlmaLinux 8' do
platform 'almalinux', '8'
step_into :ruby_build_install

before do
stub_command('yum-config-manager --dump powertools | grep -q "enabled = 1"').and_return(false)
end

it { is_expected.to install_package('yum-utils') }
it { is_expected.to run_execute('yum-config-manager --enable powertools') }
it { is_expected.to create_yum_epel('default') }
it { is_expected.not_to include_recipe('yum-epel') }
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'chefspec'
require 'chefspec/berkshelf'
require 'chefspec/policyfile'
require_relative '../libraries/package_deps'

RSpec.configure do |config|
Expand Down
6 changes: 4 additions & 2 deletions test/cookbooks/test/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

ruby_build_install

ruby_build_definition '3.0.4' do
ruby_version = platform_family?('mac_os_x') ? '3.3.10' : '3.0.4'

ruby_build_definition ruby_version do
version_prefix true
patch 'test.patch'
patch 'test.patch' unless platform_family?('mac_os_x')
end
13 changes: 8 additions & 5 deletions test/integration/default/controls/verify_ruby_build.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ruby_version = os.darwin? ? '3.3.10' : '3.0.4'
ruby_api_version = ruby_version.sub(/\.\d+$/, '.0')

control 'Check definitions' do
impact 1.0
title 'Verify we can return a list of definitions'
desc 'Verify we can get a list of Ruby definitions'
describe command('/usr/local/bin/ruby-build --definitions') do
its('exit_status') { should eq 0 }
its('stdout') { should match /3.0.4/ }
its('stdout') { should match /#{Regexp.escape(ruby_version)}/ }
end
end

Expand All @@ -19,9 +22,9 @@
end

gem_cmd = if os.darwin?
'sudo /usr/local/ruby/3.0.4/bin/gem install ffi --no-document'
"sudo /usr/local/ruby/#{ruby_version}/bin/gem install ffi --no-document"
else
'/usr/local/ruby/3.0.4/bin/gem install ffi --no-document'
"/usr/local/ruby/#{ruby_version}/bin/gem install ffi --no-document"
end

control 'Install a Ruby gem' do
Expand All @@ -34,8 +37,8 @@
its('stdout') { should match /Successfully installed ffi/ }
end

describe command('/usr/local/ruby/3.0.4/bin/gem env') do
describe command("/usr/local/ruby/#{ruby_version}/bin/gem env") do
its('exit_status') { should eq 0 }
its('stdout') { should match %r{gems/3.0.0} }
its('stdout') { should match %r{gems/#{Regexp.escape(ruby_api_version)}} }
end
end
Loading