diff options
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | Gemfile.lock | 22 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | chef-bin/lib/chef-bin/version.rb | 2 | ||||
-rw-r--r-- | chef-config/lib/chef-config/version.rb | 2 | ||||
-rw-r--r-- | chef-utils/lib/chef-utils/version.rb | 2 | ||||
-rw-r--r-- | docs/dev/how_to/running_cookbook_as_hab+effortless_package.md | 57 | ||||
-rw-r--r-- | knife/Gemfile.lock | 4 | ||||
-rw-r--r-- | knife/lib/chef/knife/version.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/zypper.rb | 1 | ||||
-rw-r--r-- | lib/chef/version.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/package/zypper_spec.rb | 10 |
12 files changed, 92 insertions, 22 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bece04d01..01f48e5fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,19 @@ <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ --> This changelog lists individual merged pull requests to Chef Infra Client and geared towards developers. For a list of significant changes per release see the [Chef Infra Client Release Notes](https://docs.chef.io/release_notes_client/). -<!-- latest_release 18.2.11 --> -## [v18.2.11](https://github.com/chef/chef/tree/v18.2.11) (2023-04-14) +<!-- latest_release 18.2.13 --> +## [v18.2.13](https://github.com/chef/chef/tree/v18.2.13) (2023-04-19) #### Merged Pull Requests -- Avoid Invalid Memory Object error [#13677](https://github.com/chef/chef/pull/13677) ([tpowell-progress](https://github.com/tpowell-progress)) +- Add documentation for running a cookbook as hab+effortless package [#13692](https://github.com/chef/chef/pull/13692) ([neha-p6](https://github.com/neha-p6)) <!-- latest_release --> <!-- release_rollup since=18.2.7 --> ### Changes not yet released to stable #### Merged Pull Requests +- Add documentation for running a cookbook as hab+effortless package [#13692](https://github.com/chef/chef/pull/13692) ([neha-p6](https://github.com/neha-p6)) <!-- 18.2.13 --> +- zypper_package: Fix idempotency issue [#13691](https://github.com/chef/chef/pull/13691) ([ramereth](https://github.com/ramereth)) <!-- 18.2.12 --> - Avoid Invalid Memory Object error [#13677](https://github.com/chef/chef/pull/13677) ([tpowell-progress](https://github.com/tpowell-progress)) <!-- 18.2.11 --> - Bump time from 0.2.1 to 0.2.2 in /omnibus [#13664](https://github.com/chef/chef/pull/13664) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 18.2.10 --> - Adding files for onboarding the project to SonarQubes [#13672](https://github.com/chef/chef/pull/13672) ([vinay-satish](https://github.com/vinay-satish)) <!-- 18.2.9 --> diff --git a/Gemfile.lock b/Gemfile.lock index eda0fca9a7..71ca3630d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,12 +44,12 @@ GIT PATH remote: . specs: - chef (18.2.11) + chef (18.2.13) addressable aws-sdk-s3 (~> 1.91) aws-sdk-secretsmanager (~> 1.46) - chef-config (= 18.2.11) - chef-utils (= 18.2.11) + chef-config (= 18.2.13) + chef-utils (= 18.2.13) chef-vault chef-zero (>= 14.0.11) corefoundation (~> 0.3.4) @@ -78,13 +78,13 @@ PATH unf_ext (>= 0.0.8.2) uuidtools (>= 2.1.5, < 3.0) vault (~> 0.16) - chef (18.2.11-x64-mingw-ucrt) + chef (18.2.13-x64-mingw-ucrt) addressable aws-sdk-s3 (~> 1.91) aws-sdk-secretsmanager (~> 1.46) - chef-config (= 18.2.11) + chef-config (= 18.2.13) chef-powershell (~> 18.0.0) - chef-utils (= 18.2.11) + chef-utils (= 18.2.13) chef-vault chef-zero (>= 14.0.11) corefoundation (~> 0.3.4) @@ -128,15 +128,15 @@ PATH PATH remote: chef-bin specs: - chef-bin (18.2.11) - chef (= 18.2.11) + chef-bin (18.2.13) + chef (= 18.2.13) PATH remote: chef-config specs: - chef-config (18.2.11) + chef-config (18.2.13) addressable - chef-utils (= 18.2.11) + chef-utils (= 18.2.13) fuzzyurl mixlib-config (>= 2.2.12, < 4.0) mixlib-shellout (>= 2.0, < 4.0) @@ -145,7 +145,7 @@ PATH PATH remote: chef-utils specs: - chef-utils (18.2.11) + chef-utils (18.2.13) concurrent-ruby GEM @@ -1 +1 @@ -18.2.11
\ No newline at end of file +18.2.13
\ No newline at end of file diff --git a/chef-bin/lib/chef-bin/version.rb b/chef-bin/lib/chef-bin/version.rb index df9b5e02e8..46b9cbe7f9 100644 --- a/chef-bin/lib/chef-bin/version.rb +++ b/chef-bin/lib/chef-bin/version.rb @@ -21,7 +21,7 @@ module ChefBin CHEFBIN_ROOT = File.expand_path("..", __dir__) - VERSION = "18.2.11".freeze + VERSION = "18.2.13".freeze end # diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index 2059ceddd3..9e530b5526 100644 --- a/chef-config/lib/chef-config/version.rb +++ b/chef-config/lib/chef-config/version.rb @@ -15,5 +15,5 @@ module ChefConfig CHEFCONFIG_ROOT = File.expand_path("..", __dir__) - VERSION = "18.2.11".freeze + VERSION = "18.2.13".freeze end diff --git a/chef-utils/lib/chef-utils/version.rb b/chef-utils/lib/chef-utils/version.rb index 978a298d18..f87741edc8 100644 --- a/chef-utils/lib/chef-utils/version.rb +++ b/chef-utils/lib/chef-utils/version.rb @@ -16,5 +16,5 @@ module ChefUtils CHEFUTILS_ROOT = File.expand_path("..", __dir__) - VERSION = "18.2.11" + VERSION = "18.2.13" end diff --git a/docs/dev/how_to/running_cookbook_as_hab+effortless_package.md b/docs/dev/how_to/running_cookbook_as_hab+effortless_package.md new file mode 100644 index 0000000000..a29a6f8b8f --- /dev/null +++ b/docs/dev/how_to/running_cookbook_as_hab+effortless_package.md @@ -0,0 +1,57 @@ +### Running a cookbook as Habitat + Effortless package using policyfiles +The Effortless Config application uses the Policyfiles feature of Chef to encapsulate an application which runs chef-solo against a compiled Policyfile and the collection of cookbooks it needs. + +Following directories will comprise the application: + * cookbooks: This directory contains the cookbooks our application will run. + * habitat: This directory contains the plan.sh and plan.ps1 files to build the habitat application for Effortless Config + * policyfiles: This directory contains the chef Policyfiles that will control what Effortless Config runs and the attributes used to configure it + +### Setting up Habitat + * Install habitat as per steps given [here](https://docs.chef.io/habitat/install_habitat/) + * Set up Origin and access token at habitat builder https://bldr.habitat.sh + For additional details about Habitat builder refer [this](https://docs.chef.io/habitat/builder_overview/) + * Set up Habitat CLI + `hab cli setup` + For additional about Habitat CLI refer [this](https://docs.chef.io/habitat/hab_setup/) + +### Generate chef-repo +Generate the cookbook repo using `chef generate repo REPO_NAME` +For more information on chef-repo generation refer doc [here](https://docs.chef.io/chef_repo/) +Once you are done creating your recipes, define the runlist inside a policy file under `policyfiles` directory of chef-repo e.g `policyfiles/base.rb` + +### Create habitat plan +Navigate to the root of cookbook repo and run +`hab plan init` +It will create a new `habitat` sub-directory with a `plan.sh` (or `plan.ps1` on Windows), a `default.toml` file as well as `config` and `hooks` directories. + +### Updating plan file +Since we are running the cookbook as Hab + Effortless package, we need let the plan file know what is the run list which will be used by Infra Client. +This can be done by setting following package configuration variables in the plan file: +``` +$pkg_scaffolding="chef/scaffolding-chef-infra" # This pulls in latest Infra Client released from stable channel +$scaffold_policyfile_path="{path_to_your_policyfile_relative_to_plan_file}" # e.g "$PLAN_CONTEXT/../policyfiles" +$scaffold_policy_name="{name_of_your_policyfile}" +``` +If we want to run the cookbook with a specific version of Infra Client, set the following variable with corresponding version details: + +`$scaffold_chef_client="chef/chef-infra-client/17.10.3/20220516153835"` + +For more details about plan file configuration refer [here](https://docs.chef.io/habitat/plan_contents/) + +### Build the package +The process for building the Effortless package is same as habitat package. +Enter the hab studio to build the package and then load the service to run it. Since we have specified the run list and Infra Client version in the plan file, the cookbook will now run as an Effortless package + * Enter hab studio + `hab studio enter` + * Build the package. + Note this name has to match your cookbook repo name + `build {your_package_name}` + * Run the package as service + `hab svc load {your_origin}/{package_name}` + * See Supervisor logs + `sup-log` # On linux + `Get-SuperVisorLog` # On windows + * Check status of Habitat services + `hab svc status` + * Stop a service + `hab svc unload {your_origin}/{package_name}` diff --git a/knife/Gemfile.lock b/knife/Gemfile.lock index 55ce5824d1..a308499346 100644 --- a/knife/Gemfile.lock +++ b/knife/Gemfile.lock @@ -1,8 +1,8 @@ PATH remote: .. specs: - chef (18.2.11) - chef (18.2.11-x64-mingw-ucrt) + chef (18.2.13) + chef (18.2.13-x64-mingw-ucrt) PLATFORMS ruby diff --git a/knife/lib/chef/knife/version.rb b/knife/lib/chef/knife/version.rb index 07a8f14124..8dcb4e2fa0 100644 --- a/knife/lib/chef/knife/version.rb +++ b/knife/lib/chef/knife/version.rb @@ -17,7 +17,7 @@ class Chef class Knife KNIFE_ROOT = File.expand_path("../..", __dir__) - VERSION = "18.2.11".freeze + VERSION = "18.2.13".freeze end end diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb index 9cd95aade7..80d6f6daeb 100644 --- a/lib/chef/provider/package/zypper.rb +++ b/lib/chef/provider/package/zypper.rb @@ -141,6 +141,7 @@ class Chef if md = line.match(/^(\S*)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|\s+(.*)$/) (status, name, type, version, arch, repo) = [ md[1], md[2], md[3], md[4], md[5], md[6] ] next if version == "Version" # header + next if name != package_name # sometimes even though we request a specific version in the search string above and have match exact, we wind up # with other versions in the output, particularly getting the installed version when downgrading. diff --git a/lib/chef/version.rb b/lib/chef/version.rb index be59daa225..e0171c278d 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -23,7 +23,7 @@ require_relative "version_string" class Chef CHEF_ROOT = File.expand_path("..", __dir__) - VERSION = Chef::VersionString.new("18.2.11") + VERSION = Chef::VersionString.new("18.2.13") end # diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index 2850a70560..c26443a148 100644 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -491,4 +491,14 @@ describe Chef::Provider::Package::Zypper do provider.remove_package(%w{emacs vim}, ["1.0", "2.0"]) end end + + describe "resolve_available_version" do + it "should return correct version if multiple packages are shown" do + status = double(stdout: "S | Name | Type | Version | Arch | Repository\n---+--------------------------+---------+---------------------+--------+-------------------------------------------------------------\n | apache2-mod_wsgi | package | 4.7.1-150400.3.3.1 | x86_64 | Update repository with updates from SUSE Linux Enterprise 15\n | apache2-mod_wsgi | package | 4.7.1-150400.1.52 | x86_64 | Main Repository\ni+ | apache2-mod_wsgi-python3 | package | 4.5.18-150000.4.6.1 | x86_64 | Update repository with updates from SUSE Linux Enterprise 15\nv | apache2-mod_wsgi-python3 | package | 4.5.18-4.3.1 | x86_64 | Main Repository\n", exitstatus: 0) + + allow(provider).to receive(:shell_out_compacted!).and_return(status) + result = provider.send(:resolve_available_version, "apache2-mod_wsgi-python3", nil) + expect(result).to eq("4.5.18-150000.4.6.1") + end + end end |