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

Deprecate backend resource #278

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
57 changes: 7 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -219,7 +177,6 @@ jobs:
- jsonlint
- cookstylelint
- integration-dokken
- integration-windows-2016
- integration-windows-2019
- integration-windows-2022
- integration-macos-latest
Expand Down
7 changes: 6 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
AllCops:
TargetChefVersion: 17.0
Stromweld marked this conversation as resolved.
Show resolved Hide resolved
TargetRubyVersion: 3.1
Include:
- "**/*.rb"
Exclude:
- "vendor/**/*"
- "spec/**/*"
32 changes: 18 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Policyfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 6 additions & 16 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 8 additions & 10 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Stromweld marked this conversation as resolved.
Show resolved Hide resolved
- 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
Stromweld marked this conversation as resolved.
Show resolved Hide resolved
driver:
Expand All @@ -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
Expand All @@ -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']
Stromweld marked this conversation as resolved.
Show resolved Hide resolved
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
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions resources/automatev2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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") }
Expand Down
2 changes: 2 additions & 0 deletions resources/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/cookbooks/test/recipes/automatev2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
EOS
products %w(automate infra-server builder desktop)
accept_license true
skip_preflight true
end
Loading