Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use chef 17 for 3.0 tests, chef 18 for 3.1 tests #221

Merged
merged 35 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
872cca3
Reopen #219
tpowell-progress Aug 15, 2023
0af9de2
bump GA checkout to @4
tpowell-progress Feb 28, 2024
93aa88a
Fixed a couple of master references
tpowell-progress Feb 28, 2024
4be5ca3
add chef as a development dependency
tpowell-progress Feb 28, 2024
16d83e4
install chef for the CI
tpowell-progress Feb 28, 2024
ede7927
Try chef dependency instead
tpowell-progress Feb 28, 2024
242f7a7
turn off the bundler cache?
tpowell-progress Feb 28, 2024
d32928b
Push a branch gem requirement for validation of tests
tpowell-progress Feb 28, 2024
63f7c47
Switch on chef version requirement
tpowell-progress Feb 29, 2024
cae814f
Add 17-stable ohai
tpowell-progress Feb 29, 2024
9f1978f
tilde wakka
tpowell-progress Feb 29, 2024
f73dbaa
fixed version pinning for default gems on 3.1
tpowell-progress Feb 29, 2024
2b496f6
Debugging traces
tpowell-progress Feb 29, 2024
e2cdd88
More debug
tpowell-progress Feb 29, 2024
1d72f75
Remove puts
tpowell-progress Feb 29, 2024
592bc6b
trace updated?
tpowell-progress Feb 29, 2024
2713896
Use cookstyle/chefstyle
tpowell-progress Mar 1, 2024
74cfe6e
Turn back on bundler cache
tpowell-progress Mar 1, 2024
ec0b426
Debug list
tpowell-progress Mar 1, 2024
182441d
limit spec run and do a stack trace
tpowell-progress Mar 1, 2024
4b2de58
debug key creation
tpowell-progress Mar 1, 2024
98f4efc
Add caller traces
tpowell-progress Mar 1, 2024
1f5812b
trace the multi return
tpowell-progress Mar 1, 2024
3dbe552
inspect the resource
tpowell-progress Mar 1, 2024
da09ff5
Inspect new resource
tpowell-progress Mar 1, 2024
76353f8
trace caller for new resource
tpowell-progress Mar 1, 2024
ccaa8a4
trace current resource
tpowell-progress Mar 1, 2024
451e583
Fix windows ruby 3.1 matcher
tpowell-progress Mar 1, 2024
f27ab87
Remove temp code and fix lint
tpowell-progress Mar 1, 2024
97fd6fd
Reenable full spec run
tpowell-progress Mar 1, 2024
e248841
Clean up comments
tpowell-progress Mar 1, 2024
736dc86
Try without default gems pins
tpowell-progress Mar 1, 2024
367f85f
Remove default gems pins
tpowell-progress Mar 1, 2024
6737009
3.0, 3.1, and unbounded
tpowell-progress Mar 1, 2024
c2d0693
3.0, 3.1, and unbounded
tpowell-progress Mar 1, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ name: lint
pull_request:
push:
branches:
- master
- main

jobs:
chefstyle:
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: ruby_shadow:omnibus_package
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
ruby-version: '3.1'
bundler-cache: true
- uses: r7kamura/rubocop-problem-matchers-action@v1 # this shows the failures in the PR
- run: bundle exec rake style
8 changes: 4 additions & 4 deletions .github/workflows/unit_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ name: unit_specs
pull_request:
push:
branches:
- master
- main

jobs:
unit:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, windows-2016, macos-10.15]
os: [ubuntu-latest, windows-latest, macos-latest]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: ['3.0']
ruby: ['3.0', '3.1']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand Down
19 changes: 15 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source "https://rubygems.org"
gemspec

group :development do
gem "chefstyle", "2.0.8"
gem "cookstyle", "~> 7.32.8"
gem "rake"
gem "rspec", "~> 3.0"
end
Expand All @@ -14,8 +14,19 @@ if ENV["GEMFILE_MOD"]
instance_eval(ENV["GEMFILE_MOD"])
else
group :development do
# temporarily we only support building against master
gem "chef", github: "chef/chef", branch: "master"
gem "ohai", github: "chef/ohai", branch: "master"
# chef 17 is on 3.0
# chef 18 is on 3.1
case RUBY_VERSION
when /^3\.0/
gem "chef", "~> 17.0"
gem "ohai", "~> 17.0"
when /^3\.1/
gem "chef", "~> 18.0"
gem "ohai", "~> 18.0"
else
# go with the latest, unbounded
gem "chef"
gem "ohai"
end
end
end
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ rescue LoadError
end

begin
require "chefstyle"
require "cookstyle/chefstyle"
require "rubocop/rake_task"
desc "Run Chefstyle tests"
RuboCop::RakeTask.new(:style) do |task|
task.options += ["--display-cop-names", "--no-color"]
end
rescue LoadError
puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed."
puts "cookstyle gem is not installed. bundle install first to make sure all dependencies are installed."
end

begin
Expand Down
4 changes: 1 addition & 3 deletions lib/chef/resource/private_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def create_key(regenerate, action)
(!current_private_key ||
current_resource.size != new_resource.size ||
current_resource.type != new_resource.type))

case new_resource.type
when :rsa
if new_resource.exponent
Expand Down Expand Up @@ -137,7 +136,7 @@ def create_key(regenerate, action)
converge_by "change format of #{new_resource.type} private key #{new_path} from #{current_resource.format} to #{new_resource.format}" do
write_private_key(current_private_key)
end
elsif RUBY_PLATFORM !~ /mswin|mingw32|windows/ && (@current_file_mode & 0077) != 0
elsif RUBY_PLATFORM !~ /mswin|mingw|windows/ && (@current_file_mode & 0077) != 0
new_mode = @current_file_mode & 07700
converge_by "change mode of private key #{new_path} to #{new_mode.to_s(8)}" do
::File.chmod(new_mode, new_path)
Expand Down Expand Up @@ -249,7 +248,6 @@ def load_current_resource
else
resource.action :delete
end

@current_resource = resource
end
end
Expand Down