diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb3be0f..f3af45f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,38 +3,34 @@ on: jobs: markdownlint: - uses: Stromweld/github-workflows/.github/workflows/markdownlint.yml@main + uses: Stromweld/github-workflows/.github/workflows/markdown-lint.yml@main yamllint: - uses: Stromweld/github-workflows/.github/workflows/yamllint.yml@main + uses: Stromweld/github-workflows/.github/workflows/yaml-lint.yml@main jsonlint: - uses: Stromweld/github-workflows/.github/workflows/jsonlint.yml@main + uses: Stromweld/github-workflows/.github/workflows/json-lint.yml@main cookstylelint: - uses: Stromweld/github-workflows/.github/workflows/cookstylelint.yml@main + uses: Stromweld/github-workflows/.github/workflows/cookstyle-lint.yml@main integration-dokken: runs-on: ubuntu-latest strategy: matrix: os: - - centos-7 - - centos-8 - almalinux-8 -# - almalinux-9 # TODO: uncomment this when almalinux-9 dokken image is fixed - - ubuntu-1804 + - almalinux-9 - ubuntu-2004 - ubuntu-2204 + - ubuntu-2404 suite: - chef-workstation - inspec - chef-server - chef-automatev2 exclude: - - os: centos-7 - suite: chef-server - - os: ubuntu-2204 + - os: ubuntu-2404 suite: chef-server fail-fast: false steps: @@ -62,44 +58,6 @@ jobs: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.dokken.yml - - integration-windows-2016: - runs-on: windows-2016 - strategy: - matrix: - os: - - windows-2016 - suite: - - chef-workstation - - inspec - fail-fast: false - steps: - - name: Check windows Version - run: systeminfo - - name: Check out code - uses: actions/checkout@main - - name: Install Chef - uses: actionshub/chef-install@main - - name: Test-Kitchen Converge - uses: actionshub/test-kitchen@main - with: - suite: ${{ matrix.suite }} - os: ${{ matrix.os }} - action: converge - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.exec.yml - continue-on-error: false - - name: Test-Kitchen Verify - uses: actionshub/test-kitchen@main - with: - suite: ${{ matrix.suite }} - os: ${{ matrix.os }} - action: verify - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.exec.yml - integration-windows-2019: runs-on: windows-2019 strategy: @@ -219,7 +177,6 @@ jobs: - jsonlint - cookstylelint - integration-dokken - - integration-windows-2016 - integration-windows-2019 - integration-windows-2022 - integration-macos-latest diff --git a/.rubocop.yml b/.rubocop.yml index 2c347c4..7955d9b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,8 @@ --- AllCops: - TargetChefVersion: 17.0 + TargetRubyVersion: 3.1 + Include: + - "**/*.rb" + Exclude: + - "vendor/**/*" + - "spec/**/*" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3dd04..6856986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the chef-ingredient cookbook. +## 3.5.1 (2024-10-02) + +- Add deprecation warning log notice for chef backend resource + ## 3.5.0 (2022-07-28) - Added attribute to specify mixlib-install version, defaults to nil to install latest version - [@stromweld](https://github.com/stromweld) @@ -43,20 +47,20 @@ This file is used to list changes made in each version of the chef-ingredient co - Cookstyle 6.2.9 Fixes - [@xorimabot](https://github.com/xorimabot) - Update platforms we test on - [@tas50](https://github.com/tas50) - Cookstyle Fixes including Chef Infra Client 16 compatibility - [@xorimabot](https://github.com/xorimabot) - - resolved cookstyle error: resources/chef_ingredient.rb:19:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - - resolved cookstyle error: resources/ingredient_config.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - - resolved cookstyle error: resources/omnibus_service.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - - resolved cookstyle error: resources/backend.rb:28:45 refactor: `ChefCorrectness/LazyEvalNodeAttributeDefaults` - - resolved cookstyle error: resources/chef_org.rb:31:36 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/chef_org.rb:32:35 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/chef_user.rb:32:36 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/wf_builder.rb:260:9 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: resources/wf_builder.rb:274:18 refactor: `ChefModernize/ShellOutHelper` - - resolved cookstyle error: spec/unit/recipes/test_default_handler_spec.rb:20:7 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` - - resolved cookstyle error: libraries/helpers.rb:254:11 refactor: `ChefCorrectness/ChefApplicationFatal` - - resolved cookstyle error: resources/automatev2.rb:48:5 refactor: `ChefCorrectness/ConditionalRubyShellout` - - resolved cookstyle error: resources/wf_builder.rb:207:11 refactor: `ChefStyle/UsePlatformHelpers` - - resolved cookstyle error: resources/wf_builder.rb:210:11 refactor: `ChefStyle/UsePlatformHelpers` + - resolved cookstyle error: resources/chef_ingredient.rb:19:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/ingredient_config.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/omnibus_service.rb:18:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/backend.rb:28:45 refactor: `ChefCorrectness/LazyEvalNodeAttributeDefaults` + - resolved cookstyle error: resources/chef_org.rb:31:36 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/chef_org.rb:32:35 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/chef_user.rb:32:36 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/wf_builder.rb:260:9 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: resources/wf_builder.rb:274:18 refactor: `ChefModernize/ShellOutHelper` + - resolved cookstyle error: spec/unit/recipes/test_default_handler_spec.rb:20:7 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` + - resolved cookstyle error: libraries/helpers.rb:254:11 refactor: `ChefCorrectness/ChefApplicationFatal` + - resolved cookstyle error: resources/automatev2.rb:48:5 refactor: `ChefCorrectness/ConditionalRubyShellout` + - resolved cookstyle error: resources/wf_builder.rb:207:11 refactor: `ChefStyle/UsePlatformHelpers` + - resolved cookstyle error: resources/wf_builder.rb:210:11 refactor: `ChefStyle/UsePlatformHelpers` ## 3.1.2 (2019-10-02) diff --git a/Policyfile.rb b/Policyfile.rb index b1fe448..b8bd346 100644 --- a/Policyfile.rb +++ b/Policyfile.rb @@ -16,7 +16,7 @@ named_run_list :test_repo, %w(test::install_git test test::repo) named_run_list :test_local, %w(test::install_git test test::local) named_run_list :test_chef_workstation, 'test::chef_workstation' -named_run_list :test_inspec,'test::inspec' +named_run_list :test_inspec, 'test::inspec' named_run_list :test_chef_server, 'test::chef_server_noaddons' named_run_list :test_chef_automatev2, 'test::automatev2' diff --git a/README.md b/README.md index 8d4eea5..723b93e 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,8 @@ Installs Chef Automate version 2 #### chef_backend Properties - `bootstrap_node` - The node we'll bootstrap secrets with. -- `publish_address` - node['ipaddress'] | The address you want Chef-Backend to listen on. -- `chef_backend_secrets` - A location where your secrets are | we recommend using the chef_file resource. +- `publish_address` - node['ipaddress'] - The address you want Chef-Backend to listen on. +- `chef_backend_secrets` - A location where your secrets are - we recommend using the chef_file resource. - `chef_backend_secrets_user` - The user that owns the file created by the `chef_backend_secrets` attribute - `chef_backend_secrets_group` - The group that owns the file created by the `chef_backend_secrets` attribute diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 0d52809..92d10ec 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -51,38 +51,28 @@ platforms: intermediate_instructions: - RUN /usr/bin/apt-get update - - name: centos-7 - driver: - image: dokken/centos-7 - pid_one_command: /usr/lib/systemd/systemd - - - name: centos-8 - driver: - image: dokken/centos-8 - pid_one_command: /usr/lib/systemd/systemd - - name: fedora-latest driver: image: dokken/fedora-latest pid_one_command: /usr/lib/systemd/systemd - - name: ubuntu-18.04 + - name: ubuntu-20.04 driver: - image: dokken/ubuntu-18.04 + image: dokken/ubuntu-20.04 pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - name: ubuntu-20.04 + - name: ubuntu-22.04 driver: - image: dokken/ubuntu-20.04 + image: dokken/ubuntu-22.04 pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - name: ubuntu-22.04 + - name: ubuntu-24.04 driver: - image: dokken/ubuntu-22.04 + image: dokken/ubuntu-24.04 pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update diff --git a/kitchen.yml b/kitchen.yml index 6a4b161..0197335 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -29,8 +29,6 @@ platforms: - name: almalinux-8 - name: almalinux-9 - name: amazonlinux-2 - - name: centos-7 - - name: centos-8 - name: debian-10 - name: debian-11 - name: fedora-latest @@ -39,12 +37,12 @@ platforms: - name: opensuse-leap-15 - name: rockylinux-8 - name: rockylinux-9 - - name: ubuntu-18.04 - name: ubuntu-20.04 - name: ubuntu-22.04 - - name: macos-10.12 + - name: ubuntu-24.04 + - name: macos-14 driver: - box: chef/macos-10.12 # private + box: stromweld/macos-14 - name: macos-latest # Used for CI pipeline - name: windows-2016 driver: @@ -64,15 +62,15 @@ platforms: suites: - name: default - excludes: ['macos-10.12', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] + excludes: ['macos-14', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] named_run_list: test_repo - name: local-package-install - excludes: ['macos-10.12', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] + excludes: ['macos-14', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] named_run_list: test_local - name: rubygems-url - excludes: ['macos-10.12', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] + excludes: ['macos-14', 'macos-latest', 'windows-2016', 'windows-2019', 'windows-2022'] named_run_list: test_rubygems_url - name: chef-workstation @@ -82,12 +80,12 @@ suites: named_run_list: test_inspec - name: chef-server - includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-18.04', 'ubuntu-20.04', 'ubuntu-22.04', 'centos-7', 'centos-8'] + includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-20.04', 'ubuntu-22.04'] named_run_list: test_chef_server - name: chef-automatev2 driver: customize: memory: 2560 - includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-18.04', 'ubuntu-20.04', 'ubuntu-22.04', 'centos-7', 'centos-8'] + includes: ['almalinux-8', 'almalinux-9', 'rockylinux-8', 'rockylinux-9', 'ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04'] named_run_list: test_chef_automatev2 diff --git a/metadata.rb b/metadata.rb index 4a36457..b566f30 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@chef.io' license 'Apache-2.0' description 'Primitives for managing Chef products and packages' -version '3.5.0' +version '3.5.1' %w(amazon centos redhat scientific oracle fedora debian ubuntu).each do |os| supports os diff --git a/resources/automatev2.rb b/resources/automatev2.rb index 2004fe2..4cd1962 100644 --- a/resources/automatev2.rb +++ b/resources/automatev2.rb @@ -24,6 +24,7 @@ property :config, String, required: true property :accept_license, [true, false], default: false property :products, Array, default: ['automate'] +property :skip_preflight, [TrueClass, FalseClass], default: false action :create do bin_path = value_for_platform_family( @@ -37,7 +38,6 @@ not_if { FileTest.file?(bin_path) } end - ## TODO: add dependancy on sysctl cookbook unless chef-client v14.0+ sysctl 'vm.max_map_count' do value 262144 end @@ -52,7 +52,7 @@ only_if { FileTest.file?('/usr/local/bin/chef-automate') } end - execute "/usr/local/bin/chef-automate deploy #{Chef::Config[:file_cache_path]}/config.toml --product #{new_resource.products.join(' --product ')}#{' --accept-terms-and-mlsa' if new_resource.accept_license}" do + execute "/usr/local/bin/chef-automate deploy #{Chef::Config[:file_cache_path]}/config.toml#{' --skip-preflight' if new_resource.skip_preflight} --product #{new_resource.products.join(' --product ')}#{' --accept-terms-and-mlsa' if new_resource.accept_license}" do cwd Chef::Config[:file_cache_path] live_stream true only_if { FileTest.file?("#{Chef::Config[:file_cache_path]}/config.toml") } diff --git a/resources/backend.rb b/resources/backend.rb index 66df5da..644fc79 100644 --- a/resources/backend.rb +++ b/resources/backend.rb @@ -45,6 +45,8 @@ action :create do raise 'Must accept the Chef License agreement before continuing.' unless new_resource.accept_license + Chef::Log.warn('The chef_backend resource is deprecated in favor of Automate HA') + new_resource.config = ensurekv(new_resource.config, publish_address: new_resource.publish_address) chef_ingredient 'chef-backend' do action :upgrade diff --git a/test/fixtures/cookbooks/test/recipes/automatev2.rb b/test/fixtures/cookbooks/test/recipes/automatev2.rb index db4af9a..4b249f7 100644 --- a/test/fixtures/cookbooks/test/recipes/automatev2.rb +++ b/test/fixtures/cookbooks/test/recipes/automatev2.rb @@ -5,4 +5,5 @@ EOS products %w(automate infra-server builder desktop) accept_license true + skip_preflight true end