From 7cfc955259a93f3dffd584c3e6093adfeafb6cb6 Mon Sep 17 00:00:00 2001 From: Xorima's Bot Date: Sat, 16 May 2020 10:33:09 +0100 Subject: [PATCH 001/278] Standardise files with files in sous-chefs/repo-management (#615) Signed-off-by: Xorima Bot --- Dangerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dangerfile b/Dangerfile index 140c4da2..9602965b 100644 --- a/Dangerfile +++ b/Dangerfile @@ -36,6 +36,11 @@ if !git.modified_files.include?('CHANGELOG.md') && code_changes? failure 'Please include a CHANGELOG entry.' end +# Require Major Minor Patch version labels +unless github.pr_labels.grep /minor|major|patch/i + failure 'Please add a release label to this pull request' +end + # A sanity check for tests. if git.lines_of_code > 5 && code_changes? && !test_changes? warn 'This Pull Request is probably missing tests.' From 927f3d251ec6be57483de802c9661cce0961ba1f Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Wed, 20 May 2020 19:51:23 +0000 Subject: [PATCH 002/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- Dangerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dangerfile b/Dangerfile index 9602965b..bc08b7ae 100644 --- a/Dangerfile +++ b/Dangerfile @@ -18,7 +18,7 @@ def code_changes? end def test_changes? - tests = %w(spec test .kitchen.yml .kitchen.dokken.yml) + tests = %w(spec test kitchen.yml kitchen.dokken.yml) tests.each do |location| return true unless git.modified_files.grep(/#{location}/).empty? end @@ -38,7 +38,7 @@ end # Require Major Minor Patch version labels unless github.pr_labels.grep /minor|major|patch/i - failure 'Please add a release label to this pull request' + warn 'Please add a release label to this pull request' end # A sanity check for tests. From 9e724b11d209a97491de9b1240164698eb5eab95 Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Thu, 21 May 2020 10:42:57 -0700 Subject: [PATCH 003/278] [GH-617] - fix broken :remove action on java_certificate (#618) * [GH-617] - fix broken :remove action on java_certificate * add missing CHANGELOG entry Signed-off-by: Joshua Colson [minor release] --- CHANGELOG.md | 2 ++ resources/certificate.rb | 5 +++-- test/fixtures/cookbooks/test/recipes/java_cert.rb | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ced09d9..49422919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Fixed java_certificate resource :remove bugs preventing removal + ## 8.1.2 (2020-04-20) - Add OpenJDK source install resource diff --git a/resources/certificate.rb b/resources/certificate.rb index 5d64941c..f411eb62 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -118,7 +118,8 @@ cmd = Mixlib::ShellOut.new("#{keytool} -list -keystore #{truststore} -storepass #{truststore_passwd} -v | grep \"#{certalias}\"") cmd.run_command has_key = !cmd.stdout[/Alias name: #{certalias}/].nil? - Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless cmd.exitstatus == 0 + does_not_exist = cmd.stdout[/Alias <#{certalias}> does not exist/].nil? + Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless (cmd.exitstatus == 0) || does_not_exist if has_key converge_by("remove certificate #{certalias} from #{truststore}") do @@ -131,7 +132,7 @@ end end - FileUtils.rm_f("#{new_reource.download_path}/#{certalias}.cert.*") + FileUtils.rm_f("#{Chef::Config[:file_cache_path]}/#{certalias}.cert.*") end action_class do diff --git a/test/fixtures/cookbooks/test/recipes/java_cert.rb b/test/fixtures/cookbooks/test/recipes/java_cert.rb index efa6ad98..20a75055 100644 --- a/test/fixtures/cookbooks/test/recipes/java_cert.rb +++ b/test/fixtures/cookbooks/test/recipes/java_cert.rb @@ -9,3 +9,7 @@ java_certificate 'java_certificate_ssl_endpoint' do ssl_endpoint 'google.com:443' end + +java_certificate 'java_certificate_ssl_endpoint' do + action :remove +end From 168b1f273f2622f6c8839c61ba163371e636bef8 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Fri, 22 May 2020 14:12:58 +0100 Subject: [PATCH 004/278] Release 8.2.0 --- CHANGELOG.md | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49422919..753222b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.2.0 (2020-05-22) - Fixed java_certificate resource :remove bugs preventing removal diff --git a/metadata.rb b/metadata.rb index 054e984d..d66e61d2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'help@sous-chefs.org' license 'Apache-2.0' description 'Recipes and resources for installing Java and managing certificates' -version '8.1.2' +version '8.2.0' supports 'debian' supports 'ubuntu' From 3458d75eea12fbd33607a29ed09dc522416c0d00 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Wed, 27 May 2020 18:26:52 +0000 Subject: [PATCH 005/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .vscode/extensions.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..064bba08 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "chef-software.chef", + "rebornix.ruby", + "editorconfig.editorconfig" + ] +} \ No newline at end of file From b9a224d02d8e1ec1ef4beb937ffb13053d480735 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Thu, 28 May 2020 08:45:49 +0000 Subject: [PATCH 006/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/md-links.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/md-links.yml diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml new file mode 100644 index 00000000..41e2e5d3 --- /dev/null +++ b/.github/workflows/md-links.yml @@ -0,0 +1,20 @@ +--- +name: md-links + +on: + pull_request: + push: + branches: + - master + +jobs: + md-links: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@master + - name: markdown-link-check + uses: gaurav-nelson/github-action-markdown-link-check@1.0.2 + with: + use-quiet-mode: 'yes' + folder-path: 'documentation' From c72a7a41b2629dd8f153b2ded13f46ce753eea8f Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Sun, 31 May 2020 13:00:32 +0000 Subject: [PATCH 007/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/md-links.yml | 3 ++- .vscode/extensions.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index 41e2e5d3..a9b052be 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -16,5 +16,6 @@ jobs: - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@1.0.2 with: - use-quiet-mode: 'yes' + use-verbose-mode: 'yes' folder-path: 'documentation' + config-file: .github/workflows/mlc_config.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 064bba08..cd777250 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,4 +4,4 @@ "rebornix.ruby", "editorconfig.editorconfig" ] -} \ No newline at end of file +} From c5015267cd94223b20a9e50cf7a18be9736a4f11 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Sun, 31 May 2020 17:14:39 +0000 Subject: [PATCH 008/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/md-links.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index a9b052be..f7662611 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -18,4 +18,3 @@ jobs: with: use-verbose-mode: 'yes' folder-path: 'documentation' - config-file: .github/workflows/mlc_config.json From 92005f3bd0dc174e15936034047e4d8bc804e7fa Mon Sep 17 00:00:00 2001 From: Jason Field Date: Sun, 31 May 2020 19:17:19 +0100 Subject: [PATCH 009/278] Migrate resources from to to fix issue with Chef 16.2 --- CHANGELOG.md | 4 ++++ resources/adoptopenjdk_install.rb | 2 +- resources/adoptopenjdk_linux_install.rb | 2 +- resources/adoptopenjdk_macos_install.rb | 2 +- resources/corretto_install.rb | 2 +- resources/openjdk_install.rb | 2 +- resources/openjdk_pkg_install.rb | 2 +- resources/openjdk_source_install.rb | 2 +- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 753222b5..b071efa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + +- Migrate resources from `resource_name` to `provides` to fix issue with Chef 16.2 + ## 8.2.0 (2020-05-22) - Fixed java_certificate resource :remove bugs preventing removal diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index 0153ac30..d5f0230f 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -1,4 +1,4 @@ -resource_name :adoptopenjdk_install +provides :adoptopenjdk_install default_action :install # Common options diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb index 8e48a7a4..1ff5348b 100644 --- a/resources/adoptopenjdk_linux_install.rb +++ b/resources/adoptopenjdk_linux_install.rb @@ -1,4 +1,4 @@ -resource_name :adoptopenjdk_linux_install +provides :adoptopenjdk_linux_install include Java::Cookbook::AdoptOpenJdkHelpers property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb index 4a219b07..6cf05b7a 100644 --- a/resources/adoptopenjdk_macos_install.rb +++ b/resources/adoptopenjdk_macos_install.rb @@ -1,4 +1,4 @@ -resource_name :adoptopenjdk_macos_install +provides :adoptopenjdk_macos_install include Java::Cookbook::AdoptOpenJdkMacOsHelpers property :tap_full, [true, false], diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 1a8e5b58..4102b4de 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -1,4 +1,4 @@ -resource_name :corretto_install +provides :corretto_install include Java::Cookbook::CorrettoHelpers property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 84673e69..eebe8872 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -1,4 +1,4 @@ -resource_name :openjdk_install +provides :openjdk_install include Java::Cookbook::OpenJdkHelpers default_action :install diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 394fb71a..8f43f76b 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -1,4 +1,4 @@ -resource_name :openjdk_pkg_install +provides :openjdk_pkg_install include Java::Cookbook::OpenJdkHelpers default_action :install diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index bc906fda..20f4b62a 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,4 +1,4 @@ -resource_name :openjdk_install +provides :openjdk_install include Java::Cookbook::OpenJdkHelpers default_action :install From e3581879be46f062023345a32a32c89eab0343ec Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Mon, 1 Jun 2020 13:00:37 +0000 Subject: [PATCH 010/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/md-links.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index f7662611..a390ea95 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -1,11 +1,10 @@ --- name: md-links -on: +"on": pull_request: push: - branches: - - master + branches: [master] jobs: md-links: @@ -14,7 +13,7 @@ jobs: - name: Check out code uses: actions/checkout@master - name: markdown-link-check - uses: gaurav-nelson/github-action-markdown-link-check@1.0.2 + uses: gaurav-nelson/github-action-markdown-link-check@1 with: - use-verbose-mode: 'yes' - folder-path: 'documentation' + use-verbose-mode: "yes" + folder-path: "documentation" From 96f8693bf13a9f2858e26f6cf79766966cfefd0f Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Mon, 1 Jun 2020 13:59:25 +0000 Subject: [PATCH 011/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .yamllint | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.yamllint b/.yamllint index 15e8b694..ecfdffb8 100644 --- a/.yamllint +++ b/.yamllint @@ -1,7 +1,6 @@ --- extends: default -ignore: .kitchen/ rules: line-length: - max: 120 + max: 256 level: warning From 042f9b4b2e20be3f2165feab0786f67ec6cad640 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Tue, 2 Jun 2020 07:52:58 +0000 Subject: [PATCH 012/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/md-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index a390ea95..150e75c6 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -13,7 +13,7 @@ jobs: - name: Check out code uses: actions/checkout@master - name: markdown-link-check - uses: gaurav-nelson/github-action-markdown-link-check@1 + uses: gaurav-nelson/github-action-markdown-link-check@v1 with: use-verbose-mode: "yes" folder-path: "documentation" From 974af19310e0dd5cd228fc355d4c9d69abfaaf73 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Tue, 2 Jun 2020 08:07:22 +0000 Subject: [PATCH 013/278] Cookstyle 6.7.3 Fixes Issues found and resolved with: resources/adoptopenjdk_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Issues found and resolved with: resources/adoptopenjdk_linux_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Issues found and resolved with: resources/adoptopenjdk_macos_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Issues found and resolved with: resources/corretto_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Issues found and resolved with: resources/openjdk_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Issues found and resolved with: resources/openjdk_pkg_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Issues found and resolved with: resources/openjdk_source_install.rb - 1:1 warning: ChefDeprecations/ResourceUsesOnlyResourceName - Starting with Chef Infra Client 16, using resource_name without also using provides will result in resource failures. Use provides to change the name of the resource instead and omit resource_name entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME. Signed-off-by: Xorima Bot --- CHANGELOG.md | 10 ++++++++++ resources/adoptopenjdk_install.rb | 2 +- resources/adoptopenjdk_linux_install.rb | 2 +- resources/adoptopenjdk_macos_install.rb | 2 +- resources/corretto_install.rb | 2 +- resources/openjdk_install.rb | 2 +- resources/openjdk_pkg_install.rb | 2 +- resources/openjdk_source_install.rb | 2 +- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 753222b5..6324dbf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + +- resolved cookstyle error: resources/adoptopenjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: resources/adoptopenjdk_linux_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: resources/adoptopenjdk_macos_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: resources/corretto_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: resources/openjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: resources/openjdk_pkg_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +- resolved cookstyle error: resources/openjdk_source_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + ## 8.2.0 (2020-05-22) - Fixed java_certificate resource :remove bugs preventing removal diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index 0153ac30..d5f0230f 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -1,4 +1,4 @@ -resource_name :adoptopenjdk_install +provides :adoptopenjdk_install default_action :install # Common options diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb index 8e48a7a4..1ff5348b 100644 --- a/resources/adoptopenjdk_linux_install.rb +++ b/resources/adoptopenjdk_linux_install.rb @@ -1,4 +1,4 @@ -resource_name :adoptopenjdk_linux_install +provides :adoptopenjdk_linux_install include Java::Cookbook::AdoptOpenJdkHelpers property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb index 4a219b07..6cf05b7a 100644 --- a/resources/adoptopenjdk_macos_install.rb +++ b/resources/adoptopenjdk_macos_install.rb @@ -1,4 +1,4 @@ -resource_name :adoptopenjdk_macos_install +provides :adoptopenjdk_macos_install include Java::Cookbook::AdoptOpenJdkMacOsHelpers property :tap_full, [true, false], diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 1a8e5b58..4102b4de 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -1,4 +1,4 @@ -resource_name :corretto_install +provides :corretto_install include Java::Cookbook::CorrettoHelpers property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 84673e69..eebe8872 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -1,4 +1,4 @@ -resource_name :openjdk_install +provides :openjdk_install include Java::Cookbook::OpenJdkHelpers default_action :install diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 394fb71a..8f43f76b 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -1,4 +1,4 @@ -resource_name :openjdk_pkg_install +provides :openjdk_pkg_install include Java::Cookbook::OpenJdkHelpers default_action :install diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index bc906fda..20f4b62a 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,4 +1,4 @@ -resource_name :openjdk_install +provides :openjdk_install include Java::Cookbook::OpenJdkHelpers default_action :install From 19df763e6809b5a5a750405d5932d1cd4e88e303 Mon Sep 17 00:00:00 2001 From: Jason Field Date: Tue, 2 Jun 2020 11:06:55 +0100 Subject: [PATCH 014/278] Release 8.2.1 --- CHANGELOG.md | 2 +- metadata.rb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6324dbf5..a7801153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.2.1 (2020-06-02) - resolved cookstyle error: resources/adoptopenjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - resolved cookstyle error: resources/adoptopenjdk_linux_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` diff --git a/metadata.rb b/metadata.rb index d66e61d2..aca6b097 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,10 @@ maintainer_email 'help@sous-chefs.org' license 'Apache-2.0' description 'Recipes and resources for installing Java and managing certificates' -version '8.2.0' +source_url 'https://github.com/sous-chefs/java' +issues_url 'https://github.com/sous-chefs/java/issues' +chef_version '>= 15.0' +version '8.2.1' supports 'debian' supports 'ubuntu' @@ -17,8 +20,4 @@ supports 'suse' supports 'opensuseleap' -source_url 'https://github.com/sous-chefs/java' -issues_url 'https://github.com/sous-chefs/java/issues' -chef_version '>= 15.0' - depends 'line' From 5b36e4ffffdfc84d1329547ecd8b46985bc85057 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Tue, 2 Jun 2020 11:11:29 +0000 Subject: [PATCH 015/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- documentation/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 documentation/.gitkeep diff --git a/documentation/.gitkeep b/documentation/.gitkeep new file mode 100644 index 00000000..e69de29b From 262acad148801dcfc22be5612494631bbff5d5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sim=C3=A3o=20Martins?= Date: Fri, 5 Jun 2020 21:09:49 +0100 Subject: [PATCH 016/278] Remove Oracle/IBM from the Readme (#623) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f4489bf..d8fe9ca9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) -This cookbook installs a Java JDK/JRE. It defaults to installing OpenJDK, but it can also install Oracle, IBM JDKs or AdoptOpenJDK. +This cookbook installs a Java JDK/JRE. It defaults to installing OpenJDK, but it can also install AdoptOpenJDK. ## Maintainers From 75225412f6410a54fe110af9f7c7e36ea67e2cf4 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 17 Jun 2020 21:19:03 -0700 Subject: [PATCH 017/278] Restore Chef Infra Client < 16 compatibility Chef Infra Client 16 needs provides and Chef Infra Client < 16 needs resource_name here. If we support both then we need both. Signed-off-by: Tim Smith --- CHANGELOG.md | 5 +++++ kitchen.dokken.yml | 2 +- kitchen.yml | 2 +- resources/adoptopenjdk_install.rb | 2 ++ resources/adoptopenjdk_linux_install.rb | 2 ++ resources/adoptopenjdk_macos_install.rb | 2 ++ resources/alternatives.rb | 2 +- resources/corretto_install.rb | 2 ++ resources/jce.rb | 2 +- resources/openjdk_install.rb | 2 ++ resources/openjdk_pkg_install.rb | 2 ++ resources/openjdk_source_install.rb | 2 ++ 12 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7801153..f0a448a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This file is used to list changes made in each version of the Java cookbook. +## UNRELEASED + +- Restore compatibility with Chef Infra Client < 16 +- Update Fedora releases in the Kitchen configs + ## 8.2.1 (2020-06-02) - resolved cookstyle error: resources/adoptopenjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index af2daed5..f5286086 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -47,7 +47,7 @@ platforms: image: dokken/centos-8 pid_one_command: /usr/lib/systemd/systemd - - name: fedora-30 + - name: fedora-31 driver: image: dokken/fedora-31 pid_one_command: /usr/lib/systemd/systemd diff --git a/kitchen.yml b/kitchen.yml index b97d0b0c..4ea2be43 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -18,8 +18,8 @@ platforms: - name: debian-10 - name: freebsd-11 - name: freebsd-12 - - name: fedora-30 - name: fedora-31 + - name: fedora-32 - name: opensuse-leap-15 - name: ubuntu-18.04 - name: ubuntu-20.04 diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index d5f0230f..33fb49ca 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -1,4 +1,6 @@ +resource_name :adoptopenjdk_install provides :adoptopenjdk_install + default_action :install # Common options diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb index 1ff5348b..820c7154 100644 --- a/resources/adoptopenjdk_linux_install.rb +++ b/resources/adoptopenjdk_linux_install.rb @@ -1,4 +1,6 @@ +resource_name :adoptopenjdk_linux_install provides :adoptopenjdk_linux_install + include Java::Cookbook::AdoptOpenJdkHelpers property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb index 6cf05b7a..4a03186e 100644 --- a/resources/adoptopenjdk_macos_install.rb +++ b/resources/adoptopenjdk_macos_install.rb @@ -1,4 +1,6 @@ +resource_name :adoptopenjdk_macos_install provides :adoptopenjdk_macos_install + include Java::Cookbook::AdoptOpenJdkMacOsHelpers property :tap_full, [true, false], diff --git a/resources/alternatives.rb b/resources/alternatives.rb index 792744f3..cd98eba4 100644 --- a/resources/alternatives.rb +++ b/resources/alternatives.rb @@ -1,6 +1,6 @@ # # Cookbook:: java -# Provider:: alternatives +# Resource:: alternatives # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 4102b4de..4a451050 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -1,4 +1,6 @@ +resource_name :corretto_install provides :corretto_install + include Java::Cookbook::CorrettoHelpers property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/jce.rb b/resources/jce.rb index e01c23d6..b01ddc12 100644 --- a/resources/jce.rb +++ b/resources/jce.rb @@ -1,6 +1,6 @@ # # Cookbook:: java -# Provider:: jce +# Resource:: jce # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index eebe8872..20e7141d 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -1,4 +1,6 @@ +resource_name :openjdk_install provides :openjdk_install + include Java::Cookbook::OpenJdkHelpers default_action :install diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 8f43f76b..7904537b 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -1,4 +1,6 @@ +resource_name :openjdk_pkg_install provides :openjdk_pkg_install + include Java::Cookbook::OpenJdkHelpers default_action :install diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index 20f4b62a..ee3c9a92 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,4 +1,6 @@ +resource_name :openjdk_install provides :openjdk_install + include Java::Cookbook::OpenJdkHelpers default_action :install From 37129a8faa7956949ac6b5ed60633494ee6994f0 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Thu, 18 Jun 2020 12:40:20 +0100 Subject: [PATCH 018/278] Release 8.3.0 --- CHANGELOG.md | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0a448a7..ccdfeb6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## UNRELEASED +## 8.3.0 (2020-06-18) - Restore compatibility with Chef Infra Client < 16 - Update Fedora releases in the Kitchen configs diff --git a/metadata.rb b/metadata.rb index aca6b097..e8f2de81 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.2.1' +version '8.3.0' supports 'debian' supports 'ubuntu' From d460152b585f863e841b579d10c8870fb190cb2b Mon Sep 17 00:00:00 2001 From: Xorima's Bot Date: Thu, 18 Jun 2020 14:50:09 +0100 Subject: [PATCH 019/278] Standardise files with files in sous-chefs/repo-management (#625) Signed-off-by: Xorima Bot --- chefignore | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/chefignore b/chefignore index 7cc74609..7e243948 100644 --- a/chefignore +++ b/chefignore @@ -10,10 +10,6 @@ Icon? nohup.out Thumbs.db -# SASS # -######## -.sass-cache - # EDITORS # ########### .#* @@ -26,10 +22,11 @@ Thumbs.db *.tmproj *~ \#* -mkmf.log REVISION TAGS* tmtags +.vscode +.editorconfig ## COMPILED ## ############## @@ -42,6 +39,7 @@ tmtags *.so */rdoc/ a.out +mkmf.log # Testing # ########### @@ -95,7 +93,7 @@ Gemfile.lock Policyfile.rb Policyfile.lock.json -# Cookbooks # +# Documentation # ############# CHANGELOG* CONTRIBUTING* From 9b0e821ce6762ceaa3853984d53988b76fd144a8 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Tue, 23 Jun 2020 13:00:35 +0000 Subject: [PATCH 020/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- chefignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chefignore b/chefignore index 7e243948..7c03abca 100644 --- a/chefignore +++ b/chefignore @@ -95,7 +95,7 @@ Policyfile.lock.json # Documentation # ############# -CHANGELOG* +# CHANGELOG* CONTRIBUTING* TESTING* CODE_OF_CONDUCT* From 63c8de9987625edb4f8d69a35b8b33b4e2e2b602 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Mon, 29 Jun 2020 13:00:38 +0000 Subject: [PATCH 021/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- chefignore | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/chefignore b/chefignore index 7c03abca..cc170ea7 100644 --- a/chefignore +++ b/chefignore @@ -9,6 +9,7 @@ ehthumbs.db Icon? nohup.out Thumbs.db +.envrc # EDITORS # ########### @@ -45,17 +46,23 @@ mkmf.log ########### .circleci/* .codeclimate.yml +.delivery/* .foodcritic .kitchen* +.mdlrc +.overcommit.yml .rspec .rubocop.yml .travis.yml .watchr +.yamllint azure-pipelines.yml +Dangerfile examples/* features/* Guardfile kitchen.yml* +mlc_config.json Procfile Rakefile spec/* @@ -68,6 +75,7 @@ test/* .gitconfig .github/* .gitignore +.gitkeep .gitmodules .svn */.bzr/* @@ -95,10 +103,11 @@ Policyfile.lock.json # Documentation # ############# -# CHANGELOG* +CODE_OF_CONDUCT* CONTRIBUTING* +documentation/* TESTING* -CODE_OF_CONDUCT* +UPGRADING* # Vagrant # ########### From 8fc0179df6ea473eb200b7f96f3bd49b53c8ef0d Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Thu, 6 Aug 2020 13:54:17 -0700 Subject: [PATCH 022/278] Extract correct JAVA_HOME from custom URLs (#632) * Extract correct JAVA_HOME from custom URLs Signed-off-by: Robert Detjens * fix YAML files * add new suite to Github Actions * Extract correct JAVA_HOME from non-JDK8 urls Signed-off-by: Robert Detjens * Add support for OpenJ9 / large heap custom URLs + condense Kitchen test + add library spec tests Signed-off-by: Robert Detjens * add new tests to Github CI * Remove redundant logic from url helper Signed-off-by: Robert Detjens * use URI.parse to check for bad URLs * cookstyle fix --- .github/workflows/ci.yml | 4 ++ CHANGELOG.md | 4 ++ .../resources/adoptopenjdk_install.md | 14 ++++- .../resources/adoptopenjdk_linux_install.md | 14 ++++- .../resources/adoptopenjdk_macos_install.md | 2 +- documentation/resources/corretto_install.md | 4 +- documentation/resources/openjdk_install.md | 4 +- .../resources/openjdk_pkg_install.md | 4 +- .../resources/openjdk_source_install.md | 4 +- kitchen.yml | 46 ++++++++++++++ libraries/adopt_openjdk_helpers.rb | 29 +++++---- resources/adoptopenjdk_install.rb | 2 +- spec/libraries/adopt_openjdk_helpers_spec.rb | 62 ++++++++++++++++++- .../cookbooks/test/recipes/custom_package.rb | 7 +++ .../custom-package/attributes/hotspot-11.yml | 4 ++ .../custom-package/attributes/hotspot-8.yml | 4 ++ .../custom-package/attributes/openj9-11.yml | 4 ++ .../attributes/openj9-large-heap-11.yml | 4 ++ .../custom-package/controls/verify_home.rb | 31 ++++++++++ test/integration/custom-package/inspec.yml | 7 +++ 20 files changed, 224 insertions(+), 30 deletions(-) create mode 100644 test/fixtures/cookbooks/test/recipes/custom_package.rb create mode 100644 test/integration/custom-package/attributes/hotspot-11.yml create mode 100644 test/integration/custom-package/attributes/hotspot-8.yml create mode 100644 test/integration/custom-package/attributes/openj9-11.yml create mode 100644 test/integration/custom-package/attributes/openj9-large-heap-11.yml create mode 100644 test/integration/custom-package/controls/verify_home.rb create mode 100644 test/integration/custom-package/inspec.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18bcf717..94a12ee0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,10 @@ jobs: - adoptopenjdk-removal-11-openj9 # - corretto-11 # - corretto-8 + - custom-package-8 + - custom-package-11 + - custom-package-11-openj9 + - custom-package-11-openj9-large-heap include: - os: ubuntu-2004 suite: openjdk-pkg-14 diff --git a/CHANGELOG.md b/CHANGELOG.md index ccdfeb6e..ee38eac7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + +- Extract correct JAVA_HOME from custom URLs + ## 8.3.0 (2020-06-18) - Restore compatibility with Chef Infra Client < 16 diff --git a/documentation/resources/adoptopenjdk_install.md b/documentation/resources/adoptopenjdk_install.md index 88ff04a8..b13aeb84 100644 --- a/documentation/resources/adoptopenjdk_install.md +++ b/documentation/resources/adoptopenjdk_install.md @@ -33,13 +33,13 @@ Introduced: v7.0.0 ## Examples -To install Hotspot AdoptOpenJDK 11 and set it as the default Java +To install Hotspot AdoptOpenJDK 11 and set it as the default Java: ```ruby adoptopenjdk_install '11' ``` -To install hotspot AdoptOpenJDK 11 and set it as second highest priority +To install hotspot AdoptOpenJDK 11 and set it as second highest priority: ```ruby adoptopenjdk_install '10' do @@ -47,3 +47,13 @@ adoptopenjdk_install '10' do alternatives_priority 2 end ``` + +To install AdoptOpenJDK 11 from a custom tarball: + +```ruby +adoptopenjdk_install '11' do + variant 'hotspot' + url 'http://url.of/path/to/OpenJDK11U-jdk_x64_linux_hotspot_11.0.7_10.tar.gz' + checksum 'asdfasdfasdf' +end +``` diff --git a/documentation/resources/adoptopenjdk_linux_install.md b/documentation/resources/adoptopenjdk_linux_install.md index 9b8e9f5d..022ec848 100644 --- a/documentation/resources/adoptopenjdk_linux_install.md +++ b/documentation/resources/adoptopenjdk_linux_install.md @@ -26,13 +26,13 @@ Introduced: v8.1.0 ## Examples -To install Hotspot AdoptOpenJDK 11 and set it as the default Java +To install Hotspot AdoptOpenJDK 11 and set it as the default Java: ```ruby adoptopenjdk_linux_install1 '11' ``` -To install hotspot AdoptOpenJDK 11 and set it as second highest priority +To install hotspot AdoptOpenJDK 11 and set it as second highest priority: ```ruby adoptopenjdk_linux_install1 '10' do @@ -40,3 +40,13 @@ adoptopenjdk_linux_install1 '10' do alternatives_priority 2 end ``` + +To install AdoptOpenJDK 11 from a custom tarball: + +```ruby +adoptopenjdk_install '11' do + variant 'hotspot' + url 'http://url.of/path/to/OpenJDK11U-jdk_x64_linux_hotspot_11.0.7_10.tar.gz' + checksum 'asdfasdfasdf' +end +``` diff --git a/documentation/resources/adoptopenjdk_macos_install.md b/documentation/resources/adoptopenjdk_macos_install.md index a8b71851..a1da02a3 100644 --- a/documentation/resources/adoptopenjdk_macos_install.md +++ b/documentation/resources/adoptopenjdk_macos_install.md @@ -58,7 +58,7 @@ Introduced: v8.1.0 ## Examples -To install Hotspot AdoptOpenJDK 11 and set it as the default Java +To install Hotspot AdoptOpenJDK 11 and set it as the default Java: ```ruby adoptopenjdk_macos_install 'adoptopenjdk14-jre' diff --git a/documentation/resources/corretto_install.md b/documentation/resources/corretto_install.md index 48132fb2..53abbbbd 100644 --- a/documentation/resources/corretto_install.md +++ b/documentation/resources/corretto_install.md @@ -28,13 +28,13 @@ Introduced: v8.0.0 ## Examples -To install Corretto 11 and set it as the default Java +To install Corretto 11 and set it as the default Java: ```ruby corretto_install '11' ``` -To install Corretto 11 and set it as second highest priority +To install Corretto 11 and set it as second highest priority: ```ruby corretto_install '8' do diff --git a/documentation/resources/openjdk_install.md b/documentation/resources/openjdk_install.md index 0db6fdf5..4a5f563c 100644 --- a/documentation/resources/openjdk_install.md +++ b/documentation/resources/openjdk_install.md @@ -30,13 +30,13 @@ Introduced: v8.0.0 ## Examples -To install OpenJDK 11 and set it as the default Java +To install OpenJDK 11 and set it as the default Java: ```ruby openjdk_install '11' ``` -To install OpenJDK 11 and set it as second highest priority +To install OpenJDK 11 and set it as second highest priority: ```ruby openjdk_install '11' do diff --git a/documentation/resources/openjdk_pkg_install.md b/documentation/resources/openjdk_pkg_install.md index 60d801e7..f7374d90 100644 --- a/documentation/resources/openjdk_pkg_install.md +++ b/documentation/resources/openjdk_pkg_install.md @@ -24,13 +24,13 @@ Introduced: v8.1.0 ## Examples -To install OpenJDK 11 and set it as the default Java +To install OpenJDK 11 and set it as the default Java: ```ruby openjdk_pkg_install '11' ``` -To install OpenJDK 11 and set it as second highest priority +To install OpenJDK 11 and set it as second highest priority: ```ruby openjdk_pkg_install '11' do diff --git a/documentation/resources/openjdk_source_install.md b/documentation/resources/openjdk_source_install.md index cd08d4c8..c6356ae6 100644 --- a/documentation/resources/openjdk_source_install.md +++ b/documentation/resources/openjdk_source_install.md @@ -27,13 +27,13 @@ Introduced: v8.0.0 ## Examples -To install OpenJDK 11 and set it as the default Java +To install OpenJDK 11 and set it as the default Java: ```ruby openjdk_install '11' ``` -To install OpenJDK 11 and set it as second highest priority +To install OpenJDK 11 and set it as second highest priority: ```ruby openjdk_install '11' do diff --git a/kitchen.yml b/kitchen.yml index 4ea2be43..7cb7e2e6 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -180,3 +180,49 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: {java_version: '11'} + + # Custom URL tests + - name: custom-package-8 + run_list: + - recipe[test::custom_package] + attributes: + version: 8 + variant: hotspot + url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK8U-jdk_x64_linux_hotspot_8u232b09.tar.gz + checksum: 7b7884f2eb2ba2d47f4c0bf3bb1a2a95b73a3a7734bd47ebf9798483a7bcc423 + verifier: + inspec_tests: [test/integration/custom-package] + input_files: [test/integration/custom-package/attributes/hotspot-8.yml] + - name: custom-package-11 + run_list: + - recipe[test::custom_package] + attributes: + version: 11 + variant: hotspot + url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz + checksum: 330d19a2eaa07ed02757d7a785a77bab49f5ee710ea03b4ee2fa220ddd0feffc + verifier: + inspec_tests: [test/integration/custom-package] + input_files: [test/integration/custom-package/attributes/hotspot-11.yml] + - name: custom-package-11-openj9 + run_list: + - recipe[test::custom_package] + attributes: + version: 11 + variant: openj9 + url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz + checksum: 1530172ee98edd129954fcdca1bf725f7b30c8bfc3cdc381c88de96b7d19e690 + verifier: + inspec_tests: [test/integration/custom-package] + input_files: [test/integration/custom-package/attributes/openj9-11.yml] + - name: custom-package-11-openj9-large-heap + run_list: + - recipe[test::custom_package] + attributes: + version: 11 + variant: openj9-large-heap + url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz + checksum: 6524d85d2ce334c955a4347015567326067ef15fe5f6a805714b25cace256f40 + verifier: + inspec_tests: [test/integration/custom-package] + input_files: [test/integration/custom-package/attributes/openj9-large-heap-11.yml] diff --git a/libraries/adopt_openjdk_helpers.rb b/libraries/adopt_openjdk_helpers.rb index c70c620c..3a47eed1 100644 --- a/libraries/adopt_openjdk_helpers.rb +++ b/libraries/adopt_openjdk_helpers.rb @@ -3,22 +3,25 @@ module Cookbook module AdoptOpenJdkHelpers def sub_dir(url) uri = URI.parse(url) - f = uri.path.split('/')[-2] + # get file basename without extension + basename = uri.path.split('/')[-1].gsub('.tar.gz', '') - case f - when /jdk8/ - result = f.split('_').first - when /jdk-14/ - result = f.split('_').first.gsub('%2B', '+') - result = result.slice(0..(result.index('.') - 1)) if result.include? '.' - result + if basename.include?('linuxXL') # compensate for longer name + # Get version number from start of filename + if (basename.scan /\d+/)[0] == '8' + ver = basename.split('_')[5] + "jdk#{ver[0..4]}-#{ver[-3..-1]}" + else + ver = basename.split('_') + "jdk-#{ver[5]}+#{ver[6]}" + end + elsif (basename.scan /\d+/)[0] == '8' + ver = basename.split('_')[4] + "jdk#{ver[0..4]}-#{ver[-3..-1]}" else - result = f.split('_').first.gsub('%2B', '+') + ver = basename.split('_') + "jdk-#{ver[4]}+#{ver[5]}" end - - raise("Failed to parse #{f} for directory name!") if result.empty? - - result end def default_adopt_openjdk_url(version) diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index 33fb49ca..908d81e5 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -14,7 +14,7 @@ property :java_home_mode, String, description: 'The permission for the Java home directory' property :java_home_owner, String, description: 'Owner of the Java Home' property :java_home_group, String, description: 'Group for the Java Home' -property :default, [true, false], description: ' Whether to set this as the defalut Java' +property :default, [true, false], description: ' Whether to set this as the default Java' property :bin_cmds, Array, description: 'A list of bin_cmds based on the version and variant' property :alternatives_priority, Integer, description: 'Alternatives priority to set for this Java' property :reset_alternatives, [true, false], description: 'Whether to reset alternatives before setting' diff --git a/spec/libraries/adopt_openjdk_helpers_spec.rb b/spec/libraries/adopt_openjdk_helpers_spec.rb index 6eb05071..e4a0e9b0 100644 --- a/spec/libraries/adopt_openjdk_helpers_spec.rb +++ b/spec/libraries/adopt_openjdk_helpers_spec.rb @@ -28,7 +28,7 @@ class DummyClass < Chef::Node end end - context 'OpenJKDK 8 Large Heap' do + context 'OpenJKDK 8 LargeHeap' do let(:url) { 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08_openj9-0.18.1/OpenJDK8U-jdk_x64_linux_openj9_linuxXL_8u242b08_openj9-0.18.1.tar.gz' } it 'returns the correct folder name' do @@ -75,6 +75,62 @@ class DummyClass < Chef::Node expect(subject.sub_dir(url)).to eq 'jdk-14+36' end end + + context 'Custom URL: AdoptOpenJDK 8 Hotspot' do + let(:url) { 'https://some.custom.url/path/to/OpenJDK8U-jdk_x64_linux_hotspot_8u242b08.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' + end + end + + context 'Custom URL: OpenJDK 8 OpenJ9' do + let(:url) { 'https://some.custom.url/path/to/OpenJDK8U-jdk_x64_linux_openj9_8u242b08_openj9-0.18.1.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' + end + end + + context 'Custom URL: OpenJKDK 8 LargeHeap' do + let(:url) { 'https://some.custom.url/path/to/OpenJDK8U-jdk_x64_linux_openj9_linuxXL_8u242b08_openj9-0.18.1.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' + end + end + + context 'Custom URL: AdoptOpenJDK 11 Hotspot' do + let(:url) { 'https://some.custom.url/path/to/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' + end + end + + context 'Custom URL: AdoptOpenJDK 11 OpenJ9' do + let(:url) { 'https://some.custom.url/path/to/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' + end + end + + context 'Custom URL: AdoptOpenJDK 11 LargeHeap' do + let(:url) { 'https://some.custom.url/path/to/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' + end + end + + context 'Malformed URL' do + let(:url) { 'a\bad/path/\to\/some.tar.gz' } + + it 'throws an error' do + expect { subject.sub_dir(url) }.to raise_error(URI::InvalidURIError) + end + end end describe '#default_adopt_openjdk_url' do @@ -86,7 +142,7 @@ class DummyClass < Chef::Node let(:version) { '11' } let(:variant) { 'openj9-large-heap' } - it 'returns the correct folder name' do + it 'returns the correct URL' do expect(subject.default_adopt_openjdk_url(version)[variant]).to eq 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz' end end @@ -95,7 +151,7 @@ class DummyClass < Chef::Node let(:version) { '11' } let(:variant) { 'openj9' } - it 'returns the correct folder name' do + it 'returns the correct URL' do expect(subject.default_adopt_openjdk_url(version)[variant]).to eq 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz' end end diff --git a/test/fixtures/cookbooks/test/recipes/custom_package.rb b/test/fixtures/cookbooks/test/recipes/custom_package.rb new file mode 100644 index 00000000..4b59004e --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/custom_package.rb @@ -0,0 +1,7 @@ +adoptopenjdk_install node['version'] do + variant node['variant'] + url node['url'] + checksum node['checksum'] + default true + alternatives_priority 1 +end diff --git a/test/integration/custom-package/attributes/hotspot-11.yml b/test/integration/custom-package/attributes/hotspot-11.yml new file mode 100644 index 00000000..b3ec265e --- /dev/null +++ b/test/integration/custom-package/attributes/hotspot-11.yml @@ -0,0 +1,4 @@ +--- +variant: hotspot +java_version: 11.0.6 +java_home_dir: jdk-11.0.6+10 diff --git a/test/integration/custom-package/attributes/hotspot-8.yml b/test/integration/custom-package/attributes/hotspot-8.yml new file mode 100644 index 00000000..e848987d --- /dev/null +++ b/test/integration/custom-package/attributes/hotspot-8.yml @@ -0,0 +1,4 @@ +--- +variant: hotspot +java_version: 1.8.0_232 +java_home_dir: jdk8u232-b09 diff --git a/test/integration/custom-package/attributes/openj9-11.yml b/test/integration/custom-package/attributes/openj9-11.yml new file mode 100644 index 00000000..cfefb59b --- /dev/null +++ b/test/integration/custom-package/attributes/openj9-11.yml @@ -0,0 +1,4 @@ +--- +variant: openj9 +java_version: 11.0.6 +java_home_dir: jdk-11.0.6+10 diff --git a/test/integration/custom-package/attributes/openj9-large-heap-11.yml b/test/integration/custom-package/attributes/openj9-large-heap-11.yml new file mode 100644 index 00000000..6bf147e5 --- /dev/null +++ b/test/integration/custom-package/attributes/openj9-large-heap-11.yml @@ -0,0 +1,4 @@ +--- +variant: openj9-large-heap +java_version: 11.0.6 +java_home_dir: jdk-11.0.6+10 diff --git a/test/integration/custom-package/controls/verify_home.rb b/test/integration/custom-package/controls/verify_home.rb new file mode 100644 index 00000000..018d542f --- /dev/null +++ b/test/integration/custom-package/controls/verify_home.rb @@ -0,0 +1,31 @@ +variant = attribute('variant', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') +java_version = attribute('java_version', description: 'Which version of java should be installed') +parent_install_dir = attribute('parent_install_dir', + value: "java-#{java_version.to_i > 8 ? java_version.to_i : java_version.split('.')[1]}-adoptopenjdk-#{variant}", + description: 'The parent of the Java home') +java_home_dir = attribute('java_home_dir', description: 'Name of the JAVA_HOME directory') + +control 'check-java-version' do + impact 1.0 + title 'Verify java version' + desc 'Verify the correct version of java is installed' + + describe command('java -version 2>&1') do + its('stdout') { should match /AdoptOpenJDK/ } unless java_version.to_i == 1 + its('stdout') { should match Regexp.new(java_version.to_s) } + end +end + +control 'check-java-home' do + impact 1.0 + title 'Check JAVA_HOME is set' + desc 'Check that custom URL install sets JAVA_HOME properly' + + describe directory("/usr/lib/jvm/#{parent_install_dir}/#{java_home_dir}") do + it { should exist } + end + + describe file('/etc/profile.d/java.sh') do + its('content') { should eq "export JAVA_HOME=/usr/lib/jvm/#{parent_install_dir}/#{java_home_dir}\n" } + end +end diff --git a/test/integration/custom-package/inspec.yml b/test/integration/custom-package/inspec.yml new file mode 100644 index 00000000..e8b042ff --- /dev/null +++ b/test/integration/custom-package/inspec.yml @@ -0,0 +1,7 @@ +--- +name: custom-package +title: Custom package from URL testing +license: Public domain +copyright: None +summary: Verify installation from a custom URL +version: 0.0.1 From fdc15e55a8e1a860490056fee8ab873e503d1d62 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Thu, 6 Aug 2020 15:23:30 -0700 Subject: [PATCH 023/278] Release 8.3.1 Signed-off-by: Lance Albertson --- CHANGELOG.md | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee38eac7..d5138196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.3.1 (2020-08-06) - Extract correct JAVA_HOME from custom URLs diff --git a/metadata.rb b/metadata.rb index e8f2de81..0cbcfc16 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.3.0' +version '8.3.1' supports 'debian' supports 'ubuntu' From fb55286c3e312347653334201e8a9c73be36c618 Mon Sep 17 00:00:00 2001 From: Duncan Schulze Date: Tue, 18 Aug 2020 14:24:20 -0400 Subject: [PATCH 024/278] Add aarch64 systems for corretto installation --- libraries/corretto_helpers.rb | 36 ++++++++++++++++++------- spec/libraries/corretto_helpers_spec.rb | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index f9a2982c..c3fa1a8a 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -3,36 +3,52 @@ module Cookbook module CorrettoHelpers def default_corretto_url(version) if version.to_s == '8' - 'https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz' + if node['kernel']['machine'] =~ /x86_64/ + 'https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz' + elsif node['kernel']['machine'] =~ /aarch64/ + 'https://corretto.aws/downloads/latest/amazon-corretto-8-aarch64-linux-jdk.tar.gz' + end else - 'https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz' + if node['kernel']['machine'] =~ /x86_64/ + 'https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz' + elsif node['kernel']['machine'] =~ /aarch64/ + 'https://corretto.aws/downloads/latest/amazon-corretto-11-aarch64-linux-jdk.tar.gz' + end end end def default_corretto_checksum(version) if version.to_s == '8' - '7f08bc6097a14424bf09eb693304d48812099f29edb1d7326c6372a85b86b1df' + if node['kernel']['machine'] =~ /x86_64/ + '1db9c4bd89b9949c97bc5e690aedce2872bb716cf35c670a29cadeeb80d0cb18' + elsif node['kernel']['machine'] =~ /aarch64/ + '2e3755bac052ad7c502adbaec7823328644af3767abd1169974b144805eb718e' + end else - '24a487d594d10df540383c4c642444f969a00e616331d3dc3bdc4815ada71c0e' + if node['kernel']['machine'] =~ /x86_64/ + 'dbbf98ca93b44a0c81df5a3a4f2cebf467ec5c30e28c359e26615ffbed0b454f' + elsif node['kernel']['machine'] =~ /aarch64/ + 'f278647d126d973a841d80b0b6836b723f14c63ee0d0f1804b8d4125843b13ed' + end end end def default_corretto_bin_cmds(version) if version.to_s == '8' - ['appletviewer', 'clhsdb', 'extcheck', 'hsdb', 'idlj', 'jar', 'jarsigner', 'java', 'java-rmi.cgi', 'javac', 'javadoc', 'javafxpackager', 'javah', 'javap', 'javapackager', 'jcmd', 'jconsole', 'jdb', 'jdeps', 'jhat', 'jinfo', 'jjs', 'jmap', 'jps', 'jrunscript', 'jsadebugd', 'jstack', 'jstat', 'jstatd', 'keytool', 'native2ascii', 'orbd', 'pack200', 'policytool', 'rmic', 'rmid', 'rmiregistry', 'schemagen', 'serialver', 'servertool', 'tnameserv', 'unpack200', 'wsgen', 'wsimport', 'xjc'] + %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) else - %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) + %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) end end def corretto_sub_dir(version, full_version = nil) ver = if version == '8' - full_version || '8.242.08.1' + full_version || '8.265.01.1' else - full_version || '11.0.6.10.1' + full_version || '11.0.8.10.1' end - - "amazon-corretto-#{ver}-linux-x64" + arch = node['kernel']['machine'] + "amazon-corretto-#{ver}-linux-#{arch}" end end end diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index a6580ea9..b71226a3 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -69,7 +69,7 @@ class DummyClass < Chef::Node context 'No full_version passed for Corretto 11' do let(:version) { '11' } - it 'returns the default directory value for Corrretto 8' do + it 'returns the default directory value for Corrretto 11' do expect(subject.corretto_sub_dir(version)).to include '0.6.10.1' end end From 47d30108fa688f1f1e3f90f597b1b2f6d96f9d7d Mon Sep 17 00:00:00 2001 From: Duncan Schulze Date: Tue, 18 Aug 2020 14:30:57 -0400 Subject: [PATCH 025/278] add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5138196..959dc31e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the Java cookbook. +## Unrleased + +- Add aarch64 installation candidate for Corretto + ## 8.3.1 (2020-08-06) - Extract correct JAVA_HOME from custom URLs From 3be076513592f52010f45e2d20c82cedeb139d38 Mon Sep 17 00:00:00 2001 From: Duncan Schulze Date: Tue, 18 Aug 2020 14:39:54 -0400 Subject: [PATCH 026/278] fixes --- libraries/corretto_helpers.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index c3fa1a8a..9926b798 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -3,15 +3,15 @@ module Cookbook module CorrettoHelpers def default_corretto_url(version) if version.to_s == '8' - if node['kernel']['machine'] =~ /x86_64/ + if node['kernel']['machine'].match?('x86_64') 'https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz' - elsif node['kernel']['machine'] =~ /aarch64/ + elsif node['kernel']['machine'].match?('aarch64') 'https://corretto.aws/downloads/latest/amazon-corretto-8-aarch64-linux-jdk.tar.gz' end - else - if node['kernel']['machine'] =~ /x86_64/ + elsif version.to_s == '11' + if node['kernel']['machine'].match?('x86_64') 'https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz' - elsif node['kernel']['machine'] =~ /aarch64/ + elsif node['kernel']['machine'].match?('aarch64') 'https://corretto.aws/downloads/latest/amazon-corretto-11-aarch64-linux-jdk.tar.gz' end end @@ -19,15 +19,15 @@ def default_corretto_url(version) def default_corretto_checksum(version) if version.to_s == '8' - if node['kernel']['machine'] =~ /x86_64/ + if node['kernel']['machine'].match?('x86_64') '1db9c4bd89b9949c97bc5e690aedce2872bb716cf35c670a29cadeeb80d0cb18' - elsif node['kernel']['machine'] =~ /aarch64/ + elsif node['kernel']['machine'].match?('aarch64') '2e3755bac052ad7c502adbaec7823328644af3767abd1169974b144805eb718e' end - else - if node['kernel']['machine'] =~ /x86_64/ + elsif version.to_s == '11' + if node['kernel']['machine'].match?('x86_64') 'dbbf98ca93b44a0c81df5a3a4f2cebf467ec5c30e28c359e26615ffbed0b454f' - elsif node['kernel']['machine'] =~ /aarch64/ + elsif node['kernel']['machine'].match?('aarch64') 'f278647d126d973a841d80b0b6836b723f14c63ee0d0f1804b8d4125843b13ed' end end @@ -36,7 +36,7 @@ def default_corretto_checksum(version) def default_corretto_bin_cmds(version) if version.to_s == '8' %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) - else + elsif version.to_s == '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) end end @@ -44,7 +44,7 @@ def default_corretto_bin_cmds(version) def corretto_sub_dir(version, full_version = nil) ver = if version == '8' full_version || '8.265.01.1' - else + elsif version.to_s == '11' full_version || '11.0.8.10.1' end arch = node['kernel']['machine'] From 124776771062033f24db68b798abb3f75f0ad8a9 Mon Sep 17 00:00:00 2001 From: Duncan Schulze Date: Wed, 19 Aug 2020 10:34:56 -0400 Subject: [PATCH 027/278] fix tests --- CHANGELOG.md | 2 +- libraries/corretto_helpers.rb | 21 ++++---- spec/libraries/corretto_helpers_spec.rb | 71 +++++++++++++++++++++---- 3 files changed, 72 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 959dc31e..723c2d21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unrleased +## Unreleased - Add aarch64 installation candidate for Corretto diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 9926b798..0bcd494a 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -1,19 +1,16 @@ module Java module Cookbook module CorrettoHelpers + def correto_arch + node['kernel']['machine'].match?('aarch64') ? 'aarch64' : 'x64' + end + def default_corretto_url(version) + corretto_arch = corretto_arch if version.to_s == '8' - if node['kernel']['machine'].match?('x86_64') - 'https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz' - elsif node['kernel']['machine'].match?('aarch64') - 'https://corretto.aws/downloads/latest/amazon-corretto-8-aarch64-linux-jdk.tar.gz' - end + "https://corretto.aws/downloads/latest/amazon-corretto-8-#{corretto_arch}-linux-jdk.tar.gz" elsif version.to_s == '11' - if node['kernel']['machine'].match?('x86_64') - 'https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz' - elsif node['kernel']['machine'].match?('aarch64') - 'https://corretto.aws/downloads/latest/amazon-corretto-11-aarch64-linux-jdk.tar.gz' - end + "https://corretto.aws/downloads/latest/amazon-corretto-11-#{corretto_arch}-linux-jdk.tar.gz" end end @@ -47,8 +44,8 @@ def corretto_sub_dir(version, full_version = nil) elsif version.to_s == '11' full_version || '11.0.8.10.1' end - arch = node['kernel']['machine'] - "amazon-corretto-#{ver}-linux-#{arch}" + corretto_arch = corretto_arch + "amazon-corretto-#{ver}-linux-#{corretto_arch}" end end end diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index b71226a3..220576f0 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -10,18 +10,39 @@ class DummyClass < Chef::Node describe '#default_corretto_url' do before do allow(subject).to receive(:[]).with('version').and_return(version) + allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine) end - context 'Corretto 8' do + context 'Corretto 8 x64' do let(:version) { '8' } + let(:machine) { 'x86_64' } it 'returns the correct URL' do expect(subject.default_corretto_url(version)).to match /corretto-8.+\.tar.gz/ end end - context 'Corretto 11' do + context 'Corretto 11 x64' do let(:version) { '11' } + let(:machine) { 'x86_64' } + + it 'returns the correct URL' do + expect(subject.default_corretto_url(version)).to match /corretto-11.+\.tar.gz/ + end + end + + context 'Corretto 8 aarch64' do + let(:version) { '8' } + let(:machine) { 'aarch64' } + + it 'returns the correct URL' do + expect(subject.default_corretto_url(version)).to match /corretto-8.+\.tar.gz/ + end + end + + context 'Corretto 11 aarch64' do + let(:version) { '11' } + let(:machine) { 'aarch64' } it 'returns the correct URL' do expect(subject.default_corretto_url(version)).to match /corretto-11.+\.tar.gz/ @@ -56,31 +77,63 @@ class DummyClass < Chef::Node describe '#corretto_sub_dir' do before do allow(subject).to receive(:[]).with('version', 'full_version').and_return(version) + allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine) end - context 'No full_version passed for Corretto 8' do + context 'No full_version passed for Corretto 8 x64' do let(:version) { '8' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 8' do - expect(subject.corretto_sub_dir(version)).to include '242' + it 'returns the default directory value for Corrretto 8 x64' do + expect(subject.corretto_sub_dir(version)).to include '265' end end - context 'No full_version passed for Corretto 11' do + context 'No full_version passed for Corretto 8 aarch64' do + let(:version) { '8' } + let(:machine) { 'aarch64' } + + it 'returns the default directory value for Corrretto 8 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '265' + end + end + + context 'No full_version passed for Corretto 11 x64' do let(:version) { '11' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 11' do - expect(subject.corretto_sub_dir(version)).to include '0.6.10.1' + it 'returns the default directory value for Corrretto 11 x64' do + expect(subject.corretto_sub_dir(version)).to include '0.8.10.1' end end - context 'A full version passed for for Corretto 8' do + context 'No full_version passed for Corretto 11 aarch64' do + let(:version) { '11' } + let(:machine) { 'aarch64' } + + it 'returns the default directory value for Corrretto 11 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '0.8.10.1' + end + end + + context 'A full version passed for for Corretto 8 x64' do let(:version) { '8' } let(:full_version) { '8.123.45.6' } + let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 8' do expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' end end + + context 'A full version passed for for Corretto 8 aarch64' do + let(:version) { '8' } + let(:full_version) { '8.123.45.6' } + let(:machine) { 'aarch64' } + + it 'returns the default directory value for Corrretto 8 aarch64' do + expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' + end + end end end From cb6b488eea24140399466dbb9d438055097c9720 Mon Sep 17 00:00:00 2001 From: Duncan Schulze Date: Wed, 19 Aug 2020 10:39:37 -0400 Subject: [PATCH 028/278] small change --- spec/libraries/corretto_helpers_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index 220576f0..addd6406 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -121,7 +121,7 @@ class DummyClass < Chef::Node let(:full_version) { '8.123.45.6' } let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 8' do + it 'returns the default directory value for Corrretto 8 x64' do expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' end end From 3aec19c75863da22dee568209db1b0a8fdf43cfe Mon Sep 17 00:00:00 2001 From: Duncan Schulze Date: Wed, 19 Aug 2020 15:01:27 -0400 Subject: [PATCH 029/278] fix typo --- libraries/corretto_helpers.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 0bcd494a..7656fb87 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -1,12 +1,11 @@ module Java module Cookbook module CorrettoHelpers - def correto_arch + def corretto_arch node['kernel']['machine'].match?('aarch64') ? 'aarch64' : 'x64' end def default_corretto_url(version) - corretto_arch = corretto_arch if version.to_s == '8' "https://corretto.aws/downloads/latest/amazon-corretto-8-#{corretto_arch}-linux-jdk.tar.gz" elsif version.to_s == '11' @@ -44,7 +43,6 @@ def corretto_sub_dir(version, full_version = nil) elsif version.to_s == '11' full_version || '11.0.8.10.1' end - corretto_arch = corretto_arch "amazon-corretto-#{ver}-linux-#{corretto_arch}" end end From 7e7858c6a3cf6260f3767959b3a727abb685a897 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Thu, 20 Aug 2020 15:44:27 -0700 Subject: [PATCH 030/278] Release 8.3.2 Signed-off-by: Lance Albertson --- CHANGELOG.md | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 723c2d21..1adebc03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.3.2 (2020-08-20) - Add aarch64 installation candidate for Corretto diff --git a/metadata.rb b/metadata.rb index 0cbcfc16..40271d49 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.3.1' +version '8.3.2' supports 'debian' supports 'ubuntu' From 942d23097925a5c44acbcd8ec190e49a0c6cc312 Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Tue, 8 Sep 2020 06:02:28 -0700 Subject: [PATCH 031/278] add starttls property to java_certificate resource Signed-off-by: Joshua Colson --- CHANGELOG.md | 4 ++ documentation/resources/certificate.md | 1 + kitchen.macos.yml | 5 ++- kitchen.yml | 37 ++++++++++++++++--- resources/certificate.rb | 10 ++++- .../cookbooks/test/recipes/adoptopenjdk.rb | 14 +++++++ .../cookbooks/test/recipes/corretto.rb | 2 + .../cookbooks/test/recipes/java_cert.rb | 16 ++++++++ .../cookbooks/test/recipes/openjdk.rb | 2 + .../cookbooks/test/recipes/openjdk_pkg.rb | 2 + 10 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 1adebc03..8c9a05e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + +- Add `starttls` property to `java_certificate` resource to allow fetching certificates from non HTTPS endpoints + ## 8.3.2 (2020-08-20) - Add aarch64 installation candidate for Corretto diff --git a/documentation/resources/certificate.md b/documentation/resources/certificate.md index 681e4449..c2c9af7c 100644 --- a/documentation/resources/certificate.md +++ b/documentation/resources/certificate.md @@ -22,6 +22,7 @@ It can also populate the keystore with a certificate retrieved from a given SSL | `cert_data` | String | | The certificate data to install | | `cert_file` | String | | Path to a certificate file to install | | `ssl_endpoint` | String | | An SSL end-point from which to download the certificate | +| `starttls` | String | '' | Control the TLS protocol handler when fetching a remote certificate from `ssl_endpoint` | ## Examples diff --git a/kitchen.macos.yml b/kitchen.macos.yml index 3756e658..45d9d592 100644 --- a/kitchen.macos.yml +++ b/kitchen.macos.yml @@ -23,7 +23,10 @@ suites: - name: adoptopenjdk-14 run_list: - recipe[homebrew] - - recipe[test::adoptopenjdk-14-openj9] + - recipe[test::adoptopenjdk] + attributes: + version: 14 + variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-macos.yml] diff --git a/kitchen.yml b/kitchen.yml index 7cb7e2e6..3e6dfab0 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -99,19 +99,28 @@ suites: # Version 8 - name: adoptopenjdk-8-hotspot run_list: - - recipe[test::adoptopenjdk-8-hotspot] + - recipe[test::adoptopenjdk] + attributes: + version: 8 + variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml] - name: adoptopenjdk-8-openj9 run_list: - recipe[test::adoptopenjdk-8-openj9] + attributes: + version: 8 + variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9.yml] - name: adoptopenjdk-8-openj9-large-heap run_list: - - recipe[test::adoptopenjdk-8-openj9-large-heap] + - recipe[test::adoptopenjdk] + attributes: + version: 8 + variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9-large-heap.yml] @@ -120,18 +129,27 @@ suites: - name: adoptopenjdk-11-hotspot run_list: - recipe[test::adoptopenjdk-11-hotspot] + attributes: + version: 11 + variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml] - name: adoptopenjdk-11-openj9 run_list: - recipe[test::adoptopenjdk-11-openj9] + attributes: + version: 11 + variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] - name: adoptopenjdk-11-openj9-large-heap run_list: - recipe[test::adoptopenjdk-11-openj9-large-heap] + attributes: + version: 11 + variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9-large-heap.yml] @@ -139,20 +157,29 @@ suites: # Version 14 - name: adoptopenjdk-14-openj9-large-heap run_list: - - recipe[test::adoptopenjdk-14-openj9-large-heap] + - recipe[test::adoptopenjdk] + attributes: + version: 14 + variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9-large-heap.yml] - name: adoptopenjdk-14-openj9 run_list: - - recipe[test::adoptopenjdk-14-openj9] + - recipe[test::adoptopenjdk] + attributes: + version: 14 + variant: openj9 verifier: inspec_tests: - test/integration/adoptopenjdk input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9.yml] - name: adoptopenjdk-14-hotspot run_list: - - recipe[test::adoptopenjdk-14-hotspot] + - recipe[test::adoptopenjdk] + attributes: + version: 14 + variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-hotspot.yml] diff --git a/resources/certificate.rb b/resources/certificate.rb index f411eb62..e8494946 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -27,7 +27,7 @@ property :java_version, String, default: lazy { node['java']['jdk_version'] }, - description: ' The java version' + description: 'The java version' property :keystore_path, String, description: 'Path to the keystore' @@ -45,6 +45,11 @@ property :ssl_endpoint, String, description: 'An SSL end-point from which to download the certificate' +property :starttls, String, + default: '', + equal_to: ['', 'smtp', 'pop3', 'imap', 'ftp', 'xmpp', 'xmpp-server', 'irc', 'postgres', 'mysql', 'lmtp', 'nntp', 'sieve', 'ldap'], + description: 'A protocol specific STARTTLS argument to use when fetching from an ssl_endpoint' + action :install do require 'openssl' @@ -140,8 +145,9 @@ def fetch_certdata return IO.read(new_resource.cert_file) unless new_resource.cert_file.nil? certendpoint = new_resource.ssl_endpoint + starttls = new_resource.starttls.empty? ? '' : "-starttls #{new_resource.starttls}" unless certendpoint.nil? - cmd = Mixlib::ShellOut.new("echo QUIT | openssl s_client -showcerts -servername #{certendpoint.split(':').first} -connect #{certendpoint} 2> /dev/null | openssl x509") + cmd = Mixlib::ShellOut.new("echo QUIT | openssl s_client -showcerts -servername #{certendpoint.split(':').first} -connect #{certendpoint} #{starttls} 2> /dev/null | openssl x509") cmd.run_command Chef::Log.debug(cmd.format_for_exception) diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb new file mode 100644 index 00000000..2c89076f --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb @@ -0,0 +1,14 @@ +apt_update + +version = node['version'] +variant = node['variant'] + +adoptopenjdk_install version do + variant variant +end + +cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do + source 'UnlimitedSupportJCETest.jar' +end + +include_recipe 'test::java_cert' diff --git a/test/fixtures/cookbooks/test/recipes/corretto.rb b/test/fixtures/cookbooks/test/recipes/corretto.rb index 216a4463..c79294d6 100644 --- a/test/fixtures/cookbooks/test/recipes/corretto.rb +++ b/test/fixtures/cookbooks/test/recipes/corretto.rb @@ -1 +1,3 @@ corretto_install node['version'] + +include_recipe 'test::java_cert' diff --git a/test/fixtures/cookbooks/test/recipes/java_cert.rb b/test/fixtures/cookbooks/test/recipes/java_cert.rb index 20a75055..857d1874 100644 --- a/test/fixtures/cookbooks/test/recipes/java_cert.rb +++ b/test/fixtures/cookbooks/test/recipes/java_cert.rb @@ -1,15 +1,31 @@ +version = node['version'].to_s + cookbook_file '/tmp/java_certificate_test.pem' do source 'java_certificate_test.pem' end java_certificate 'java_certificate_test' do cert_file '/tmp/java_certificate_test.pem' + java_version version end java_certificate 'java_certificate_ssl_endpoint' do ssl_endpoint 'google.com:443' + java_version version end java_certificate 'java_certificate_ssl_endpoint' do + java_version version + action :remove +end + +java_certificate 'java_certificate_ssl_endpoint_starttls_smtp' do + ssl_endpoint 'smtp.gmail.com:587' + starttls 'smtp' + java_version version +end + +java_certificate 'java_certificate_ssl_endpoint_starttls_smtp' do + java_version version action :remove end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk.rb b/test/fixtures/cookbooks/test/recipes/openjdk.rb index f78349f5..97ce6d41 100644 --- a/test/fixtures/cookbooks/test/recipes/openjdk.rb +++ b/test/fixtures/cookbooks/test/recipes/openjdk.rb @@ -1 +1,3 @@ openjdk_install node['version'] + +include_recipe 'test::java_cert' diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb b/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb index 4201abdc..f1a81433 100644 --- a/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb +++ b/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb @@ -1 +1,3 @@ openjdk_pkg_install node['version'] + +include_recipe 'test::java_cert' From 044ff4ec98680f8be6dbd1dc4d90b07e9e734cb0 Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Tue, 8 Sep 2020 06:54:12 -0700 Subject: [PATCH 032/278] fix JAVA_HOME edge case bug in amazon linux with openjdk 11 Signed-off-by: Joshua Colson --- libraries/openjdk_helpers.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 2487de5a..f683c928 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -70,7 +70,8 @@ def default_openjdk_pkg_names(version) def default_openjdk_pkg_java_home(version) value_for_platform_family( - %w(rhel fedora amazon) => version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/java-#{version}", + %w(rhel fedora) => version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/java-#{version}", + amazon: version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/jre-#{version}", suse: "/usr/lib#{node['kernel']['machine'] == 'x86_64' ? '64' : nil}/jvm/java-1.#{version}.0", freebsd: "/usr/local/openjdk#{version}", arch: "/usr/lib/jvm/java-#{version}-openjdk", From df8a9feb7826f3009c2948a119ad872018be4365 Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Tue, 8 Sep 2020 07:17:06 -0700 Subject: [PATCH 033/278] updated inspec tests to address JAVA_HOME edge case bug Signed-off-by: Joshua Colson --- test/integration/openjdk_pkg/controls/verify_openjdk.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/openjdk_pkg/controls/verify_openjdk.rb b/test/integration/openjdk_pkg/controls/verify_openjdk.rb index 3cfd0bd4..7772b55f 100644 --- a/test/integration/openjdk_pkg/controls/verify_openjdk.rb +++ b/test/integration/openjdk_pkg/controls/verify_openjdk.rb @@ -9,6 +9,10 @@ end describe command('update-alternatives --display java') do - its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } + if java_version.to_i < 11 + its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } + else + its('stdout') { should match %r{\/usr\/lib\/jvm\/jre} } + end end end From 6074f3fd1369db2570298e095edd1fe5ac96e4ac Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Tue, 8 Sep 2020 09:23:10 -0700 Subject: [PATCH 034/278] cleanup unused fixture recipes Signed-off-by: Joshua Colson --- kitchen.macos.local.yml | 5 +++- kitchen.windows.yml | 2 +- kitchen.yml | 11 +++++--- .../test/recipes/adoptopenjdk-11-hotspot.rb | 26 ------------------- .../adoptopenjdk-11-openj9-large-heap.rb | 26 ------------------- .../test/recipes/adoptopenjdk-11-openj9.rb | 26 ------------------- .../test/recipes/adoptopenjdk-14-hotspot.rb | 26 ------------------- .../adoptopenjdk-14-openj9-large-heap.rb | 26 ------------------- .../test/recipes/adoptopenjdk-14-openj9.rb | 23 ---------------- .../test/recipes/adoptopenjdk-8-hotspot.rb | 26 ------------------- .../adoptopenjdk-8-openj9-large-heap.rb | 26 ------------------- .../test/recipes/adoptopenjdk-8-openj9.rb | 26 ------------------- .../recipes/remove-adoptopenjdk-11-openj9.rb | 2 +- 13 files changed, 13 insertions(+), 238 deletions(-) delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-hotspot.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9-large-heap.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-hotspot.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9-large-heap.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-hotspot.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9-large-heap.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9.rb diff --git a/kitchen.macos.local.yml b/kitchen.macos.local.yml index f1aa6219..24f8732e 100644 --- a/kitchen.macos.local.yml +++ b/kitchen.macos.local.yml @@ -16,7 +16,10 @@ suites: - name: adoptopenjdk-14 run_list: - recipe[homebrew] - - recipe[test::adoptopenjdk-14-openj9] + - recipe[test::adoptopenjdk] + attributes: + version: 14 + variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-macos.yml] diff --git a/kitchen.windows.yml b/kitchen.windows.yml index c3aa95f3..a2796166 100644 --- a/kitchen.windows.yml +++ b/kitchen.windows.yml @@ -14,7 +14,7 @@ # suites: # - name: adoptopenjdk-13-openj9 # run_list: -# - recipe[test::adoptopenjdk-13-openj9] +# - recipe[test::adoptopenjdk] # platforms: # - name: windows_2019 diff --git a/kitchen.yml b/kitchen.yml index 3e6dfab0..409f5154 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -108,7 +108,7 @@ suites: input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml] - name: adoptopenjdk-8-openj9 run_list: - - recipe[test::adoptopenjdk-8-openj9] + - recipe[test::adoptopenjdk] attributes: version: 8 variant: openj9 @@ -128,7 +128,7 @@ suites: # Version 11 - name: adoptopenjdk-11-hotspot run_list: - - recipe[test::adoptopenjdk-11-hotspot] + - recipe[test::adoptopenjdk] attributes: version: 11 variant: hotspot @@ -137,7 +137,7 @@ suites: input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml] - name: adoptopenjdk-11-openj9 run_list: - - recipe[test::adoptopenjdk-11-openj9] + - recipe[test::adoptopenjdk] attributes: version: 11 variant: openj9 @@ -146,7 +146,7 @@ suites: input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] - name: adoptopenjdk-11-openj9-large-heap run_list: - - recipe[test::adoptopenjdk-11-openj9-large-heap] + - recipe[test::adoptopenjdk] attributes: version: 11 variant: openj9-large-heap @@ -188,6 +188,9 @@ suites: - name: adoptopenjdk-removal-11-openj9 run_list: - recipe[test::remove-adoptopenjdk-11-openj9] + attributes: + version: 11 + variant: openj9 verifier: inspec_tests: [test/integration/remove-adoptopenjdk] input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-hotspot.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-hotspot.rb deleted file mode 100644 index b4afe5a6..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-hotspot.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '11' -variant = 'hotspot' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9-large-heap.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9-large-heap.rb deleted file mode 100644 index ee8c3283..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9-large-heap.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '11' -variant = 'openj9-large-heap' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9.rb deleted file mode 100644 index dab6de80..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-11-openj9.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '11' -variant = 'openj9' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-hotspot.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-hotspot.rb deleted file mode 100644 index 4d5d1f22..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-hotspot.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '14' -variant = 'hotspot' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9-large-heap.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9-large-heap.rb deleted file mode 100644 index 841899eb..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9-large-heap.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '14' -variant = 'openj9-large-heap' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9.rb deleted file mode 100644 index 7251ff50..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-14-openj9.rb +++ /dev/null @@ -1,23 +0,0 @@ -apt_update - -version = '14' - -adoptopenjdk_install version - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-hotspot.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-hotspot.rb deleted file mode 100644 index 0665310c..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-hotspot.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '8' -variant = 'hotspot' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9-large-heap.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9-large-heap.rb deleted file mode 100644 index ba8804c4..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9-large-heap.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '8' -variant = 'openj9-large-heap' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9.rb deleted file mode 100644 index 40c4f3d6..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk-8-openj9.rb +++ /dev/null @@ -1,26 +0,0 @@ -apt_update - -version = '8' -variant = 'openj9' - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/java_certificate_test.pem' do - source 'java_certificate_test.pem' -end - -java_certificate 'java_certificate_test' do - cert_file '/tmp/java_certificate_test.pem' - java_version version -end - -java_certificate 'java_certificate_ssl_endpoint' do - ssl_endpoint 'google.com:443' - java_version version -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end diff --git a/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb b/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb index 606df0e1..02857f5b 100644 --- a/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb +++ b/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb @@ -1,6 +1,6 @@ apt_update -include_recipe 'test::adoptopenjdk-11-openj9' +include_recipe 'test::adoptopenjdk' adoptopenjdk_install '11' do variant 'openj9' From f8cbea37e3ace7271358108e8ac15efae5b09c32 Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Tue, 8 Sep 2020 09:24:12 -0700 Subject: [PATCH 035/278] convert default value of starttls to nil Signed-off-by: Joshua Colson --- documentation/resources/certificate.md | 2 +- resources/certificate.rb | 5 ++--- test/integration/openjdk_pkg/controls/verify_openjdk.rb | 8 +++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/documentation/resources/certificate.md b/documentation/resources/certificate.md index c2c9af7c..e6922b17 100644 --- a/documentation/resources/certificate.md +++ b/documentation/resources/certificate.md @@ -22,7 +22,7 @@ It can also populate the keystore with a certificate retrieved from a given SSL | `cert_data` | String | | The certificate data to install | | `cert_file` | String | | Path to a certificate file to install | | `ssl_endpoint` | String | | An SSL end-point from which to download the certificate | -| `starttls` | String | '' | Control the TLS protocol handler when fetching a remote certificate from `ssl_endpoint` | +| `starttls` | String | | Control the TLS protocol handler when fetching a remote certificate from `ssl_endpoint` | ## Examples diff --git a/resources/certificate.rb b/resources/certificate.rb index e8494946..a3f9175d 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -46,8 +46,7 @@ description: 'An SSL end-point from which to download the certificate' property :starttls, String, - default: '', - equal_to: ['', 'smtp', 'pop3', 'imap', 'ftp', 'xmpp', 'xmpp-server', 'irc', 'postgres', 'mysql', 'lmtp', 'nntp', 'sieve', 'ldap'], + equal_to: ['smtp', 'pop3', 'imap', 'ftp', 'xmpp', 'xmpp-server', 'irc', 'postgres', 'mysql', 'lmtp', 'nntp', 'sieve', 'ldap'], description: 'A protocol specific STARTTLS argument to use when fetching from an ssl_endpoint' action :install do @@ -145,7 +144,7 @@ def fetch_certdata return IO.read(new_resource.cert_file) unless new_resource.cert_file.nil? certendpoint = new_resource.ssl_endpoint - starttls = new_resource.starttls.empty? ? '' : "-starttls #{new_resource.starttls}" + starttls = new_resource.starttls.nil? ? '' : "-starttls #{new_resource.starttls}" unless certendpoint.nil? cmd = Mixlib::ShellOut.new("echo QUIT | openssl s_client -showcerts -servername #{certendpoint.split(':').first} -connect #{certendpoint} #{starttls} 2> /dev/null | openssl x509") cmd.run_command diff --git a/test/integration/openjdk_pkg/controls/verify_openjdk.rb b/test/integration/openjdk_pkg/controls/verify_openjdk.rb index 7772b55f..2e09dd65 100644 --- a/test/integration/openjdk_pkg/controls/verify_openjdk.rb +++ b/test/integration/openjdk_pkg/controls/verify_openjdk.rb @@ -9,10 +9,12 @@ end describe command('update-alternatives --display java') do - if java_version.to_i < 11 - its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } - else + # the openjdk 11 package on amazon linux 2 creates a symbolic link + # using jre- rather than java- like the other platforms. + if os[:name] == 'amazon' && os[:release].start_with?('2') && java_version.to_i == 11 its('stdout') { should match %r{\/usr\/lib\/jvm\/jre} } + else + its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } end end end From ccef9becddc27eec2e9071e0ee8f9e3fe7c984fb Mon Sep 17 00:00:00 2001 From: Joshua Colson Date: Tue, 8 Sep 2020 09:28:46 -0700 Subject: [PATCH 036/278] fix cookstyle error Signed-off-by: Joshua Colson --- resources/certificate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/certificate.rb b/resources/certificate.rb index a3f9175d..3517c22f 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -46,7 +46,7 @@ description: 'An SSL end-point from which to download the certificate' property :starttls, String, - equal_to: ['smtp', 'pop3', 'imap', 'ftp', 'xmpp', 'xmpp-server', 'irc', 'postgres', 'mysql', 'lmtp', 'nntp', 'sieve', 'ldap'], + equal_to: %w(smtp pop3 imap ftp xmpp xmpp-server irc postgres mysql lmtp nntp sieve ldap), description: 'A protocol specific STARTTLS argument to use when fetching from an ssl_endpoint' action :install do From cb767c79551b52f92f1cf8ba9d653835f14f1400 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Wed, 9 Sep 2020 15:26:13 -0700 Subject: [PATCH 037/278] Release 8.4.0 Signed-off-by: Lance Albertson --- CHANGELOG.md | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c9a05e9..d7467c75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.4.0 (2020-09-09) - Add `starttls` property to `java_certificate` resource to allow fetching certificates from non HTTPS endpoints diff --git a/metadata.rb b/metadata.rb index 40271d49..68a4c1e0 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.3.2' +version '8.4.0' supports 'debian' supports 'ubuntu' From 496de465c68702a8388a37f8eb2c59b7dbb89ef3 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Fri, 18 Sep 2020 00:01:21 +0000 Subject: [PATCH 038/278] Cookstyle 6.18.8 Fixes Issues found and resolved with: spec/spec_helper.rb - 4:18 convention: Style/RedundantFileExtensionInRequire - Redundant .rb file extension detected. - 5:18 convention: Style/RedundantFileExtensionInRequire - Redundant .rb file extension detected. - 6:18 convention: Style/RedundantFileExtensionInRequire - Redundant .rb file extension detected. - 7:18 convention: Style/RedundantFileExtensionInRequire - Redundant .rb file extension detected. Signed-off-by: Xorima Bot --- CHANGELOG.md | 7 +++++++ spec/spec_helper.rb | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7467c75..cde4213a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + +- resolved cookstyle error: spec/spec_helper.rb:4:18 convention: `Style/RedundantFileExtensionInRequire` +- resolved cookstyle error: spec/spec_helper.rb:5:18 convention: `Style/RedundantFileExtensionInRequire` +- resolved cookstyle error: spec/spec_helper.rb:6:18 convention: `Style/RedundantFileExtensionInRequire` +- resolved cookstyle error: spec/spec_helper.rb:7:18 convention: `Style/RedundantFileExtensionInRequire` + ## 8.4.0 (2020-09-09) - Add `starttls` property to `java_certificate` resource to allow fetching certificates from non HTTPS endpoints diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e19e1f46..06bb7349 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,10 @@ require 'chefspec' require 'chefspec/berkshelf' -require_relative '../libraries/adopt_openjdk_helpers.rb' -require_relative '../libraries/adopt_openjdk_macos_helpers.rb' -require_relative '../libraries/corretto_helpers.rb' -require_relative '../libraries/openjdk_helpers.rb' +require_relative '../libraries/adopt_openjdk_helpers' +require_relative '../libraries/adopt_openjdk_macos_helpers' +require_relative '../libraries/corretto_helpers' +require_relative '../libraries/openjdk_helpers' RSpec.configure do |config| config.file_cache_path = File.join(Dir.tmpdir, 'chefspec') if config.respond_to?(:file_cache_path) From 90dd3b5de1bb6a4bdc3b1f428ab7f03001557d21 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Fri, 25 Sep 2020 13:00:36 +0000 Subject: [PATCH 039/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/stale.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..5b05e16d --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,28 @@ +--- +name: Mark stale issues and pull requests + +"on": + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v3 + - with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + close-issue-message: > + Closing due to inactivity. + If this is still an issue please reopen or open another issue. + Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! + Thanks, Sous-Chefs. + days-before-close: 7 + days-before-stale: 365 + stale-issue-message: > + Marking stale due to inactivity. + Remove stale label or comment or this will be closed in 7 days. + Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! + Thanks, Sous-Chefs. From d92280f9de432bce7d5ca92e4e7cac3a73482acc Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Sat, 26 Sep 2020 13:00:33 +0000 Subject: [PATCH 040/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5b05e16d..67d738d3 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/stale@v3 - - with: + with: repo-token: ${{ secrets.GITHUB_TOKEN }} close-issue-message: > Closing due to inactivity. From 858fe757e641830aee3555af3ae8aa04d541e161 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Tue, 29 Sep 2020 13:00:40 +0000 Subject: [PATCH 041/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/stale.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 67d738d3..0f337015 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,16 +13,16 @@ jobs: steps: - uses: actions/stale@v3 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - close-issue-message: > - Closing due to inactivity. - If this is still an issue please reopen or open another issue. - Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! - Thanks, Sous-Chefs. - days-before-close: 7 - days-before-stale: 365 - stale-issue-message: > - Marking stale due to inactivity. - Remove stale label or comment or this will be closed in 7 days. - Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! - Thanks, Sous-Chefs. + repo-token: ${{ secrets.GITHUB_TOKEN }} + close-issue-message: > + Closing due to inactivity. + If this is still an issue please reopen or open another issue. + Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! + Thanks, Sous-Chefs. + days-before-close: 7 + days-before-stale: 365 + stale-issue-message: > + Marking stale due to inactivity. + Remove stale label or comment or this will be closed in 7 days. + Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! + Thanks, Sous-Chefs. From e1e174b60a3a03d69f7b3ab21d764972c48f9e04 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Thu, 8 Oct 2020 13:00:47 +0000 Subject: [PATCH 042/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .editorconfig | 10 +++++++++- .gitignore | 19 ++++++++++--------- .yamllint | 1 + 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.editorconfig b/.editorconfig index 1656a6d5..cc21b046 100755 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,19 @@ -#https://EditorConfig.org +# https://EditorConfig.org + # top-most EditorConfig file root=true +# Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true + +# 2 space indentation indent_style = space indent_size = 2 + +# Avoid issues parsing cookbook files later charset = utf-8 + +# Avoid cookstyle warnings trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore index e085291b..be3b9a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,7 @@ *.rbc .config -coverage InstalledFiles -lib/bundler/man pkg -rdoc -spec/reports test/tmp test/version_tmp tmp @@ -14,27 +10,32 @@ _Store *# .#* \#*# -.*.sw[a-z] *.un~ *.tmp *.bk *.bkup -# ruby/bundler files +# editor files +.idea +.*.sw[a-z] + +# ruby/bundler/rspec files .ruby-version .ruby-gemset .rvmrc Gemfile.lock .bundle *.gem +coverage +spec/reports -# YARD artifacts +# YARD / rdoc artifacts .yardoc _yardoc doc/ -.idea +rdoc -# chef stuff +# chef infra stuff Berksfile.lock .kitchen kitchen.local.yml diff --git a/.yamllint b/.yamllint index ecfdffb8..2d696128 100644 --- a/.yamllint +++ b/.yamllint @@ -4,3 +4,4 @@ rules: line-length: max: 256 level: warning + document-start: disable From b8e45c1898c95bbad38258024dbc5b692c6a763b Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 24 Nov 2020 18:54:49 -0800 Subject: [PATCH 043/278] If installation issues with openjdk_install resource This actually fixes two issues: - Properly fix `resource_name` and `provides` parameters in `openjdk_source_install` resource as `openjdk_source_install`. - Use `new_resource.install` when references parameters in `openjdk_install` This resolves #645. Signed-off-by: Lance Albertson --- CHANGELOG.md | 1 + resources/openjdk_install.rb | 8 ++++---- resources/openjdk_source_install.rb | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cde4213a..0274cc61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This file is used to list changes made in each version of the Java cookbook. - resolved cookstyle error: spec/spec_helper.rb:5:18 convention: `Style/RedundantFileExtensionInRequire` - resolved cookstyle error: spec/spec_helper.rb:6:18 convention: `Style/RedundantFileExtensionInRequire` - resolved cookstyle error: spec/spec_helper.rb:7:18 convention: `Style/RedundantFileExtensionInRequire` +- If installation issues with `openjdk_install` resource (fixes #645) ## 8.4.0 (2020-09-09) diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 20e7141d..910589b0 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -20,7 +20,7 @@ property :java_home_group, String, description: 'Group for the Java Home' action :install do - if install_type == 'package' + if new_resource.install_type == 'package' openjdk_pkg_install new_resource.version do pkg_names new_resource.pkg_names pkg_version new_resource.pkg_version @@ -30,7 +30,7 @@ alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives end - elsif install_type == 'source' + elsif new_resource.install_type == 'source' openjdk_source_install new_resource.version do url new_resource.url checksum new_resource.checksum @@ -48,7 +48,7 @@ end action :remove do - if install_type == 'package' + if new_resource.install_type == 'package' openjdk_pkg_install new_resource.version do pkg_names new_resource.pkg_names pkg_version new_resource.pkg_version @@ -59,7 +59,7 @@ reset_alternatives new_resource.reset_alternatives action :remove end - elsif install_type == 'source' + elsif new_resource.install_type == 'source' openjdk_source_install new_resource.version do url new_resource.url checksum new_resource.checksum diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index ee3c9a92..e6d6a84f 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,5 +1,5 @@ -resource_name :openjdk_install -provides :openjdk_install +resource_name :openjdk_source_install +provides :openjdk_source_install include Java::Cookbook::OpenJdkHelpers default_action :install From feb5469d0a4dac8513583036e36e5fd9de176a0e Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 1 Dec 2020 08:47:11 -0800 Subject: [PATCH 044/278] Remove testing of Amazon Linux 1 Signed-off-by: Lance Albertson --- .github/workflows/ci.yml | 3 --- CHANGELOG.md | 1 + kitchen.dokken.yml | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94a12ee0..427722f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,6 @@ jobs: strategy: matrix: os: - - amazon-linux - amazonlinux-2 - debian-9 - debian-10 @@ -72,8 +71,6 @@ jobs: - os: ubuntu-2004 suite: openjdk-pkg-14 exclude: - - os: amazon-linux - suite: openjdk-pkg-11 - os: debian-9 suite: openjdk-pkg-11 - os: debian-10 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0274cc61..9a77d712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This file is used to list changes made in each version of the Java cookbook. - resolved cookstyle error: spec/spec_helper.rb:6:18 convention: `Style/RedundantFileExtensionInRequire` - resolved cookstyle error: spec/spec_helper.rb:7:18 convention: `Style/RedundantFileExtensionInRequire` - If installation issues with `openjdk_install` resource (fixes #645) +- Remove testing of Amazon Linux 1 ## 8.4.0 (2020-09-09) diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index f5286086..b85a6254 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -13,11 +13,6 @@ verifier: name: inspec platforms: - - name: amazon-linux - driver: - image: dokken/amazonlinux - pid_one_command: /sbin/init - - name: amazonlinux-2 driver: image: dokken/amazonlinux-2 From 7f6907b8a541742521636a49542b9023528f6eaf Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 1 Dec 2020 09:27:54 -0800 Subject: [PATCH 045/278] Create default_openjdk_install_method helper This new helper method automatically configures whether or not a platform has a package included for the platform and it's platform version. This allows users to simply use `openjdk_install` and let the resource decide which one to install. Signed-off-by: Lance Albertson --- libraries/openjdk_helpers.rb | 57 +++++++++++++++++++ resources/openjdk_install.rb | 5 +- .../openjdk/controls/verify_openjdk.rb | 8 ++- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index f683c928..90c5cfd6 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -1,6 +1,63 @@ module Java module Cookbook module OpenJdkHelpers + def default_openjdk_install_method(version) + case node['platform_family'] + when 'amazon' + case version.to_i + when 7, 8, 11 + 'package' + else + 'source' + end + when 'rhel', 'fedora' + case node['platform_version'].to_i + when 7 + case version.to_i + when 6, 7, 8, 11 + 'package' + else + 'source' + end + when 8 + case version.to_i + when 8, 11 + 'package' + else + 'source' + end + else + # Assume Fedora + case version.to_i + when 8, 11 + 'package' + else + 'source' + end + end + when 'debian' + if platform?('debian') + case node['platform_version'].to_i + when 9 + 'source' + when 10 + version.to_i == 11 ? 'package' : 'source' + end + else + version.to_i == 10 ? 'source' : 'package' + end + when 'suse' + case version.to_i + when 8, 9, 11 + 'package' + else + 'source' + end + else + 'package' + end + end + def default_openjdk_url(version) case version when '9' diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 910589b0..0b4bf8ca 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -5,7 +5,10 @@ default_action :install property :version, String, name_property: true, description: 'Java major version to install' -property :install_type, String, default: 'package', equal_to: %w( package source ), description: 'Installation type' +property :install_type, String, + default: lazy { default_openjdk_install_method(version) }, + equal_to: %w( package source ), + description: 'Installation type' property :pkg_names, [String, Array], description: 'List of packages to install' property :pkg_version, String, description: 'Package version to install' property :java_home, String, description: 'Set to override the java_home' diff --git a/test/integration/openjdk/controls/verify_openjdk.rb b/test/integration/openjdk/controls/verify_openjdk.rb index e966199f..59b59597 100644 --- a/test/integration/openjdk/controls/verify_openjdk.rb +++ b/test/integration/openjdk/controls/verify_openjdk.rb @@ -9,6 +9,12 @@ end describe command('update-alternatives --display jar') do - its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } + # the openjdk 11 package on amazon linux 2 creates a symbolic link + # using jre- rather than java- like the other platforms. + if os[:name] == 'amazon' && os[:release].start_with?('2') && java_version.to_i == 11 + its('stdout') { should match %r{\/usr\/lib\/jvm\/jre} } + else + its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } + end end end From 51853aa8326baea62f6441a10145baf49ceeb4cd Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 1 Dec 2020 09:28:53 -0800 Subject: [PATCH 046/278] Use fedora-latest for kitchen Just worry about the newest version of Fedora for testing. Signed-off-by: Lance Albertson --- CHANGELOG.md | 1 + kitchen.dokken.yml | 5 ----- kitchen.yml | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a77d712..09991af1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This file is used to list changes made in each version of the Java cookbook. - resolved cookstyle error: spec/spec_helper.rb:7:18 convention: `Style/RedundantFileExtensionInRequire` - If installation issues with `openjdk_install` resource (fixes #645) - Remove testing of Amazon Linux 1 +- Use fedora-latest ## 8.4.0 (2020-09-09) diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index b85a6254..994b5064 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -42,11 +42,6 @@ platforms: image: dokken/centos-8 pid_one_command: /usr/lib/systemd/systemd - - name: fedora-31 - driver: - image: dokken/fedora-31 - pid_one_command: /usr/lib/systemd/systemd - - name: fedora-latest driver: image: dokken/fedora-latest diff --git a/kitchen.yml b/kitchen.yml index 409f5154..deda1e20 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -18,8 +18,7 @@ platforms: - name: debian-10 - name: freebsd-11 - name: freebsd-12 - - name: fedora-31 - - name: fedora-32 + - name: fedora-latest - name: opensuse-leap-15 - name: ubuntu-18.04 - name: ubuntu-20.04 From 371d2df54fe269f3a3bd6d72a994067f493eb91a Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 1 Dec 2020 12:23:19 -0800 Subject: [PATCH 047/278] Fix paths for OpenSUSE Signed-off-by: Lance Albertson --- libraries/openjdk_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 90c5cfd6..1439d5f9 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -117,7 +117,7 @@ def default_openjdk_pkg_names(version) value_for_platform_family( amazon: version.to_i < 11 ? ["java-1.#{version}.0-openjdk", "java-1.#{version}.0-openjdk-devel"] : "java-#{version}-amazon-corretto", %w(rhel fedora) => version.to_i < 11 ? ["java-1.#{version}.0-openjdk", "java-1.#{version}.0-openjdk-devel"] : ["java-#{version}-openjdk", "java-#{version}-openjdk-devel"], - suse: ["java-1_#{version}_0-openjdk", "java-1_#{version}_0-openjdk-devel"], + suse: version.to_i == 8 ? ["java-1_#{version}_0-openjdk", "java-1_#{version}_0-openjdk-devel"] : ["java-#{version}-openjdk", "java-#{version}-openjdk-devel"], freebsd: version.to_i.eql?(7) ? 'openjdk' : "openjdk#{version}", arch: "openjdk#{version}", debian: ["openjdk-#{version}-jdk", "openjdk-#{version}-jre-headless"], @@ -129,7 +129,7 @@ def default_openjdk_pkg_java_home(version) value_for_platform_family( %w(rhel fedora) => version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/java-#{version}", amazon: version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/jre-#{version}", - suse: "/usr/lib#{node['kernel']['machine'] == 'x86_64' ? '64' : nil}/jvm/java-1.#{version}.0", + suse: "/usr/lib#{node['kernel']['machine'] == 'x86_64' ? '64' : nil}/jvm/java-#{version.to_i == 8 ? "1.#{version}.0" : version}", freebsd: "/usr/local/openjdk#{version}", arch: "/usr/lib/jvm/java-#{version}-openjdk", debian: "/usr/lib/jvm/java-#{version}-openjdk-#{node['kernel']['machine'] == 'x86_64' ? 'amd64' : 'i386'}", From 05c766364a665802116a12e4b2f6228e6307327b Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 1 Dec 2020 14:05:27 -0800 Subject: [PATCH 048/278] Fix MacOS Github Actions JAVA_HOME env vars This fixes the following error: ``` Error: Unable to process command '::set-env name=JAVA_HOME::/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home' successfully. Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ ``` Signed-off-by: Lance Albertson --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 427722f9..e29eb865 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,7 @@ jobs: echo "sourced profile for JAVA_HOME" echo "New JAVA home after Chef run is: ${JAVA_HOME}" # Magic line for github actions to persist the change - echo ::set-env name=JAVA_HOME::$(echo ${JAVA_HOME}) + echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV - name: Kitchen Verify uses: actionshub/test-kitchen@master env: From 8d056fc059428e0c9599cee6ac156761cedffb38 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 3 Dec 2020 18:32:22 +0000 Subject: [PATCH 049/278] Update changelog for 8.5.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09991af1..1b7b8438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.5.0 - *2020-12-03* - resolved cookstyle error: spec/spec_helper.rb:4:18 convention: `Style/RedundantFileExtensionInRequire` - resolved cookstyle error: spec/spec_helper.rb:5:18 convention: `Style/RedundantFileExtensionInRequire` From cdc48162b04b6684718a58c1d44db1afbd274244 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 3 Dec 2020 18:32:23 +0000 Subject: [PATCH 050/278] Update metadata for 8.5.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 68a4c1e0..fac47716 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.4.0' +version '8.5.0' supports 'debian' supports 'ubuntu' From 9b5abe4e52f8de571bc5ba97edc00b9d73ac4aa4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 3 Dec 2020 18:32:26 +0000 Subject: [PATCH 051/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b7b8438..5c3bdb3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 8.5.0 - *2020-12-03* - resolved cookstyle error: spec/spec_helper.rb:4:18 convention: `Style/RedundantFileExtensionInRequire` From 78323c64678e69e7e2e1ab9ab566be13b51f544a Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Tue, 12 Jan 2021 17:14:35 -0600 Subject: [PATCH 052/278] Adds Amazon Corretto 15 support Adds configurable file cache property to `java_certificate` Adds `cacerts` property for interacting with java cacerts file for Java 9+ --- README.md | 2 +- kitchen.yml | 92 ++++++++++++++++--------- libraries/corretto_helpers.rb | 24 +++++-- resources/certificate.rb | 82 ++++++++++------------ spec/libraries/corretto_helpers_spec.rb | 53 ++++++++++++-- spec/spec_helper.rb | 1 + 6 files changed, 163 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index d8fe9ca9..429d1f4c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) -This cookbook installs a Java JDK/JRE. It defaults to installing OpenJDK, but it can also install AdoptOpenJDK. +This cookbook installs a Java JDK/JRE. It defaults to installing [OpenJDK](https://openjdk.java.net/), but it can also install [AdoptOpenJDK](https://adoptopenjdk.net/) and [Amazon Corretto](https://corretto.aws/). ## Maintainers diff --git a/kitchen.yml b/kitchen.yml index deda1e20..e80b75a5 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -28,70 +28,70 @@ suites: - name: openjdk-10 run_list: - recipe[test::openjdk] - attributes: {version: '10'} + attributes: { version: '10' } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: '10'} + inputs: { java_version: '10' } - name: openjdk-11 run_list: - recipe[test::openjdk] - attributes: {version: '11'} + attributes: { version: '11' } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: '11'} + inputs: { java_version: '11' } - name: openjdk-12 run_list: - recipe[test::openjdk] - attributes: {version: '12'} + attributes: { version: '12' } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: '12'} + inputs: { java_version: '12' } - name: openjdk-13 run_list: - recipe[test::openjdk] - attributes: {version: '13'} + attributes: { version: '13' } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: '13'} + inputs: { java_version: '13' } # OpenJDK_PKG - name: openjdk-pkg-7 run_list: - recipe[test::openjdk_pkg] - attributes: {version: '7'} + attributes: { version: '7' } verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: '7'} - includes: ["amazon-linux", "amazonlinux-2", "centos-7"] + inputs: { java_version: '7' } + includes: ['amazon-linux', 'amazonlinux-2', 'centos-7'] - name: openjdk-pkg-8 run_list: - recipe[test::openjdk_pkg] - attributes: {version: '8'} + attributes: { version: '8' } verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: '8'} - excludes: ["debian-10"] + inputs: { java_version: '8' } + excludes: ['debian-10'] - name: openjdk-pkg-11 run_list: - recipe[test::openjdk_pkg] - attributes: {version: '11'} + attributes: { version: '11' } verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: '11'} - excludes: ["amazon-linux", "debian-9"] + inputs: { java_version: '11' } + excludes: ['amazon-linux', 'debian-9'] - name: openjdk-pkg-14 run_list: - recipe[test::openjdk_pkg] - attributes: {version: '14'} + attributes: { version: '14' } verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: '14'} + inputs: { java_version: '14' } includes: [ubuntu-20.04] # AdoptOpenJDK @@ -104,7 +104,8 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml] - name: adoptopenjdk-8-openj9 run_list: - recipe[test::adoptopenjdk] @@ -113,7 +114,8 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9.yml] - name: adoptopenjdk-8-openj9-large-heap run_list: - recipe[test::adoptopenjdk] @@ -122,7 +124,10 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9-large-heap.yml] + input_files: + [ + test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9-large-heap.yml, + ] # Version 11 - name: adoptopenjdk-11-hotspot @@ -133,7 +138,8 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml] - name: adoptopenjdk-11-openj9 run_list: - recipe[test::adoptopenjdk] @@ -142,7 +148,8 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] - name: adoptopenjdk-11-openj9-large-heap run_list: - recipe[test::adoptopenjdk] @@ -151,7 +158,10 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9-large-heap.yml] + input_files: + [ + test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9-large-heap.yml, + ] # Version 14 - name: adoptopenjdk-14-openj9-large-heap @@ -162,7 +172,10 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9-large-heap.yml] + input_files: + [ + test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9-large-heap.yml, + ] - name: adoptopenjdk-14-openj9 run_list: - recipe[test::adoptopenjdk] @@ -172,7 +185,8 @@ suites: verifier: inspec_tests: - test/integration/adoptopenjdk - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9.yml] - name: adoptopenjdk-14-hotspot run_list: - recipe[test::adoptopenjdk] @@ -181,7 +195,8 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-hotspot.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-hotspot.yml] # 11 Removal - name: adoptopenjdk-removal-11-openj9 @@ -192,23 +207,31 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/remove-adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] + input_files: + [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] # Corretto - name: corretto-8 run_list: - recipe[test::corretto] - attributes: {version: '8'} + attributes: { version: '8' } verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: '8'} + inputs: { java_version: '8' } - name: corretto-11 run_list: - recipe[test::corretto] - attributes: {version: '11'} + attributes: { version: '11' } verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: '11'} + inputs: { java_version: '11' } + - name: corretto-15 + run_list: + - recipe[test::corretto] + attributes: { version: '15' } + verifier: + inspec_tests: [test/integration/corretto] + inputs: { java_version: '15' } # Custom URL tests - name: custom-package-8 @@ -254,4 +277,5 @@ suites: checksum: 6524d85d2ce334c955a4347015567326067ef15fe5f6a805714b25cace256f40 verifier: inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/attributes/openj9-large-heap-11.yml] + input_files: + [test/integration/custom-package/attributes/openj9-large-heap-11.yml] diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 7656fb87..ca60415d 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -10,21 +10,29 @@ def default_corretto_url(version) "https://corretto.aws/downloads/latest/amazon-corretto-8-#{corretto_arch}-linux-jdk.tar.gz" elsif version.to_s == '11' "https://corretto.aws/downloads/latest/amazon-corretto-11-#{corretto_arch}-linux-jdk.tar.gz" + elsif version.to_s == '15' + "https://corretto.aws/downloads/latest/amazon-corretto-15-#{corretto_arch}-linux-jdk.tar.gz" end end def default_corretto_checksum(version) if version.to_s == '8' if node['kernel']['machine'].match?('x86_64') - '1db9c4bd89b9949c97bc5e690aedce2872bb716cf35c670a29cadeeb80d0cb18' + '25415701c864ec301975097f207e909d065eb7c452a501c0e4b4487e77fbdc7a' elsif node['kernel']['machine'].match?('aarch64') - '2e3755bac052ad7c502adbaec7823328644af3767abd1169974b144805eb718e' + '7b86c40410c75de44c311fe127bb1dd02c43040312d66b1363737ab3e7d77011' end elsif version.to_s == '11' if node['kernel']['machine'].match?('x86_64') - 'dbbf98ca93b44a0c81df5a3a4f2cebf467ec5c30e28c359e26615ffbed0b454f' + '448494766be37bb8a4ecd983a09742d28b1fa426684417b0dec2f3b03c44f3a3' elsif node['kernel']['machine'].match?('aarch64') - 'f278647d126d973a841d80b0b6836b723f14c63ee0d0f1804b8d4125843b13ed' + 'e25669eb74d6c270af303bc0d1d859dd9ff16a0288f00a9d0ba4105467fc9695' + end + elsif version.to_s == '15' + if node['kernel']['machine'].match?('x86_64') + '6bd07d74e11deeba9f8927f8353aa689ffaa2ada263b09a4c297c0c58887af0f' + elsif node['kernel']['machine'].match?('aarch64') + 'e5112fec0f4e6f3de048c5bd6a9a690dd07344436985755636df6dc18b4bfb62' end end end @@ -34,14 +42,18 @@ def default_corretto_bin_cmds(version) %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) elsif version.to_s == '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) + elsif version.to_s == '15' + %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jlink jmap jmod jpackage jps jrunscript jshell jstack jstat jstatd keytool rmid rmiregistry serialver) end end def corretto_sub_dir(version, full_version = nil) ver = if version == '8' - full_version || '8.265.01.1' + full_version || '8.275.01.1' elsif version.to_s == '11' - full_version || '11.0.8.10.1' + full_version || '11.0.9.11.1' + elsif version.to_s == '15' + full_version || '15.0.1.9.1' end "amazon-corretto-#{ver}-linux-#{corretto_arch}" end diff --git a/resources/certificate.rb b/resources/certificate.rb index 3517c22f..d656422c 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -17,6 +17,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +include Java::Cookbook::CertificateHelpers + property :cert_alias, String, name_property: true, description: 'The alias of the certificate in the keystore. This defaults to the name of the resource' @@ -27,9 +30,14 @@ property :java_version, String, default: lazy { node['java']['jdk_version'] }, - description: 'The java version' + description: 'The major java version' + +property :cacerts, [true, false], + default: true, + description: 'Specify true for interacting with the Java installation cacerts file. (Java 9+)' property :keystore_path, String, + default: lazy { default_truststore_path(java_version, java_home) }, description: 'Path to the keystore' property :keystore_passwd, String, @@ -49,46 +57,43 @@ equal_to: %w(smtp pop3 imap ftp xmpp xmpp-server irc postgres mysql lmtp nntp sieve ldap), description: 'A protocol specific STARTTLS argument to use when fetching from an ssl_endpoint' +property :file_cache_path, String, + default: Chef::Config[:file_cache_path], + description: 'Location to store certificate files' + action :install do require 'openssl' - java_home = new_resource.java_home - Chef::Log.info java_home - keytool = "#{java_home}/bin/keytool" - truststore = if new_resource.keystore_path.nil? - truststore_default_location - else - new_resource.keystore_path - end - truststore_passwd = new_resource.keystore_passwd - certalias = new_resource.cert_alias + keystore_argument = keystore_argument(new_resource.java_version, new_resource.cacerts, new_resource.keystore_path) + certdata = new_resource.cert_data || fetch_certdata hash = OpenSSL::Digest::SHA512.hexdigest(certdata) - certfile = "#{Chef::Config[:file_cache_path]}/#{certalias}.cert.#{hash}" - cmd = Mixlib::ShellOut.new("#{keytool} -list -keystore #{truststore} -storepass #{truststore_passwd} -rfc -alias \"#{certalias}\"") + certfile = ::File.join(new_resource.file_cache_path, "#{new_resource.cert_alias}.cert.#{hash}") + + cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -rfc -alias \"#{new_resource.cert_alias}\"") cmd.run_command keystore_cert = cmd.stdout.match(/^[-]+BEGIN.*END(\s|\w)+[-]+$/m).to_s keystore_cert_digest = keystore_cert.empty? ? nil : OpenSSL::Digest::SHA512.hexdigest(OpenSSL::X509::Certificate.new(keystore_cert).to_der) certfile_digest = OpenSSL::Digest::SHA512.hexdigest(OpenSSL::X509::Certificate.new(certdata).to_der) if keystore_cert_digest == certfile_digest - Chef::Log.debug("Certificate \"#{certalias}\" in keystore \"#{truststore}\" is up-to-date.") + Chef::Log.debug("Certificate \"#{new_resource.cert_alias}\" in keystore \"#{new_resource.keystore_path}\" is up-to-date.") else - cmd = Mixlib::ShellOut.new("#{keytool} -list -keystore #{truststore} -storepass #{truststore_passwd} -v") + cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -v") cmd.run_command - Chef::Log.info(cmd.format_for_exception) + Chef::Log.debug(cmd.format_for_exception) Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless cmd.exitstatus == 0 - has_key = !cmd.stdout[/Alias name: \b#{certalias}\s*$/i].nil? + has_key = !cmd.stdout[/Alias name: \b#{new_resource.cert_alias}\s*$/i].nil? if has_key - converge_by("delete existing certificate #{certalias} from #{truststore}") do - cmd = Mixlib::ShellOut.new("#{keytool} -delete -alias \"#{certalias}\" -keystore #{truststore} -storepass #{truststore_passwd}") + converge_by("delete existing certificate #{new_resource.cert_alias} from #{new_resource.keystore_path}") do + cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -delete -alias \"#{new_resource.cert_alias}\" #{keystore_argument} -storepass #{new_resource.keystore_passwd}") cmd.run_command Chef::Log.debug(cmd.format_for_exception) unless cmd.exitstatus == 0 - Chef::Application.fatal!("Error deleting existing certificate \"#{certalias}\" in " \ + Chef::Application.fatal!("Error deleting existing certificate \"#{new_resource.cert_alias}\" in " \ "keystore so it can be updated: #{cmd.exitstatus}", cmd.exitstatus) end end @@ -96,8 +101,8 @@ ::File.open(certfile, 'w', 0o644) { |f| f.write(certdata) } - converge_by("add certificate #{certalias} to keystore #{truststore}") do - cmd = Mixlib::ShellOut.new("#{keytool} -import -trustcacerts -alias \"#{certalias}\" -file #{certfile} -keystore #{truststore} -storepass #{truststore_passwd} -noprompt") + converge_by("add certificate #{new_resource.cert_alias} to keystore #{new_resource.keystore_path}") do + cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -import -trustcacerts -alias \"#{new_resource.cert_alias}\" -file #{certfile} #{keystore_argument} -storepass #{new_resource.keystore_passwd} -noprompt") cmd.run_command Chef::Log.debug(cmd.format_for_exception) @@ -110,33 +115,26 @@ end action :remove do - certalias = new_resource.name - truststore = if new_resource.keystore_path.nil? - truststore_default_location - else - new_resource.keystore_path - end - truststore_passwd = new_resource.keystore_passwd - keytool = "#{new_resource.java_home}/bin/keytool" - - cmd = Mixlib::ShellOut.new("#{keytool} -list -keystore #{truststore} -storepass #{truststore_passwd} -v | grep \"#{certalias}\"") + keystore_argument = keystore_argument(new_resource.java_version, new_resource.cacerts, new_resource.keystore_path) + + cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -v | grep \"#{new_resource.cert_alias}\"") cmd.run_command - has_key = !cmd.stdout[/Alias name: #{certalias}/].nil? - does_not_exist = cmd.stdout[/Alias <#{certalias}> does not exist/].nil? + has_key = !cmd.stdout[/Alias name: #{new_resource.cert_alias}/].nil? + does_not_exist = cmd.stdout[/Alias <#{new_resource.cert_alias}> does not exist/].nil? Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless (cmd.exitstatus == 0) || does_not_exist if has_key - converge_by("remove certificate #{certalias} from #{truststore}") do - cmd = Mixlib::ShellOut.new("#{keytool} -delete -alias \"#{certalias}\" -keystore #{truststore} -storepass #{truststore_passwd}") + converge_by("remove certificate #{new_resource.cert_alias} from #{new_resource.keystore_path}") do + cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -delete -alias \"#{new_resource.cert_alias}\" #{keystore_argument} -storepass #{new_resource.keystore_passwd}") cmd.run_command unless cmd.exitstatus == 0 - Chef::Application.fatal!("Error deleting existing certificate \"#{certalias}\" in " \ + Chef::Application.fatal!("Error deleting existing certificate \"#{new_resource.cert_alias}\" in " \ "keystore so it can be updated: #{cmd.exitstatus}", cmd.exitstatus) end end end - FileUtils.rm_f("#{Chef::Config[:file_cache_path]}/#{certalias}.cert.*") + FileUtils.rm_f("#{new_resource.file_cache_path}/#{new_resource.cert_alias}.cert.*") end action_class do @@ -159,12 +157,4 @@ def fetch_certdata Chef::Application.fatal!('At least one of cert_data, cert_file or ssl_endpoint attributes must be provided.', 999) end - - def truststore_default_location - if new_resource.java_version.to_i > 8 - "#{new_resource.java_home}/lib/security/cacerts" - else - "#{new_resource.java_home}/jre/lib/security/cacerts" - end - end end diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index addd6406..8f00267c 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -31,6 +31,15 @@ class DummyClass < Chef::Node end end + context 'Corretto 15 x64' do + let(:version) { '15' } + let(:machine) { 'x86_64' } + + it 'returns the correct URL' do + expect(subject.default_corretto_url(version)).to match /corretto-15.+\.tar.gz/ + end + end + context 'Corretto 8 aarch64' do let(:version) { '8' } let(:machine) { 'aarch64' } @@ -48,6 +57,15 @@ class DummyClass < Chef::Node expect(subject.default_corretto_url(version)).to match /corretto-11.+\.tar.gz/ end end + + context 'Corretto 15 aarch64' do + let(:version) { '15' } + let(:machine) { 'aarch64' } + + it 'returns the correct URL' do + expect(subject.default_corretto_url(version)).to match /corretto-15.+\.tar.gz/ + end + end end describe '#default_bin_cmds' do @@ -72,6 +90,15 @@ class DummyClass < Chef::Node expect(subject.default_corretto_bin_cmds(version)).to include 'jaotc' end end + + context 'Corretto 15' do + let(:version) { '15' } + + it 'returns the correct bin command array' do + expect(subject.default_corretto_bin_cmds(version)).to_not include 'unpack200' + expect(subject.default_corretto_bin_cmds(version)).to include 'jaotc' + end + end end describe '#corretto_sub_dir' do @@ -85,7 +112,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version)).to include '265' + expect(subject.corretto_sub_dir(version)).to include '275' end end @@ -94,7 +121,7 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '265' + expect(subject.corretto_sub_dir(version)).to include '275' end end @@ -103,7 +130,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 11 x64' do - expect(subject.corretto_sub_dir(version)).to include '0.8.10.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.9.11.1' end end @@ -112,7 +139,25 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 11 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '0.8.10.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.9.11.1' + end + end + + context 'No full_version passed for Corretto 15 x64' do + let(:version) { '15' } + let(:machine) { 'x86_64' } + + it 'returns the default directory value for Corrretto 15 x64' do + expect(subject.corretto_sub_dir(version)).to include '15.0.1.9.1' + end + end + + context 'No full_version passed for Corretto 15 aarch64' do + let(:version) { '15' } + let(:machine) { 'aarch64' } + + it 'returns the default directory value for Corrretto 15 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '15.0.1.9.1' end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 06bb7349..5906593e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,6 +3,7 @@ require_relative '../libraries/adopt_openjdk_helpers' require_relative '../libraries/adopt_openjdk_macos_helpers' +require_relative '../libraries/certificate_helpers' require_relative '../libraries/corretto_helpers' require_relative '../libraries/openjdk_helpers' From 298449b68d29e6cfeabcbb02f36b50e2affe1e29 Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Tue, 12 Jan 2021 17:30:12 -0600 Subject: [PATCH 053/278] Fix yaml spaces --- kitchen.yml | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index e80b75a5..c43ab7a8 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -28,70 +28,70 @@ suites: - name: openjdk-10 run_list: - recipe[test::openjdk] - attributes: { version: '10' } + attributes: {version: "10"} verifier: inspec_tests: [test/integration/openjdk] - inputs: { java_version: '10' } + inputs: {java_version: "10"} - name: openjdk-11 run_list: - recipe[test::openjdk] - attributes: { version: '11' } + attributes: {version: "11"} verifier: inspec_tests: [test/integration/openjdk] - inputs: { java_version: '11' } + inputs: {java_version: "11"} - name: openjdk-12 run_list: - recipe[test::openjdk] - attributes: { version: '12' } + attributes: {version: "12"} verifier: inspec_tests: [test/integration/openjdk] - inputs: { java_version: '12' } + inputs: {java_version: "12"} - name: openjdk-13 run_list: - recipe[test::openjdk] - attributes: { version: '13' } + attributes: {version: "13"} verifier: inspec_tests: [test/integration/openjdk] - inputs: { java_version: '13' } + inputs: {java_version: "13"} # OpenJDK_PKG - name: openjdk-pkg-7 run_list: - recipe[test::openjdk_pkg] - attributes: { version: '7' } + attributes: {version: "7"} verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: { java_version: '7' } - includes: ['amazon-linux', 'amazonlinux-2', 'centos-7'] + inputs: {java_version: "7"} + includes: ["amazon-linux", "amazonlinux-2", "centos-7"] - name: openjdk-pkg-8 run_list: - recipe[test::openjdk_pkg] - attributes: { version: '8' } + attributes: {version: "8"} verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: { java_version: '8' } - excludes: ['debian-10'] + inputs: {java_version: "8"} + excludes: ["debian-10"] - name: openjdk-pkg-11 run_list: - recipe[test::openjdk_pkg] - attributes: { version: '11' } + attributes: {version: "11"} verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: { java_version: '11' } - excludes: ['amazon-linux', 'debian-9'] + inputs: {java_version: "11"} + excludes: ["amazon-linux", "debian-9"] - name: openjdk-pkg-14 run_list: - recipe[test::openjdk_pkg] - attributes: { version: '14' } + attributes: {version: "14"} verifier: inspec_tests: [test/integration/openjdk_pkg] - inputs: { java_version: '14' } + inputs: {java_version: "14"} includes: [ubuntu-20.04] # AdoptOpenJDK @@ -214,24 +214,24 @@ suites: - name: corretto-8 run_list: - recipe[test::corretto] - attributes: { version: '8' } + attributes: {version: "8"} verifier: inspec_tests: [test/integration/corretto] - inputs: { java_version: '8' } + inputs: {java_version: "8"} - name: corretto-11 run_list: - recipe[test::corretto] - attributes: { version: '11' } + attributes: {version: "11"} verifier: inspec_tests: [test/integration/corretto] - inputs: { java_version: '11' } + inputs: {java_version: "11"} - name: corretto-15 run_list: - recipe[test::corretto] - attributes: { version: '15' } + attributes: {version: "15"} verifier: inspec_tests: [test/integration/corretto] - inputs: { java_version: '15' } + inputs: {java_version: "15"} # Custom URL tests - name: custom-package-8 From 33b0856bcac06aa063653957f4b47fcf5c72ef25 Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Tue, 12 Jan 2021 17:36:42 -0600 Subject: [PATCH 054/278] Added missing certificate_helpers library and tests --- libraries/certificate_helpers.rb | 21 ++++++++ spec/libraries/certificate_helpers_spec.rb | 61 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 libraries/certificate_helpers.rb create mode 100644 spec/libraries/certificate_helpers_spec.rb diff --git a/libraries/certificate_helpers.rb b/libraries/certificate_helpers.rb new file mode 100644 index 00000000..6dad63e6 --- /dev/null +++ b/libraries/certificate_helpers.rb @@ -0,0 +1,21 @@ +module Java + module Cookbook + module CertificateHelpers + def default_truststore_path(version, java_home) + if version.to_i > 8 + "#{java_home}/lib/security/cacerts" + else + "#{java_home}/jre/lib/security/cacerts" + end + end + + def keystore_argument(version, cacerts, truststore_path) + if version.to_i > 8 && cacerts + '-cacerts' + else + "-keystore #{truststore_path}" + end + end + end + end +end diff --git a/spec/libraries/certificate_helpers_spec.rb b/spec/libraries/certificate_helpers_spec.rb new file mode 100644 index 00000000..926f8f3e --- /dev/null +++ b/spec/libraries/certificate_helpers_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +RSpec.describe Java::Cookbook::CertificateHelpers do + class DummyClass < Chef::Node + include Java::Cookbook::CertificateHelpers + end + + subject { DummyClass.new } + + describe '#default_truststore_path' do + context 'Java 8' do + let(:version) { '8' } + let(:java_home) { '/usr/lib/jvm/corretto-8' } + + it 'returns the correct path' do + expect(subject.default_truststore_path(version, java_home)).to eq('/usr/lib/jvm/corretto-8/jre/lib/security/cacerts') + end + end + + context 'Java 9' do + let(:version) { '9' } + let(:java_home) { '/usr/lib/jvm/corretto-9' } + + it 'returns the correct path' do + expect(subject.default_truststore_path(version, java_home)).to eq('/usr/lib/jvm/corretto-9/lib/security/cacerts') + end + end + end + + describe '#keystore_argument' do + context 'Java 8 and cacerts' do + let(:version) { '8' } + let(:cacerts) { true } + let(:truststore_path) { '/usr/lib/jvm/corretto-8/jre/lib/security/cacerts' } + + it 'returns the correct argument' do + expect(subject.keystore_argument(version, cacerts, truststore_path)).to eq('-keystore /usr/lib/jvm/corretto-8/jre/lib/security/cacerts') + end + end + + context 'Java 9 and cacerts' do + let(:version) { '9' } + let(:cacerts) { true } + let(:truststore_path) { '/usr/lib/jvm/corretto-9/jre/lib/security/cacerts' } + + it 'returns the correct argument' do + expect(subject.keystore_argument(version, cacerts, truststore_path)).to eq('-cacerts') + end + end + + context 'Java 9 and no cacerts' do + let(:version) { '9' } + let(:cacerts) { false } + let(:truststore_path) { '/mycertstore.jks' } + + it 'returns the correct argument' do + expect(subject.keystore_argument(version, cacerts, truststore_path)).to eq('-keystore /mycertstore.jks') + end + end + end +end From 35e458553ce7fd10d3c3e0b2eda12bc02d4d378f Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Tue, 12 Jan 2021 18:49:46 -0600 Subject: [PATCH 055/278] Enable corretto suites and add 15 --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e29eb865..f4c585f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,8 +61,9 @@ jobs: - adoptopenjdk-14-openj9 - adoptopenjdk-14-openj9-large-heap - adoptopenjdk-removal-11-openj9 - # - corretto-11 - # - corretto-8 + - corretto-8 + - corretto-11 + - corretto-15 - custom-package-8 - custom-package-11 - custom-package-11-openj9 From c3c8cf3ed94728efafbaadd7cd5865f95c410597 Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Mon, 18 Jan 2021 21:27:24 -0600 Subject: [PATCH 056/278] Had the incorrect corretto 11 version --- libraries/corretto_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index ca60415d..44aa786c 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -51,7 +51,7 @@ def corretto_sub_dir(version, full_version = nil) ver = if version == '8' full_version || '8.275.01.1' elsif version.to_s == '11' - full_version || '11.0.9.11.1' + full_version || '11.0.9.12.1' elsif version.to_s == '15' full_version || '15.0.1.9.1' end From 68241a2eb9923bf24db740b44147fddffa2eb5a8 Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Mon, 18 Jan 2021 21:33:41 -0600 Subject: [PATCH 057/278] Fix Corretto 11 tests --- spec/libraries/corretto_helpers_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index 8f00267c..9e01917e 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -130,7 +130,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 11 x64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.9.11.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.9.12.1' end end @@ -139,7 +139,7 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 11 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.9.11.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.9.12.1' end end From 617e24e363fc23c45148b879252f536f6cc93f34 Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Tue, 19 Jan 2021 22:06:12 -0600 Subject: [PATCH 058/278] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c3bdb3f..5246c042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Added Amazon Corretto 15 support to `corretto_install` +- Added configurable `file_cache_path` property to `java_certificate` +- Added `cacerts` property to `java_certificate` for interacting with java cacerts file (Java 9+) + ## 8.5.0 - *2020-12-03* - resolved cookstyle error: spec/spec_helper.rb:4:18 convention: `Style/RedundantFileExtensionInRequire` From 3f13e312aa324e87ef77e6e8f6951956567934d6 Mon Sep 17 00:00:00 2001 From: Jared Kauppila Date: Thu, 21 Jan 2021 11:30:20 -0600 Subject: [PATCH 059/278] Update 8 and 11 hashes --- libraries/corretto_helpers.rb | 12 ++++++------ spec/libraries/corretto_helpers_spec.rb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 44aa786c..5a432d20 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -18,15 +18,15 @@ def default_corretto_url(version) def default_corretto_checksum(version) if version.to_s == '8' if node['kernel']['machine'].match?('x86_64') - '25415701c864ec301975097f207e909d065eb7c452a501c0e4b4487e77fbdc7a' + '5db96ea7c5fa34de4eadbc41e2adf1fccb7e373b5788f77e26e0d69b9e368b7f' elsif node['kernel']['machine'].match?('aarch64') - '7b86c40410c75de44c311fe127bb1dd02c43040312d66b1363737ab3e7d77011' + '124875d5d2b3b540d40a584605385c03e71bf57f782baf5130e0bfee18b680c1' end elsif version.to_s == '11' if node['kernel']['machine'].match?('x86_64') - '448494766be37bb8a4ecd983a09742d28b1fa426684417b0dec2f3b03c44f3a3' + 'bf9380ee0cdd78fafb6d0cdfa0c1a97baaaec44432a15c8c2f296696ad9ed631' elsif node['kernel']['machine'].match?('aarch64') - 'e25669eb74d6c270af303bc0d1d859dd9ff16a0288f00a9d0ba4105467fc9695' + '18f4716151f4786abe6b185aab2cc5f5ad7b15f899d7eb143a81ccda8690f6f6' end elsif version.to_s == '15' if node['kernel']['machine'].match?('x86_64') @@ -49,9 +49,9 @@ def default_corretto_bin_cmds(version) def corretto_sub_dir(version, full_version = nil) ver = if version == '8' - full_version || '8.275.01.1' + full_version || '8.282.08.1' elsif version.to_s == '11' - full_version || '11.0.9.12.1' + full_version || '11.0.10.9.1' elsif version.to_s == '15' full_version || '15.0.1.9.1' end diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index 9e01917e..5d4938ce 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -112,7 +112,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version)).to include '275' + expect(subject.corretto_sub_dir(version)).to include '8.282.08.1' end end @@ -121,7 +121,7 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '275' + expect(subject.corretto_sub_dir(version)).to include '8.282.08.1' end end @@ -130,7 +130,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 11 x64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.9.12.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.10.9.1' end end @@ -139,7 +139,7 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 11 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.9.12.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.10.9.1' end end From 1a974c2e0a7db3972cb1094796d3f954c369ec58 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 22 Jan 2021 21:12:18 +0000 Subject: [PATCH 060/278] Update changelog for 8.6.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5246c042..c14e7c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.6.0 - *2021-01-22* - Added Amazon Corretto 15 support to `corretto_install` - Added configurable `file_cache_path` property to `java_certificate` From 122c3252793399f5b60bb136b55ae487095af903 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 22 Jan 2021 21:12:19 +0000 Subject: [PATCH 061/278] Update metadata for 8.6.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index fac47716..118bde73 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.5.0' +version '8.6.0' supports 'debian' supports 'ubuntu' From 83d8c4603e5aa45c2f283cd5823610d835e1af06 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 22 Jan 2021 21:12:22 +0000 Subject: [PATCH 062/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c14e7c47..9cfd50a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 8.6.0 - *2021-01-22* - Added Amazon Corretto 15 support to `corretto_install` From b3257916ca614cca62a098acaa83939a899e07b5 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Tue, 11 May 2021 14:53:52 +0000 Subject: [PATCH 063/278] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .github/workflows/md-links.yml | 2 +- .github/workflows/stale.yml | 5 +---- .yamllint | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index 150e75c6..d3a2e2b2 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@main - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@v1 with: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0f337015..9e2ff38e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -2,14 +2,11 @@ name: Mark stale issues and pull requests "on": - schedule: - - cron: "0 0 * * *" + schedule: [cron: "0 0 * * *"] jobs: stale: - runs-on: ubuntu-latest - steps: - uses: actions/stale@v3 with: diff --git a/.yamllint b/.yamllint index 2d696128..1b5cea09 100644 --- a/.yamllint +++ b/.yamllint @@ -5,3 +5,9 @@ rules: max: 256 level: warning document-start: disable + braces: + forbid: false + min-spaces-inside: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 From ceaf80f8e7ace08347d0f6ea1fce69cfa8b38bb1 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 1 Jun 2021 13:17:13 +0100 Subject: [PATCH 064/278] Standardise files with files in sous-chefs/repo-management (#653) Signed-off-by: Dan Webb --- .delivery/project.toml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.delivery/project.toml b/.delivery/project.toml index 6d5e3617..0d6f0ae9 100644 --- a/.delivery/project.toml +++ b/.delivery/project.toml @@ -1 +1,9 @@ -remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml" +[local_phases] +unit = "rspec spec/" +lint = 'cookstyle --display-cop-names --extra-details' +syntax = "echo skipping" +provision = "echo skipping" +deploy = "echo skipping" +smoke = "echo skipping" +functional = "echo skipping" +cleanup = "echo skipping" From 3c9e876f1a9c9fd94c8e708954f45a3a9a55ce33 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 1 Jun 2021 05:17:16 -0700 Subject: [PATCH 065/278] Update changelog for 8.6.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cfd50a7..67cce89b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 8.6.1 - *2021-06-01* ## 8.6.0 - *2021-01-22* From a7197e165c36349740bfb7536b26487a5a977dd3 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 1 Jun 2021 05:17:17 -0700 Subject: [PATCH 066/278] Update metadata for 8.6.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 118bde73..07919196 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.0' -version '8.6.0' +version '8.6.1' supports 'debian' supports 'ubuntu' From e99cad9bcd4b0fa023eff569d52396e3a2e24075 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 1 Jun 2021 05:17:19 -0700 Subject: [PATCH 067/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67cce89b..ab07c785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 8.6.1 - *2021-06-01* ## 8.6.0 - *2021-01-22* From efd7dfd92bfb709b280daf63076952d645f1123e Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Fri, 4 Jun 2021 16:07:20 +0100 Subject: [PATCH 068/278] Change the ActionsHub from the master to main branch (#655) ActionsHub is deleting the master branch Use the v2 checkout action rather than master --- .github/workflows/ci.yml | 28 ++++++++++++++-------------- .github/workflows/md-links.yml | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4c585f4..d3392edf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Run Chef Delivery - uses: actionshub/chef-delivery@master + uses: actionshub/chef-delivery@main env: CHEF_LICENSE: accept-no-persist @@ -22,17 +22,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Run yaml Lint - uses: actionshub/yamllint@master + uses: actionshub/yamllint@main mdl: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Run Markdown Lint - uses: actionshub/markdownlint@master + uses: actionshub/markdownlint@main dokken: needs: [mdl, yamllint, delivery] @@ -79,11 +79,11 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Install Chef - uses: actionshub/chef-install@master + uses: actionshub/chef-install@main - name: Dokken - uses: actionshub/test-kitchen@master + uses: actionshub/test-kitchen@main env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.dokken.yml @@ -96,11 +96,11 @@ jobs: runs-on: macos-latest steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Install Chef - uses: actionshub/chef-install@master + uses: actionshub/chef-install@main - name: Kitchen Converge - uses: actionshub/test-kitchen@master + uses: actionshub/test-kitchen@main env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.macos.yml @@ -117,7 +117,7 @@ jobs: # Magic line for github actions to persist the change echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV - name: Kitchen Verify - uses: actionshub/test-kitchen@master + uses: actionshub/test-kitchen@main env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.macos.yml @@ -132,4 +132,4 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@master + uses: actions/checkout@v2 diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index d3a2e2b2..18d6e9fc 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@main + uses: actions/checkout@v2 - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@v1 with: From ce9c1d3d8418217d953f84cf5a675a41b95dea1f Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Fri, 4 Jun 2021 16:54:45 +0100 Subject: [PATCH 069/278] unified_mode & Corretto checksum fixes (#656) - Remove Corretto checksum code defaults as this changes regularly, and is not provide in the SHA256 format via an API - Set unified_mode to true for Chef 17 support - Bump the minimum Chef version to 15.3 for unified_mode support --- CHANGELOG.md | 5 +++++ documentation/resources/corretto_install.md | 2 +- libraries/corretto_helpers.rb | 22 --------------------- metadata.rb | 2 +- resources/adoptopenjdk_install.rb | 4 +--- resources/adoptopenjdk_linux_install.rb | 4 ++-- resources/adoptopenjdk_macos_install.rb | 3 +-- resources/alternatives.rb | 16 +-------------- resources/certificate.rb | 21 +------------------- resources/corretto_install.rb | 6 ++---- resources/jce.rb | 16 +-------------- resources/openjdk_install.rb | 4 +--- resources/openjdk_pkg_install.rb | 4 +--- resources/openjdk_source_install.rb | 4 +--- 14 files changed, 19 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab07c785..52938d52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Remove Corretto checksum code defualts as this changes reguarly, + and is not provide in the SHA256 format via an API +- Set unified_mode to true for Chef 17 support +- Bump the minimum Chef version to 15.3 for unified_mode support + ## 8.6.1 - *2021-06-01* ## 8.6.0 - *2021-01-22* diff --git a/documentation/resources/corretto_install.md b/documentation/resources/corretto_install.md index 53abbbbd..05e62498 100644 --- a/documentation/resources/corretto_install.md +++ b/documentation/resources/corretto_install.md @@ -16,7 +16,7 @@ Introduced: v8.0.0 | version | String | | Java version to install | | full_version | String | | Used to configure the package directory, change this is the version installed by the package is no longer correct | | url | String | `default_corretto_url(version)` | The URL to download from | -| checksum | String | `default_corretto_checksum(version)` | The checksum for the downloaded file | +| checksum | String | | The checksum for the downloaded file | | java_home | String | Based on the version | Set to override the java_home | | java_home_mode | Integer, String | `0755` | The permission for the Java home directory | | java_home_owner | String | `root` | Owner of the Java Home | diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 5a432d20..2ff6a40a 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -15,28 +15,6 @@ def default_corretto_url(version) end end - def default_corretto_checksum(version) - if version.to_s == '8' - if node['kernel']['machine'].match?('x86_64') - '5db96ea7c5fa34de4eadbc41e2adf1fccb7e373b5788f77e26e0d69b9e368b7f' - elsif node['kernel']['machine'].match?('aarch64') - '124875d5d2b3b540d40a584605385c03e71bf57f782baf5130e0bfee18b680c1' - end - elsif version.to_s == '11' - if node['kernel']['machine'].match?('x86_64') - 'bf9380ee0cdd78fafb6d0cdfa0c1a97baaaec44432a15c8c2f296696ad9ed631' - elsif node['kernel']['machine'].match?('aarch64') - '18f4716151f4786abe6b185aab2cc5f5ad7b15f899d7eb143a81ccda8690f6f6' - end - elsif version.to_s == '15' - if node['kernel']['machine'].match?('x86_64') - '6bd07d74e11deeba9f8927f8353aa689ffaa2ada263b09a4c297c0c58887af0f' - elsif node['kernel']['machine'].match?('aarch64') - 'e5112fec0f4e6f3de048c5bd6a9a690dd07344436985755636df6dc18b4bfb62' - end - end - end - def default_corretto_bin_cmds(version) if version.to_s == '8' %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) diff --git a/metadata.rb b/metadata.rb index 07919196..071e672f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ description 'Recipes and resources for installing Java and managing certificates' source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' -chef_version '>= 15.0' +chef_version '>= 15.3' version '8.6.1' supports 'debian' diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index 908d81e5..da258284 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -1,7 +1,5 @@ -resource_name :adoptopenjdk_install provides :adoptopenjdk_install - -default_action :install +unified_mode true # Common options property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb index 820c7154..631d9246 100644 --- a/resources/adoptopenjdk_linux_install.rb +++ b/resources/adoptopenjdk_linux_install.rb @@ -1,7 +1,7 @@ -resource_name :adoptopenjdk_linux_install provides :adoptopenjdk_linux_install - +unified_mode true include Java::Cookbook::AdoptOpenJdkHelpers + property :version, String, name_property: true, description: 'Java version to install' property :variant, String, diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb index 4a03186e..3e6abf24 100644 --- a/resources/adoptopenjdk_macos_install.rb +++ b/resources/adoptopenjdk_macos_install.rb @@ -1,6 +1,5 @@ -resource_name :adoptopenjdk_macos_install provides :adoptopenjdk_macos_install - +unified_mode true include Java::Cookbook::AdoptOpenJdkMacOsHelpers property :tap_full, [true, false], diff --git a/resources/alternatives.rb b/resources/alternatives.rb index cd98eba4..26bb6ec1 100644 --- a/resources/alternatives.rb +++ b/resources/alternatives.rb @@ -1,18 +1,4 @@ -# -# Cookbook:: java -# Resource:: alternatives -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +unified_mode true property :java_location, String, description: 'Java installation location' diff --git a/resources/certificate.rb b/resources/certificate.rb index d656422c..6fc1f32a 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -1,23 +1,4 @@ -# -# Author:: Mevan Samaratunga () -# Author:: Michael Goetz () -# Cookbook:: java -# Resource:: certificate -# -# Copyright:: 2013, Mevan Samaratunga -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - +unified_mode true include Java::Cookbook::CertificateHelpers property :cert_alias, String, diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 4a451050..7bec5112 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -1,6 +1,5 @@ -resource_name :corretto_install provides :corretto_install - +unified_mode true include Java::Cookbook::CorrettoHelpers property :version, String, name_property: true, description: 'Java version to install' @@ -13,7 +12,6 @@ property :checksum, String, regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, - default: lazy { default_corretto_checksum(version) }, description: 'The checksum for the downloaded file' property :java_home, String, @@ -62,7 +60,7 @@ remote_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do source new_resource.url - checksum new_resource.checksum + checksum new_resource.checksum if new_resource.checksum retries new_resource.retries retry_delay new_resource.retry_delay mode '644' diff --git a/resources/jce.rb b/resources/jce.rb index b01ddc12..e2df51cd 100644 --- a/resources/jce.rb +++ b/resources/jce.rb @@ -1,18 +1,4 @@ -# -# Cookbook:: java -# Resource:: jce -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +unified_mode true property :jdk_version, String, default: lazy { node['java']['jdk_version'].to_s }, description: 'The Java version to install into' property :jce_url, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['url'] }, description: 'The URL for the JCE distribution' diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 0b4bf8ca..58532609 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -1,8 +1,6 @@ -resource_name :openjdk_install provides :openjdk_install - +unified_mode true include Java::Cookbook::OpenJdkHelpers -default_action :install property :version, String, name_property: true, description: 'Java major version to install' property :install_type, String, diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 7904537b..4d053e7f 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -1,8 +1,6 @@ -resource_name :openjdk_pkg_install provides :openjdk_pkg_install - +unified_mode true include Java::Cookbook::OpenJdkHelpers -default_action :install property :version, String, name_property: true, diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index e6d6a84f..61fa7e54 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,8 +1,6 @@ -resource_name :openjdk_source_install provides :openjdk_source_install - +unified_mode true include Java::Cookbook::OpenJdkHelpers -default_action :install property :version, String, name_property: true, From ce8326ab86fb1144b4c98a5faf4a8a0322024d47 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 4 Jun 2021 08:54:47 -0700 Subject: [PATCH 070/278] Update changelog for 9.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52938d52..8e2d3995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 9.0.0 - *2021-06-04* - Remove Corretto checksum code defualts as this changes reguarly, and is not provide in the SHA256 format via an API From c08cac718a94fbdc5ddacab78f9d906a8c2e07f7 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 4 Jun 2021 08:54:48 -0700 Subject: [PATCH 071/278] Update metadata for 9.0.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 071e672f..a89afcbf 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '8.6.1' +version '9.0.0' supports 'debian' supports 'ubuntu' From 18c855d9a0f869a287fed8bdcfd1ffe88036f0ea Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 4 Jun 2021 08:54:49 -0700 Subject: [PATCH 072/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e2d3995..b0bab220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 9.0.0 - *2021-06-04* - Remove Corretto checksum code defualts as this changes reguarly, From 1529d0cd3015b734bc8f6a65273dc805739c0cea Mon Sep 17 00:00:00 2001 From: Jason Field Date: Wed, 16 Jun 2021 17:30:02 +0100 Subject: [PATCH 073/278] prep for main --- .github/ISSUE_TEMPLATE.md | 20 -------------------- .github/PULL_REQUEST_TEMPLATE.md | 13 ------------- .github/workflows/ci.yml | 13 +++---------- .github/workflows/md-links.yml | 2 +- 4 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 651e753a..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,20 +0,0 @@ -### Cookbook version -[Version of the cookbook where you are encountering the issue] - -### Chef-client version -[Version of chef-client in your environment] - -### Platform Details -[Operating system distribution and release version. Cloud provider if running in the cloud] - -### Scenario: -[What you are trying to achieve and you can't?] - -### Steps to Reproduce: -[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?] - -### Expected Result: -[What are you expecting to happen as the consequence of above reproduction steps?] - -### Actual Result: -[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5ae7f3ff..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,13 +0,0 @@ -### Description - -[Describe what this change achieves] - -### Issues Resolved - -[List any existing issues this PR resolves] - -### Check List - -- [ ] All tests pass. See -- [ ] New functionality includes testing. -- [ ] New functionality has been documented in the README if applicable \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3392edf..9a47292e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ name: ci pull_request: push: branches: - - master + - main jobs: delivery: @@ -34,7 +34,7 @@ jobs: - name: Run Markdown Lint uses: actionshub/markdownlint@main - dokken: + integration: needs: [mdl, yamllint, delivery] runs-on: ubuntu-latest strategy: @@ -91,7 +91,7 @@ jobs: suite: ${{ matrix.suite }} os: ${{ matrix.os }} - macos: + integration-macos: needs: [mdl, yamllint, delivery] runs-on: macos-latest steps: @@ -126,10 +126,3 @@ jobs: suite: adoptopenjdk-14 os: macos action: verify - - final: - needs: [dokken, macos] - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index 18d6e9fc..ba887a16 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -4,7 +4,7 @@ name: md-links "on": pull_request: push: - branches: [master] + branches: [main] jobs: md-links: From ef40a52f383910d51f29235c2c96e1e5c55ef533 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 30 Aug 2021 06:32:54 +0100 Subject: [PATCH 074/278] Automated PR: Standardising Files (#658) * Standardise files with files in sous-chefs/repo-management Signed-off-by: kitchen-porter * Fix changelog Signed-off-by: Lance Albertson Co-authored-by: Lance Albertson --- .github/CODEOWNERS | 2 +- CHANGELOG.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3f69af20..7cc52a97 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @sous-chefs/java +* @sous-chefs/maintainers diff --git a/CHANGELOG.md b/CHANGELOG.md index b0bab220..af4cf08d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Standardise files with files in sous-chefs/repo-management + ## 9.0.0 - *2021-06-04* - Remove Corretto checksum code defualts as this changes reguarly, From 726844170fea9550920bd164db459e21c150a814 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 30 Aug 2021 06:32:56 +0100 Subject: [PATCH 075/278] Update changelog for 9.0.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af4cf08d..105c2ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 9.0.1 - *2021-08-30* - Standardise files with files in sous-chefs/repo-management From fb227459ad8e5d01cb57e02cef4a26606a4c8633 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 30 Aug 2021 06:32:57 +0100 Subject: [PATCH 076/278] Update metadata for 9.0.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index a89afcbf..51edff82 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '9.0.0' +version '9.0.1' supports 'debian' supports 'ubuntu' From 2af0af70cb1bb19593d6c911e7377199738ea1ee Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 30 Aug 2021 06:32:58 +0100 Subject: [PATCH 077/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 105c2ddb..1a9753fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 9.0.1 - *2021-08-30* - Standardise files with files in sous-chefs/repo-management From ab74e1670bef78985dafc1196cdc202a268d3326 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 31 Aug 2021 10:46:43 +0100 Subject: [PATCH 078/278] Cookstyle 7.16.1 Fixes (#659) Issues found and resolved with: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb - 1:11 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 2:16 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 3:31 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 6:40 convention: Layout/ClosingParenthesisIndentation - Indent to column 0 not 39 - 7:22 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 10:21 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 13:30 convention: Layout/ClosingParenthesisIndentation - Indent to column 0 not 29 - 14:21 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper Issues found and resolved with: test/integration/custom-package/controls/verify_home.rb - 1:11 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 2:16 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 3:22 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 6:17 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper Issues found and resolved with: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb - 1:11 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 2:24 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 5:16 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper - 8:13 warning: InSpec/Deprecations/AttributeHelper - InSpec attributes have been renamed to inputs. Use the input method not the deprecation attribute method to access these values. https://docs.chef.io/workstation/cookstyle/inspec_deprecations_attributehelper Signed-off-by: kitchen-porter Co-authored-by: Dan Webb --- CHANGELOG.md | 17 +++++++++++++++++ .../controls/verify_adoptopenjdk.rb | 16 ++++++++-------- .../custom-package/controls/verify_home.rb | 8 ++++---- .../controls/verify_adoptopenjdk-removal.rb | 8 ++++---- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a9753fb..491a3593 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:1:11 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:2:16 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:3:31 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:6:40 convention: `Layout/ClosingParenthesisIndentation` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:7:22 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:10:21 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:13:30 convention: `Layout/ClosingParenthesisIndentation` +- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:14:21 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:1:11 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:2:16 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:3:22 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:6:17 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:1:11 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:2:24 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:5:16 warning: `InSpec/Deprecations/AttributeHelper` +- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:8:13 warning: `InSpec/Deprecations/AttributeHelper` + ## 9.0.1 - *2021-08-30* - Standardise files with files in sous-chefs/repo-management diff --git a/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb b/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb index 4cb0cd64..2ae80294 100644 --- a/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb +++ b/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb @@ -1,17 +1,17 @@ -variant = attribute('variant', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') -java_version = attribute('java_version', description: 'Which version of java should be installed') -certificate_sha256_checksum = attribute('certificate_sha256_checksum', +variant = input('variant', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') +java_version = input('java_version', description: 'Which version of java should be installed') +certificate_sha256_checksum = input('certificate_sha256_checksum', value: '64:F3:3B:A7:EF:C3:5C:6B:2D:ED:95:0B:CB:4E:96:3B:12:97:B8:62:BA:1A:8E:30:13:B0:B0:59:77:12:31:EA', description: 'The SHA256 checksum of the certificate' - ) -parent_install_dir = attribute('parent_install_dir', +) +parent_install_dir = input('parent_install_dir', value: "java-#{java_version.to_i > 8 ? java_version.to_i : java_version.split('.')[1]}-adoptopenjdk-#{variant}", description: 'The parent of the Java home') -keystore_location = attribute('keystore_location', +keystore_location = input('keystore_location', value: nil, description: 'Where the java keystore is located' - ) -keystore_password = attribute('keystore_password', +) +keystore_password = input('keystore_password', value: 'changeit', description: 'Password to the Java keystore') diff --git a/test/integration/custom-package/controls/verify_home.rb b/test/integration/custom-package/controls/verify_home.rb index 018d542f..bad2ff4d 100644 --- a/test/integration/custom-package/controls/verify_home.rb +++ b/test/integration/custom-package/controls/verify_home.rb @@ -1,9 +1,9 @@ -variant = attribute('variant', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') -java_version = attribute('java_version', description: 'Which version of java should be installed') -parent_install_dir = attribute('parent_install_dir', +variant = input('variant', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') +java_version = input('java_version', description: 'Which version of java should be installed') +parent_install_dir = input('parent_install_dir', value: "java-#{java_version.to_i > 8 ? java_version.to_i : java_version.split('.')[1]}-adoptopenjdk-#{variant}", description: 'The parent of the Java home') -java_home_dir = attribute('java_home_dir', description: 'Name of the JAVA_HOME directory') +java_home_dir = input('java_home_dir', description: 'Name of the JAVA_HOME directory') control 'check-java-version' do impact 1.0 diff --git a/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb b/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb index 60d0f643..73ec00a7 100644 --- a/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb +++ b/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb @@ -1,11 +1,11 @@ -variant = attribute('variant', value: 'openj9', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') -alternative_bin_cmds = attribute('alternative_bin_cmds', +variant = input('variant', value: 'openj9', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') +alternative_bin_cmds = input('alternative_bin_cmds', value: %w(jar java keytool), description: 'List of bin commands that should be included in alternatives') -java_version = attribute('java_version', +java_version = input('java_version', value: '1.8.0', description: 'Which version of java should be installed') -java_home = attribute('java_home', +java_home = input('java_home', value: "/usr/lib/jvm/java-#{java_version.to_i > 8 ? java_version.to_i : java_version.split('.')[1]}-adoptopenjdk-#{variant}", description: 'Path to the Java home directory') From e718926a6bbc75164a212550b6599447d0e03df5 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Thu, 2 Sep 2021 10:41:59 +0100 Subject: [PATCH 079/278] Remove recipes (#660) * Remove recipes as they are confusing users Not all of our users are reading the errors in the logs, and are expecting the recipes to do something. The recipes have been warning since 8.0.0 (2020-03-30) Signed-off-by: Dan Webb --- CHANGELOG.md | 17 +---------------- recipes/adoptopenjdk.rb | 10 ---------- recipes/corretto.rb | 10 ---------- recipes/default.rb | 10 ---------- recipes/homebrew.rb | 9 --------- recipes/ibm.rb | 10 ---------- recipes/ibm_tar.rb | 10 ---------- recipes/notify.rb | 10 ---------- recipes/openjdk.rb | 10 ---------- recipes/set_java_home.rb | 10 ---------- recipes/windows.rb | 10 ---------- 11 files changed, 1 insertion(+), 115 deletions(-) delete mode 100644 recipes/adoptopenjdk.rb delete mode 100644 recipes/corretto.rb delete mode 100644 recipes/default.rb delete mode 100644 recipes/homebrew.rb delete mode 100644 recipes/ibm.rb delete mode 100644 recipes/ibm_tar.rb delete mode 100644 recipes/notify.rb delete mode 100644 recipes/openjdk.rb delete mode 100644 recipes/set_java_home.rb delete mode 100644 recipes/windows.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 491a3593..2809e92e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,22 +4,7 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:1:11 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:2:16 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:3:31 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:6:40 convention: `Layout/ClosingParenthesisIndentation` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:7:22 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:10:21 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:13:30 convention: `Layout/ClosingParenthesisIndentation` -- resolved cookstyle error: test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb:14:21 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:1:11 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:2:16 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:3:22 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/custom-package/controls/verify_home.rb:6:17 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:1:11 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:2:24 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:5:16 warning: `InSpec/Deprecations/AttributeHelper` -- resolved cookstyle error: test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb:8:13 warning: `InSpec/Deprecations/AttributeHelper` +- Remove recipes to stop confusing users ## 9.0.1 - *2021-08-30* diff --git a/recipes/adoptopenjdk.rb b/recipes/adoptopenjdk.rb deleted file mode 100644 index 68030668..00000000 --- a/recipes/adoptopenjdk.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -Adopt OpenJDK recipe is now deprecated -Using the adoptopenjdk_install resource is now recommended -See: https://github.com/sous-chefs/java/blob/master/documentation/resources/adoptopenjdk_.md for help - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/corretto.rb b/recipes/corretto.rb deleted file mode 100644 index a4f7e56b..00000000 --- a/recipes/corretto.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -java::corretto recipe is now deprecated -Using the corrett_install resource is now recommended -See: https://github.com/sous-chefs/java/blob/master/documentation/resources/corretto_install.md for help - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/default.rb b/recipes/default.rb deleted file mode 100644 index 685057e0..00000000 --- a/recipes/default.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -Default install recipe is now deprecated -Use one of the documented install resources -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/homebrew.rb b/recipes/homebrew.rb deleted file mode 100644 index 58cbfd5e..00000000 --- a/recipes/homebrew.rb +++ /dev/null @@ -1,9 +0,0 @@ -Chef::Log.fatal(" - -The java::homebrew recipe is now deprecated -Use the homebrew cookbook and resources in your wrapper cookbook -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/ibm.rb b/recipes/ibm.rb deleted file mode 100644 index 88c487b5..00000000 --- a/recipes/ibm.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -java::ibm recipe is now removed -Use one of the documented install resources -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/ibm_tar.rb b/recipes/ibm_tar.rb deleted file mode 100644 index 5bfc5ac8..00000000 --- a/recipes/ibm_tar.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -java::ibm_tar recipe is now deprecated -Using one of the documented install resources -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/notify.rb b/recipes/notify.rb deleted file mode 100644 index fa4eeae1..00000000 --- a/recipes/notify.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -java::notify recipe is now deprecated -Use one of the documented install resources -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/openjdk.rb b/recipes/openjdk.rb deleted file mode 100644 index 7b5ef4a2..00000000 --- a/recipes/openjdk.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -java::openjdk recipe is now deprecated -Using the openjdk_install resource is now recommended -See: https://github.com/sous-chefs/java/blob/master/documentation/resources/openjdk_install.md for help - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/set_java_home.rb b/recipes/set_java_home.rb deleted file mode 100644 index 63531ca6..00000000 --- a/recipes/set_java_home.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -java::set_java_home recipe is now deprecated -Use one of the documented install resources -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' diff --git a/recipes/windows.rb b/recipes/windows.rb deleted file mode 100644 index 2a33e745..00000000 --- a/recipes/windows.rb +++ /dev/null @@ -1,10 +0,0 @@ - -Chef::Log.fatal(" - -The java::windows recipe is now deprecated -Use one of the documented install resources -See the documentation folder for a list of resources - -") - -raise 'Recipe used instead of custom resource' From 62e1aead25832d32c105adce00eb77fa91b85bfc Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 2 Sep 2021 10:42:01 +0100 Subject: [PATCH 080/278] Update changelog for 10.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2809e92e..9d344521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.0.0 - *2021-09-02* - Remove recipes to stop confusing users From 90319cdabee55a02cc21e73c3e18a116714e52ea Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 2 Sep 2021 10:42:02 +0100 Subject: [PATCH 081/278] Update metadata for 10.0.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 51edff82..58187277 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '9.0.1' +version '10.0.0' supports 'debian' supports 'ubuntu' From a4b192b62d8ad55665400368c58450f21a514b3f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 2 Sep 2021 10:42:04 +0100 Subject: [PATCH 082/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d344521..e336131f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.0.0 - *2021-09-02* - Remove recipes to stop confusing users From 9db6b6e6f73b5560f68a99f2fa93406ab76b5644 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 21 Sep 2021 10:30:01 +0100 Subject: [PATCH 083/278] Make workflow runs wait for workflow runs (#661) * Make workflow runs wait for workflow runs * Split out workflows to allow standardfiles to control markdown, yaml and delivery - Adds a "Final" workflow to set a known pass/failure hook - This allows us to have Terraform set the Final workflow as a required check Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 37 +++++----------------------------- .github/workflows/delivery.yml | 34 +++++++++++++++++++++++++++++++ .github/workflows/final.yml | 20 ++++++++++++++++++ .github/workflows/md-links.yml | 2 +- CHANGELOG.md | 4 ++++ 5 files changed, 64 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/delivery.yml create mode 100644 .github/workflows/final.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a47292e..7020da4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,40 +2,13 @@ name: ci 'on': - pull_request: - push: - branches: - - main + workflow_run: + workflows: ['Lint & Unit Test'] + types: [completed] jobs: - delivery: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run Chef Delivery - uses: actionshub/chef-delivery@main - env: - CHEF_LICENSE: accept-no-persist - - yamllint: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run yaml Lint - uses: actionshub/yamllint@main - - mdl: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run Markdown Lint - uses: actionshub/markdownlint@main - integration: - needs: [mdl, yamllint, delivery] + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest strategy: matrix: @@ -92,7 +65,7 @@ jobs: os: ${{ matrix.os }} integration-macos: - needs: [mdl, yamllint, delivery] + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: macos-latest steps: - name: Check out code diff --git a/.github/workflows/delivery.yml b/.github/workflows/delivery.yml new file mode 100644 index 00000000..4059e571 --- /dev/null +++ b/.github/workflows/delivery.yml @@ -0,0 +1,34 @@ +--- +name: 'Lint & Unit Test' + +'on': + pull_request: + push: + branches: [main] + +jobs: + delivery: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Run Chef Delivery + uses: actionshub/chef-delivery@main + env: + CHEF_LICENSE: accept-no-persist + + yamllint: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Run yaml Lint + uses: actionshub/yamllint@main + + mdl: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Run Markdown Lint + uses: actionshub/markdownlint@main diff --git a/.github/workflows/final.yml b/.github/workflows/final.yml new file mode 100644 index 00000000..6c564ceb --- /dev/null +++ b/.github/workflows/final.yml @@ -0,0 +1,20 @@ +--- +name: 'Final' + +'on': + workflow_run: + workflows: [ci] + types: [completed] + +jobs: + on-success: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: exit 0 + + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: exit 1 diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index ba887a16..ba5e3bb2 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -1,5 +1,5 @@ --- -name: md-links +name: 'Markdown Link Check' "on": pull_request: diff --git a/CHANGELOG.md b/CHANGELOG.md index e336131f..b6aaec17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Split out workflows to allow standardfiles to control markdown, yaml and delivery +- Adds a "Final" workflow to set a known pass/failure hook + - This allows us to have Terraform set the Final workflow as a required check + ## 10.0.0 - *2021-09-02* - Remove recipes to stop confusing users From e71c7f82874928848d9b175145954f6a7e5201fc Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:30:04 +0100 Subject: [PATCH 084/278] Update changelog for 10.0.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6aaec17..86e7eada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.0.1 - *2021-09-21* - Split out workflows to allow standardfiles to control markdown, yaml and delivery - Adds a "Final" workflow to set a known pass/failure hook From 11afc6aed47f2b2749d7e194a27c452561fd443c Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:30:05 +0100 Subject: [PATCH 085/278] Update metadata for 10.0.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 58187277..43e3314a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.0.0' +version '10.0.1' supports 'debian' supports 'ubuntu' From d14799db9ec77eb0377fc8cef6202a76b69f57c5 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:30:08 +0100 Subject: [PATCH 086/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86e7eada..378cfd11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.0.1 - *2021-09-21* - Split out workflows to allow standardfiles to control markdown, yaml and delivery From f0480c8c4325967fa3c70501df8615c6b558e80c Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 6 Oct 2021 12:51:11 +0100 Subject: [PATCH 087/278] Add Corretto 16 and update the minor version numbers for 8, 11 & 15 (#662) * Add Corretto 16 and update the minor version numbers for 8, 11 & 15 * Revert workflow split out * Refactor Corretto helpers to be simpler * Update Kitchen config for Debian-11 * Update Debian 11 default install method * Fix InSpec input files * Fixing OpenJDK helpers * Add spec to OpenJDK helpers Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 101 ---------- .github/workflows/delivery.yml | 92 +++++++++ .github/workflows/final.yml | 20 -- CHANGELOG.md | 13 ++ README.md | 2 +- kitchen.dokken.yml | 15 +- kitchen.macos.local.yml | 2 +- kitchen.macos.yml | 2 +- kitchen.yml | 117 ++++-------- libraries/corretto_helpers.rb | 43 +++-- libraries/openjdk_helpers.rb | 89 ++++----- spec/libraries/corretto_helpers_spec.rb | 57 +++++- spec/libraries/openjdk_helpers_spec.rb | 176 ++++++++++++++++++ .../cookbooks/test/recipes/openjdk_pkg.rb | 4 +- .../adoptopenjdk-11-hotspot.yml | 0 .../adoptopenjdk-11-openj9-large-heap.yml | 0 .../adoptopenjdk-11-openj9.yml | 0 .../adoptopenjdk-14-hotspot.yml | 0 .../adoptopenjdk-14-macos.yml | 0 .../adoptopenjdk-14-openj9-large-heap.yml | 0 .../adoptopenjdk-14-openj9.yml | 0 .../adoptopenjdk-8-hotspot.yml | 0 .../adoptopenjdk-8-openj9-large-heap.yml | 0 .../adoptopenjdk-8-openj9.yml | 0 .../{attributes => inputs}/hotspot-11.yml | 0 .../{attributes => inputs}/hotspot-8.yml | 0 .../{attributes => inputs}/openj9-11.yml | 0 .../openj9-large-heap-11.yml | 0 .../openjdk/controls/verify_openjdk.rb | 8 +- .../openjdk_pkg/controls/verify_openjdk.rb | 8 +- 30 files changed, 446 insertions(+), 303 deletions(-) delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/final.yml create mode 100644 spec/libraries/openjdk_helpers_spec.rb rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-11-hotspot.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-11-openj9-large-heap.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-11-openj9.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-14-hotspot.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-14-macos.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-14-openj9-large-heap.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-14-openj9.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-8-hotspot.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-8-openj9-large-heap.yml (100%) rename test/integration/adoptopenjdk/{attributes => inputs}/adoptopenjdk-8-openj9.yml (100%) rename test/integration/custom-package/{attributes => inputs}/hotspot-11.yml (100%) rename test/integration/custom-package/{attributes => inputs}/hotspot-8.yml (100%) rename test/integration/custom-package/{attributes => inputs}/openj9-11.yml (100%) rename test/integration/custom-package/{attributes => inputs}/openj9-large-heap-11.yml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 7020da4c..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- -name: ci - -'on': - workflow_run: - workflows: ['Lint & Unit Test'] - types: [completed] - -jobs: - integration: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - strategy: - matrix: - os: - - amazonlinux-2 - - debian-9 - - debian-10 - - centos-7 - - centos-8 - - ubuntu-1804 - - ubuntu-2004 - suite: - - openjdk-11 - - openjdk-12 - - openjdk-13 - - openjdk-pkg-8 - - openjdk-pkg-11 - - adoptopenjdk-8-openj9 - - adoptopenjdk-11-hotspot - - adoptopenjdk-11-openj9 - - adoptopenjdk-11-openj9-large-heap - - adoptopenjdk-14-hotspot - - adoptopenjdk-14-openj9 - - adoptopenjdk-14-openj9-large-heap - - adoptopenjdk-removal-11-openj9 - - corretto-8 - - corretto-11 - - corretto-15 - - custom-package-8 - - custom-package-11 - - custom-package-11-openj9 - - custom-package-11-openj9-large-heap - include: - - os: ubuntu-2004 - suite: openjdk-pkg-14 - exclude: - - os: debian-9 - suite: openjdk-pkg-11 - - os: debian-10 - suite: openjdk-pkg-8 - fail-fast: false - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Install Chef - uses: actionshub/chef-install@main - - name: Dokken - uses: actionshub/test-kitchen@main - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.dokken.yml - with: - suite: ${{ matrix.suite }} - os: ${{ matrix.os }} - - integration-macos: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: macos-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Install Chef - uses: actionshub/chef-install@main - - name: Kitchen Converge - uses: actionshub/test-kitchen@main - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.macos.yml - TERM: xterm-256color - with: - suite: adoptopenjdk-14 - os: macos - action: converge - - name: Source Profile for JAVA_HOME - run: | - source /etc/profile - echo "sourced profile for JAVA_HOME" - echo "New JAVA home after Chef run is: ${JAVA_HOME}" - # Magic line for github actions to persist the change - echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - name: Kitchen Verify - uses: actionshub/test-kitchen@main - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.macos.yml - TERM: xterm-256color - with: - suite: adoptopenjdk-14 - os: macos - action: verify diff --git a/.github/workflows/delivery.yml b/.github/workflows/delivery.yml index 4059e571..75a8158a 100644 --- a/.github/workflows/delivery.yml +++ b/.github/workflows/delivery.yml @@ -32,3 +32,95 @@ jobs: uses: actions/checkout@v2 - name: Run Markdown Lint uses: actionshub/markdownlint@main + + integration: + needs: [delivery, yamllint, mdl] + runs-on: ubuntu-latest + strategy: + matrix: + os: + - amazonlinux-2 + - debian-9 + - debian-10 + - debian-11 + - centos-7 + - centos-8 + - ubuntu-1804 + - ubuntu-2004 + suite: + - openjdk-11 + - openjdk-16 + - openjdk-17 + - adoptopenjdk-8-openj9 + - adoptopenjdk-11-hotspot + - adoptopenjdk-11-openj9 + - adoptopenjdk-11-openj9-large-heap + - adoptopenjdk-14-hotspot + - adoptopenjdk-14-openj9 + - adoptopenjdk-14-openj9-large-heap + - adoptopenjdk-removal-11-openj9 + - corretto-8 + - corretto-11 + - corretto-15 + - corretto-16 + - custom-package-8 + - custom-package-11 + - custom-package-11-openj9 + - custom-package-11-openj9-large-heap + fail-fast: false + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Install Chef + uses: actionshub/chef-install@main + - name: Dokken + uses: actionshub/test-kitchen@main + env: + CHEF_LICENSE: accept-no-persist + KITCHEN_LOCAL_YAML: kitchen.dokken.yml + with: + suite: ${{ matrix.suite }} + os: ${{ matrix.os }} + + integration-macos: + needs: [delivery, yamllint, mdl] + runs-on: macos-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Install Chef + uses: actionshub/chef-install@main + - name: Kitchen Converge + uses: actionshub/test-kitchen@main + env: + CHEF_LICENSE: accept-no-persist + KITCHEN_LOCAL_YAML: kitchen.macos.yml + TERM: xterm-256color + with: + suite: adoptopenjdk-14 + os: macos + action: converge + - name: Source Profile for JAVA_HOME + run: | + source /etc/profile + echo "sourced profile for JAVA_HOME" + echo "New JAVA home after Chef run is: ${JAVA_HOME}" + # Magic line for github actions to persist the change + echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV + - name: Kitchen Verify + uses: actionshub/test-kitchen@main + env: + CHEF_LICENSE: accept-no-persist + KITCHEN_LOCAL_YAML: kitchen.macos.yml + TERM: xterm-256color + with: + suite: adoptopenjdk-14 + os: macos + action: verify + + final: + runs-on: ubuntu-latest + needs: [integration, integration-macos] + steps: + - run: echo ${{needs.integration.outputs}} + - run: echo ${{needs.integration-macos.outputs}} diff --git a/.github/workflows/final.yml b/.github/workflows/final.yml deleted file mode 100644 index 6c564ceb..00000000 --- a/.github/workflows/final.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: 'Final' - -'on': - workflow_run: - workflows: [ci] - types: [completed] - -jobs: - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - run: exit 0 - - on-failure: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - steps: - - run: exit 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 378cfd11..89888236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Revert worklfow split out +- Rename InSpec attribute folders to input +- Add Corretto 16 +- Update the Corretto minor version numbers +- Default the Debian install method to package +- Remove testing for end of life OpenJDK suites +- Primarily support OpenJDK LTS versions 11, 17 +- Drop support for OpenJDK package installs for non-LTS versions + - These packages are still possible to install though they will now default to a source install +- Direct Amazon users to Amazon Corretto instead of installing OpenJDK +- Drop package install support for Java 8. Most supported operating systems no longer support OpenJDK 8 + - To install OpenJDK 8, a 'source' install from an internal mirror is now recommended + ## 10.0.1 - *2021-09-21* - Split out workflows to allow standardfiles to control markdown, yaml and delivery diff --git a/README.md b/README.md index 429d1f4c..cf51517f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of ## Requirements -Chef 15+ +Chef 15.3+ ### Platforms diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 994b5064..65665279 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -22,15 +22,22 @@ platforms: driver: image: dokken/debian-9 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update + # intermediate_instructions: + # - RUN /usr/bin/apt-get update - name: debian-10 driver: image: dokken/debian-10 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update + # intermediate_instructions: + # - RUN /usr/bin/apt-get update + + - name: debian-11 + driver: + image: dokken/debian-11 + pid_one_command: /bin/systemd + # intermediate_instructions: + # - RUN /usr/bin/apt-get update - name: centos-7 driver: diff --git a/kitchen.macos.local.yml b/kitchen.macos.local.yml index 24f8732e..9de6bec9 100644 --- a/kitchen.macos.local.yml +++ b/kitchen.macos.local.yml @@ -22,4 +22,4 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-macos.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml] diff --git a/kitchen.macos.yml b/kitchen.macos.yml index 45d9d592..7a316d5a 100644 --- a/kitchen.macos.yml +++ b/kitchen.macos.yml @@ -29,4 +29,4 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-macos.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml] diff --git a/kitchen.yml b/kitchen.yml index c43ab7a8..3dc6ae76 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -16,23 +16,16 @@ platforms: - name: centos-8 - name: debian-9 - name: debian-10 + - name: debian-11 - name: freebsd-11 - name: freebsd-12 - name: fedora-latest - - name: opensuse-leap-15 + # - name: opensuse-leap-15 - name: ubuntu-18.04 - name: ubuntu-20.04 suites: # OpenJDK - - name: openjdk-10 - run_list: - - recipe[test::openjdk] - attributes: {version: "10"} - verifier: - inspec_tests: [test/integration/openjdk] - inputs: {java_version: "10"} - - name: openjdk-11 run_list: - recipe[test::openjdk] @@ -41,58 +34,21 @@ suites: inspec_tests: [test/integration/openjdk] inputs: {java_version: "11"} - - name: openjdk-12 + - name: openjdk-16 run_list: - recipe[test::openjdk] - attributes: {version: "12"} + attributes: {version: "16"} verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: "12"} + inputs: {java_version: "16"} - - name: openjdk-13 + - name: openjdk-17 run_list: - recipe[test::openjdk] - attributes: {version: "13"} + attributes: {version: "17"} verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: "13"} - - # OpenJDK_PKG - - name: openjdk-pkg-7 - run_list: - - recipe[test::openjdk_pkg] - attributes: {version: "7"} - verifier: - inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: "7"} - includes: ["amazon-linux", "amazonlinux-2", "centos-7"] - - - name: openjdk-pkg-8 - run_list: - - recipe[test::openjdk_pkg] - attributes: {version: "8"} - verifier: - inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: "8"} - excludes: ["debian-10"] - - - name: openjdk-pkg-11 - run_list: - - recipe[test::openjdk_pkg] - attributes: {version: "11"} - verifier: - inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: "11"} - excludes: ["amazon-linux", "debian-9"] - - - name: openjdk-pkg-14 - run_list: - - recipe[test::openjdk_pkg] - attributes: {version: "14"} - verifier: - inspec_tests: [test/integration/openjdk_pkg] - inputs: {java_version: "14"} - includes: [ubuntu-20.04] + inputs: {java_version: "17"} # AdoptOpenJDK # Version 8 @@ -104,8 +60,8 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml] + - name: adoptopenjdk-8-openj9 run_list: - recipe[test::adoptopenjdk] @@ -114,8 +70,8 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml] + - name: adoptopenjdk-8-openj9-large-heap run_list: - recipe[test::adoptopenjdk] @@ -124,10 +80,7 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [ - test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9-large-heap.yml, - ] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml] # Version 11 - name: adoptopenjdk-11-hotspot @@ -138,8 +91,7 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml] - name: adoptopenjdk-11-openj9 run_list: - recipe[test::adoptopenjdk] @@ -148,8 +100,7 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml] - name: adoptopenjdk-11-openj9-large-heap run_list: - recipe[test::adoptopenjdk] @@ -158,10 +109,7 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [ - test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9-large-heap.yml, - ] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml] # Version 14 - name: adoptopenjdk-14-openj9-large-heap @@ -172,10 +120,7 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [ - test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9-large-heap.yml, - ] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml] - name: adoptopenjdk-14-openj9 run_list: - recipe[test::adoptopenjdk] @@ -183,10 +128,8 @@ suites: version: 14 variant: openj9 verifier: - inspec_tests: - - test/integration/adoptopenjdk - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9.yml] + inspec_tests: [test/integration/adoptopenjdk] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml] - name: adoptopenjdk-14-hotspot run_list: - recipe[test::adoptopenjdk] @@ -195,8 +138,7 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-14-hotspot.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml] # 11 Removal - name: adoptopenjdk-removal-11-openj9 @@ -207,8 +149,7 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/remove-adoptopenjdk] - input_files: - [test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml] + input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml] # Corretto - name: corretto-8 @@ -232,6 +173,13 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: {java_version: "15"} + - name: corretto-16 + run_list: + - recipe[test::corretto] + attributes: {version: "16"} + verifier: + inspec_tests: [test/integration/corretto] + inputs: {java_version: "16"} # Custom URL tests - name: custom-package-8 @@ -244,7 +192,7 @@ suites: checksum: 7b7884f2eb2ba2d47f4c0bf3bb1a2a95b73a3a7734bd47ebf9798483a7bcc423 verifier: inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/attributes/hotspot-8.yml] + input_files: [test/integration/custom-package/inputs/hotspot-8.yml] - name: custom-package-11 run_list: - recipe[test::custom_package] @@ -255,7 +203,7 @@ suites: checksum: 330d19a2eaa07ed02757d7a785a77bab49f5ee710ea03b4ee2fa220ddd0feffc verifier: inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/attributes/hotspot-11.yml] + input_files: [test/integration/custom-package/inputs/hotspot-11.yml] - name: custom-package-11-openj9 run_list: - recipe[test::custom_package] @@ -266,7 +214,7 @@ suites: checksum: 1530172ee98edd129954fcdca1bf725f7b30c8bfc3cdc381c88de96b7d19e690 verifier: inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/attributes/openj9-11.yml] + input_files: [test/integration/custom-package/inputs/openj9-11.yml] - name: custom-package-11-openj9-large-heap run_list: - recipe[test::custom_package] @@ -277,5 +225,4 @@ suites: checksum: 6524d85d2ce334c955a4347015567326067ef15fe5f6a805714b25cace256f40 verifier: inspec_tests: [test/integration/custom-package] - input_files: - [test/integration/custom-package/attributes/openj9-large-heap-11.yml] + input_files: [test/integration/custom-package/inputs/openj9-large-heap-11.yml] diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 2ff6a40a..a6c48faa 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -6,33 +6,42 @@ def corretto_arch end def default_corretto_url(version) - if version.to_s == '8' - "https://corretto.aws/downloads/latest/amazon-corretto-8-#{corretto_arch}-linux-jdk.tar.gz" - elsif version.to_s == '11' - "https://corretto.aws/downloads/latest/amazon-corretto-11-#{corretto_arch}-linux-jdk.tar.gz" - elsif version.to_s == '15' - "https://corretto.aws/downloads/latest/amazon-corretto-15-#{corretto_arch}-linux-jdk.tar.gz" - end + "https://corretto.aws/downloads/latest/amazon-corretto-#{version}-#{corretto_arch}-linux-jdk.tar.gz" end def default_corretto_bin_cmds(version) - if version.to_s == '8' + case version.to_s + when '8' %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) - elsif version.to_s == '11' + when '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) - elsif version.to_s == '15' + when '15' + %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jlink jmap jmod jpackage jps jrunscript jshell jstack jstat jstatd keytool rmid rmiregistry serialver) + when '16' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jlink jmap jmod jpackage jps jrunscript jshell jstack jstat jstatd keytool rmid rmiregistry serialver) + else + raise 'Corretto version not recognised' end end def corretto_sub_dir(version, full_version = nil) - ver = if version == '8' - full_version || '8.282.08.1' - elsif version.to_s == '11' - full_version || '11.0.10.9.1' - elsif version.to_s == '15' - full_version || '15.0.1.9.1' - end + if full_version.nil? + case version + when '8' + ver = '8.302.08.1' + when '11' + ver = '11.0.12.7.1' + when '15' + ver = '15.0.2.7.1' + when '16' + ver = '16.0.2.7.1' + else + raise 'Corretto version not recognised' + end + else + ver = full_version + end + "amazon-corretto-#{ver}-linux-#{corretto_arch}" end end diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 1439d5f9..715c5ea7 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -1,60 +1,29 @@ module Java module Cookbook module OpenJdkHelpers + def lts + %w(11 17) + end + def default_openjdk_install_method(version) case node['platform_family'] when 'amazon' - case version.to_i - when 7, 8, 11 - 'package' - else - 'source' - end - when 'rhel', 'fedora' - case node['platform_version'].to_i - when 7 - case version.to_i - when 6, 7, 8, 11 - 'package' - else - 'source' - end - when 8 - case version.to_i - when 8, 11 - 'package' - else - 'source' - end - else - # Assume Fedora - case version.to_i - when 8, 11 - 'package' - else - 'source' - end - end + 'source' + when 'rhel' + supported = lts.delete('11') + supported.include?(version) ? 'package' : 'source' when 'debian' - if platform?('debian') - case node['platform_version'].to_i - when 9 - 'source' - when 10 - version.to_i == 11 ? 'package' : 'source' - end - else - version.to_i == 10 ? 'source' : 'package' - end - when 'suse' - case version.to_i - when 8, 9, 11 - 'package' + case node['platform_version'] + when '10', '18.04' + supported = lts - ['17'] + supported.include?(version) ? 'package' : 'source' + when '9' + %w(8).include?(version) ? 'package' : 'source' else - 'source' + lts.include?(version) ? 'package' : 'source' end else - 'package' + lts.include?(version) ? 'package' : 'source' end end @@ -70,9 +39,17 @@ def default_openjdk_url(version) 'https://download.java.net/java/GA/jdk12/33/GPL/openjdk-12_linux-x64_bin.tar.gz' when '13' 'https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz' + when '14' + 'https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz' + when '15' + 'https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_linux-x64_bin.tar.gz' + when '16' + 'https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_linux-x64_bin.tar.gz' + when '17' + 'https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz' else Chef::Log.fatal('Version specified does not have a URL value set') - raise 'No checksum value' + raise 'Version supplied does not have a download URL set' end end @@ -88,8 +65,16 @@ def default_openjdk_checksum(version) 'b43bc15f4934f6d321170419f2c24451486bc848a2179af5e49d10721438dd56' when '13' '5f547b8f0ffa7da517223f6f929a5055d749776b1878ccedbd6cc1334f4d6f4d' + when '14' + 'c7006154dfb8b66328c6475447a396feb0042608ee07a96956547f574a911c09' + when '15' + 'bb67cadee687d7b486583d03c9850342afea4593be4f436044d785fba9508fb7' + when '16' + 'e952958f16797ad7dc7cd8b724edd69ec7e0e0434537d80d6b5165193e33b931' + when '17' + 'aef49cc7aa606de2044302e757fa94c8e144818e93487081c4fd319ca858134b' else - Chef::Log.fatal('Version specified does not have a c value set') + Chef::Log.fatal('Version specified does not have a checksum value set') raise 'No checksum value' end end @@ -106,7 +91,7 @@ def default_openjdk_bin_cmds(version) %w(appletviewer idlj jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool orbd pack200 rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) when '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) - when '12', '13', '14', '15', 'latest' + when '12', '13', '14', '15', '16', '17', 'latest' %w(jaotc jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) else Chef::Log.fatal('Version specified does not have a default set of bin_cmds') @@ -115,10 +100,10 @@ def default_openjdk_bin_cmds(version) def default_openjdk_pkg_names(version) value_for_platform_family( - amazon: version.to_i < 11 ? ["java-1.#{version}.0-openjdk", "java-1.#{version}.0-openjdk-devel"] : "java-#{version}-amazon-corretto", + amazon: ["java-1.#{version}.0-openjdk", "java-1.#{version}.0-openjdk-devel"], %w(rhel fedora) => version.to_i < 11 ? ["java-1.#{version}.0-openjdk", "java-1.#{version}.0-openjdk-devel"] : ["java-#{version}-openjdk", "java-#{version}-openjdk-devel"], suse: version.to_i == 8 ? ["java-1_#{version}_0-openjdk", "java-1_#{version}_0-openjdk-devel"] : ["java-#{version}-openjdk", "java-#{version}-openjdk-devel"], - freebsd: version.to_i.eql?(7) ? 'openjdk' : "openjdk#{version}", + freebsd: "openjdk#{version}", arch: "openjdk#{version}", debian: ["openjdk-#{version}-jdk", "openjdk-#{version}-jre-headless"], default: ["openjdk-#{version}-jdk"] diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index 5d4938ce..9bc1cc32 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -40,6 +40,15 @@ class DummyClass < Chef::Node end end + context 'Corretto 16 x64' do + let(:version) { '16' } + let(:machine) { 'x86_64' } + + it 'returns the correct URL' do + expect(subject.default_corretto_url(version)).to match /corretto-16.+\.tar.gz/ + end + end + context 'Corretto 8 aarch64' do let(:version) { '8' } let(:machine) { 'aarch64' } @@ -66,6 +75,15 @@ class DummyClass < Chef::Node expect(subject.default_corretto_url(version)).to match /corretto-15.+\.tar.gz/ end end + + context 'Corretto 16 aarch64' do + let(:version) { '16' } + let(:machine) { 'aarch64' } + + it 'returns the correct URL' do + expect(subject.default_corretto_url(version)).to match /corretto-16.+\.tar.gz/ + end + end end describe '#default_bin_cmds' do @@ -99,6 +117,15 @@ class DummyClass < Chef::Node expect(subject.default_corretto_bin_cmds(version)).to include 'jaotc' end end + + context 'Corretto 16' do + let(:version) { '16' } + + it 'returns the correct bin command array' do + expect(subject.default_corretto_bin_cmds(version)).to_not include 'unpack200' + expect(subject.default_corretto_bin_cmds(version)).to include 'jaotc' + end + end end describe '#corretto_sub_dir' do @@ -112,7 +139,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version)).to include '8.282.08.1' + expect(subject.corretto_sub_dir(version)).to include '8.302.08.1' end end @@ -121,7 +148,7 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '8.282.08.1' + expect(subject.corretto_sub_dir(version)).to include '8.302.08.1' end end @@ -130,7 +157,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 11 x64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.10.9.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.12.7.1' end end @@ -139,7 +166,7 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 11 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.10.9.1' + expect(subject.corretto_sub_dir(version)).to include '11.0.12.7.1' end end @@ -148,7 +175,7 @@ class DummyClass < Chef::Node let(:machine) { 'x86_64' } it 'returns the default directory value for Corrretto 15 x64' do - expect(subject.corretto_sub_dir(version)).to include '15.0.1.9.1' + expect(subject.corretto_sub_dir(version)).to include '15.0.2.7.1' end end @@ -157,7 +184,25 @@ class DummyClass < Chef::Node let(:machine) { 'aarch64' } it 'returns the default directory value for Corrretto 15 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '15.0.1.9.1' + expect(subject.corretto_sub_dir(version)).to include '15.0.2.7.1' + end + end + + context 'No full_version passed for Corretto 16 x64' do + let(:version) { '16' } + let(:machine) { 'x86_64' } + + it 'returns the default directory value for Corrretto 16 x64' do + expect(subject.corretto_sub_dir(version)).to include '16.0.2.7.1' + end + end + + context 'No full_version passed for Corretto 16 aarch64' do + let(:version) { '16' } + let(:machine) { 'aarch64' } + + it 'returns the default directory value for Corrretto 16 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '16.0.2.7.1' end end diff --git a/spec/libraries/openjdk_helpers_spec.rb b/spec/libraries/openjdk_helpers_spec.rb new file mode 100644 index 00000000..56c12c47 --- /dev/null +++ b/spec/libraries/openjdk_helpers_spec.rb @@ -0,0 +1,176 @@ +require 'spec_helper' + +RSpec.describe Java::Cookbook::OpenJdkHelpers do + class DummyClass < Chef::Node + include Java::Cookbook::OpenJdkHelpers + end + + subject { DummyClass.new } + + describe '#lts' do + it 'returns the currently supported OpenJDK versions minus version 8' do + expect(subject.lts).to include('11', '17') + end + end + + describe '#default_openjdk_url' do + before do + allow(subject).to receive(:[]).with(version).and_return(version) + end + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'returns the correct download URL' do + expect(subject.default_openjdk_url(version)).to eq 'https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz' + end + end + + context 'Invalid OpenJDK version' do + let(:version) { '18' } + + it 'should raise an error' do + expect { subject.default_openjdk_url(version) } + .to raise_error('Version supplied does not have a download URL set') + end + end + end + + describe '#default_openjdk_install_method' do + before do + allow(subject).to receive(:[]).with(version).and_return(version) + allow(subject).to receive(:[]).with('platform_family').and_return(platform_family) + allow(subject).to receive(:[]).with('platform_version').and_return(platform_version) + end + + context 'Amazon' do + let(:platform_family) { 'amazon' } + let(:platform_version) { '2' } + let(:version) { '17' } + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'Debian' do + let(:platform_family) { 'debian' } + + context '9' do + let(:platform_version) { '9' } + + context 'OpenJDK 8' do + let(:version) { '8' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + end + + context '10' do + let(:platform_version) { '10' } + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + end + + context '11' do + let(:platform_version) { '11' } + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + end + + context 'Ubuntu 18.04' do + let(:platform_version) { '18.04' } + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + end + + context 'Ubuntu 20.04' do + let(:platform_version) { '20.04' } + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + end + end + + # context 'Debian 11' do + # let(:platform_family) { 'debian' } + # let(:platform_version) { '10' } + # let(:version) { '17' } + # it 'should default to a package install' do + # expect(subject.default_openjdk_install_method(version)).to eq 'package' + # end + # end + end +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb b/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb index f1a81433..328f9b3c 100644 --- a/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb +++ b/test/fixtures/cookbooks/test/recipes/openjdk_pkg.rb @@ -1,3 +1,5 @@ -openjdk_pkg_install node['version'] +openjdk_install node['version'] do + install_type 'package' +end include_recipe 'test::java_cert' diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-11-hotspot.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9-large-heap.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9-large-heap.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-11-openj9.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-14-hotspot.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-14-hotspot.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-14-macos.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-14-macos.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9-large-heap.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9-large-heap.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-14-openj9.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-8-hotspot.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9-large-heap.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9-large-heap.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml diff --git a/test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml similarity index 100% rename from test/integration/adoptopenjdk/attributes/adoptopenjdk-8-openj9.yml rename to test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml diff --git a/test/integration/custom-package/attributes/hotspot-11.yml b/test/integration/custom-package/inputs/hotspot-11.yml similarity index 100% rename from test/integration/custom-package/attributes/hotspot-11.yml rename to test/integration/custom-package/inputs/hotspot-11.yml diff --git a/test/integration/custom-package/attributes/hotspot-8.yml b/test/integration/custom-package/inputs/hotspot-8.yml similarity index 100% rename from test/integration/custom-package/attributes/hotspot-8.yml rename to test/integration/custom-package/inputs/hotspot-8.yml diff --git a/test/integration/custom-package/attributes/openj9-11.yml b/test/integration/custom-package/inputs/openj9-11.yml similarity index 100% rename from test/integration/custom-package/attributes/openj9-11.yml rename to test/integration/custom-package/inputs/openj9-11.yml diff --git a/test/integration/custom-package/attributes/openj9-large-heap-11.yml b/test/integration/custom-package/inputs/openj9-large-heap-11.yml similarity index 100% rename from test/integration/custom-package/attributes/openj9-large-heap-11.yml rename to test/integration/custom-package/inputs/openj9-large-heap-11.yml diff --git a/test/integration/openjdk/controls/verify_openjdk.rb b/test/integration/openjdk/controls/verify_openjdk.rb index 59b59597..a2b6fe08 100644 --- a/test/integration/openjdk/controls/verify_openjdk.rb +++ b/test/integration/openjdk/controls/verify_openjdk.rb @@ -9,12 +9,6 @@ end describe command('update-alternatives --display jar') do - # the openjdk 11 package on amazon linux 2 creates a symbolic link - # using jre- rather than java- like the other platforms. - if os[:name] == 'amazon' && os[:release].start_with?('2') && java_version.to_i == 11 - its('stdout') { should match %r{\/usr\/lib\/jvm\/jre} } - else - its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } - end + its('stdout') { should match %r{/usr/lib/jvm/java} } end end diff --git a/test/integration/openjdk_pkg/controls/verify_openjdk.rb b/test/integration/openjdk_pkg/controls/verify_openjdk.rb index 2e09dd65..b00d2647 100644 --- a/test/integration/openjdk_pkg/controls/verify_openjdk.rb +++ b/test/integration/openjdk_pkg/controls/verify_openjdk.rb @@ -9,12 +9,6 @@ end describe command('update-alternatives --display java') do - # the openjdk 11 package on amazon linux 2 creates a symbolic link - # using jre- rather than java- like the other platforms. - if os[:name] == 'amazon' && os[:release].start_with?('2') && java_version.to_i == 11 - its('stdout') { should match %r{\/usr\/lib\/jvm\/jre} } - else - its('stdout') { should match %r{\/usr\/lib\/jvm\/java} } - end + its('stdout') { should match %r{/usr/lib/jvm/java} } end end From 72f1b096d2d8c10449baa448d99248c27bf4822a Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 6 Oct 2021 12:51:13 +0100 Subject: [PATCH 088/278] Update changelog for 10.1.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89888236..d7dc086a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.1.0 - *2021-10-06* - Revert worklfow split out - Rename InSpec attribute folders to input From 5abdd79bb4debdf57f27bdf6a54c6719d701efdb Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 6 Oct 2021 12:51:13 +0100 Subject: [PATCH 089/278] Update metadata for 10.1.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 43e3314a..86d2243b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.0.1' +version '10.1.0' supports 'debian' supports 'ubuntu' From 6434873876d58008530cdd7a1cc56339e9106ead Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 6 Oct 2021 12:51:15 +0100 Subject: [PATCH 090/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7dc086a..99ee26a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.1.0 - *2021-10-06* - Revert worklfow split out From 90acc28c256788c720518ab44b79e3c29fe7b16f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Oct 2021 03:30:56 -0700 Subject: [PATCH 091/278] Standardise files with files in sous-chefs/repo-management (#664) Signed-off-by: kitchen-porter --- .github/workflows/md-links.yml | 2 +- CHANGELOG.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index ba5e3bb2..ba887a16 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -1,5 +1,5 @@ --- -name: 'Markdown Link Check' +name: md-links "on": pull_request: diff --git a/CHANGELOG.md b/CHANGELOG.md index 99ee26a6..02e32deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 10.1.0 - *2021-10-06* - Revert worklfow split out From 67505a5405eb9e9b57382a681e50517b1dec2d1c Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Oct 2021 03:30:58 -0700 Subject: [PATCH 092/278] Update changelog for 10.1.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02e32deb..de1d9b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.1.1 - *2021-10-19* Standardise files with files in sous-chefs/repo-management From f4435502ec22cdf3fae7ebf36b75cca05a6f31ed Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Oct 2021 03:30:59 -0700 Subject: [PATCH 093/278] Update metadata for 10.1.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 86d2243b..1ef04ad6 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.1.0' +version '10.1.1' supports 'debian' supports 'ubuntu' From f84e00578bdd552a1a8cf71fd00624f489fa6e00 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Oct 2021 03:31:01 -0700 Subject: [PATCH 094/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de1d9b83..e2aff987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.1.1 - *2021-10-19* Standardise files with files in sous-chefs/repo-management From 768a2ae772d528f71da1ea082d177a5130e1a7d6 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 26 Jan 2022 11:43:37 +0000 Subject: [PATCH 095/278] Add test reusable workflow (#665) * Remove Homebrew from the MacOS runlist Signed-off-by: Dan Webb --- .delivery/project.toml | 9 ----- .../{delivery.yml => test-kitchen.yml} | 33 +++---------------- Berksfile | 1 - CHANGELOG.md | 2 ++ kitchen.macos.yml | 1 - 5 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 .delivery/project.toml rename .github/workflows/{delivery.yml => test-kitchen.yml} (79%) diff --git a/.delivery/project.toml b/.delivery/project.toml deleted file mode 100644 index 0d6f0ae9..00000000 --- a/.delivery/project.toml +++ /dev/null @@ -1,9 +0,0 @@ -[local_phases] -unit = "rspec spec/" -lint = 'cookstyle --display-cop-names --extra-details' -syntax = "echo skipping" -provision = "echo skipping" -deploy = "echo skipping" -smoke = "echo skipping" -functional = "echo skipping" -cleanup = "echo skipping" diff --git a/.github/workflows/delivery.yml b/.github/workflows/test-kitchen.yml similarity index 79% rename from .github/workflows/delivery.yml rename to .github/workflows/test-kitchen.yml index 75a8158a..773ffbc9 100644 --- a/.github/workflows/delivery.yml +++ b/.github/workflows/test-kitchen.yml @@ -1,5 +1,5 @@ --- -name: 'Lint & Unit Test' +name: 'Test' 'on': pull_request: @@ -7,34 +7,11 @@ name: 'Lint & Unit Test' branches: [main] jobs: - delivery: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run Chef Delivery - uses: actionshub/chef-delivery@main - env: - CHEF_LICENSE: accept-no-persist - - yamllint: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run yaml Lint - uses: actionshub/yamllint@main - - mdl: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run Markdown Lint - uses: actionshub/markdownlint@main + lint-unit: + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@0.0.1 integration: - needs: [delivery, yamllint, mdl] + needs: 'lint-unit' runs-on: ubuntu-latest strategy: matrix: @@ -83,7 +60,7 @@ jobs: os: ${{ matrix.os }} integration-macos: - needs: [delivery, yamllint, mdl] + needs: 'lint-unit' runs-on: macos-latest steps: - name: Check out code diff --git a/Berksfile b/Berksfile index 8275f4f3..e09849c7 100644 --- a/Berksfile +++ b/Berksfile @@ -3,6 +3,5 @@ source 'https://supermarket.chef.io' metadata group :integration do - cookbook 'homebrew' cookbook 'test', path: 'test/fixtures/cookbooks/test' end diff --git a/CHANGELOG.md b/CHANGELOG.md index e2aff987..5766f237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Remove delivery and move to calling RSpec directly via a reusable workflow + ## 10.1.1 - *2021-10-19* Standardise files with files in sous-chefs/repo-management diff --git a/kitchen.macos.yml b/kitchen.macos.yml index 7a316d5a..2fc17f27 100644 --- a/kitchen.macos.yml +++ b/kitchen.macos.yml @@ -22,7 +22,6 @@ platforms: suites: - name: adoptopenjdk-14 run_list: - - recipe[homebrew] - recipe[test::adoptopenjdk] attributes: version: 14 From 66954d21b38fa0185c986fdfcdaa7dc0af85f3b3 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 26 Jan 2022 03:43:40 -0800 Subject: [PATCH 096/278] Update changelog for 10.1.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5766f237..b71cf68b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.1.2 - *2022-01-26* - Remove delivery and move to calling RSpec directly via a reusable workflow From 097843a3f99d5eaaacf3f14899d26ae14e7c4279 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 26 Jan 2022 03:43:40 -0800 Subject: [PATCH 097/278] Update metadata for 10.1.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 1ef04ad6..bbed210f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.1.1' +version '10.1.2' supports 'debian' supports 'ubuntu' From 4f0ad57f55219e887220f350cba19053c7b92b63 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 26 Jan 2022 03:43:42 -0800 Subject: [PATCH 098/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b71cf68b..0e66adb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.1.2 - *2022-01-26* - Remove delivery and move to calling RSpec directly via a reusable workflow From 4605b4d06b4bc4d87513524e00e2c575b19af098 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 26 Jan 2022 11:48:00 +0000 Subject: [PATCH 099/278] Remove brew tap --full option (#666) --full is no longer a valid option Signed-off-by: Dan Webb --- CHANGELOG.md | 2 ++ documentation/resources/adoptopenjdk_install.md | 1 - documentation/resources/adoptopenjdk_macos_install.md | 1 - resources/adoptopenjdk_install.rb | 3 --- resources/adoptopenjdk_macos_install.rb | 5 ----- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e66adb2..13e67776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Remove tap_full option as this is no longer supported and there is no replacement + ## 10.1.2 - *2022-01-26* - Remove delivery and move to calling RSpec directly via a reusable workflow diff --git a/documentation/resources/adoptopenjdk_install.md b/documentation/resources/adoptopenjdk_install.md index b13aeb84..d4fbea4f 100644 --- a/documentation/resources/adoptopenjdk_install.md +++ b/documentation/resources/adoptopenjdk_install.md @@ -25,7 +25,6 @@ Introduced: v7.0.0 | bin_cmds | Array | | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | | Alternatives priority to set for this Java | | reset_alternatives | [true, false] | | Whether to reset alternatives before setting | -| tap_full | [true, false] | `true` | Perform a full clone on the tap, as opposed to a shallow clone | | tap_url | String, | | The URL of the tap | | cask_options | String, | | Options to pass to the brew command during installation | | homebrew_path | String, | | The path to the homebrew binary | diff --git a/documentation/resources/adoptopenjdk_macos_install.md b/documentation/resources/adoptopenjdk_macos_install.md index a1da02a3..f5f47dfa 100644 --- a/documentation/resources/adoptopenjdk_macos_install.md +++ b/documentation/resources/adoptopenjdk_macos_install.md @@ -13,7 +13,6 @@ Introduced: v8.1.0 | Name | Type | Default | Description | Allowed Values | | ------------- | ----------------- | -------------------------- | -------------------------------------------------------------- | -| tap_full | [true, false] | `true` | Perform a full clone on the tap, as opposed to a shallow clone | | tap_url | String | | The URL of the tap | | cask_options | String | | Options to pass to the brew command during installation | | homebrew_path | String | | The path to the homebrew binary | diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index da258284..6b628708 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -18,7 +18,6 @@ property :reset_alternatives, [true, false], description: 'Whether to reset alternatives before setting' # MacOS options -property :tap_full, [true, false], default: true, description: 'Perform a full clone on the tap, as opposed to a shallow clone' property :tap_url, String, description: 'The URL of the tap' property :cask_options, String, description: 'Options to pass to the brew command during installation' property :homebrew_path, String, description: 'The path to the homebrew binary' @@ -34,7 +33,6 @@ end adoptopenjdk_macos_install 'homebrew' do - tap_full new_resource.tap_full tap_url new_resource.tap_url cask_options new_resource.cask_options homebrew_path new_resource.homebrew_path @@ -59,7 +57,6 @@ case node['platform_family'] when 'mac_os_x' adoptopenjdk_macos_install 'homebrew' do - tap_full new_resource.tap_full tap_url new_resource.tap_url cask_options new_resource.cask_options homebrew_path new_resource.homebrew_path diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb index 3e6abf24..21d9dddd 100644 --- a/resources/adoptopenjdk_macos_install.rb +++ b/resources/adoptopenjdk_macos_install.rb @@ -2,10 +2,6 @@ unified_mode true include Java::Cookbook::AdoptOpenJdkMacOsHelpers -property :tap_full, [true, false], - default: true, - description: 'Perform a full clone on the tap, as opposed to a shallow clone' - property :tap_url, String, description: 'The URL of the tap' @@ -40,7 +36,6 @@ action :install do homebrew_tap 'AdoptOpenJDK/openjdk' do - full new_resource.tap_full homebrew_path new_resource.homebrew_path owner new_resource.owner url new_resource.tap_url From 399c915f2c6eb58f0d5d7af9da8e1c52e6fc7f27 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 26 Jan 2022 03:48:04 -0800 Subject: [PATCH 100/278] Update changelog for 10.2.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13e67776..eeece2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.2.0 - *2022-01-26* - Remove tap_full option as this is no longer supported and there is no replacement From d671e4169d099cdc22a45bf2efccaff16374e90c Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 26 Jan 2022 03:48:05 -0800 Subject: [PATCH 101/278] Update metadata for 10.2.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index bbed210f..2f86b0c0 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.1.2' +version '10.2.0' supports 'debian' supports 'ubuntu' From 3d96081012bfca15b77b914475c7779dab08be32 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 26 Jan 2022 03:48:07 -0800 Subject: [PATCH 102/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeece2f4..b87729b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.2.0 - *2022-01-26* - Remove tap_full option as this is no longer supported and there is no replacement From 70c1b497e1cff48f649e6ba01e8e391e0deee7c7 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 2 Feb 2022 11:48:19 +0000 Subject: [PATCH 103/278] Add Cookstyle back into the required checks (#670) * Add Cookstyle back into the required checks Signed-off-by: Dan Webb * Fix name of step Signed-off-by: Dan Webb --- .github/workflows/test-kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 773ffbc9..6506fcf0 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -8,7 +8,7 @@ name: 'Test' jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@0.0.1 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@0.0.3 integration: needs: 'lint-unit' From dfd00e19bdd510607706c6e652974d556f8d64ed Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 2 Feb 2022 03:48:21 -0800 Subject: [PATCH 104/278] Update changelog for 10.2.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b87729b2..ec26d026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.2.1 - *2022-02-02* ## 10.2.0 - *2022-01-26* From 6ad42ed7ac945afdcd7afa01888e7e946ae866f7 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 2 Feb 2022 03:48:22 -0800 Subject: [PATCH 105/278] Update metadata for 10.2.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 2f86b0c0..6739f6e3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.2.0' +version '10.2.1' supports 'debian' supports 'ubuntu' From f7df4aece95ff24b6e33c85126eb2abd377efd91 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 2 Feb 2022 03:48:24 -0800 Subject: [PATCH 106/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec26d026..35fcfafd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.2.1 - *2022-02-02* ## 10.2.0 - *2022-01-26* From d5afa1371cf3504499136df1788f684da3462842 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Feb 2022 01:30:27 -0800 Subject: [PATCH 107/278] Standardise files with files in sous-chefs/repo-management (#671) Signed-off-by: kitchen-porter --- .overcommit.yml | 4 ---- CHANGELOG.md | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.overcommit.yml b/.overcommit.yml index 1d27ed8d..cd8682a0 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -11,10 +11,6 @@ PreCommit: enabled: true required_executable: 'cookstyle' command: ["cookstyle"] - Delivery: - enabled: true - required_executable: 'delivery' - flags: ['local', 'all'] CommitMsg: HardTabs: enabled: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 35fcfafd..7d285404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 10.2.1 - *2022-02-02* ## 10.2.0 - *2022-01-26* From 91adf2eb772a993ab9f3cff11df60e74b31c17fe Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Feb 2022 01:30:29 -0800 Subject: [PATCH 108/278] Update changelog for 10.2.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d285404..ef3136ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 10.2.2 - *2022-02-14* Standardise files with files in sous-chefs/repo-management From 583e985c456380f6e2c2f7bdbb0c70993cc1f245 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Feb 2022 01:30:30 -0800 Subject: [PATCH 109/278] Update metadata for 10.2.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 6739f6e3..6c4a2775 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 15.3' -version '10.2.1' +version '10.2.2' supports 'debian' supports 'ubuntu' From cff777a59cbb64f2a917f38ed333ccf87046f20d Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Feb 2022 01:30:32 -0800 Subject: [PATCH 110/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef3136ce..745fdae7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 10.2.2 - *2022-02-14* Standardise files with files in sous-chefs/repo-management From c8d12caae966cc712ddeccd42be11ab17670dc13 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 16 Feb 2022 00:32:03 +0000 Subject: [PATCH 111/278] Resource partials (#668) - Require Chef 16 for resource partials - Add resource partials for: MacOS, Linux, Java Home and Common as these are used in a multiple places Signed-off-by: Dan Webb Co-authored-by: Lance Albertson --- CHANGELOG.md | 7 +- metadata.rb | 2 +- resources/adoptopenjdk_install.rb | 41 +++++------ resources/adoptopenjdk_linux_install.rb | 51 ++++---------- resources/adoptopenjdk_macos_install.rb | 44 +++++------- resources/alternatives.rb | 31 +++++---- resources/certificate.rb | 91 ++++++++++++++----------- resources/corretto_install.rb | 45 ++++-------- resources/jce.rb | 34 +++++++-- resources/openjdk_install.rb | 50 +++++++++----- resources/openjdk_pkg_install.rb | 31 +++------ resources/openjdk_source_install.rb | 48 ++++--------- resources/partial/_common.rb | 3 + resources/partial/_java_home.rb | 11 +++ resources/partial/_linux.rb | 11 +++ resources/partial/_macos.rb | 15 ++++ 16 files changed, 267 insertions(+), 248 deletions(-) create mode 100644 resources/partial/_common.rb create mode 100644 resources/partial/_java_home.rb create mode 100644 resources/partial/_linux.rb create mode 100644 resources/partial/_macos.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 745fdae7..fcd9f993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,17 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Require Chef 16 for resource partials +- Add resource partials for: MacOS, Linux, Java Home and Common as these are used in a multiple places + ## 10.2.2 - *2022-02-14* -Standardise files with files in sous-chefs/repo-management +- Standardise files with files in sous-chefs/repo-management ## 10.2.1 - *2022-02-02* +- Standardise files with files in sous-chefs/repo-management + ## 10.2.0 - *2022-01-26* - Remove tap_full option as this is no longer supported and there is no replacement diff --git a/metadata.rb b/metadata.rb index 6c4a2775..407840bd 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ description 'Recipes and resources for installing Java and managing certificates' source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' -chef_version '>= 15.3' +chef_version '>= 16.0' version '10.2.2' supports 'debian' diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb index 6b628708..45743a19 100644 --- a/resources/adoptopenjdk_install.rb +++ b/resources/adoptopenjdk_install.rb @@ -1,27 +1,30 @@ provides :adoptopenjdk_install unified_mode true -# Common options -property :version, String, name_property: true, description: 'Java version to install' +property :variant, + String, + description: 'Install flavour', default: 'openj9' -# Linux options -property :variant, String, description: 'Install flavour', default: 'openj9' -property :url, String, description: 'The URL to download from' -property :checksum, String, description: 'The checksum for the downloaded file' -property :java_home, String, description: 'Set to override the java_home' -property :java_home_mode, String, description: 'The permission for the Java home directory' -property :java_home_owner, String, description: 'Owner of the Java Home' -property :java_home_group, String, description: 'Group for the Java Home' -property :default, [true, false], description: ' Whether to set this as the default Java' -property :bin_cmds, Array, description: 'A list of bin_cmds based on the version and variant' -property :alternatives_priority, Integer, description: 'Alternatives priority to set for this Java' -property :reset_alternatives, [true, false], description: 'Whether to reset alternatives before setting' +property :url, + String, + description: 'The URL to download from' -# MacOS options -property :tap_url, String, description: 'The URL of the tap' -property :cask_options, String, description: 'Options to pass to the brew command during installation' -property :homebrew_path, String, description: 'The path to the homebrew binary' -property :owner, [String, Integer], description: 'The owner of the Homebrew installation' +property :checksum, + String, + description: 'The checksum for the downloaded file' + +property :java_home, + String, + description: 'Set to override the java_home' + +property :bin_cmds, + Array, + description: 'A list of bin_cmds based on the version and variant' + +use 'partial/_common' +use 'partial/_linux' +use 'partial/_java_home' +use 'partial/_macos' action :install do case node['platform_family'] diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb index 631d9246..126652b9 100644 --- a/resources/adoptopenjdk_linux_install.rb +++ b/resources/adoptopenjdk_linux_install.rb @@ -2,52 +2,31 @@ unified_mode true include Java::Cookbook::AdoptOpenJdkHelpers -property :version, String, name_property: true, description: 'Java version to install' - property :variant, String, - equal_to: %w(hotspot openj9 openj9-large-heap), - default: 'openj9', - description: 'Install flavour' + equal_to: %w(hotspot openj9 openj9-large-heap), + default: 'openj9', + description: 'Install flavour' property :url, String, - default: lazy { default_adopt_openjdk_url(version)[variant] }, - description: 'The URL to download from' + default: lazy { default_adopt_openjdk_url(version)[variant] }, + description: 'The URL to download from' property :checksum, String, - regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, - default: lazy { default_adopt_openjdk_checksum(version)[variant] }, - description: 'The checksum for the downloaded file' + regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, + default: lazy { default_adopt_openjdk_checksum(version)[variant] }, + description: 'The checksum for the downloaded file' property :java_home, String, - default: lazy { "/usr/lib/jvm/java-#{version}-adoptopenjdk-#{variant}/#{sub_dir(url)}" }, - description: 'Set to override the java_home' - -property :java_home_mode, String, - description: 'The permission for the Java home directory' - -property :java_home_owner, String, - default: 'root', - description: 'Owner of the Java Home' - -property :java_home_group, String, - default: lazy { node['root_group'] }, - description: 'Group for the Java Home' - -property :default, [true, false], - default: true, - description: ' Whether to set this as the defalut Java' + default: lazy { "/usr/lib/jvm/java-#{version}-adoptopenjdk-#{variant}/#{sub_dir(url)}" }, + description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_adopt_openjdk_bin_cmds(version)[variant] }, - description: 'A list of bin_cmds based on the version and variant' - -property :alternatives_priority, Integer, - default: 1, - description: 'Alternatives priority to set for this Java' + default: lazy { default_adopt_openjdk_bin_cmds(version)[variant] }, + description: 'A list of bin_cmds based on the version and variant' -property :reset_alternatives, [true, false], - default: true, - description: 'Whether to reset alternatives before setting' +use 'partial/_common' +use 'partial/_linux' +use 'partial/_java_home' action :install do extract_dir = new_resource.java_home.split('/')[0..-2].join('/') diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb index 21d9dddd..92fd6c7e 100644 --- a/resources/adoptopenjdk_macos_install.rb +++ b/resources/adoptopenjdk_macos_install.rb @@ -2,37 +2,27 @@ unified_mode true include Java::Cookbook::AdoptOpenJdkMacOsHelpers -property :tap_url, String, - description: 'The URL of the tap' - -property :cask_options, String, - description: 'Options to pass to the brew command during installation' - -property :homebrew_path, String, - description: 'The path to the homebrew binary' - -property :owner, [String, Integer], - description: 'The owner of the Homebrew installation' +use 'partial/_macos' property :java_home, String, - default: lazy { macos_java_home(version) }, - description: 'MacOS specific JAVA_HOME' + default: lazy { macos_java_home(version) }, + description: 'MacOS specific JAVA_HOME' property :version, String, - default: 'adoptopenjdk14', - equal_to: %w( - adoptopenjdk8 adoptopenjdk8-openj9 adoptopenjdk8-openj9-large - adoptopenjdk8-jre adoptopenjdk8-openj9-jre adoptopenjdk8-jre-large - adoptopenjdk9 adoptopenjdk10 - adoptopenjdk11 adoptopenjdk11-openj9 adoptopenjdk11-openj9-large - adoptopenjdk11-jre adoptopenjdk11-openj9-jre adoptopenjdk11-openj9-jre-large - adoptopenjdk12 adoptopenjdk12-openj9 adoptopenjdk12-openj9-large - adoptopenjdk12-jre adoptopenjdk12-openj9-jre adoptopenjdk12-openj9-jre-large - adoptopenjdk13 adoptopenjdk13-openj9 adoptopenjdk13-openj9-large - adoptopenjdk13-jre adoptopenjdk13-openj9-jre adoptopenjdk13-openj9-jre-large - adoptopenjdk14 adoptopenjdk14-openj9 adoptopenjdk14-openj9-large - adoptopenjdk14-jre adoptopenjdk14-openj9-jre adoptopenjdk14-openj9-jre-large - ) + default: 'adoptopenjdk14', + equal_to: %w( + adoptopenjdk8 adoptopenjdk8-openj9 adoptopenjdk8-openj9-large + adoptopenjdk8-jre adoptopenjdk8-openj9-jre adoptopenjdk8-jre-large + adoptopenjdk9 adoptopenjdk10 + adoptopenjdk11 adoptopenjdk11-openj9 adoptopenjdk11-openj9-large + adoptopenjdk11-jre adoptopenjdk11-openj9-jre adoptopenjdk11-openj9-jre-large + adoptopenjdk12 adoptopenjdk12-openj9 adoptopenjdk12-openj9-large + adoptopenjdk12-jre adoptopenjdk12-openj9-jre adoptopenjdk12-openj9-jre-large + adoptopenjdk13 adoptopenjdk13-openj9 adoptopenjdk13-openj9-large + adoptopenjdk13-jre adoptopenjdk13-openj9-jre adoptopenjdk13-openj9-jre-large + adoptopenjdk14 adoptopenjdk14-openj9 adoptopenjdk14-openj9-large + adoptopenjdk14-jre adoptopenjdk14-openj9-jre adoptopenjdk14-openj9-jre-large + ) action :install do homebrew_tap 'AdoptOpenJDK/openjdk' do diff --git a/resources/alternatives.rb b/resources/alternatives.rb index 26bb6ec1..bb5b820a 100644 --- a/resources/alternatives.rb +++ b/resources/alternatives.rb @@ -1,22 +1,27 @@ unified_mode true -property :java_location, String, - description: 'Java installation location' +property :java_location, + String, + description: 'Java installation location' -property :bin_cmds, Array, - description: 'Array of Java tool names to set or unset alternatives on' +property :bin_cmds, + Array, + description: 'Array of Java tool names to set or unset alternatives on' -property :default, [true, false], - default: true, - description: 'Whether to set the Java tools as system default. Boolean, defaults to `true`' +property :default, + [true, false], + default: true, + description: 'Whether to set the Java tools as system default. Boolean, defaults to `true`' -property :priority, Integer, - default: 1061, - description: ' Priority of the alternatives. Integer, defaults to `1061`' +property :priority, + Integer, + default: 1061, + description: ' Priority of the alternatives. Integer, defaults to `1061`' -property :reset_alternatives, [true, false], - default: true, - description: 'Whether to reset alternatives before setting them' +property :reset_alternatives, + [true, false], + default: true, + description: 'Whether to reset alternatives before setting them' action :set do if new_resource.bin_cmds diff --git a/resources/certificate.rb b/resources/certificate.rb index 6fc1f32a..1c5286fe 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -1,46 +1,57 @@ unified_mode true include Java::Cookbook::CertificateHelpers -property :cert_alias, String, - name_property: true, - description: 'The alias of the certificate in the keystore. This defaults to the name of the resource' - -property :java_home, String, - default: lazy { node['java']['java_home'] }, - description: 'The java home directory' - -property :java_version, String, - default: lazy { node['java']['jdk_version'] }, - description: 'The major java version' - -property :cacerts, [true, false], - default: true, - description: 'Specify true for interacting with the Java installation cacerts file. (Java 9+)' - -property :keystore_path, String, - default: lazy { default_truststore_path(java_version, java_home) }, - description: 'Path to the keystore' - -property :keystore_passwd, String, - default: 'changeit', - description: 'Password to the keystore' - -property :cert_data, String, - description: 'The certificate data to install' - -property :cert_file, String, - description: 'Path to a certificate file to install' - -property :ssl_endpoint, String, - description: 'An SSL end-point from which to download the certificate' - -property :starttls, String, - equal_to: %w(smtp pop3 imap ftp xmpp xmpp-server irc postgres mysql lmtp nntp sieve ldap), - description: 'A protocol specific STARTTLS argument to use when fetching from an ssl_endpoint' - -property :file_cache_path, String, - default: Chef::Config[:file_cache_path], - description: 'Location to store certificate files' +property :cert_alias, + String, + name_property: true, + description: 'The alias of the certificate in the keystore. This defaults to the name of the resource' + +property :java_home, + String, + default: lazy { node['java']['java_home'] }, + description: 'The java home directory' + +property :java_version, + String, + default: lazy { node['java']['jdk_version'] }, + description: 'The major java version' + +property :cacerts, + [true, false], + default: true, + description: 'Specify true for interacting with the Java installation cacerts file. (Java 9+)' + +property :keystore_path, + String, + default: lazy { default_truststore_path(java_version, java_home) }, + description: 'Path to the keystore' + +property :keystore_passwd, + String, + default: 'changeit', + description: 'Password to the keystore' + +property :cert_data, + String, + description: 'The certificate data to install' + +property :cert_file, + String, + description: 'Path to a certificate file to install' + +property :ssl_endpoint, + String, + description: 'An SSL end-point from which to download the certificate' + +property :starttls, + String, + equal_to: %w(smtp pop3 imap ftp xmpp xmpp-server irc postgres mysql lmtp nntp sieve ldap), + description: 'A protocol specific STARTTLS argument to use when fetching from an ssl_endpoint' + +property :file_cache_path, + String, + default: Chef::Config[:file_cache_path], + description: 'Location to store certificate files' action :install do require 'openssl' diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 7bec5112..245cea2e 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -2,49 +2,28 @@ unified_mode true include Java::Cookbook::CorrettoHelpers -property :version, String, name_property: true, description: 'Java version to install' property :full_version, String, - description: 'Used to configure the package directory, change this is the version installed by the package is no longer correct' + description: 'Used to configure the package directory, change this is the version installed by the package is no longer correct' property :url, String, - default: lazy { default_corretto_url(version) }, - description: 'The URL to download from' + default: lazy { default_corretto_url(version) }, + description: 'The URL to download from' property :checksum, String, - regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, - description: 'The checksum for the downloaded file' + regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, + description: 'The checksum for the downloaded file' property :java_home, String, - default: lazy { "/usr/lib/jvm/java-#{version}-corretto/#{corretto_sub_dir(version, full_version)}" }, - description: 'Set to override the java_home' - -property :java_home_mode, String, - default: '0755', - description: 'The permission for the Java home directory' - -property :java_home_owner, String, - default: 'root', - description: 'Owner of the Java Home' - -property :java_home_group, String, - default: lazy { node['root_group'] }, - description: 'Group for the Java Home' - -property :default, [true, false], - default: true, - description: ' Whether to set this as the defalut Java' + default: lazy { "/usr/lib/jvm/java-#{version}-corretto/#{corretto_sub_dir(version, full_version)}" }, + description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_corretto_bin_cmds(version) }, - description: 'A list of bin_cmds based on the version and variant' - -property :alternatives_priority, Integer, - default: 1, - description: 'Alternatives priority to set for this Java' + default: lazy { default_corretto_bin_cmds(version) }, + description: 'A list of bin_cmds based on the version and variant' -property :reset_alternatives, [true, false], - default: true, - description: 'Whether to reset alternatives before setting' +use 'partial/_common' +use 'partial/_linux' +use 'partial/_java_home' action :install do extract_dir = new_resource.java_home.split('/')[0..-2].join('/') diff --git a/resources/jce.rb b/resources/jce.rb index e2df51cd..ee11918b 100644 --- a/resources/jce.rb +++ b/resources/jce.rb @@ -1,12 +1,32 @@ unified_mode true -property :jdk_version, String, default: lazy { node['java']['jdk_version'].to_s }, description: 'The Java version to install into' -property :jce_url, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['url'] }, description: 'The URL for the JCE distribution' -property :jce_checksum, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['checksum'] }, description: 'The checksum of the JCE distribution' -property :java_home, String, default: lazy { node['java']['java_home'] }, description: 'The location of the Java installation' -property :jce_home, String, default: lazy { node['java']['oracle']['jce']['home'] }, description: 'The location where JCE files will be decompressed for installation' -property :jce_cookie, String, default: lazy { node['java']['oracle']['accept_oracle_download_terms'] ? 'oraclelicense=accept-securebackup-cookie' : '' }, description: 'Indicates that you accept Oracles EULA' -property :principal, String, default: lazy { platform_family?('windows') ? node['java']['windows']['owner'] : 'administrator' }, description: 'For Windows installations only, this determines the owner of the JCE files' +property :jdk_version, + String, + default: lazy { node['java']['jdk_version'].to_s }, description: 'The Java version to install into' + +property :jce_url, + String, + default: lazy { node['java']['oracle']['jce'][jdk_version]['url'] }, description: 'The URL for the JCE distribution' + +property :jce_checksum, + String, + default: lazy { node['java']['oracle']['jce'][jdk_version]['checksum'] }, description: 'The checksum of the JCE distribution' + +property :java_home, + String, + default: lazy { node['java']['java_home'] }, description: 'The location of the Java installation' + +property :jce_home, + String, + default: lazy { node['java']['oracle']['jce']['home'] }, description: 'The location where JCE files will be decompressed for installation' + +property :jce_cookie, + String, + default: lazy { node['java']['oracle']['accept_oracle_download_terms'] ? 'oraclelicense=accept-securebackup-cookie' : '' }, description: 'Indicates that you accept Oracles EULA' + +property :principal, + String, + default: lazy { platform_family?('windows') ? node['java']['windows']['owner'] : 'administrator' }, description: 'For Windows installations only, this determines the owner of the JCE files' action :install do jdk_version = new_resource.jdk_version diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 58532609..137a13b2 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -2,23 +2,39 @@ unified_mode true include Java::Cookbook::OpenJdkHelpers -property :version, String, name_property: true, description: 'Java major version to install' -property :install_type, String, - default: lazy { default_openjdk_install_method(version) }, - equal_to: %w( package source ), - description: 'Installation type' -property :pkg_names, [String, Array], description: 'List of packages to install' -property :pkg_version, String, description: 'Package version to install' -property :java_home, String, description: 'Set to override the java_home' -property :default, [true, false], description: ' Whether to set this as the defalut Java' -property :bin_cmds, Array, description: 'A list of bin_cmds based on the version and variant' -property :alternatives_priority, Integer, description: 'Alternatives priority to set for this Java' -property :reset_alternatives, [true, false], description: 'Whether to reset alternatives before setting' -property :url, String, description: 'The URL to download from' -property :checksum, String, description: 'The checksum for the downloaded file' -property :java_home_mode, String, description: 'The permission for the Java home directory' -property :java_home_owner, String, description: 'Owner of the Java Home' -property :java_home_group, String, description: 'Group for the Java Home' +property :install_type, + String, + default: lazy { default_openjdk_install_method(version) }, + equal_to: %w( package source ), + description: 'Installation type' + +property :pkg_names, + [String, Array], + description: 'List of packages to install' + +property :pkg_version, + String, + description: 'Package version to install' + +property :java_home, + String, + description: 'Set to override the java_home' + +property :bin_cmds, + Array, + description: 'A list of bin_cmds based on the version and variant' + +property :url, + String, + description: 'The URL to download from' + +property :checksum, + String, + description: 'The checksum for the downloaded file' + +use 'partial/_common' +use 'partial/_linux' +use 'partial/_java_home' action :install do if new_resource.install_type == 'package' diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 4d053e7f..7e2f7725 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -2,36 +2,27 @@ unified_mode true include Java::Cookbook::OpenJdkHelpers -property :version, String, - name_property: true, - description: 'Java major version to install' - property :pkg_names, [String, Array], - default: lazy { default_openjdk_pkg_names(version) }, - description: 'List of packages to install' + default: lazy { default_openjdk_pkg_names(version) }, + description: 'List of packages to install' property :pkg_version, String, - description: 'Package version to install' + description: 'Package version to install' property :java_home, String, - default: lazy { default_openjdk_pkg_java_home(version) }, - description: 'Set to override the java_home' - -property :default, [true, false], - default: true, - description: ' Whether to set this as the defalut Java' + default: lazy { default_openjdk_pkg_java_home(version) }, + description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_openjdk_bin_cmds(version) }, - description: 'A list of bin_cmds based on the version and variant' + default: lazy { default_openjdk_bin_cmds(version) }, + description: 'A list of bin_cmds based on the version and variant' property :alternatives_priority, Integer, - default: 1062, - description: 'Alternatives priority to set for this Java' + default: 1062, + description: 'Alternatives priority to set for this Java' -property :reset_alternatives, [true, false], - default: true, - description: 'Whether to reset alternatives before setting' +use 'partial/_common' +use 'partial/_linux' action :install do if platform?('ubuntu') diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index 61fa7e54..f999712e 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -3,49 +3,29 @@ include Java::Cookbook::OpenJdkHelpers property :version, String, - name_property: true, - description: 'Java version to install' + name_property: true, + description: 'Java version to install' property :url, String, - default: lazy { default_openjdk_url(version) }, - description: 'The URL to download from' + default: lazy { default_openjdk_url(version) }, + description: 'The URL to download from' property :checksum, String, - regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, - default: lazy { default_openjdk_checksum(version) }, - description: 'The checksum for the downloaded file' + regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, + default: lazy { default_openjdk_checksum(version) }, + description: 'The checksum for the downloaded file' property :java_home, String, - default: lazy { "/usr/lib/jvm/java-#{version}-openjdk/jdk-#{version}" }, - description: 'Set to override the java_home' - -property :java_home_mode, String, - default: '0755', - description: 'The permission for the Java home directory' - -property :java_home_owner, String, - default: 'root', - description: 'Owner of the Java Home' - -property :java_home_group, String, - default: lazy { node['root_group'] }, - description: 'Group for the Java Home' - -property :default, [true, false], - default: true, - description: ' Whether to set this as the defalut Java' + default: lazy { "/usr/lib/jvm/java-#{version}-openjdk/jdk-#{version}" }, + description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_openjdk_bin_cmds(version) }, - description: 'A list of bin_cmds based on the version and variant' - -property :alternatives_priority, Integer, - default: 1, - description: 'Alternatives priority to set for this Java' + default: lazy { default_openjdk_bin_cmds(version) }, + description: 'A list of bin_cmds based on the version and variant' -property :reset_alternatives, [true, false], - default: true, - description: 'Whether to reset alternatives before setting' +use 'partial/_common' +use 'partial/_linux' +use 'partial/_java_home' action :install do extract_dir = new_resource.java_home.split('/')[0..-2].join('/') diff --git a/resources/partial/_common.rb b/resources/partial/_common.rb new file mode 100644 index 00000000..1e8f424c --- /dev/null +++ b/resources/partial/_common.rb @@ -0,0 +1,3 @@ +property :version, String, + name_property: true, + description: 'Java version to install' diff --git a/resources/partial/_java_home.rb b/resources/partial/_java_home.rb new file mode 100644 index 00000000..8abdfc15 --- /dev/null +++ b/resources/partial/_java_home.rb @@ -0,0 +1,11 @@ +property :java_home_mode, String, + default: '0755', + description: 'The permission for the Java home directory' + +property :java_home_owner, String, + default: 'root', + description: 'Owner of the Java Home' + +property :java_home_group, String, + default: lazy { node['root_group'] }, + description: 'Group for the Java Home' diff --git a/resources/partial/_linux.rb b/resources/partial/_linux.rb new file mode 100644 index 00000000..3fcad6c0 --- /dev/null +++ b/resources/partial/_linux.rb @@ -0,0 +1,11 @@ +property :alternatives_priority, Integer, + default: 1, + description: 'Alternatives priority to set for this Java' + +property :reset_alternatives, [true, false], + default: true, + description: 'Whether to reset alternatives before setting' + +property :default, [true, false], + default: true, + description: ' Whether to set this as the default Java' diff --git a/resources/partial/_macos.rb b/resources/partial/_macos.rb new file mode 100644 index 00000000..2e872fc3 --- /dev/null +++ b/resources/partial/_macos.rb @@ -0,0 +1,15 @@ +property :tap_url, + String, + description: 'The URL of the tap' + +property :cask_options, + String, + description: 'Options to pass to the brew command during installation' + +property :homebrew_path, + String, + description: 'The path to the homebrew binary' + +property :owner, + [String, Integer], + description: 'The owner of the Homebrew installation' From 1e6f9171824d621251664b20b0fc6071daee6065 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 15 Feb 2022 16:32:05 -0800 Subject: [PATCH 112/278] Update changelog for 11.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcd9f993..2da5506a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.0.0 - *2022-02-16* - Require Chef 16 for resource partials - Add resource partials for: MacOS, Linux, Java Home and Common as these are used in a multiple places From 6cdb766a1424fedae6f604979997c046a2f6d286 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 15 Feb 2022 16:32:06 -0800 Subject: [PATCH 113/278] Update metadata for 11.0.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 407840bd..39af0012 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '10.2.2' +version '11.0.0' supports 'debian' supports 'ubuntu' From df2f641d4dcad6aa7480414001cba27013c116f4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 15 Feb 2022 16:32:08 -0800 Subject: [PATCH 114/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2da5506a..a1fa4063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.0.0 - *2022-02-16* - Require Chef 16 for resource partials From 801ee50cd4a0f2a755e8e010e20da822dca5e5cd Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 16 Feb 2022 13:55:07 +0000 Subject: [PATCH 115/278] Elevate permissions for GitHub reuable workflow (#672) This will allow the reusable workflow to post problems back to the open PR Signed-off-by: Dan Webb --- .github/workflows/test-kitchen.yml | 6 ++++++ CHANGELOG.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 6506fcf0..c5a70cee 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -9,6 +9,12 @@ name: 'Test' jobs: lint-unit: uses: sous-chefs/.github/.github/workflows/lint-unit.yml@0.0.3 + permissions: + actions: write + checks: write + pull-requests: write + statuses: write + issues: write integration: needs: 'lint-unit' diff --git a/CHANGELOG.md b/CHANGELOG.md index a1fa4063..026a48bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Elevate permissions for reuable workflow + ## 11.0.0 - *2022-02-16* - Require Chef 16 for resource partials From ac468761780afc953140a92b7221eaf4e3677889 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 16 Feb 2022 05:55:10 -0800 Subject: [PATCH 116/278] Update changelog for 11.0.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 026a48bf..63e6095b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.0.1 - *2022-02-16* - Elevate permissions for reuable workflow From e27c321de70c0a0e5a23596f0a4b4f134a8105b9 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 16 Feb 2022 05:55:10 -0800 Subject: [PATCH 117/278] Update metadata for 11.0.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 39af0012..f63687ac 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.0.0' +version '11.0.1' supports 'debian' supports 'ubuntu' From 0755cd24ee85af691324229b3f306c81291e4310 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 16 Feb 2022 05:55:12 -0800 Subject: [PATCH 118/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e6095b..2dcee4f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.0.1 - *2022-02-16* - Elevate permissions for reuable workflow From 82b910c194392483f2c4467889bb379377f60a55 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 20 Apr 2022 07:31:20 -0700 Subject: [PATCH 119/278] Standardise files with files in sous-chefs/repo-management (#673) Signed-off-by: kitchen-porter --- CHANGELOG.md | 2 ++ chefignore | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dcee4f9..d40ad508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 11.0.1 - *2022-02-16* - Elevate permissions for reuable workflow diff --git a/chefignore b/chefignore index cc170ea7..a27b0b25 100644 --- a/chefignore +++ b/chefignore @@ -61,7 +61,7 @@ Dangerfile examples/* features/* Guardfile -kitchen.yml* +kitchen*.yml mlc_config.json Procfile Rakefile From 4ddc0bffa3382d4bac73ee7eef97130dde4c8498 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 20 Apr 2022 07:31:23 -0700 Subject: [PATCH 120/278] Update changelog for 11.0.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d40ad508..865f8619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.0.2 - *2022-04-20* Standardise files with files in sous-chefs/repo-management From b87f675e86f60b3aaa9a9f218ec8a973228acd51 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 20 Apr 2022 07:31:23 -0700 Subject: [PATCH 121/278] Update metadata for 11.0.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index f63687ac..285f9c22 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.0.1' +version '11.0.2' supports 'debian' supports 'ubuntu' From ef927e5820fbf3db1d914f1cba4420f132362503 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 20 Apr 2022 07:31:25 -0700 Subject: [PATCH 122/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 865f8619..c30be027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.0.2 - *2022-04-20* Standardise files with files in sous-chefs/repo-management From 8437399621e26717afef88947a574625a62a7b9a Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 26 Apr 2022 13:15:31 +0100 Subject: [PATCH 123/278] Update Corretto URLs (#675) - Remove Correto 15 and 16 - Add Corretto 17 and 18 - Change the default download URL for Corretto to the versioned resources URL, rather than the latest. - Add default_corretto_minor helper to find out a default minor version for a given major - Fix default_corretto_minor helper to accept full versions - Move logic for full_version out of the major-to-minor method Signed-off-by: Dan Webb --- .github/workflows/test-kitchen.yml | 4 +- CHANGELOG.md | 6 +- kitchen.yml | 12 +- libraries/corretto_helpers.rb | 43 +++--- spec/libraries/corretto_helpers_spec.rb | 170 ++++++++++++------------ 5 files changed, 119 insertions(+), 116 deletions(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index c5a70cee..9997005c 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -44,8 +44,8 @@ jobs: - adoptopenjdk-removal-11-openj9 - corretto-8 - corretto-11 - - corretto-15 - - corretto-16 + - corretto-17 + - corretto-18 - custom-package-8 - custom-package-11 - custom-package-11-openj9 diff --git a/CHANGELOG.md b/CHANGELOG.md index c30be027..4e94ae93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,13 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Remove Correto 15 and 16 +- Add Corretto 17 and 18 +- Change the defualt download URL for Corretto to the versioned resources URL, rather than latest. + ## 11.0.2 - *2022-04-20* -Standardise files with files in sous-chefs/repo-management +- Standardise files with files in sous-chefs/repo-management ## 11.0.1 - *2022-02-16* diff --git a/kitchen.yml b/kitchen.yml index 3dc6ae76..7b14a831 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -166,20 +166,20 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: {java_version: "11"} - - name: corretto-15 + - name: corretto-17 run_list: - recipe[test::corretto] - attributes: {version: "15"} + attributes: {version: "17"} verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: "15"} - - name: corretto-16 + inputs: {java_version: "17"} + - name: corretto-18 run_list: - recipe[test::corretto] - attributes: {version: "16"} + attributes: {version: "18"} verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: "16"} + inputs: {java_version: "18"} # Custom URL tests - name: custom-package-8 diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index a6c48faa..350e5f54 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -5,45 +5,44 @@ def corretto_arch node['kernel']['machine'].match?('aarch64') ? 'aarch64' : 'x64' end - def default_corretto_url(version) - "https://corretto.aws/downloads/latest/amazon-corretto-#{version}-#{corretto_arch}-linux-jdk.tar.gz" - end - def default_corretto_bin_cmds(version) case version.to_s when '8' %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) when '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) - when '15' - %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jlink jmap jmod jpackage jps jrunscript jshell jstack jstat jstatd keytool rmid rmiregistry serialver) - when '16' + when '15', '17', '18' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jlink jmap jmod jpackage jps jrunscript jshell jstack jstat jstatd keytool rmid rmiregistry serialver) else raise 'Corretto version not recognised' end end - def corretto_sub_dir(version, full_version = nil) - if full_version.nil? - case version - when '8' - ver = '8.302.08.1' - when '11' - ver = '11.0.12.7.1' - when '15' - ver = '15.0.2.7.1' - when '16' - ver = '16.0.2.7.1' - else - raise 'Corretto version not recognised' - end + def default_corretto_minor(version) + case version + when '8' + '8.332.08.1' + when '11' + '11.0.15.9.1' + when '17' + '17.0.3.6.1' + when '18' + '18.0.1.10.1' else - ver = full_version + raise 'Corretto version not recognised' end + end + def corretto_sub_dir(version, full_version = nil) + ver = full_version.nil? ? default_corretto_minor(version) : full_version "amazon-corretto-#{ver}-linux-#{corretto_arch}" end + + def default_corretto_url(version) + ver = version.include?('.') ? version : default_corretto_minor(version) + + "https://corretto.aws/downloads/resources/#{ver}/amazon-corretto-#{ver}-linux-#{corretto_arch}.tar.gz" + end end end end diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index 9bc1cc32..c7239dad 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -31,21 +31,21 @@ class DummyClass < Chef::Node end end - context 'Corretto 15 x64' do - let(:version) { '15' } + context 'Corretto 17 x64' do + let(:version) { '17' } let(:machine) { 'x86_64' } it 'returns the correct URL' do - expect(subject.default_corretto_url(version)).to match /corretto-15.+\.tar.gz/ + expect(subject.default_corretto_url(version)).to match /corretto-17.+\.tar.gz/ end end - context 'Corretto 16 x64' do - let(:version) { '16' } + context 'Corretto 18 x64' do + let(:version) { '18' } let(:machine) { 'x86_64' } it 'returns the correct URL' do - expect(subject.default_corretto_url(version)).to match /corretto-16.+\.tar.gz/ + expect(subject.default_corretto_url(version)).to match /corretto-18.+\.tar.gz/ end end @@ -67,21 +67,21 @@ class DummyClass < Chef::Node end end - context 'Corretto 15 aarch64' do - let(:version) { '15' } + context 'Corretto 17 aarch64' do + let(:version) { '17' } let(:machine) { 'aarch64' } it 'returns the correct URL' do - expect(subject.default_corretto_url(version)).to match /corretto-15.+\.tar.gz/ + expect(subject.default_corretto_url(version)).to match /corretto-17.+\.tar.gz/ end end - context 'Corretto 16 aarch64' do - let(:version) { '16' } + context 'Corretto 18 aarch64' do + let(:version) { '18' } let(:machine) { 'aarch64' } it 'returns the correct URL' do - expect(subject.default_corretto_url(version)).to match /corretto-16.+\.tar.gz/ + expect(subject.default_corretto_url(version)).to match /corretto-18.+\.tar.gz/ end end end @@ -109,120 +109,120 @@ class DummyClass < Chef::Node end end - context 'Corretto 15' do - let(:version) { '15' } + context 'Corretto 17' do + let(:version) { '17' } it 'returns the correct bin command array' do - expect(subject.default_corretto_bin_cmds(version)).to_not include 'unpack200' + expect(subject.default_corretto_bin_cmds(version)).to_not include 'jjs' expect(subject.default_corretto_bin_cmds(version)).to include 'jaotc' end end - context 'Corretto 16' do - let(:version) { '16' } + context 'Corretto 18' do + let(:version) { '18' } it 'returns the correct bin command array' do - expect(subject.default_corretto_bin_cmds(version)).to_not include 'unpack200' + expect(subject.default_corretto_bin_cmds(version)).to_not include 'jjs' expect(subject.default_corretto_bin_cmds(version)).to include 'jaotc' end end - end - describe '#corretto_sub_dir' do - before do - allow(subject).to receive(:[]).with('version', 'full_version').and_return(version) - allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine) - end + describe '#corretto_sub_dir' do + before do + allow(subject).to receive(:[]).with('version', 'full_version').and_return(version) + allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine) + end - context 'No full_version passed for Corretto 8 x64' do - let(:version) { '8' } - let(:machine) { 'x86_64' } + context 'No full_version passed for Corretto 8 x64' do + let(:version) { '8' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version)).to include '8.302.08.1' + it 'returns the default directory value for Corrretto 8 x64' do + expect(subject.corretto_sub_dir(version)).to include '8.332.08.1' + end end - end - context 'No full_version passed for Corretto 8 aarch64' do - let(:version) { '8' } - let(:machine) { 'aarch64' } + context 'No full_version passed for Corretto 8 aarch64' do + let(:version) { '8' } + let(:machine) { 'aarch64' } - it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '8.302.08.1' + it 'returns the default directory value for Corrretto 8 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '8.332.08.1' + end end - end - context 'No full_version passed for Corretto 11 x64' do - let(:version) { '11' } - let(:machine) { 'x86_64' } + context 'No full_version passed for Corretto 11 x64' do + let(:version) { '11' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 11 x64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.12.7.1' + it 'returns the default directory value for Corrretto 11 x64' do + expect(subject.corretto_sub_dir(version)).to include '11.0.15.9.1' + end end - end - context 'No full_version passed for Corretto 11 aarch64' do - let(:version) { '11' } - let(:machine) { 'aarch64' } + context 'No full_version passed for Corretto 11 aarch64' do + let(:version) { '11' } + let(:machine) { 'aarch64' } - it 'returns the default directory value for Corrretto 11 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '11.0.12.7.1' + it 'returns the default directory value for Corrretto 11 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '11.0.15.9.1' + end end - end - context 'No full_version passed for Corretto 15 x64' do - let(:version) { '15' } - let(:machine) { 'x86_64' } + context 'No full_version passed for Corretto 17 x64' do + let(:version) { '17' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 15 x64' do - expect(subject.corretto_sub_dir(version)).to include '15.0.2.7.1' + it 'returns the default directory value for Corrretto 17 x64' do + expect(subject.corretto_sub_dir(version)).to include '17.0.3.6.1' + end end - end - context 'No full_version passed for Corretto 15 aarch64' do - let(:version) { '15' } - let(:machine) { 'aarch64' } + context 'No full_version passed for Corretto 17 aarch64' do + let(:version) { '17' } + let(:machine) { 'aarch64' } - it 'returns the default directory value for Corrretto 15 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '15.0.2.7.1' + it 'returns the default directory value for Corrretto 17 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '17.0.3.6.1' + end end - end - context 'No full_version passed for Corretto 16 x64' do - let(:version) { '16' } - let(:machine) { 'x86_64' } + context 'No full_version passed for Corretto 18 x64' do + let(:version) { '18' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 16 x64' do - expect(subject.corretto_sub_dir(version)).to include '16.0.2.7.1' + it 'returns the default directory value for Corrretto 18 x64' do + expect(subject.corretto_sub_dir(version)).to include '18.0.1.10.1' + end end - end - context 'No full_version passed for Corretto 16 aarch64' do - let(:version) { '16' } - let(:machine) { 'aarch64' } + context 'No full_version passed for Corretto 18 aarch64' do + let(:version) { '18' } + let(:machine) { 'aarch64' } - it 'returns the default directory value for Corrretto 16 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '16.0.2.7.1' + it 'returns the default directory value for Corrretto 18 aarch64' do + expect(subject.corretto_sub_dir(version)).to include '18.0.1.10.1' + end end - end - context 'A full version passed for for Corretto 8 x64' do - let(:version) { '8' } - let(:full_version) { '8.123.45.6' } - let(:machine) { 'x86_64' } + context 'A full version passed for for Corretto 8 x64' do + let(:version) { '8' } + let(:full_version) { '8.123.45.6' } + let(:machine) { 'x86_64' } - it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' + it 'returns the default directory value for Corrretto 8 x64' do + expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' + end end - end - context 'A full version passed for for Corretto 8 aarch64' do - let(:version) { '8' } - let(:full_version) { '8.123.45.6' } - let(:machine) { 'aarch64' } + context 'A full version passed for for Corretto 8 aarch64' do + let(:version) { '8' } + let(:full_version) { '8.123.45.6' } + let(:machine) { 'aarch64' } - it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' + it 'returns the default directory value for Corrretto 8 aarch64' do + expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' + end end end end From 76aead96be5d96d320f3025d001288b0906d3f7e Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 26 Apr 2022 05:15:34 -0700 Subject: [PATCH 124/278] Update changelog for 11.1.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e94ae93..0aa770f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.0 - *2022-04-26* - Remove Correto 15 and 16 - Add Corretto 17 and 18 From ba52f53690ca6f24c9629cc279f9ae2b58a32f00 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 26 Apr 2022 05:15:35 -0700 Subject: [PATCH 125/278] Update metadata for 11.1.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 285f9c22..cf25b4db 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.0.2' +version '11.1.0' supports 'debian' supports 'ubuntu' From cb3cda7b1cdd59cdc2306d1e4c199c88ffec6ff5 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 26 Apr 2022 05:15:37 -0700 Subject: [PATCH 126/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aa770f8..55d48c0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.0 - *2022-04-26* - Remove Correto 15 and 16 From 32a2ac2d727086a3d4557c903647fe45f92048ec Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 7 Dec 2022 21:06:16 -0800 Subject: [PATCH 127/278] Standardise files with files in sous-chefs/repo-management (#678) Signed-off-by: kitchen-porter Signed-off-by: kitchen-porter --- .github/workflows/md-links.yml | 2 +- CHANGELOG.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index ba887a16..13a60f3a 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d48c0d..2d90881f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 11.1.0 - *2022-04-26* - Remove Correto 15 and 16 From 2d9033d677517ccefe3e4fe266783d2eac0ea424 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 7 Dec 2022 21:06:21 -0800 Subject: [PATCH 128/278] Update changelog for 11.1.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d90881f..93345c74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.1 - *2022-12-08* Standardise files with files in sous-chefs/repo-management From 11fba1eac556f5dae531353716626da325642284 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 7 Dec 2022 21:06:22 -0800 Subject: [PATCH 129/278] Update metadata for 11.1.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index cf25b4db..c8051858 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.0' +version '11.1.1' supports 'debian' supports 'ubuntu' From 248e5e3b887fffd1138d37ce16c787c2f8ce47f2 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 7 Dec 2022 21:06:24 -0800 Subject: [PATCH 130/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93345c74..7fd2fc53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.1 - *2022-12-08* Standardise files with files in sous-chefs/repo-management From f6bc1fbe5dec35da13b9b811434c2a4429bc85d7 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 14 Feb 2023 08:58:50 +0000 Subject: [PATCH 131/278] Remove CircleCI (#681) --- .circleci/config.yml | 10 ---------- .github/workflows/test-kitchen.yml | 18 +++++++++--------- 2 files changed, 9 insertions(+), 19 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8af810ef..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -version: 2.1 -orbs: - kitchen: sous-chefs/kitchen@2 -workflows: - danger: - jobs: - - kitchen/danger: - name: danger - context: Danger-Minimal diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 9997005c..db4db09a 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -1,7 +1,7 @@ --- -name: 'Test' +name: "Test" -'on': +"on": pull_request: push: branches: [main] @@ -17,7 +17,7 @@ jobs: issues: write integration: - needs: 'lint-unit' + needs: "lint-unit" runs-on: ubuntu-latest strategy: matrix: @@ -55,9 +55,9 @@ jobs: - name: Check out code uses: actions/checkout@v2 - name: Install Chef - uses: actionshub/chef-install@main + uses: actionshub/chef-install@2.0.4 - name: Dokken - uses: actionshub/test-kitchen@main + uses: actionshub/test-kitchen@2.1.0 env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.dokken.yml @@ -66,15 +66,15 @@ jobs: os: ${{ matrix.os }} integration-macos: - needs: 'lint-unit' + needs: "lint-unit" runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@v2 - name: Install Chef - uses: actionshub/chef-install@main + uses: actionshub/chef-install@2.0.4 - name: Kitchen Converge - uses: actionshub/test-kitchen@main + uses: actionshub/test-kitchen@2.1.0 env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.macos.yml @@ -91,7 +91,7 @@ jobs: # Magic line for github actions to persist the change echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV - name: Kitchen Verify - uses: actionshub/test-kitchen@main + uses: actionshub/test-kitchen@2.1.0 env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.macos.yml From b60976e4fbf5e6a3d773256f99339fd39896b9da Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 00:58:53 -0800 Subject: [PATCH 132/278] Update changelog for 11.1.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fd2fc53..c6d5f0f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.2 - *2023-02-14* ## 11.1.1 - *2022-12-08* From b9942b8ce0d87acb51c49f64b9d6a53e4e1be1d5 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 00:58:54 -0800 Subject: [PATCH 133/278] Update metadata for 11.1.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c8051858..bf3be9fc 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.1' +version '11.1.2' supports 'debian' supports 'ubuntu' From b9678884a76d695ec8fcf8786730a162828228b2 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 00:58:58 -0800 Subject: [PATCH 134/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d5f0f2..4272cd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.2 - *2023-02-14* ## 11.1.1 - *2022-12-08* From f30a946f169598f44e517cfb5b2d8fe5a8472874 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:04:39 -0800 Subject: [PATCH 135/278] Standardise files with files in sous-chefs/repo-management (#682) Signed-off-by: kitchen-porter --- CHANGELOG.md | 2 ++ renovate.json | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 renovate.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 4272cd8b..81f9ae3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 11.1.2 - *2023-02-14* ## 11.1.1 - *2022-12-08* diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..7e7a8bad --- /dev/null +++ b/renovate.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:base"], + "packageRules": [{ + "groupName": "Actions", + "matchUpdateTypes": ["patch", "pin", "digest"], + "automerge": true, + "addLabels": ["Release: Patch", "Skip: Announcements"] + }, + { + "groupName": "Actions", + "matchUpdateTypes": ["major"], + "automerge": false, + "addLabels": ["Release: Patch", "Skip: Announcements"] + } + ] +} From 4ae068f042b0ffc647f484fe173834f60f221d3e Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:04:43 -0800 Subject: [PATCH 136/278] Update changelog for 11.1.3 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81f9ae3a..d7f0839c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.3 - *2023-02-14* Standardise files with files in sous-chefs/repo-management From cabd4652802a1a1913229d4184b739be7ec5b133 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:04:44 -0800 Subject: [PATCH 137/278] Update metadata for 11.1.3 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index bf3be9fc..c5d668b5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.2' +version '11.1.3' supports 'debian' supports 'ubuntu' From 4cca24b9b248bc94b37fdae7f0ca9bbf95ec51e9 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:04:58 -0800 Subject: [PATCH 138/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7f0839c..3675d621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.3 - *2023-02-14* Standardise files with files in sous-chefs/repo-management From 6d8e27844490a4d61fb630ace96c4f6de62546a0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:14:24 +0000 Subject: [PATCH 139/278] Update Actions (#683) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- .github/workflows/test-kitchen.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 9e2ff38e..19d86dbe 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: actions/stale@v7 with: repo-token: ${{ secrets.GITHUB_TOKEN }} close-issue-message: > diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index db4db09a..3ddc2f27 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -53,7 +53,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Dokken @@ -70,7 +70,7 @@ jobs: runs-on: macos-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Kitchen Converge From dfb8ccaad120dfb5ab276009a588808a9b2a0100 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:14:31 +0000 Subject: [PATCH 140/278] Update changelog for 11.1.4 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3675d621..d72e0a14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.4 - *2023-02-15* ## 11.1.3 - *2023-02-14* From e46298033772334bb2b3196607f4e1f01c7f311f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:14:32 +0000 Subject: [PATCH 141/278] Update metadata for 11.1.4 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c5d668b5..55fcbd80 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.3' +version '11.1.4' supports 'debian' supports 'ubuntu' From f7664cf3ca085853e9cdba7e5d3937decaf5f4e9 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:14:34 +0000 Subject: [PATCH 142/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d72e0a14..f902cb1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.4 - *2023-02-15* ## 11.1.3 - *2023-02-14* From 5ea8e6b53163343d0562498fb0fdb9ca9de195aa Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:47:05 +0000 Subject: [PATCH 143/278] Automated PR: Standardising Files (#685) * Standardise files with files in sous-chefs/repo-management Signed-off-by: kitchen-porter * Standardise files with files in sous-chefs/repo-management Signed-off-by: kitchen-porter --------- Signed-off-by: kitchen-porter --- .github/workflows/md-links.yml | 2 +- CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index 13a60f3a..208cb1a2 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -13,7 +13,7 @@ jobs: - name: Check out code uses: actions/checkout@v3 - name: markdown-link-check - uses: gaurav-nelson/github-action-markdown-link-check@v1 + uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 with: use-verbose-mode: "yes" folder-path: "documentation" diff --git a/CHANGELOG.md b/CHANGELOG.md index f902cb1a..57576a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + +Standardise files with files in sous-chefs/repo-management + ## 11.1.4 - *2023-02-15* ## 11.1.3 - *2023-02-14* From e13311988d30e2c54f57223a3c3e4ff1438f9d3f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:47:09 +0000 Subject: [PATCH 144/278] Update changelog for 11.1.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57576a31..8483c628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.5 - *2023-02-20* Standardise files with files in sous-chefs/repo-management From 0a6fadc317ae57fe7dc8c714d696af7e49a5a3f8 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:47:10 +0000 Subject: [PATCH 145/278] Update metadata for 11.1.5 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 55fcbd80..60394c5e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.4' +version '11.1.5' supports 'debian' supports 'ubuntu' From eebad3086fd83f98517ddde2a07d287b5e5f42b6 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:47:12 +0000 Subject: [PATCH 146/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8483c628..a6215de3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.5 - *2023-02-20* Standardise files with files in sous-chefs/repo-management From 0ce8130cd4e6e0d90135f915c770eebe89ec985e Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Thu, 2 Mar 2023 16:20:07 +0000 Subject: [PATCH 147/278] [skip ci] Fix yaml & markdown (#688) --- .github/workflows/md-links.yml | 19 ------- .github/workflows/test-kitchen.yml | 2 +- .markdownlint-cli2.yaml | 4 ++ .vscode/extensions.json | 6 +-- CHANGELOG.md | 49 ++----------------- .../resources/adoptopenjdk_install.md | 4 +- .../resources/adoptopenjdk_linux_install.md | 3 +- .../resources/adoptopenjdk_macos_install.md | 3 +- documentation/resources/alternatives.md | 3 +- documentation/resources/certificate.md | 7 +-- documentation/resources/corretto_install.md | 3 +- documentation/resources/jce.md | 3 +- documentation/resources/openjdk_install.md | 3 +- .../resources/openjdk_pkg_install.md | 3 +- .../resources/openjdk_source_install.md | 3 +- 15 files changed, 34 insertions(+), 81 deletions(-) delete mode 100644 .github/workflows/md-links.yml create mode 100644 .markdownlint-cli2.yaml diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml deleted file mode 100644 index 208cb1a2..00000000 --- a/.github/workflows/md-links.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: md-links - -"on": - pull_request: - push: - branches: [main] - -jobs: - md-links: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 - - name: markdown-link-check - uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 - with: - use-verbose-mode: "yes" - folder-path: "documentation" diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 3ddc2f27..05f162c4 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@0.0.3 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.1 permissions: actions: write checks: write diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 00000000..dffb96a8 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,4 @@ +config: + ul-indent: false # MD007 + line-length: false # MD013 + no-duplicate-heading/no-duplicate-header: false # MD024 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index cd777250..80fa82bd 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,7 @@ { "recommendations": [ - "chef-software.chef", - "rebornix.ruby", - "editorconfig.editorconfig" + "chef-software.chef", + "rebornix.ruby", + "editorconfig.editorconfig" ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index a6215de3..a2eee0ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,16 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased -## 11.1.5 - *2023-02-20* - Standardise files with files in sous-chefs/repo-management +## 11.1.5 - *2023-02-20* + Standardise files with files in sous-chefs/repo-management ## 11.1.4 - *2023-02-15* +Standardise files with files in sous-chefs/repo-management + ## 11.1.3 - *2023-02-14* Standardise files with files in sous-chefs/repo-management @@ -184,41 +186,24 @@ Standardise files with files in sous-chefs/repo-management ## 7.0.0 (2020-03-05) - Refactored and sped up unit tests. - -## Added - - Added `adoptopenjdk_install` resource & documentation - Added AdoptOpenJDK 13 testing - -## Deprecated - - Removed the adoptopenjdk recipe, please use the `adoptopenjdk_install` resource instead. - Increased the minimum Chef requirement to Chef 15 to use the archive resource. - Removed AdoptOpenJDK 10 testing ## 6.0.0 (2020-03-02) -## Deprecated - - The resource alias `java_ark` has been deprecated in favour of `java_oracle_install` ## 5.0.0 (2020-02-21) -### Added - -### Changed - - Fixed java_certificate regex where it checks if cert exists in cacert file. - Make Homebrew Cask name an attribute to allow for other options (ex: adoptopenjdk) - Switch homebrew tap to homebrew/cask-versions - Make builds parallel - Updates package name and link changes for adoptopenjdk - Migrated testing to github actions - -### Deprecated - -### Removed - - Removes openjdk-6 - Removes openjdk-7 for Ubuntu 16.04 - Removes openjdk-11 for Ubuntu @@ -589,19 +574,13 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut ## v1.17.4 -### Bug - - **[#111](https://github.com/socrata-cookbooks/java/pull/111)** - Fix alternatives for centos -### Improvement - - **[COOK-4165](https://tickets.opscode.com/browse/COOK-4165)** - Replace curl with remote_file with cookie header - **[#110](https://github.com/socrata-cookbooks/java/pull/110)** - Update openjdk to use the alternatives resource ## v1.17.2 -### Bug - - **[COOK-4136](https://tickets.opscode.com/browse/COOK-4136)** - Add md5 parameter to java_ark resource ## v1.17.0 @@ -617,28 +596,20 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut ## v1.16.4 -### Bug - - **[#103](https://github.com/socrata/java/pull/103)** - set alternatives when using ibm_tar recipe - **[#104](https://github.com/socrata/java/pull/104)** - Specify windows attributes in attribute files ## v1.16.2 -### Improvement - - **[COOK-3488](https://tickets.opscode.com/browse/COOK-3488)** - set alternatives for ibm jdk - **[COOK-3764](https://tickets.opscode.com/browse/COOK-3764)** - IBM Java installer needs 'rpm' package on Ubuntu -### Bug - - **[COOK-3857](https://tickets.opscode.com/browse/COOK-3857)** - do not unescape the java windows url before parsing it - **[#95](https://github.com/socrata/java/pull/95)** - fixes update-alternatives for openjdk installs - **[#100](https://github.com/socrata/java/pull/100)** - Use escaped quotes for Windows INSTALLDIR ## v1.16.0 -### Improvement - - **[COOK-3823](https://tickets.opscode.com/browse/COOK-3823)** - Upgrade to JDK 7u45-b18 ## v1.15.4 @@ -651,8 +622,6 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut ## v1.15.0 -### Bug - - Fixing version number. Accidently released at 0.15.x instead of 1.15.x ## v0.15.2 @@ -663,8 +632,6 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut ## v1.14.0 -### Bug - - **[COOK-3704](https://tickets.opscode.com/browse/COOK-3704)** - Fix alternatives when the package is already installed - **[COOK-3668](https://tickets.opscode.com/browse/COOK-3668)** - Fix a condition that would result in an error executing action `run` on resource 'bash[update-java-alternatives]' - **[COOK-3569](https://tickets.opscode.com/browse/COOK-3569)** - Fix bad checksum length @@ -672,19 +639,13 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut - **[COOK-3518](https://tickets.opscode.com/browse/COOK-3518)** - Allow Windoes recipe to download from signed S3 url - **[COOK-2996](https://tickets.opscode.com/browse/COOK-2996)** - Fix a failure on Centos 6.4 and Oracle JDK 7 -### Improvement - - **[COOK-2793](https://tickets.opscode.com/browse/COOK-2793)** - Improve Windows support ## v1.13.0 -### Bug - - **[COOK-3295](https://tickets.opscode.com/browse/COOK-3295)** - Add default `platform_family` option in Java helper - **[COOK-3277](https://tickets.opscode.com/browse/COOK-3277)** - Fix support for Fedora -### Improvement - - **[COOK-3278](https://tickets.opscode.com/browse/COOK-3278)** - Upgrade to Oracle Java 7u25 - **[COOK-3029](https://tickets.opscode.com/browse/COOK-3029)** - Add Oracle RPM support - **[COOK-2931](https://tickets.opscode.com/browse/COOK-2931)** - Add support for the platform `xenserver` @@ -692,8 +653,6 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut ## v1.12.0 -### Improvement - - [COOK-2154]: Add SmartOS support to java::openjdk recipe - [COOK-3278]: upgrade to Oracle Java 7u25 - [COOK-2931]: Adding support for the platform 'xenserver' (for installations of java in DOM0) diff --git a/documentation/resources/adoptopenjdk_install.md b/documentation/resources/adoptopenjdk_install.md index d4fbea4f..6edee611 100644 --- a/documentation/resources/adoptopenjdk_install.md +++ b/documentation/resources/adoptopenjdk_install.md @@ -1,7 +1,7 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) - # adoptopenjdk_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v7.0.0 ## Actions diff --git a/documentation/resources/adoptopenjdk_linux_install.md b/documentation/resources/adoptopenjdk_linux_install.md index 022ec848..3e20ccbf 100644 --- a/documentation/resources/adoptopenjdk_linux_install.md +++ b/documentation/resources/adoptopenjdk_linux_install.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # adoptopenjdk_linux_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v8.1.0 ## Actions diff --git a/documentation/resources/adoptopenjdk_macos_install.md b/documentation/resources/adoptopenjdk_macos_install.md index f5f47dfa..9336a334 100644 --- a/documentation/resources/adoptopenjdk_macos_install.md +++ b/documentation/resources/adoptopenjdk_macos_install.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # adoptopenjdk_macos_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v8.1.0 ## Actions diff --git a/documentation/resources/alternatives.md b/documentation/resources/alternatives.md index fabc67e7..902e4f6b 100644 --- a/documentation/resources/alternatives.md +++ b/documentation/resources/alternatives.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # java_alternatives +[back to resource list](https://github.com/sous-chefs/java#resources) + The `java_alternatives` resource uses `update-alternatives` command to set and unset command alternatives for various Java tools such as java, javac, etc. ## Actions diff --git a/documentation/resources/certificate.md b/documentation/resources/certificate.md index e6922b17..019f1a77 100644 --- a/documentation/resources/certificate.md +++ b/documentation/resources/certificate.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # java_certificate +[back to resource list](https://github.com/sous-chefs/java#resources) + Java certificate simplifies adding certificates to a java keystore. It can also populate the keystore with a certificate retrieved from a given SSL end-point. @@ -14,8 +15,8 @@ It can also populate the keystore with a certificate retrieved from a given SSL | Name | Type | Default | Description | | ----------------- | ------ | --------------------------- | --------------------------------------------------------------------------------------- | -| `java_home` | | node['java']['java_home'] | The java home directory | -| `java_version` | | node['java']['jdk_version'] | The java version | +| `java_home` | | `node['java']['java_home']` | The java home directory | +| `java_version` | | `node['java']['jdk_version']` | The java version | | `keystore_path` | String | | Path to the keystore | | `keystore_passwd` | String | `changeit` | Password to the keystore | | `cert_alias` | String | | The alias of the certificate in the keystore. This defaults to the name of the resource | diff --git a/documentation/resources/corretto_install.md b/documentation/resources/corretto_install.md index 05e62498..2bf76155 100644 --- a/documentation/resources/corretto_install.md +++ b/documentation/resources/corretto_install.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # corretto_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v8.0.0 ## Actions diff --git a/documentation/resources/jce.md b/documentation/resources/jce.md index 2c73db8a..d0714855 100644 --- a/documentation/resources/jce.md +++ b/documentation/resources/jce.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # java_jce +[back to resource list](https://github.com/sous-chefs/java#resources) + `java_jce` installs the Java Cryptography Extension (JCE) policy files for a given Java installation. ## Actions diff --git a/documentation/resources/openjdk_install.md b/documentation/resources/openjdk_install.md index 4a5f563c..1ca8903f 100644 --- a/documentation/resources/openjdk_install.md +++ b/documentation/resources/openjdk_install.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # openjdk_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v8.0.0 ## Actions diff --git a/documentation/resources/openjdk_pkg_install.md b/documentation/resources/openjdk_pkg_install.md index f7374d90..49045cec 100644 --- a/documentation/resources/openjdk_pkg_install.md +++ b/documentation/resources/openjdk_pkg_install.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # openjdk_pkg_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v8.1.0 ## Actions diff --git a/documentation/resources/openjdk_source_install.md b/documentation/resources/openjdk_source_install.md index c6356ae6..b2ad8b5a 100644 --- a/documentation/resources/openjdk_source_install.md +++ b/documentation/resources/openjdk_source_install.md @@ -1,7 +1,8 @@ -[back to resource list](https://github.com/sous-chefs/java#resources) # openjdk_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Introduced: v8.0.0 ## Actions From 2453f69350e66c093defcbe069621bd786643b4c Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 2 Mar 2023 16:20:11 +0000 Subject: [PATCH 148/278] Update changelog for 11.1.6 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2eee0ba..2d839ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.6 - *2023-03-02* Standardise files with files in sous-chefs/repo-management From 2964ddb837f737083a36faea7231aac788869229 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 2 Mar 2023 16:20:11 +0000 Subject: [PATCH 149/278] Update metadata for 11.1.6 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 60394c5e..e0a8f2ba 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.5' +version '11.1.6' supports 'debian' supports 'ubuntu' From deb05989ee2549e15c5955c94cd28b95321d4189 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 2 Mar 2023 16:20:14 +0000 Subject: [PATCH 150/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d839ebf..b836e070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.6 - *2023-03-02* Standardise files with files in sous-chefs/repo-management From 523403a5b54e7d0c484ab8cf1e33313999b0fa48 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 08:18:05 +0100 Subject: [PATCH 151/278] Automated PR: Standardising Files [skip ci] This PR will standardise the files we have with out agreed spec in sous-chefs/repo-management. This repo has been identified by topic(s) of chef-cookbook --- .github/workflows/md-links.yml | 19 +++++++++++++++++++ .markdownlint-cli2.yaml | 3 ++- .vscode/extensions.json | 3 ++- .yamllint | 2 ++ CHANGELOG.md | 4 ++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/md-links.yml diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml new file mode 100644 index 00000000..208cb1a2 --- /dev/null +++ b/.github/workflows/md-links.yml @@ -0,0 +1,19 @@ +--- +name: md-links + +"on": + pull_request: + push: + branches: [main] + +jobs: + md-links: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + - name: markdown-link-check + uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 + with: + use-verbose-mode: "yes" + folder-path: "documentation" diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index dffb96a8..6fa8e776 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -1,4 +1,5 @@ config: ul-indent: false # MD007 line-length: false # MD013 - no-duplicate-heading/no-duplicate-header: false # MD024 + no-duplicate-heading: false # MD024 + reference-links-images: false # MD052 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 80fa82bd..51d0ae7a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "chef-software.chef", "rebornix.ruby", - "editorconfig.editorconfig" + "editorconfig.editorconfig", + "DavidAnson.vscode-markdownlint" ] } diff --git a/.yamllint b/.yamllint index 1b5cea09..0046b237 100644 --- a/.yamllint +++ b/.yamllint @@ -11,3 +11,5 @@ rules: max-spaces-inside: 1 min-spaces-inside-empty: -1 max-spaces-inside-empty: -1 + comments: + min-spaces-from-content: 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index b836e070..250e9b6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + +Standardise files with files in sous-chefs/repo-management + ## 11.1.6 - *2023-03-02* Standardise files with files in sous-chefs/repo-management From 7f16c2d2f57ab1b696c4e319e1cbad32f78f5d0a Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 08:18:09 +0100 Subject: [PATCH 152/278] Update changelog for 11.1.7 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 250e9b6b..841892ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.7 - *2023-04-01* Standardise files with files in sous-chefs/repo-management From 37cb9d8501e50d2631d0ca0e1361fcdc5a8308c6 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 08:18:09 +0100 Subject: [PATCH 153/278] Update metadata for 11.1.7 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index e0a8f2ba..552e696a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.6' +version '11.1.7' supports 'debian' supports 'ubuntu' From fdbd2ce24cc75948185d525118b973060da7c9b7 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 08:18:11 +0100 Subject: [PATCH 154/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 841892ce..2a5e610b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.7 - *2023-04-01* Standardise files with files in sous-chefs/repo-management From a23ee111c6fad976b73b108b64d87200b2aecf0b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:44:04 +0800 Subject: [PATCH 155/278] Update actions/stale action to v8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/stale](https://togithub.com/actions/stale) | action | major | `v7` -> `v8` | --- ### Release Notes
actions/stale ### [`v8`](https://togithub.com/actions/stale/compare/v7...v8) [Compare Source](https://togithub.com/actions/stale/compare/v7...v8)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/sous-chefs/java). --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 19d86dbe..4bb59c62 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v7 + - uses: actions/stale@v8 with: repo-token: ${{ secrets.GITHUB_TOKEN }} close-issue-message: > From cf2abfc36ab84e9b638a47dac52dc341144c49aa Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:44:07 +0100 Subject: [PATCH 156/278] Update changelog for 11.1.8 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a5e610b..30be6868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.8 - *2023-04-01* ## 11.1.7 - *2023-04-01* From f7ee895cdf415f7d55f0813980e0cab160976c7b Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:44:08 +0100 Subject: [PATCH 157/278] Update metadata for 11.1.8 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 552e696a..2f09e5aa 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.7' +version '11.1.8' supports 'debian' supports 'ubuntu' From c84019d97315c3387f74007871dceb3511a2e97b Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:44:10 +0100 Subject: [PATCH 158/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30be6868..da3e09d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.8 - *2023-04-01* ## 11.1.7 - *2023-04-01* From b114906b25a78a00c4de28cf1edc0ae6036cbb22 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:51:31 +0800 Subject: [PATCH 159/278] Update gaurav-nelson/github-action-markdown-link-check action to v1.0.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [gaurav-nelson/github-action-markdown-link-check](https://togithub.com/gaurav-nelson/github-action-markdown-link-check) | action | patch | `1.0.13` -> `1.0.15` | --- ### Release Notes
gaurav-nelson/github-action-markdown-link-check ### [`v1.0.15`](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/releases/tag/1.0.15) [Compare Source](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/compare/1.0.14...1.0.15) ##### Changes - [https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/168](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/pull/168) - Respect folder-path when check-modified-files-only == yes: Thank you [@​exoego](https://togithub.com/exoego) Thank you [@​mgrojo](https://togithub.com/mgrojo) [@​qaristote](https://togithub.com/qaristote) [@​RezaRahemtola](https://togithub.com/RezaRahemtola) for minor typo fixes. ### [`v1.0.14`](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/releases/tag/1.0.14) [Compare Source](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/compare/1.0.13...1.0.14) ### Important ‼️ This version is in beta. Use `1.0.13` or `v1` which are the stable versions. *** ##### Changes - [https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/116](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/pull/116) - Changed the base image to more stage Node image `node:lts-alpine` - [https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/126](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/pull/126) - Use markdown-link-check version 3.9.3 - [https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/148](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/pull/148) - Fully disable the Git ownership check - [https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/144](https://togithub.com/gaurav-nelson/github-action-markdown-link-check/pull/144) - Update markdown-lint-check to v3.10.2 Thank you [@​thanethomson](https://togithub.com/thanethomson) [@​edumco](https://togithub.com/edumco) [@​Pandapip1](https://togithub.com/Pandapip1) [@​creachadair](https://togithub.com/creachadair) [@​bogdandrutu](https://togithub.com/bogdandrutu)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/sous-chefs/java). --- .github/workflows/md-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index 208cb1a2..e5c1e7a2 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -13,7 +13,7 @@ jobs: - name: Check out code uses: actions/checkout@v3 - name: markdown-link-check - uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 + uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 with: use-verbose-mode: "yes" folder-path: "documentation" From e0333f36255c735aa03d797915d247c43936652f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:51:35 +0100 Subject: [PATCH 160/278] Update changelog for 11.1.9 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da3e09d7..914bb22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.9 - *2023-04-01* ## 11.1.8 - *2023-04-01* From 31e68d1a5072d89a00201e3e1ef9fc7ef432d6b3 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:51:35 +0100 Subject: [PATCH 161/278] Update metadata for 11.1.9 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 2f09e5aa..dac5e913 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.8' +version '11.1.9' supports 'debian' supports 'ubuntu' From 629d1473f433df1b801aa429070afaa414d13d83 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:51:38 +0100 Subject: [PATCH 162/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 914bb22d..223e3171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.9 - *2023-04-01* ## 11.1.8 - *2023-04-01* From dc5159f2a3cf7ccbe185e7bdf917844e9721b65a Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 7 Apr 2023 06:00:32 +0100 Subject: [PATCH 163/278] Automated PR: Standardising Files [skip ci] This PR will standardise the files we have with out agreed spec in sous-chefs/repo-management. This repo has been identified by topic(s) of chef-cookbook --- .overcommit.yml | 14 +++++-- CHANGELOG.md | 2 + kitchen.dokken.yml | 97 ++++++++++++++++++++++++++++++++-------------- kitchen.exec.yml | 7 ++++ kitchen.global.yml | 38 ++++++++++++++++++ 5 files changed, 126 insertions(+), 32 deletions(-) create mode 100644 kitchen.exec.yml create mode 100644 kitchen.global.yml diff --git a/.overcommit.yml b/.overcommit.yml index cd8682a0..0e89a3c1 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -4,13 +4,21 @@ PreCommit: enabled: true YamlLint: enabled: true - Rspec: + required_executable: "yamllint" + ChefSpec: enabled: true - required_executable: 'rspec' + required_executable: "chef" + command: ["chef", "exec", "rspec"] Cookstyle: enabled: true - required_executable: 'cookstyle' + required_executable: "cookstyle" command: ["cookstyle"] + MarkdownLint: + enabled: false + required_executable: "npx" + command: ["npx", "markdownlint-cli2", "'**/*.md'"] + include: ["**/*.md"] + CommitMsg: HardTabs: enabled: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 223e3171..a0fe7c70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 11.1.9 - *2023-04-01* ## 11.1.8 - *2023-04-01* diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 65665279..47eff95d 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -1,74 +1,113 @@ ---- driver: name: dokken - privileged: true # because Docker and SystemD/Upstart + privileged: true + chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> -transport: - name: dokken +transport: { name: dokken } +provisioner: { name: dokken } -provisioner: - name: dokken +platforms: + - name: almalinux-8 + driver: + image: dokken/almalinux-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: almalinux-9 + driver: + image: dokken/almalinux-9 + pid_one_command: /usr/lib/systemd/systemd -verifier: - name: inspec + - name: amazonlinux-2023 + driver: + image: dokken/amazonlinux-2023 + pid_one_command: /usr/lib/systemd/systemd -platforms: - - name: amazonlinux-2 + - name: centos-7 driver: - image: dokken/amazonlinux-2 + image: dokken/centos-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-stream-8 + driver: + image: dokken/centos-stream-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-stream-9 + driver: + image: dokken/centos-stream-9 pid_one_command: /usr/lib/systemd/systemd - name: debian-9 driver: image: dokken/debian-9 pid_one_command: /bin/systemd - # intermediate_instructions: - # - RUN /usr/bin/apt-get update - name: debian-10 driver: image: dokken/debian-10 pid_one_command: /bin/systemd - # intermediate_instructions: - # - RUN /usr/bin/apt-get update - name: debian-11 driver: image: dokken/debian-11 pid_one_command: /bin/systemd - # intermediate_instructions: - # - RUN /usr/bin/apt-get update - - name: centos-7 + - name: debian-12 driver: - image: dokken/centos-7 + image: dokken/debian-12 + pid_one_command: /bin/systemd + + - name: fedora-latest + driver: + image: dokken/fedora-latest pid_one_command: /usr/lib/systemd/systemd - - name: centos-8 + - name: opensuse-leap-15 driver: - image: dokken/centos-8 + image: dokken/opensuse-leap-15 pid_one_command: /usr/lib/systemd/systemd - - name: fedora-latest + - name: oraclelinux-7 driver: - image: dokken/fedora-latest + image: dokken/oraclelinux-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: oraclelinux-8 + driver: + image: dokken/oraclelinux-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: oraclelinux-9 + driver: + image: dokken/oraclelinux-9 + pid_one_command: /usr/lib/systemd/systemd + + - name: rockylinux-8 + driver: + image: dokken/rockylinux-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: rockylinux-9 + driver: + image: dokken/rockylinux-9 pid_one_command: /usr/lib/systemd/systemd - name: ubuntu-18.04 driver: image: dokken/ubuntu-18.04 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - name: ubuntu-20.04 driver: image: dokken/ubuntu-20.04 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - name: opensuse-leap-15 + - name: ubuntu-22.04 driver: - image: dokken/opensuse-leap-15 + image: dokken/ubuntu-22.04 + pid_one_command: /bin/systemd + + - name: ubuntu-23.04 + driver: + image: dokken/ubuntu-23.04 pid_one_command: /bin/systemd diff --git a/kitchen.exec.yml b/kitchen.exec.yml new file mode 100644 index 00000000..ba7b2a96 --- /dev/null +++ b/kitchen.exec.yml @@ -0,0 +1,7 @@ +--- +driver: { name: exec } +transport: { name: exec } + +platforms: + - name: macos-latest + - name: windows-latest diff --git a/kitchen.global.yml b/kitchen.global.yml new file mode 100644 index 00000000..a382fcd0 --- /dev/null +++ b/kitchen.global.yml @@ -0,0 +1,38 @@ +--- +provisioner: + name: chef_infra + product_name: chef + product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> + channel: stable + install_strategy: once + chef_license: accept + enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %> + multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> + deprecations_as_errors: true + log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> + +verifier: + name: inspec + +platforms: + - name: almalinux-8 + - name: almalinux-9 + - name: amazonlinux-2023 + - name: centos-7 + - name: centos-stream-8 + - name: centos-stream-9 + - name: debian-9 + - name: debian-10 + - name: debian-11 + - name: debian-12 + - name: fedora-latest + - name: opensuse-leap-15 + - name: oraclelinux-7 + - name: oraclelinux-8 + - name: oraclelinux-9 + - name: rockylinux-8 + - name: rockylinux-9 + - name: ubuntu-18.04 + - name: ubuntu-20.04 + - name: ubuntu-22.04 + - name: ubuntu-23.04 From 0fbd0cbac6012754bb9681e75c66e66b653502ee Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 7 Apr 2023 06:00:36 +0100 Subject: [PATCH 164/278] Update changelog for 11.1.10 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0fe7c70..f307f15e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.10 - *2023-04-07* Standardise files with files in sous-chefs/repo-management From 8d2f446c70e60ba799104c6e2283b5d3324de89b Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 7 Apr 2023 06:00:37 +0100 Subject: [PATCH 165/278] Update metadata for 11.1.10 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index dac5e913..66a0b670 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.9' +version '11.1.10' supports 'debian' supports 'ubuntu' From 80cc8ffab07ce394578b86270da1e02ad9d0d7cb Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 7 Apr 2023 06:00:39 +0100 Subject: [PATCH 166/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f307f15e..820d999e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.10 - *2023-04-07* Standardise files with files in sous-chefs/repo-management From d87a4322fa48c580ba1a18de53d6aa8ba1ec1087 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:45:14 +0100 Subject: [PATCH 167/278] Update sous-chefs/.github action to v2.0.2 (#694) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/test-kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 05f162c4..46cf6d7b 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.1 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.2 permissions: actions: write checks: write From 39121b246e8c723a38511c1b13504d4503e2a6ce Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:45:17 +0100 Subject: [PATCH 168/278] Update changelog for 11.1.11 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 820d999e..e8e4a615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.11 - *2023-04-17* ## 11.1.10 - *2023-04-07* From ef390c76882a9e6767f55598de2580440f650995 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:45:18 +0100 Subject: [PATCH 169/278] Update metadata for 11.1.11 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 66a0b670..4ce3d758 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.10' +version '11.1.11' supports 'debian' supports 'ubuntu' From 186a5e91619aa04ac2544213c49d60aab280afe4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:45:20 +0100 Subject: [PATCH 170/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e4a615..33e4fe3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.11 - *2023-04-17* ## 11.1.10 - *2023-04-07* From bdccb3c8a24c4e451edad37ac4e11001e1328cbc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 14:48:47 +0100 Subject: [PATCH 171/278] Update sous-chefs/.github action to v2.0.4 (#695) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/test-kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 46cf6d7b..b3eee4e4 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.2 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.4 permissions: actions: write checks: write From 91b8c231280fc60d89887e26749ea1a36eb1f0b4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 May 2023 14:48:51 +0100 Subject: [PATCH 172/278] Update changelog for 11.1.12 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33e4fe3e..ee86bc0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.12 - *2023-05-16* ## 11.1.11 - *2023-04-17* From c635155787517b18fa60f3989485a81578a26fa7 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 May 2023 14:48:52 +0100 Subject: [PATCH 173/278] Update metadata for 11.1.12 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 4ce3d758..105ed026 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.11' +version '11.1.12' supports 'debian' supports 'ubuntu' From 656c836c5bdbf0919539aaeb62fc87a6bbe71ea7 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 May 2023 14:48:55 +0100 Subject: [PATCH 174/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee86bc0d..43b301b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.12 - *2023-05-16* ## 11.1.11 - *2023-04-17* From c571f1e52b15cfaaab83611baedd22d68b0f8360 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:27:33 +0100 Subject: [PATCH 175/278] Update sous-chefs/.github action to v2.0.5 (#696) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/test-kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index b3eee4e4..6ea97ce2 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.4 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.5 permissions: actions: write checks: write From 8e34ae0df87f0664f77a1f387ad1033bf7f097f0 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:27:37 +0100 Subject: [PATCH 176/278] Update changelog for 11.1.13 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43b301b4..87fedebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.13 - *2023-07-10* ## 11.1.12 - *2023-05-16* From b7a2e6d2da2d6a4ddbe73bd4b9c354ab6ec354e2 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:27:38 +0100 Subject: [PATCH 177/278] Update metadata for 11.1.13 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 105ed026..cffdf5b3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.12' +version '11.1.13' supports 'debian' supports 'ubuntu' From 84498f40f32ae03b6b97480388f54902ccee9075 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:27:40 +0100 Subject: [PATCH 178/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87fedebb..84b9f8d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.13 - *2023-07-10* ## 11.1.12 - *2023-05-16* From 3e36b1fb818b418a7e1f0d291703736e9f916689 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:53:47 +0100 Subject: [PATCH 179/278] Update actions/checkout action to v4 (#697) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/md-links.yml | 2 +- .github/workflows/test-kitchen.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index e5c1e7a2..b4f2de13 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 with: diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 6ea97ce2..0f28c542 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -53,7 +53,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Dokken @@ -70,7 +70,7 @@ jobs: runs-on: macos-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Kitchen Converge From b405e06dff5c38bc7bf9c4137bb4cb0f2a0d4edc Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:53:50 +0100 Subject: [PATCH 180/278] Update changelog for 11.1.14 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84b9f8d9..18b8537d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.1.14 - *2023-09-04* ## 11.1.13 - *2023-07-10* From 6f49c0467a8be027478f597d163b304b4e3b8b68 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:53:51 +0100 Subject: [PATCH 181/278] Update metadata for 11.1.14 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index cffdf5b3..818a42f4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.13' +version '11.1.14' supports 'debian' supports 'ubuntu' From fccf996bc40d305481cdb8bfa6dd15549419edb4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:53:54 +0100 Subject: [PATCH 182/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b8537d..763caab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.1.14 - *2023-09-04* ## 11.1.13 - *2023-07-10* From 644ffc0cfa5bb0f2c791e6988fe5f4d1fac71004 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 12 Sep 2023 14:44:51 +0100 Subject: [PATCH 183/278] Remove EOL Debian 9 (#699) --- .github/workflows/test-kitchen.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 0f28c542..c38cabb9 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -22,14 +22,16 @@ jobs: strategy: matrix: os: + - almalinux-8 - amazonlinux-2 - - debian-9 - debian-10 - debian-11 - centos-7 - - centos-8 + - centos-stream-8 - ubuntu-1804 - ubuntu-2004 + - ubuntu-2204 + - rockylinux-8 suite: - openjdk-11 - openjdk-16 From 5f14c9baef02664166296b5a5343e158bd28f0b4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:44:55 +0100 Subject: [PATCH 184/278] Update changelog for 11.2.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 763caab7..f466e4d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.2.0 - *2023-09-12* ## 11.1.14 - *2023-09-04* From e4b547592236862b14520564ca747bb550c88b8c Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:44:55 +0100 Subject: [PATCH 185/278] Update metadata for 11.2.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 818a42f4..5725f95e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.1.14' +version '11.2.0' supports 'debian' supports 'ubuntu' From b2c04f6fc9968e4e2e79c53af1a355f5a332be8f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:44:58 +0100 Subject: [PATCH 186/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f466e4d4..d783620c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.2.0 - *2023-09-12* ## 11.1.14 - *2023-09-04* From 422fa55c2247fe5b133baec2508b58b244e8abab Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:03:55 +0100 Subject: [PATCH 187/278] Update sous-chefs/.github action to v2.0.6 (#698) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/test-kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index c38cabb9..8fb0a6d0 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.5 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.6 permissions: actions: write checks: write From dd489a078464311420084456336e92cb184b27ed Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:03:58 +0100 Subject: [PATCH 188/278] Update changelog for 11.2.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d783620c..3962600a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.2.1 - *2023-09-12* ## 11.2.0 - *2023-09-12* From 5437e02ed807e24b80851ce486deb1d5ccb5c000 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:03:59 +0100 Subject: [PATCH 189/278] Update metadata for 11.2.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 5725f95e..55ac99a3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.2.0' +version '11.2.1' supports 'debian' supports 'ubuntu' From 9c645f37aa426fd6e44ccbc3a098e4102e321a39 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:04:02 +0100 Subject: [PATCH 190/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3962600a..0e8462fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.2.1 - *2023-09-12* ## 11.2.0 - *2023-09-12* From 4ffd00e40d7e6c1c9517301165ea6284c9980989 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 09:40:22 +0800 Subject: [PATCH 191/278] Update actions/checkout digest to 8ade135 (#700) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/md-links.yml | 2 +- .github/workflows/test-kitchen.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml index b4f2de13..abdae233 100644 --- a/.github/workflows/md-links.yml +++ b/.github/workflows/md-links.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 with: diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 8fb0a6d0..29cdac56 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -55,7 +55,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Dokken @@ -72,7 +72,7 @@ jobs: runs-on: macos-latest steps: - name: Check out code - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Kitchen Converge From c836a08fbe433b8ac3f092d56030ac8fddb26834 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 28 Sep 2023 02:40:25 +0100 Subject: [PATCH 192/278] Update changelog for 11.2.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e8462fb..61c9380e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 11.2.2 - *2023-09-28* ## 11.2.1 - *2023-09-12* From a6e7163028c2b1e6fe36746a7fd1e75a40fd4506 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 28 Sep 2023 02:40:25 +0100 Subject: [PATCH 193/278] Update metadata for 11.2.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 55ac99a3..8fd5609e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.2.1' +version '11.2.2' supports 'debian' supports 'ubuntu' From 9d3e63a35d64be61bd7c7f89d0b305828cc36681 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 28 Sep 2023 02:40:28 +0100 Subject: [PATCH 194/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61c9380e..a8df71e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 11.2.2 - *2023-09-28* ## 11.2.1 - *2023-09-12* From 00570a6f0c07020186fae2aeedd2c49eb82d1e13 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Fri, 29 Sep 2023 15:47:00 +0100 Subject: [PATCH 195/278] AdoptOpenJDK --> Termurin/Semeru # Description Remove AdoptOpenJDK and replace with Adoptium Termurin & IBM Semeru ## Issues Resolved #674 ## Check List - [ ] A summary of changes made is included in the CHANGELOG under `## Unreleased` - [ ] New functionality includes testing. - [ ] New functionality has been documented in the README if applicable. --- CHANGELOG.md | 275 +++++++++--------- kitchen.yml | 77 ++--- libraries/adopt_openjdk_helpers.rb | 102 ------- libraries/openjdk_helpers.rb | 57 +++- resources/adoptopenjdk_linux_install.rb | 147 +++------- resources/openjdk_source_install.rb | 12 +- spec/libraries/adopt_openjdk_helpers_spec.rb | 159 ---------- .../adopt_openjdk_macos_helpers_spec.rb | 47 --- spec/libraries/openjdk_helpers_spec.rb | 2 +- spec/libraries/semeru_helpers_spec.rb | 73 +++++ spec/spec_helper.rb | 1 - .../cookbooks/test/recipes/adoptopenjdk.rb | 14 - .../cookbooks/test/recipes/openjdk.rb | 7 +- 13 files changed, 373 insertions(+), 600 deletions(-) delete mode 100644 libraries/adopt_openjdk_helpers.rb delete mode 100644 spec/libraries/adopt_openjdk_helpers_spec.rb delete mode 100644 spec/libraries/adopt_openjdk_macos_helpers_spec.rb create mode 100644 spec/libraries/semeru_helpers_spec.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index a8df71e4..baad3e85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,18 +18,22 @@ This file is used to list changes made in each version of the Java cookbook. ## 11.1.11 - *2023-04-17* +Standardise files with files in sous-chefs/repo-management + ## 11.1.10 - *2023-04-07* Standardise files with files in sous-chefs/repo-management ## 11.1.9 - *2023-04-01* -## 11.1.8 - *2023-04-01* +Standardise files with files in sous-chefs/repo-management -## 11.1.7 - *2023-04-01* +## 11.1.8 - *2023-04-01* Standardise files with files in sous-chefs/repo-management +## 11.1.7 - *2023-04-01* + Standardise files with files in sous-chefs/repo-management ## 11.1.6 - *2023-03-02* @@ -103,16 +107,19 @@ Standardise files with files in sous-chefs/repo-management - Remove testing for end of life OpenJDK suites - Primarily support OpenJDK LTS versions 11, 17 - Drop support for OpenJDK package installs for non-LTS versions - - These packages are still possible to install though they will now default to a source install + + These packages are still possible to install though they will now default to a source install - Direct Amazon users to Amazon Corretto instead of installing OpenJDK - Drop package install support for Java 8. Most supported operating systems no longer support OpenJDK 8 - - To install OpenJDK 8, a 'source' install from an internal mirror is now recommended + + To install OpenJDK 8, a 'source' install from an internal mirror is now recommended ## 10.0.1 - *2021-09-21* - Split out workflows to allow standardfiles to control markdown, yaml and delivery - Adds a "Final" workflow to set a known pass/failure hook - - This allows us to have Terraform set the Final workflow as a required check + + This allows us to have Terraform set the Final workflow as a required check ## 10.0.0 - *2021-09-02* @@ -489,9 +496,9 @@ Standardise files with files in sous-chefs/repo-management ## v1.29.0 - (11/14/2014) -- **[#216](https://github.com/agileorbit-cookbooks/java/pull/216)** - Ensure dirs, links, and jinfo files are owned correctly -- **[#217](https://github.com/agileorbit-cookbooks/java/pull/217)** - Update to Oracle JDK 8u25 -- **[#214](https://github.com/agileorbit-cookbooks/java/pull/214)** - Update to Oracle JDK 7u71-b14 +- Ensure dirs, links, and jinfo files are owned correctly +- Update to Oracle JDK 8u25 +- Update to Oracle JDK 7u71-b14 - Adding a connect_timeout option for downloading java. - Switched to chef-zero provisioner in test suites. - Adding ISSUES.md for guidance on creating new issues for the Java cookbook. @@ -509,15 +516,15 @@ Standardise files with files in sous-chefs/repo-management ## v1.26.0 - (8/16/2014) -- **[#201](https://github.com/agileorbit-cookbooks/java/pull/201)** - Allow pinning of package versions for openjdk -- **[#198](https://github.com/agileorbit-cookbooks/java/pull/198)** - Update Oracle JDK7 to version 7u67 -- **[#189](https://github.com/agileorbit-cookbooks/java/pull/184)** - Support specific version and name for Oracle RPM +- Allow pinning of package versions for openjdk +- Update Oracle JDK7 to version 7u67 +- Support specific version and name for Oracle RPM ## v1.25.0 - (8/1/2014) -- **[#189](https://github.com/agileorbit-cookbooks/java/pull/189)** - Resource ark -> attribute bin_cmds default value -- **[#168](https://github.com/agileorbit-cookbooks/java/pull/168)** - Add option to put JAVA_HOME in /etc/environment -- **[#172](https://github.com/agileorbit-cookbooks/java/pull/172)** - Allow ark to pull from http and files ending in .gz. +- Resource ark -> attribute bin_cmds default value +- Add option to put JAVA_HOME in /etc/environment +- Allow ark to pull from http and files ending in .gz. - Recommendations for inclusion in community cookbooks - Production Deployment with Oracle Java - Update testing instructions for chefdk @@ -530,15 +537,15 @@ Standardise files with files in sous-chefs/repo-management New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** -- **[#192](https://github.com/agileorbit-cookbooks/java/pull/192)** - Bump JDK7 URLs to 7u65 -- **[#191](https://github.com/agileorbit-cookbooks/java/pull/192)** - Upgrade Oracle's Java 8 to u11 -- **[#188](https://github.com/agileorbit-cookbooks/java/pull/188)** - Allow for alternatives priority to be set from attribute. -- **[#176](https://github.com/agileorbit-cookbooks/java/pull/176)** - Change ownership of extracted files -- **[#169](https://github.com/agileorbit-cookbooks/java/pull/169)** - Add retries and retry_delay parameters to java_ark LWRP -- **[#167](https://github.com/agileorbit-cookbooks/java/pull/167)** - default: don't fail when using java 8 on windows -- **[#165](https://github.com/agileorbit-cookbooks/java/pull/165)** - Support for Server JRE -- **[#158](https://github.com/agileorbit-cookbooks/java/pull/158)** - Updated README for accepting oracle terms -- **[#157](https://github.com/agileorbit-cookbooks/java/pull/157)** -Remove VirtualBox specific box_urls +- Bump JDK7 URLs to 7u65 +- Upgrade Oracle's Java 8 to u11 +- Allow for alternatives priority to be set from attribute. +- Change ownership of extracted files +- Add retries and retry_delay parameters to java_ark LWRP +- default: don't fail when using java 8 on windows +- Support for Server JRE +- Updated README for accepting oracle terms +-Remove VirtualBox specific box_urls - List AgileOrbit as the maintainer (AgileOrbit took over from Socrata in July 2014) ## v1.23.0 - (7/25/2014) @@ -547,100 +554,100 @@ New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** ## v1.22.0 -- **[#148](https://github.com/socrata-cookbooks/java/pull/148)** - Add support for Oracle JDK 1.8.0 -- **[#150](https://github.com/socrata-cookbooks/java/pull/150)** - Make use of Chef's cache directory instead of /tmp -- **[#151](https://github.com/socrata-cookbooks/java/pull/151)** - Update Test Kitchen suites -- **[#154](https://github.com/socrata-cookbooks/java/pull/154)** - Add safety check for JDK 8 on non-Oracle +- Add support for Oracle JDK 1.8.0 +- Make use of Chef's cache directory instead of /tmp +- Update Test Kitchen suites +- Add safety check for JDK 8 on non-Oracle ## v1.21.2 -- **[#146](https://github.com/socrata-cookbooks/java/pull/146)** - Update Oracle accept-license-terms cookie format +- Update Oracle accept-license-terms cookie format ## v1.21.0 -- **[#143](https://github.com/socrata-cookbooks/java/pull/143)** - Symlink /usr/lib/jvm/default-java for both OpenJDK and Oracle -- **[#144](https://github.com/socrata-cookbooks/java/pull/144)** - Remove /var/lib/alternatives/#{cmd} before calling alternatives (Hopefully fixes sporadic issues when setting alternatives) -- **[Make default_java_symlink conditional on set_default attribute](https://github.com/socrata-cookbooks/java/commit/e300e235a463382a5022e1dddaac674930b4d138)** +- Symlink /usr/lib/jvm/default-java for both OpenJDK and Oracle +- Remove /var/lib/alternatives/#{cmd} before calling alternatives (Hopefully fixes sporadic issues when setting alternatives) +- Make default_java_symlink conditional on set_default attribute ## v1.20.0 -- **[#137](https://github.com/socrata-cookbooks/java/pull/137)** - Create /usr/lib/jvm/default-java on Debian -- **[#138](https://github.com/socrata-cookbooks/java/pull/138)** - allow wrapping cookbook without providing templates -- **[#140](https://github.com/socrata-cookbooks/java/pull/140)** - Adds set_default attribute to toggle setting JDK as default -- **[#141](https://github.com/socrata-cookbooks/java/pull/141)** - set java_home correctly for oracle_rpm +- Create /usr/lib/jvm/default-java on Debian +- allow wrapping cookbook without providing templates +- Adds set_default attribute to toggle setting JDK as default +- set java_home correctly for oracle_rpm ## v1.19.2 -- **[#129](https://github.com/socrata-cookbooks/java/pull/129)** - Upgrade to ChefSpec 3 +- Upgrade to ChefSpec 3 - Rewrite unit tests for better coverage and to work with ChefSpec 3 (various commits) - List Socrata as the maintainer (Socrata took over from Opscode in December 2013) -- **[#133](https://github.com/socrata-cookbooks/java/pull/133)** - Allow jdk_version to be a string or number -- **[#131](https://github.com/socrata-cookbooks/java/pull/131)** - Fix JDK install on Windows -- **[Fix openjdk_packages on Arch Linux](https://github.com/socrata-cookbooks/java/commit/677bee7b9bf08988596d40ac65e75984a86bda99)** +- Allow jdk_version to be a string or number +- Fix JDK install on Windows +- Fix openjdk_packages on Arch Linux +- ## v1.19.0 Refactor the cookbook to better support wrapper cookbooks and other cookbook authoring patterns. -- **[#123](https://github.com/socrata-cookbooks/java/pull/123)** - Update documentation & add warning for issue 122 -- **[#124](https://github.com/socrata-cookbooks/java/pull/124)** - Refactor default recipe to better enable wrapper cookbooks -- **[#125](https://github.com/socrata-cookbooks/java/pull/125)** - Removes the attribute to purge deprecated packages -- **[#127](https://github.com/socrata-cookbooks/java/pull/127)** - Add safety check if attributes are unset -- **[Adds tests for directly using openjdk and oracle recipes](https://github.com/socrata-cookbooks/java/commit/794df596959d65a1a6d5f6c52688bffd8de6bff4)** -- **[Adds recipes to README](https://github.com/socrata-cookbooks/java/commit/76d52114bb9df084174d43fed143123b1cdbae16)** -- **[The Opscode CCLA is no longer required](https://github.com/socrata-cookbooks/java/commit/ce4ac25caa8383f185c25c4e32cafef8c0453376)** -- **[Adds tests for openjdk-7 and oracle-7](https://github.com/socrata-cookbooks/java/commit/9c38af241f68b3198cde4ad6fe2b4cb752062009)** -- **[#119](https://github.com/socrata-cookbooks/java/pull/119)** - Use java_home instead of java_location for update-alternatives -- **[Fix java_home for rhel and fedora](https://github.com/socrata-cookbooks/java/commit/71dadbd1bfe2eab50ff21cdab4ded97877911cc4)** +- Update documentation & add warning for issue 122 +- Refactor default recipe to better enable wrapper cookbooks +- Removes the attribute to purge deprecated packages +- Add safety check if attributes are unset +- Adds tests for directly using openjdk and oracle recipes +- Adds recipes to README +- The Opscode CCLA is no longer required +- Adds tests for openjdk-7 and oracle-7 +- Use java_home instead of java_location for update-alternatives +- Fix java_home for rhel and fedora ## v1.18.0 -- **[#118](https://github.com/socrata-cookbooks/java/pull/118)** - Upgrade to 7u51 -- **[#117](https://github.com/socrata-cookbooks/java/pull/117)** - Suggest windows and aws +- Upgrade to 7u51 +- Suggest windows and aws ## v1.17.6 -- Revert **[COOK-4165](https://tickets.opscode.com/browse/COOK-4165)** - The headers option was only added to remote_file in Chef 11.6.0, meaning this change breaks older clients. +- Revert **[COOK-4165]** - The headers option was only added to remote_file in Chef 11.6.0, meaning this change breaks older clients. ## v1.17.4 -- **[#111](https://github.com/socrata-cookbooks/java/pull/111)** - Fix alternatives for centos +- Fix alternatives for centos -- **[COOK-4165](https://tickets.opscode.com/browse/COOK-4165)** - Replace curl with remote_file with cookie header -- **[#110](https://github.com/socrata-cookbooks/java/pull/110)** - Update openjdk to use the alternatives resource +- Replace curl with remote_file with cookie header +- Update openjdk to use the alternatives resource ## v1.17.2 -- **[COOK-4136](https://tickets.opscode.com/browse/COOK-4136)** - Add md5 parameter to java_ark resource +- Add md5 parameter to java_ark resource ## v1.17.0 -- **[COOK-4114](https://tickets.opscode.com/browse/COOK-4114)** - Test Kitchen no longer works after merging Pull Request #95 for openjdk tests on Debian/Ubuntu -- **[COOK-4124](https://tickets.opscode.com/browse/COOK-4124)** - update-alternatives fails to run -- **[#81](https://github.com/socrata/java/pull/81)** - Ensure local directory hierarchy -- **[#97](https://github.com/socrata/java/pull/97)** - Expose LWRP state attributes -- **[#99](https://github.com/socrata/java/pull/99)** - support for MD5 checksum -- **[#106](https://github.com/socrata/java/pull/106)** - Fixed windows case to prevent bad java_home variable setting -- **[Update checksums to the officially-published ones from Oracle](https://github.com/socrata/java/commit/b9e1df24caeb6e22346d2d415b3b4384f15d4ffd)** -- **[Further test kitchen fixes to use the default recipe](https://github.com/socrata/java/commit/01c0b432705d9cfa6d2dfeaa380983e3f604069f)** +- Test Kitchen no longer works after merging Pull Request #95 for openjdk tests on Debian/Ubuntu +- update-alternatives fails to run +- Ensure local directory hierarchy +- Expose LWRP state attributes support for MD5 checksum +- Fixed windows case to prevent bad java_home variable setting +- Update checksums to the officially-published ones +- Further test kitchen fixes ## v1.16.4 -- **[#103](https://github.com/socrata/java/pull/103)** - set alternatives when using ibm_tar recipe -- **[#104](https://github.com/socrata/java/pull/104)** - Specify windows attributes in attribute files +- set alternatives when using ibm_tar recipe +- Specify windows attributes in attribute files ## v1.16.2 -- **[COOK-3488](https://tickets.opscode.com/browse/COOK-3488)** - set alternatives for ibm jdk -- **[COOK-3764](https://tickets.opscode.com/browse/COOK-3764)** - IBM Java installer needs 'rpm' package on Ubuntu +- set alternatives for ibm jdk +- IBM Java installer needs 'rpm' package on Ubuntu -- **[COOK-3857](https://tickets.opscode.com/browse/COOK-3857)** - do not unescape the java windows url before parsing it -- **[#95](https://github.com/socrata/java/pull/95)** - fixes update-alternatives for openjdk installs -- **[#100](https://github.com/socrata/java/pull/100)** - Use escaped quotes for Windows INSTALLDIR +- do not unescape the java windows url before parsing it +- fixes update-alternatives for openjdk installs +- Use escaped quotes for Windows INSTALLDIR ## v1.16.0 -- **[COOK-3823](https://tickets.opscode.com/browse/COOK-3823)** - Upgrade to JDK 7u45-b18 +- Upgrade to JDK 7u45-b18 ## v1.15.4 @@ -658,44 +665,42 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut ### FIX -- [COOK-3908] - Fixing JAVA_HOME on Ubuntu 10.04 +- Fixing JAVA_HOME on Ubuntu 10.04 ## v1.14.0 -- **[COOK-3704](https://tickets.opscode.com/browse/COOK-3704)** - Fix alternatives when the package is already installed -- **[COOK-3668](https://tickets.opscode.com/browse/COOK-3668)** - Fix a condition that would result in an error executing action `run` on resource 'bash[update-java-alternatives]' -- **[COOK-3569](https://tickets.opscode.com/browse/COOK-3569)** - Fix bad checksum length -- **[COOK-3541](https://tickets.opscode.com/browse/COOK-3541)** - Fix an issue where Java cookbook installs both JDK 6 and JDK 7 when JDK 7 is specified -- **[COOK-3518](https://tickets.opscode.com/browse/COOK-3518)** - Allow Windoes recipe to download from signed S3 url -- **[COOK-2996](https://tickets.opscode.com/browse/COOK-2996)** - Fix a failure on Centos 6.4 and Oracle JDK 7 - -- **[COOK-2793](https://tickets.opscode.com/browse/COOK-2793)** - Improve Windows support +- Fix alternatives when the package is already installed +- Fix a condition that would result in an error executing action `run` on resource 'bash[update-java-alternatives]' +- Fix bad checksum length +- Fix an issue where Java cookbook installs both JDK 6 and JDK 7 when JDK 7 is specified +- Allow Windoes recipe to download from signed S3 url +- Fix a failure on Centos 6.4 and Oracle JDK 7 +- Improve Windows support ## v1.13.0 -- **[COOK-3295](https://tickets.opscode.com/browse/COOK-3295)** - Add default `platform_family` option in Java helper -- **[COOK-3277](https://tickets.opscode.com/browse/COOK-3277)** - Fix support for Fedora - -- **[COOK-3278](https://tickets.opscode.com/browse/COOK-3278)** - Upgrade to Oracle Java 7u25 -- **[COOK-3029](https://tickets.opscode.com/browse/COOK-3029)** - Add Oracle RPM support -- **[COOK-2931](https://tickets.opscode.com/browse/COOK-2931)** - Add support for the platform `xenserver` -- **[COOK-2154](https://tickets.opscode.com/browse/COOK-2154)** - Add SmartOS support +- Add default `platform_family` option in Java helper +- Fix support for Fedora +- Upgrade to Oracle Java 7u25 +- Add Oracle RPM support +- Add support for the platform `xenserver` +- Add SmartOS support ## v1.12.0 -- [COOK-2154]: Add SmartOS support to java::openjdk recipe -- [COOK-3278]: upgrade to Oracle Java 7u25 -- [COOK-2931]: Adding support for the platform 'xenserver' (for installations of java in DOM0) -- [COOK-3277]: java cookbook fails on Fedora +- Add SmartOS support to java::openjdk recipe +- upgrade to Oracle Java 7u25 +- Adding support for the platform 'xenserver' (for installations of java in DOM0) +- java cookbook fails on Fedora ## v1.11.6 -- [COOK-2847]: Java cookbook does not have opensuse support -- [COOK-3142]: Syntax Errors spec/default_spec.rb:4-8 +- Java cookbook does not have opensuse support +- Syntax Errors spec/default_spec.rb:4-8 ## v1.11.4 -- [COOK-2989]: `bash[update-java-alternatives]` resource uses wrong attribute +- `bash[update-java-alternatives]` resource uses wrong attribute ## v1.11.2 @@ -705,96 +710,96 @@ Refactor the cookbook to better support wrapper cookbooks and other cookbook aut This version brings a wealth of tests and (backwards-compatible) refactoring, plus some new features (updated Java, IBM recipe). -- [COOK-2897]: Add ibm recipe to java cookbook -- [COOK-2903]: move java_home resources to their own recipe -- [COOK-2904]: refactor ruby_block "update-java-alternatives" -- [COOK-2905]: use platform_family in java cookbook -- [COOK-2920]: add chefspec to java cookbook -- [COOK-2902]: Refactor java cookbook -- [COOK-2900]: update JDK to JDK 7u21, 6u45 +- Add ibm recipe to java cookbook +- move java_home resources to their own recipe +- refactor ruby_block "update-java-alternatives" +- use platform_family in java cookbook +- add chefspec to java cookbook +- Refactor java cookbook +- update JDK to JDK 7u21, 6u45 ## v1.10.2 -- [COOK-2415] - Fixed deprecation warnings in ark provider and openjdk recipe by using Chef::Mixin::ShellOut instead of Chef::ShellOut +- [2415] - Fixed deprecation warnings in ark provider and openjdk recipe by using Chef::Mixin::ShellOut instead of Chef::ShellOut ## v1.10.0 -- [COOK-2400] - Allow java ark :url to be https -- [COOK-2436] - Upgrade needed for oracle jdk in java cookbook +- Allow java ark :url to be https +- Upgrade needed for oracle jdk in java cookbook ## v1.9.6 -- [COOK-2412] - add support for Oracle Linux +- add support for Oracle Linux ## v1.9.4 -- [COOK-2083] - Run set-env-java-home in Java cookbook only if necessary -- [COOK-2332] - ark provider does not allow for *.tgz tarballs to be used -- [COOK-2345] - Java cookbook fails on CentOS6 (update-java-alternatives) +- Run set-env-java-home in Java cookbook only if necessary +- ark provider does not allow for *.tgz tarballs to be used +- Java cookbook fails on CentOS6 (update-java-alternatives) ## v1.9.2 -- [COOK-2306] - FoodCritic fixes for java cookbook +- FoodCritic fixes for java cookbook ## v1.9.0 -- [COOK-2236] - Update the Oracle Java version in the Java cookbook to release 1.7u11 +- Update the Oracle Java version in the Java cookbook to release 1.7u11 ## v1.8.2 -- [COOK-2205] - Fix for missing /usr/lib/jvm/default-java on Debian +- Fix for missing /usr/lib/jvm/default-java on Debian ## v1.8.0 -- [COOK-2095] - Add windows support +- Add windows support ## v1.7.0 -- [COOK-2001] - improvements for Oracle update-alternatives - - When installing an Oracle JDK it is now registered with a higher priority than OpenJDK. (Related to COOK-1131.) - - When running both the oracle and oracle_i386 recipes, alternatives are now created for both JDKs. - - Alternatives are now created for all binaries listed in version specific attributes. (Related to COOK-1563 and COOK-1635.) - - When installing Oracke JDKs on Ubuntu, create .jinfo files for use with update-java-alternatives. Commands to set/install alternatives now only run if needed. +- improvements for Oracle update-alternatives +- When installing an Oracle JDK it is now registered with a higher priority than OpenJDK. (Related to COOK-1131.) +- When running both the oracle and oracle_i386 recipes, alternatives are now created for both JDKs. +- Alternatives are now created for all binaries listed in version specific attributes. (Related to COOK-1563 and COOK-1635.) +- When installing Oracke JDKs on Ubuntu, create .jinfo files for use with update-java-alternatives. Commands to set/install alternatives now only run if needed. ## v1.6.4 -- [COOK-1930] - fixed typo in attribute for java 5 on i586 +- fixed typo in attribute for java 5 on i586 ## v1.6.2 - whyrun support in `java_ark` LWRP - CHEF-1804 compatibility -- [COOK-1786] - install Java 6u37 and Java 7u9 -- [COOK-1819] - incorrect warning text about `node['java']['oracle']['accept_oracle_download_terms']` +- install Java 6u37 and Java 7u9 +- incorrect warning text about `node['java']['oracle']['accept_oracle_download_terms']` ## v1.6.0 -- [COOK-1218] - Install Oracle JDK from Oracle download directly -- [COOK-1631] - set JAVA_HOME in openjdk recipe -- [COOK-1655] - Install correct architecture on Amazon Linux +- Install Oracle JDK from Oracle download directly +- set JAVA_HOME in openjdk recipe +- Install correct architecture on Amazon Linux ## v1.5.4 -- [COOK-885] update alternatives called on wrong file -- [COOK-1607] use shellout instead of execute resource to update alternatives +update alternatives called on wrong file +use shellout instead of execute resource to update alternatives ## v1.5.2 -- [COOK-1200] - remove sun-java6-jre on Ubuntu before installing Oracle's Java -- [COOK-1260] - fails on Ubuntu 12.04 64bit with openjdk7 -- [COOK-1265] - Oracle Java should symlink the jar command +- remove sun-java6-jre on Ubuntu before installing Oracle's Java +- fails on Ubuntu 12.04 64bit with openjdk7 +- Oracle Java should symlink the jar command ## v1.5.0 -- [COOK-1146] - Oracle now prevents download of JDK via non-browser -- [COOK-1114] - fix File.exists? +- Oracle now prevents download of JDK via non-browser +- fix File.exists? ## v1.4.2 -- [COOK-1051] - fix attributes typo and platform case switch consistency +- fix attributes typo and platform case switch consistency ## v1.4.0 -- [COOK-858] - numerous updates: handle jdk6 and 7, switch from sun to oracle, make openjdk default, add `java_ark` LWRP. -- [COOK-942] - FreeBSD support -- [COOK-520] - ArchLinux support +- numerous updates: handle jdk6 and 7, switch from sun to oracle, make openjdk default, add `java_ark` LWRP. +- [42] - FreeBSD support +- ArchLinux support diff --git a/kitchen.yml b/kitchen.yml index 7b14a831..30ee8389 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -20,7 +20,6 @@ platforms: - name: freebsd-11 - name: freebsd-12 - name: fedora-latest - # - name: opensuse-leap-15 - name: ubuntu-18.04 - name: ubuntu-20.04 @@ -29,26 +28,26 @@ suites: - name: openjdk-11 run_list: - recipe[test::openjdk] - attributes: {version: "11"} + attributes: { version: "11" } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: "11"} + inputs: { java_version: "11" } - name: openjdk-16 run_list: - recipe[test::openjdk] - attributes: {version: "16"} + attributes: { version: "16" } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: "16"} + inputs: { java_version: "16" } - name: openjdk-17 run_list: - recipe[test::openjdk] - attributes: {version: "17"} + attributes: { version: "17" } verifier: inspec_tests: [test/integration/openjdk] - inputs: {java_version: "17"} + inputs: { java_version: "17" } # AdoptOpenJDK # Version 8 @@ -60,7 +59,8 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml - name: adoptopenjdk-8-openj9 run_list: @@ -70,7 +70,8 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml - name: adoptopenjdk-8-openj9-large-heap run_list: @@ -80,7 +81,8 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml # Version 11 - name: adoptopenjdk-11-hotspot @@ -91,7 +93,8 @@ suites: variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml - name: adoptopenjdk-11-openj9 run_list: - recipe[test::adoptopenjdk] @@ -100,7 +103,8 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml - name: adoptopenjdk-11-openj9-large-heap run_list: - recipe[test::adoptopenjdk] @@ -109,36 +113,41 @@ suites: variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml - # Version 14 - - name: adoptopenjdk-14-openj9-large-heap + # Version 17 + - name: adoptopenjdk-17-openj9-large-heap run_list: - recipe[test::adoptopenjdk] attributes: - version: 14 + version: 17 variant: openj9-large-heap verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml] - - name: adoptopenjdk-14-openj9 + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-17-openj9-large-heap.yml + + - name: adoptopenjdk-17-openj9 run_list: - recipe[test::adoptopenjdk] attributes: - version: 14 + version: 17 variant: openj9 verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml] - - name: adoptopenjdk-14-hotspot + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-17-openj9.yml + - name: adoptopenjdk-17-hotspot run_list: - recipe[test::adoptopenjdk] attributes: - version: 14 + version: 17 variant: hotspot verifier: inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml # 11 Removal - name: adoptopenjdk-removal-11-openj9 @@ -149,37 +158,38 @@ suites: variant: openj9 verifier: inspec_tests: [test/integration/remove-adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml] + input_files: + - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml # Corretto - name: corretto-8 run_list: - recipe[test::corretto] - attributes: {version: "8"} + attributes: { version: "8" } verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: "8"} + inputs: { java_version: "8" } - name: corretto-11 run_list: - recipe[test::corretto] - attributes: {version: "11"} + attributes: { version: "11" } verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: "11"} + inputs: { java_version: "11" } - name: corretto-17 run_list: - recipe[test::corretto] - attributes: {version: "17"} + attributes: { version: "17" } verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: "17"} + inputs: { java_version: "17" } - name: corretto-18 run_list: - recipe[test::corretto] - attributes: {version: "18"} + attributes: { version: "18" } verifier: inspec_tests: [test/integration/corretto] - inputs: {java_version: "18"} + inputs: { java_version: "18" } # Custom URL tests - name: custom-package-8 @@ -225,4 +235,5 @@ suites: checksum: 6524d85d2ce334c955a4347015567326067ef15fe5f6a805714b25cace256f40 verifier: inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/inputs/openj9-large-heap-11.yml] + input_files: + [test/integration/custom-package/inputs/openj9-large-heap-11.yml] diff --git a/libraries/adopt_openjdk_helpers.rb b/libraries/adopt_openjdk_helpers.rb deleted file mode 100644 index 3a47eed1..00000000 --- a/libraries/adopt_openjdk_helpers.rb +++ /dev/null @@ -1,102 +0,0 @@ -module Java - module Cookbook - module AdoptOpenJdkHelpers - def sub_dir(url) - uri = URI.parse(url) - # get file basename without extension - basename = uri.path.split('/')[-1].gsub('.tar.gz', '') - - if basename.include?('linuxXL') # compensate for longer name - # Get version number from start of filename - if (basename.scan /\d+/)[0] == '8' - ver = basename.split('_')[5] - "jdk#{ver[0..4]}-#{ver[-3..-1]}" - else - ver = basename.split('_') - "jdk-#{ver[5]}+#{ver[6]}" - end - elsif (basename.scan /\d+/)[0] == '8' - ver = basename.split('_')[4] - "jdk#{ver[0..4]}-#{ver[-3..-1]}" - else - ver = basename.split('_') - "jdk-#{ver[4]}+#{ver[5]}" - end - end - - def default_adopt_openjdk_url(version) - case version - when '8' - { 'hotspot' => 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u242b08.tar.gz', - 'openj9' => 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08_openj9-0.18.1/OpenJDK8U-jdk_x64_linux_openj9_8u242b08_openj9-0.18.1.tar.gz', - 'openj9-large-heap' => 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08_openj9-0.18.1/OpenJDK8U-jdk_x64_linux_openj9_linuxXL_8u242b08_openj9-0.18.1.tar.gz', - } - when '11' - { 'hotspot' => 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz', - 'openj9' => 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz', - 'openj9-large-heap' => 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz', - } - when '13' - { 'hotspot' => 'https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jdk_x64_linux_hotspot_13.0.2_8.tar.gz', - 'openj9' => 'https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8_openj9-0.18.0/OpenJDK13U-jdk_x64_linux_openj9_13.0.2_8_openj9-0.18.0.tar.gz', - 'openj9-large-heap' => 'https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8_openj9-0.18.0/OpenJDK13U-jdk_x64_linux_openj9_linuxXL_13.0.2_8_openj9-0.18.0.tar.gz', - } - when '14' - { - 'hotspot' => 'https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36/OpenJDK14U-jdk_x64_linux_hotspot_14_36.tar.gz', - 'openj9' => 'https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36.1_openj9-0.19.0/OpenJDK14U-jdk_x64_linux_openj9_14_36_openj9-0.19.0.tar.gz', - 'openj9-large-heap' => 'https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36.1_openj9-0.19.0/OpenJDK14U-jdk_x64_linux_openj9_linuxXL_14_36_openj9-0.19.0.tar.gz', - } - else - Chef::Log.fatal('Version specified does not have a URL value set') - end - end - - def default_adopt_openjdk_checksum(version) - case version - when '8' - { 'hotspot' => 'f39b523c724d0e0047d238eb2bb17a9565a60574cf651206c867ee5fc000ab43', - 'openj9' => 'ca785af638b24f9d4df896f5a9f557cc9f1e5fa5e2b1174d6b906e3fd5474c2e', - 'openj9-large-heap' => '6ee788d57f15cc8c326bb3468390d5e353cc1aac1925efa3f2992a93e2520d97', - } - when '11' - { 'hotspot' => '330d19a2eaa07ed02757d7a785a77bab49f5ee710ea03b4ee2fa220ddd0feffc', - 'openj9' => '1530172ee98edd129954fcdca1bf725f7b30c8bfc3cdc381c88de96b7d19e690', - 'openj9-large-heap' => '6524d85d2ce334c955a4347015567326067ef15fe5f6a805714b25cace256f40', - } - when '13' - { 'hotspot' => '9ccc063569f19899fd08e41466f8c4cd4e05058abdb5178fa374cb365dcf5998', - 'openj9' => 'aeecf6d30d0c847db81d07793cf97e5dc44890c29366d7d9f8f9f397f6c52590', - 'openj9-large-heap' => '16751b3951b808c4cb0b77d4df1a16f9bfff5b2dbc59919773e6386114e6d8d5', - } - when '14' - { 'hotspot' => '6c06853332585ab58834d9e8a02774b388e6e062ef6c4084b4f058c67f2e81b5', - 'openj9' => '106b72d565be98834ead5fea9555bd646d488a86fc4ae4dd294a38e97bf77509', - 'openj9-large-heap' => '4ee13d0689ab7a38d6abb7dee974c3b189e36f1911a0cb61c882a38e61cc8b98', - } - else - Chef::Log.fatal('Version specified does not have a checksum value set') - end - end - - def default_adopt_openjdk_bin_cmds(version) - case version - when '8' - { 'hotspot' => ['appletviewer', 'clhsdb', 'extcheck', 'hsdb', 'idlj', 'jar', 'jarsigner', 'java', 'java-rmi.cgi', 'javac', 'javadoc', 'javah', 'javap', 'jcmd', 'jconsole', 'jdb', 'jdeps', 'jhat', 'jinfo', 'jjs', 'jmap', 'jps', 'jrunscript', 'jsadebugd', 'jstack', 'jstat', 'jstatd', 'keytool', 'native2ascii', 'orbd', 'pack200', 'policytool', 'rmic', 'rmid', 'rmiregistry', 'schemagen', 'serialver', 'servertool', 'tnameserv', 'unpack200', 'wsgen', 'wsimport', 'xjc'], - 'openj9' => ['appletviewer', 'extcheck', 'idlj', 'jar', 'jarsigner', 'java', 'java-rmi.cgi', 'javac', 'javadoc', 'javah', 'javap', 'jcmd', 'jconsole', 'jdb', 'jdeps', 'jdmpview', 'jitserver', 'jjs', 'jmap', 'jps', 'jrunscript', 'jsadebugd', 'jstack', 'jstat', 'keytool', 'native2ascii', 'orbd', 'pack200', 'policytool', 'rmic', 'rmid', 'rmiregistry', 'schemagen', 'serialver', 'servertool', 'tnameserv', 'traceformat', 'unpack200', 'wsgen', 'wsimport', 'xjc'], - 'openj9-large-heap' => ['appletviewer', 'extcheck', 'idlj', 'jar', 'jarsigner', 'java', 'java-rmi.cgi', 'javac', 'javadoc', 'javah', 'javap', 'jcmd', 'jconsole', 'jdb', 'jdeps', 'jdmpview', 'jitserver', 'jjs', 'jmap', 'jps', 'jrunscript', 'jsadebugd', 'jstack', 'jstat', 'keytool', 'native2ascii', 'orbd', 'pack200', 'policytool', 'rmic', 'rmid', 'rmiregistry', 'schemagen', 'serialver', 'servertool', 'tnameserv', 'traceformat', 'unpack200', 'wsgen', 'wsimport', 'xjc'] } - when '11' - { 'hotspot' => %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200), - 'openj9' => %w(jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jdmpview jextract jimage jitserver jjs jlink jmap jmod jps jrunscript jshell jstack jstat keytool pack200 rmic rmid rmiregistry serialver traceformat unpack200), - 'openj9-large-heap' => %w(jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jdmpview jextract jimage jitserver jjs jlink jmap jmod jps jrunscript jshell jstack jstat keytool pack200 rmic rmid rmiregistry serialver traceformat unpack200) } - when '13', '14' - { 'hotspot' => %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200), - 'openj9' => %w(jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jdmpview jextract jimage jjs jlink jmap jmod jps jrunscript jshell jstack jstat keytool pack200 rmic rmid rmiregistry serialver traceformat unpack200), - 'openj9-large-heap' => %w(jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jdmpview jextract jimage jjs jlink jmap jmod jps jrunscript jshell jstack jstat keytool pack200 rmic rmid rmiregistry serialver traceformat unpack200) } - else - Chef::Log.fatal('Version specified does not have a default set of bin_cmds') - end - end - end - end -end diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 715c5ea7..0ef5a4b3 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -5,6 +5,13 @@ def lts %w(11 17) end + # This method relies on the GitHub release artefact URL + # e.g. https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.3_7.tar.gz + def sub_dir(url) + URI.parse(url) + url.split('/')[7].split('_')[0].gsub('%2', '-').downcase + end + def default_openjdk_install_method(version) case node['platform_family'] when 'amazon' @@ -27,14 +34,33 @@ def default_openjdk_install_method(version) end end - def default_openjdk_url(version) + def default_openjdk_url(version, variant = nil) + # Always default to OpenJDK + # If the user passes variant we'll also select that variant's URL case version + when '8' + case variant + when 'semeru' + 'https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u322-b06_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_8u322b06_openj9-0.30.0.tar.gz' + when 'temurin' + 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz' + else + Chef::Log.fatal('Version specified does not have a URL value set') + raise 'Version supplied does not have a download URL set' + end when '9' 'https://download.java.net/java/GA/jdk9/9/binaries/openjdk-9_linux-x64_bin.tar.gz' when '10' 'https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_linux-x64_bin.tar.gz' when '11' - 'https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz' + case variant + when 'semeru' + 'https://github.com/ibmruntimes/semeru11-binaries/releases/download/jdk-11.0.14.1%2B1_openj9-0.30.1/ibm-semeru-open-jdk_x64_linux_11.0.14.1_1_openj9-0.30.1.tar.gz' + when 'temurin' + 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz' + else + 'https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz' + end when '12' 'https://download.java.net/java/GA/jdk12/33/GPL/openjdk-12_linux-x64_bin.tar.gz' when '13' @@ -44,9 +70,32 @@ def default_openjdk_url(version) when '15' 'https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_linux-x64_bin.tar.gz' when '16' - 'https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_linux-x64_bin.tar.gz' + case variant + when 'semeru' + 'https://github.com/ibmruntimes/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.1/ibm-semeru-open-jdk_ppc64le_linux_16.0.2_7_openj9-0.27.1.tar.gz' + when 'temurin' + 'https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz' + else + 'https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_linux-x64_bin.tar.gz' + end when '17' - 'https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz' + case variant + when 'semeru' + 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' + when 'temurin' + 'https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz' + else + 'https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz' + end + when '18' + case variant + when 'semeru' + 'https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.1%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_18.0.1_10_openj9-0.32.0.tar.gz' + when 'temurin' + 'https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz' + else + 'https://download.java.net/java/GA/jdk18.0.1/3f48cabb83014f9fab465e280ccf630b/10/GPL/openjdk-18.0.1_linux-x64_bin.tar.gz' + end else Chef::Log.fatal('Version specified does not have a URL value set') raise 'Version supplied does not have a download URL set' diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb index 126652b9..70026542 100644 --- a/resources/adoptopenjdk_linux_install.rb +++ b/resources/adoptopenjdk_linux_install.rb @@ -1,102 +1,45 @@ -provides :adoptopenjdk_linux_install -unified_mode true -include Java::Cookbook::AdoptOpenJdkHelpers - -property :variant, String, - equal_to: %w(hotspot openj9 openj9-large-heap), - default: 'openj9', - description: 'Install flavour' - -property :url, String, - default: lazy { default_adopt_openjdk_url(version)[variant] }, - description: 'The URL to download from' - -property :checksum, String, - regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, - default: lazy { default_adopt_openjdk_checksum(version)[variant] }, - description: 'The checksum for the downloaded file' - -property :java_home, String, - default: lazy { "/usr/lib/jvm/java-#{version}-adoptopenjdk-#{variant}/#{sub_dir(url)}" }, - description: 'Set to override the java_home' - -property :bin_cmds, Array, - default: lazy { default_adopt_openjdk_bin_cmds(version)[variant] }, - description: 'A list of bin_cmds based on the version and variant' - -use 'partial/_common' -use 'partial/_linux' -use 'partial/_java_home' - -action :install do - extract_dir = new_resource.java_home.split('/')[0..-2].join('/') - parent_dir = new_resource.java_home.split('/')[0..-3].join('/') - tarball_name = new_resource.url.split('/').last - - directory parent_dir do - owner new_resource.java_home_owner - group new_resource.java_home_group - mode new_resource.java_home_mode - recursive true - end - - remote_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do - source new_resource.url - checksum new_resource.checksum - retries new_resource.retries - retry_delay new_resource.retry_delay - mode '644' - end - - archive_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do - destination extract_dir - end - - template "/usr/lib/jvm/.java-#{new_resource.version}-adoptopenjdk-#{new_resource.variant}.jinfo" do - cookbook 'java' - source 'jinfo.erb' - owner new_resource.java_home_owner - group new_resource.java_home_group - variables( - priority: new_resource.alternatives_priority, - bin_cmds: new_resource.bin_cmds, - name: extract_dir.split('/').last, - app_dir: new_resource.java_home - ) - only_if { platform_family?('debian') } - end - - java_alternatives 'set-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds - priority new_resource.alternatives_priority - default new_resource.default - reset_alternatives new_resource.reset_alternatives - action :set - end - - node.default['java']['java_home'] = new_resource.java_home - - append_if_no_line 'Java Home' do - path '/etc/profile.d/java.sh' - line "export JAVA_HOME=#{new_resource.java_home}" - end -end - -action :remove do - extract_dir = new_resource.java_home.split('/')[0..-2].join('/') - - java_alternatives 'unset-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds - only_if { ::File.exist?(extract_dir) } - action :unset - end - - directory "AdoptOpenJDK removal of #{extract_dir}" do - path extract_dir - recursive true - only_if { ::File.exist?(extract_dir) } - action :delete - end -end +# provides :adoptopenjdk_linux_install +# unified_mode true +# include Java::Cookbook::OpenJdkHelpers + +# property :variant, String, +# equal_to: %w(hotspot openj9 openj9-large-heap), +# default: 'openj9', +# description: 'Install flavour' + +# property :url, String, +# default: lazy { default_openjdk_url(version, variant) }, +# description: 'The URL to download from' + +# property :checksum, String, +# regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, +# default: lazy { default_openjdk_checksum(version, variant) }, +# description: 'The checksum for the downloaded file' + +# property :java_home, String, +# default: lazy { "/usr/lib/jvm/java-#{version}-adoptopenjdk-#{variant}/#{sub_dir(url)}" }, +# description: 'Set to override the java_home' + +# property :bin_cmds, Array, +# default: lazy { default_openjdk_bin_cmds(version, variant) }, +# description: 'A list of bin_cmds based on the version and variant' + +# use 'partial/_common' +# use 'partial/_linux' +# use 'partial/_java_home' + +# action :install do +# template "/usr/lib/jvm/.java-#{new_resource.version}-adoptopenjdk-#{new_resource.variant}.jinfo" do +# cookbook 'java' +# source 'jinfo.erb' +# owner new_resource.java_home_owner +# group new_resource.java_home_group +# variables( +# priority: new_resource.alternatives_priority, +# bin_cmds: new_resource.bin_cmds, +# name: extract_dir.split('/').last, +# app_dir: new_resource.java_home +# ) +# only_if { platform_family?('debian') } +# end +# end diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index f999712e..dc119967 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -6,8 +6,13 @@ name_property: true, description: 'Java version to install' +property :variant, String, + equal_to: %w(opendjdk semeru temurin), + default: 'openjdk', + description: 'Install flavour' + property :url, String, - default: lazy { default_openjdk_url(version) }, + default: lazy { default_openjdk_url(version, variant) }, description: 'The URL to download from' property :checksum, String, @@ -61,6 +66,11 @@ reset_alternatives new_resource.reset_alternatives action :set end + + append_if_no_line 'Java Home' do + path '/etc/profile.d/java.sh' + line "export JAVA_HOME=#{new_resource.java_home}" + end end action :remove do diff --git a/spec/libraries/adopt_openjdk_helpers_spec.rb b/spec/libraries/adopt_openjdk_helpers_spec.rb deleted file mode 100644 index e4a0e9b0..00000000 --- a/spec/libraries/adopt_openjdk_helpers_spec.rb +++ /dev/null @@ -1,159 +0,0 @@ -require 'spec_helper' - -RSpec.describe Java::Cookbook::AdoptOpenJdkHelpers do - class DummyClass < Chef::Node - include Java::Cookbook::AdoptOpenJdkHelpers - end - - subject { DummyClass.new } - - describe '#sub_dir' do - before do - allow(subject).to receive(:[]).with('url').and_return(url) - end - - context 'AdoptOpenJDK 8 Hotspot' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u242b08.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' - end - end - - context 'OpenJDK 8 OpenJ9' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08_openj9-0.18.1/OpenJDK8U-jdk_x64_linux_openj9_8u242b08_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' - end - end - - context 'OpenJKDK 8 LargeHeap' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08_openj9-0.18.1/OpenJDK8U-jdk_x64_linux_openj9_linuxXL_8u242b08_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' - end - end - - context 'AdoptOpenJDK 11 Hotspot' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' - end - end - - context 'AdoptOpenJDK 11 OpenJ9' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' - end - end - - context 'AdoptOpenJDK 11 LargeHeap' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' - end - end - - context 'AdoptOpenJDK 14 Hotspot' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36/OpenJDK14U-jdk_x64_linux_hotspot_14_36.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-14+36' - end - end - - context 'AdoptOpenJDK 14 LargeHeap' do - let(:url) { 'https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36.1_openj9-0.19.0/OpenJDK14U-jdk_x64_linux_openj9_linuxXL_14_36_openj9-0.19.0.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-14+36' - end - end - - context 'Custom URL: AdoptOpenJDK 8 Hotspot' do - let(:url) { 'https://some.custom.url/path/to/OpenJDK8U-jdk_x64_linux_hotspot_8u242b08.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' - end - end - - context 'Custom URL: OpenJDK 8 OpenJ9' do - let(:url) { 'https://some.custom.url/path/to/OpenJDK8U-jdk_x64_linux_openj9_8u242b08_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' - end - end - - context 'Custom URL: OpenJKDK 8 LargeHeap' do - let(:url) { 'https://some.custom.url/path/to/OpenJDK8U-jdk_x64_linux_openj9_linuxXL_8u242b08_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u242-b08' - end - end - - context 'Custom URL: AdoptOpenJDK 11 Hotspot' do - let(:url) { 'https://some.custom.url/path/to/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' - end - end - - context 'Custom URL: AdoptOpenJDK 11 OpenJ9' do - let(:url) { 'https://some.custom.url/path/to/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' - end - end - - context 'Custom URL: AdoptOpenJDK 11 LargeHeap' do - let(:url) { 'https://some.custom.url/path/to/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-11.0.6+10' - end - end - - context 'Malformed URL' do - let(:url) { 'a\bad/path/\to\/some.tar.gz' } - - it 'throws an error' do - expect { subject.sub_dir(url) }.to raise_error(URI::InvalidURIError) - end - end - end - - describe '#default_adopt_openjdk_url' do - before do - allow(subject).to receive(:[]).with('version').and_return(version) - end - - context 'AdoptOpenJDK 11 LargeHeap' do - let(:version) { '11' } - let(:variant) { 'openj9-large-heap' } - - it 'returns the correct URL' do - expect(subject.default_adopt_openjdk_url(version)[variant]).to eq 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz' - end - end - - context 'AdoptOpenJDK 11 OpenJ9' do - let(:version) { '11' } - let(:variant) { 'openj9' } - - it 'returns the correct URL' do - expect(subject.default_adopt_openjdk_url(version)[variant]).to eq 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%2B10_openj9-0.18.1/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz' - end - end - end -end diff --git a/spec/libraries/adopt_openjdk_macos_helpers_spec.rb b/spec/libraries/adopt_openjdk_macos_helpers_spec.rb deleted file mode 100644 index 6f98ecd5..00000000 --- a/spec/libraries/adopt_openjdk_macos_helpers_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'spec_helper' - -RSpec.describe Java::Cookbook::AdoptOpenJdkMacOsHelpers do - class DummyClass < Chef::Node - include Java::Cookbook::AdoptOpenJdkMacOsHelpers - end - - subject { DummyClass.new } - - describe '#macos_java_home' do - before do - allow(subject).to receive(:[]).with('version').and_return(version) - end - - context 'adoptopenjdk14' do - let(:version) { 'adoptopenjdk14' } - - it 'returns the correct folder' do - expect(subject.macos_java_home(version)).to eq '/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home' - end - end - - context 'adoptopenjdk14-openj9-jre' do - let(:version) { 'adoptopenjdk14-openj9-jre' } - - it 'returns the correct folder' do - expect(subject.macos_java_home(version)).to eq '/Library/Java/JavaVirtualMachines/adoptopenjdk-14-openj9.jre/Contents/Home' - end - end - - context 'adoptopenjdk14-openj9-jre-large' do - let(:version) { 'adoptopenjdk14-openj9-jre-large' } - - it 'returns the correct folder' do - expect(subject.macos_java_home(version)).to eq '/Library/Java/JavaVirtualMachines/adoptopenjdk-14-openj9.jre/Contents/Home' - end - end - - context 'adoptopenjdk14-openj9-large' do - let(:version) { 'adoptopenjdk14-openj9-large' } - - it 'returns the correct folder' do - expect(subject.macos_java_home(version)).to eq '/Library/Java/JavaVirtualMachines/adoptopenjdk-14-openj9.jdk/Contents/Home' - end - end - end -end diff --git a/spec/libraries/openjdk_helpers_spec.rb b/spec/libraries/openjdk_helpers_spec.rb index 56c12c47..f57d4724 100644 --- a/spec/libraries/openjdk_helpers_spec.rb +++ b/spec/libraries/openjdk_helpers_spec.rb @@ -27,7 +27,7 @@ class DummyClass < Chef::Node end context 'Invalid OpenJDK version' do - let(:version) { '18' } + let(:version) { '18.2' } it 'should raise an error' do expect { subject.default_openjdk_url(version) } diff --git a/spec/libraries/semeru_helpers_spec.rb b/spec/libraries/semeru_helpers_spec.rb new file mode 100644 index 00000000..8910a555 --- /dev/null +++ b/spec/libraries/semeru_helpers_spec.rb @@ -0,0 +1,73 @@ +require 'spec_helper' + +RSpec.describe Java::Cookbook::OpenJdkHelpers do + class DummyClass < Chef::Node + include Java::Cookbook::OpenJdkHelpers + end + + subject { DummyClass.new } + + describe '#sub_dir' do + before do + allow(subject).to receive(:[]).with('url').and_return(url) + end + + context 'OpenJDK Semeru 8' do + let(:url) { 'https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u322-b06_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_8u322b06_openj9-0.30.0.tar.gz' } + + it 'returns the correct folder name' do + expect(subject.sub_dir(url)).to eq 'jdk8u322-b06' + end + end + + context 'Malformed URL' do + let(:url) { 'a\bad/path/\to\/some.tar.gz' } + + it 'throws an error' do + expect { subject.sub_dir(url) }.to raise_error(URI::InvalidURIError) + end + end + end + + describe '#defaul_openjdk_url' do + before do + allow(subject).to receive(:[]).with('version').and_return(version) + end + + context 'Semeru 8' do + let(:version) { '8' } + let(:variant) { 'semeru' } + + it 'returns the correct URL' do + expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u322-b06_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_8u322b06_openj9-0.30.0.tar.gz' + end + end + + context 'Semeru 11' do + let(:version) { '11' } + let(:variant) { 'semeru' } + + it 'returns the correct URL' do + expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru11-binaries/releases/download/jdk-11.0.14.1%2B1_openj9-0.30.1/ibm-semeru-open-jdk_x64_linux_11.0.14.1_1_openj9-0.30.1.tar.gz' + end + end + + context 'Semeru 16' do + let(:version) { '16' } + let(:variant) { 'semeru' } + + it 'returns the correct URL' do + expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.1/ibm-semeru-open-jdk_ppc64le_linux_16.0.2_7_openj9-0.27.1.tar.gz' + end + end + + context 'Semeru 17' do + let(:version) { '17' } + let(:variant) { 'semeru' } + + it 'returns the correct URL' do + expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5906593e..ee2b6646 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,6 @@ require 'chefspec' require 'chefspec/berkshelf' -require_relative '../libraries/adopt_openjdk_helpers' require_relative '../libraries/adopt_openjdk_macos_helpers' require_relative '../libraries/certificate_helpers' require_relative '../libraries/corretto_helpers' diff --git a/test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb b/test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb deleted file mode 100644 index 2c89076f..00000000 --- a/test/fixtures/cookbooks/test/recipes/adoptopenjdk.rb +++ /dev/null @@ -1,14 +0,0 @@ -apt_update - -version = node['version'] -variant = node['variant'] - -adoptopenjdk_install version do - variant variant -end - -cookbook_file '/tmp/UnlimitedSupportJCETest.jar' do - source 'UnlimitedSupportJCETest.jar' -end - -include_recipe 'test::java_cert' diff --git a/test/fixtures/cookbooks/test/recipes/openjdk.rb b/test/fixtures/cookbooks/test/recipes/openjdk.rb index 97ce6d41..6fea755a 100644 --- a/test/fixtures/cookbooks/test/recipes/openjdk.rb +++ b/test/fixtures/cookbooks/test/recipes/openjdk.rb @@ -1,3 +1,8 @@ -openjdk_install node['version'] +openjdk_install node['version'] do + variant node['variant'] if node['variant'] +end + +# openjdk || semeru || temurin +# openjdk OpenJ9 || hotspot include_recipe 'test::java_cert' From 88364c1fbedae54a6c9df2d839df19a163975fed Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:47:03 +0100 Subject: [PATCH 196/278] Update changelog for 12.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baad3e85..f9c10f03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.0 - *2023-09-29* ## 11.2.2 - *2023-09-28* From 10f0ada82e03006f6686edd0642673e3f506a1ef Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:47:04 +0100 Subject: [PATCH 197/278] Update metadata for 12.0.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 8fd5609e..23e6f2d9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '11.2.2' +version '12.0.0' supports 'debian' supports 'ubuntu' From a90b93662fec8bd0c63e20478740ef3288e018a9 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:47:07 +0100 Subject: [PATCH 198/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c10f03..32ead74a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.0 - *2023-09-29* ## 11.2.2 - *2023-09-28* From 9defc0ee41cf131d6105ce98b5698fdb6131cb51 Mon Sep 17 00:00:00 2001 From: Isaac Boehman Date: Fri, 29 Sep 2023 22:48:06 -0400 Subject: [PATCH 199/278] fix: typo, 'opendjdk' should be 'openjdk' (#702) --- CHANGELOG.md | 2 ++ resources/openjdk_source_install.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32ead74a..91c57cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- fix OpenJDK variant typo + ## 12.0.0 - *2023-09-29* ## 11.2.2 - *2023-09-28* diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index dc119967..d27cf20c 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -7,7 +7,7 @@ description: 'Java version to install' property :variant, String, - equal_to: %w(opendjdk semeru temurin), + equal_to: %w(openjdk semeru temurin), default: 'openjdk', description: 'Install flavour' From 95bd040b3f23c793d0119e3be0f061e5ff36c567 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 30 Sep 2023 03:48:10 +0100 Subject: [PATCH 200/278] Update changelog for 12.0.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c57cde..ca455fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.1 - *2023-09-30* - fix OpenJDK variant typo From fbbaa10db56c631cf233a02b2f13ff151d785365 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 30 Sep 2023 03:48:10 +0100 Subject: [PATCH 201/278] Update metadata for 12.0.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 23e6f2d9..8b95f751 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.0' +version '12.0.1' supports 'debian' supports 'ubuntu' From 59139c30238b300c8fa3a0a0c9cc57024fac1247 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sat, 30 Sep 2023 03:48:14 +0100 Subject: [PATCH 202/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca455fee..f70d0e55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.1 - *2023-09-30* - fix OpenJDK variant typo From 24041aa64bd3a47c1956152365c970280f806ce5 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 3 Oct 2023 08:09:18 +0100 Subject: [PATCH 203/278] Revert CHANGELOG to 11.2.2 (#703) --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f70d0e55..baad3e85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,6 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased -## 12.0.1 - *2023-09-30* - -- fix OpenJDK variant typo - -## 12.0.0 - *2023-09-29* - ## 11.2.2 - *2023-09-28* ## 11.2.1 - *2023-09-12* From 4c08dfd08cfb5f8c8ded66116fa984eb01c49b60 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 1 Nov 2023 12:41:32 +0000 Subject: [PATCH 204/278] Workflows (#706) * Remove markdown links CI action * Rename test-kitchen.yml - Rename to ci.yml to match all other repositories - Update shared workflows - Update checkout action Signed-off-by: Dan Webb --------- Signed-off-by: Dan Webb --- .../workflows/{test-kitchen.yml => ci.yml} | 6 +++--- .github/workflows/md-links.yml | 19 ------------------- 2 files changed, 3 insertions(+), 22 deletions(-) rename .github/workflows/{test-kitchen.yml => ci.yml} (92%) delete mode 100644 .github/workflows/md-links.yml diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/ci.yml similarity index 92% rename from .github/workflows/test-kitchen.yml rename to .github/workflows/ci.yml index 29cdac56..b414de12 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@2.0.6 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.0.0 permissions: actions: write checks: write @@ -55,7 +55,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 + uses: actions/checkout@v4 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Dokken @@ -72,7 +72,7 @@ jobs: runs-on: macos-latest steps: - name: Check out code - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 + uses: actions/checkout@v4 - name: Install Chef uses: actionshub/chef-install@2.0.4 - name: Kitchen Converge diff --git a/.github/workflows/md-links.yml b/.github/workflows/md-links.yml deleted file mode 100644 index abdae233..00000000 --- a/.github/workflows/md-links.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: md-links - -"on": - pull_request: - push: - branches: [main] - -jobs: - md-links: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 - - name: markdown-link-check - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15 - with: - use-verbose-mode: "yes" - folder-path: "documentation" From 16c73bbbe1e15d023af5fc0982b902cdaf7712dd Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:23:27 +0000 Subject: [PATCH 205/278] Standardise files with files in sous-chefs/repo-management (#707) Signed-off-by: kitchen-porter --- CHANGELOG.md | 2 ++ renovate.json | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baad3e85..39cec7d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 11.2.2 - *2023-09-28* ## 11.2.1 - *2023-09-12* diff --git a/renovate.json b/renovate.json index 7e7a8bad..a0b29c85 100644 --- a/renovate.json +++ b/renovate.json @@ -1,9 +1,10 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:base"], - "packageRules": [{ + "packageRules": [ + { "groupName": "Actions", - "matchUpdateTypes": ["patch", "pin", "digest"], + "matchUpdateTypes": ["minor", "patch", "pin"], "automerge": true, "addLabels": ["Release: Patch", "Skip: Announcements"] }, From cf0d6f61650fcb739f95d5625d566778e850490e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20Stankevi=C4=8Dius?= Date: Tue, 16 Jan 2024 11:34:54 +0200 Subject: [PATCH 206/278] [GH-711] Fix openjdk_pkg_install to obey pkg_version property for all pkg_names (#712) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/sous-chefs/java/issues/711 Signed-off-by: Vytautas Stankevičius --- CHANGELOG.md | 2 +- resources/openjdk_pkg_install.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39cec7d4..a6bed755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased -Standardise files with files in sous-chefs/repo-management +- Fix `openjdk_pkg_install` to obey `pkg_version` property for all `pkg_names` ## 11.2.2 - *2023-09-28* diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 7e2f7725..8c191320 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -31,8 +31,15 @@ end end + pkg_version = + if new_resource.pkg_version && new_resource.pkg_names.is_a?(String) + version new_resource.pkg_version + elsif new_resource.pkg_version && new_resource.pkg_names.is_a?(Array) + Array.new(new_resource.pkg_names.size, new_resource.pkg_version) + end + package new_resource.pkg_names do - version new_resource.pkg_version if new_resource.pkg_version + version pkg_version if pkg_version end node.default['java']['java_home'] = new_resource.java_home From 1a264b0053cd414c3b6751a6bb5d4a93a9548ed9 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:34:59 +0000 Subject: [PATCH 207/278] Update changelog for 12.0.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6bed755..0d3f3351 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.2 - *2024-01-16* - Fix `openjdk_pkg_install` to obey `pkg_version` property for all `pkg_names` From 1825684ba15b45c2a713ed552200ed451b03bf56 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:34:59 +0000 Subject: [PATCH 208/278] Update metadata for 12.0.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 8b95f751..52c408e1 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.1' +version '12.0.2' supports 'debian' supports 'ubuntu' From 5036bc7404bfd32057a0942ebe1bab1e35a38156 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:35:03 +0000 Subject: [PATCH 209/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d3f3351..e57bf2c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.2 - *2024-01-16* - Fix `openjdk_pkg_install` to obey `pkg_version` property for all `pkg_names` From bb543e4183e530a34bbfbe2c2b30cdb8d2a12f9b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:37:52 +0000 Subject: [PATCH 210/278] chore(deps): update actions/stale action to v9 (#710) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 4bb59c62..d4dae8fc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} close-issue-message: > From 7f69dab4390ee20277db3761edc484a43a43f797 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:37:56 +0000 Subject: [PATCH 211/278] Update changelog for 12.0.3 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e57bf2c4..43e17ca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.3 - *2024-01-16* ## 12.0.2 - *2024-01-16* From 56474a6e7d7745b3c3e6314fdc45a077edcfcdcf Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:37:57 +0000 Subject: [PATCH 212/278] Update metadata for 12.0.3 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 52c408e1..5f92a6c8 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.2' +version '12.0.3' supports 'debian' supports 'ubuntu' From 8722a2f7e1270542fa5df10820340afe40232829 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:38:00 +0000 Subject: [PATCH 213/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43e17ca5..abd574a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.3 - *2024-01-16* ## 12.0.2 - *2024-01-16* From 0a77e81da4441e640e949748d1d68dae8a7c28cd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 14:25:21 -0500 Subject: [PATCH 214/278] chore(deps): update actions to v3 (#714) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b414de12..17996742 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,9 +57,9 @@ jobs: - name: Check out code uses: actions/checkout@v4 - name: Install Chef - uses: actionshub/chef-install@2.0.4 + uses: actionshub/chef-install@3.0.0 - name: Dokken - uses: actionshub/test-kitchen@2.1.0 + uses: actionshub/test-kitchen@3.0.0 env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.dokken.yml @@ -74,9 +74,9 @@ jobs: - name: Check out code uses: actions/checkout@v4 - name: Install Chef - uses: actionshub/chef-install@2.0.4 + uses: actionshub/chef-install@3.0.0 - name: Kitchen Converge - uses: actionshub/test-kitchen@2.1.0 + uses: actionshub/test-kitchen@3.0.0 env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.macos.yml @@ -93,7 +93,7 @@ jobs: # Magic line for github actions to persist the change echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV - name: Kitchen Verify - uses: actionshub/test-kitchen@2.1.0 + uses: actionshub/test-kitchen@3.0.0 env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.macos.yml From caa7647be1eadcd3032ea940599701ee75fd5e95 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 3 May 2024 20:25:26 +0100 Subject: [PATCH 215/278] Update changelog for 12.0.4 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abd574a3..f53cbdb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.4 - *2024-05-03* ## 12.0.3 - *2024-01-16* From a924871a543cc73854bc28dc047393f8fea6c886 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 3 May 2024 20:25:27 +0100 Subject: [PATCH 216/278] Update metadata for 12.0.4 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 5f92a6c8..f0c5d9ca 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.3' +version '12.0.4' supports 'debian' supports 'ubuntu' From 62605821cb4ed23208ad4a04d466dbef440752a0 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 3 May 2024 20:25:30 +0100 Subject: [PATCH 217/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f53cbdb3..390e8efc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.4 - *2024-05-03* ## 12.0.3 - *2024-01-16* From 4ff6450cc6b8d29d4d752cd43933af57c77557de Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 14:26:08 -0500 Subject: [PATCH 218/278] chore(deps): update sous-chefs/.github action to v3.1.1 (#713) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17996742..1fd3faee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.0.0 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 permissions: actions: write checks: write From 2742fee9a78849dac73081d6a18a6e994e24c882 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 3 May 2024 20:26:12 +0100 Subject: [PATCH 219/278] Update changelog for 12.0.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 390e8efc..a0f9f23b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.5 - *2024-05-03* ## 12.0.4 - *2024-05-03* From b27be4bd0273008d1a35a4215058b33276057f19 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 3 May 2024 20:26:13 +0100 Subject: [PATCH 220/278] Update metadata for 12.0.5 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index f0c5d9ca..16f3e2e1 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.4' +version '12.0.5' supports 'debian' supports 'ubuntu' From 26b51fc20af58cf58bdff0211991913612033ca9 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 3 May 2024 20:26:16 +0100 Subject: [PATCH 221/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f9f23b..fbac21d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.5 - *2024-05-03* ## 12.0.4 - *2024-05-03* From 6f2bcdd3ddfb8a18f2e8eb3fcb92cfbd894ad53d Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 22 May 2024 10:14:49 +0100 Subject: [PATCH 222/278] Standardise files with files in sous-chefs/repo-management (#716) Signed-off-by: kitchen-porter --- .envrc | 1 + CHANGELOG.md | 2 ++ CONTRIBUTING.md | 2 +- TESTING.md | 2 +- kitchen.dokken.yml | 29 ++--------------------------- kitchen.global.yml | 6 +----- 6 files changed, 8 insertions(+), 34 deletions(-) diff --git a/.envrc b/.envrc index 6ed589ea..484ad266 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ use chefworkstation +export KITCHEN_GLOBAL_YAML=kitchen.global.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index fbac21d5..6a43e5b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 12.0.5 - *2024-05-03* ## 12.0.4 - *2024-05-03* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a946aea1..c76e180f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ # Contributing Please refer to -[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) +[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD) diff --git a/TESTING.md b/TESTING.md index 920e381f..5a7d0019 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,3 +1,3 @@ # Testing -Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD). +Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/TESTING.MD). diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 47eff95d..1dfe62c8 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -22,11 +22,6 @@ platforms: image: dokken/amazonlinux-2023 pid_one_command: /usr/lib/systemd/systemd - - name: centos-7 - driver: - image: dokken/centos-7 - pid_one_command: /usr/lib/systemd/systemd - - name: centos-stream-8 driver: image: dokken/centos-stream-8 @@ -37,16 +32,6 @@ platforms: image: dokken/centos-stream-9 pid_one_command: /usr/lib/systemd/systemd - - name: debian-9 - driver: - image: dokken/debian-9 - pid_one_command: /bin/systemd - - - name: debian-10 - driver: - image: dokken/debian-10 - pid_one_command: /bin/systemd - - name: debian-11 driver: image: dokken/debian-11 @@ -67,11 +52,6 @@ platforms: image: dokken/opensuse-leap-15 pid_one_command: /usr/lib/systemd/systemd - - name: oraclelinux-7 - driver: - image: dokken/oraclelinux-7 - pid_one_command: /usr/lib/systemd/systemd - - name: oraclelinux-8 driver: image: dokken/oraclelinux-8 @@ -92,11 +72,6 @@ platforms: image: dokken/rockylinux-9 pid_one_command: /usr/lib/systemd/systemd - - name: ubuntu-18.04 - driver: - image: dokken/ubuntu-18.04 - pid_one_command: /bin/systemd - - name: ubuntu-20.04 driver: image: dokken/ubuntu-20.04 @@ -107,7 +82,7 @@ platforms: image: dokken/ubuntu-22.04 pid_one_command: /bin/systemd - - name: ubuntu-23.04 + - name: ubuntu-24.04 driver: - image: dokken/ubuntu-23.04 + image: dokken/ubuntu-24.04 pid_one_command: /bin/systemd diff --git a/kitchen.global.yml b/kitchen.global.yml index a382fcd0..3967ff51 100644 --- a/kitchen.global.yml +++ b/kitchen.global.yml @@ -18,16 +18,12 @@ platforms: - name: almalinux-8 - name: almalinux-9 - name: amazonlinux-2023 - - name: centos-7 - name: centos-stream-8 - name: centos-stream-9 - - name: debian-9 - - name: debian-10 - name: debian-11 - name: debian-12 - name: fedora-latest - name: opensuse-leap-15 - - name: oraclelinux-7 - name: oraclelinux-8 - name: oraclelinux-9 - name: rockylinux-8 @@ -35,4 +31,4 @@ platforms: - name: ubuntu-18.04 - name: ubuntu-20.04 - name: ubuntu-22.04 - - name: ubuntu-23.04 + - name: ubuntu-24.04 From edd90c39ef42f6d7b1f266936534d4c12a38608f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 23 May 2024 22:27:26 +0100 Subject: [PATCH 223/278] Standardise files with files in sous-chefs/repo-management (#717) Signed-off-by: kitchen-porter --- CHANGELOG.md | 2 ++ kitchen.global.yml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a43e5b4..d33243fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This file is used to list changes made in each version of the Java cookbook. Standardise files with files in sous-chefs/repo-management +Standardise files with files in sous-chefs/repo-management + ## 12.0.5 - *2024-05-03* ## 12.0.4 - *2024-05-03* diff --git a/kitchen.global.yml b/kitchen.global.yml index 3967ff51..4396f11e 100644 --- a/kitchen.global.yml +++ b/kitchen.global.yml @@ -28,7 +28,6 @@ platforms: - name: oraclelinux-9 - name: rockylinux-8 - name: rockylinux-9 - - name: ubuntu-18.04 - name: ubuntu-20.04 - name: ubuntu-22.04 - name: ubuntu-24.04 From d9533a57b02dcfde3e5021804955f23d77096584 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jul 2024 01:30:45 +0800 Subject: [PATCH 224/278] Automated PR: Standardising Files (#718) * Standardise files with files in sous-chefs/repo-management Signed-off-by: kitchen-porter * Update openjdk_install.md --------- Signed-off-by: kitchen-porter Co-authored-by: Corey Hemminger --- CHANGELOG.md | 2 ++ documentation/resources/openjdk_install.md | 26 +++++++++++----------- kitchen.dokken.yml | 5 ----- kitchen.global.yml | 1 - 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d33243fa..8ab09cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Standardise files with files in sous-chefs/repo-management Standardise files with files in sous-chefs/repo-management +Standardise files with files in sous-chefs/repo-management + ## 12.0.5 - *2024-05-03* ## 12.0.4 - *2024-05-03* diff --git a/documentation/resources/openjdk_install.md b/documentation/resources/openjdk_install.md index 1ca8903f..afe02fcb 100644 --- a/documentation/resources/openjdk_install.md +++ b/documentation/resources/openjdk_install.md @@ -14,19 +14,19 @@ Introduced: v8.0.0 | Name | Type | Default | Description | Allowed values | | --------------------- | --------------- | ------- | --------------------------------------------------- | ------------------ | -| version | String | | Java version to install | -| url | String | | The URL to download from | -| checksum | String | | The checksum for the downloaded file | -| java_home | String | | Set to override the java_home | -| java_home_mode | Integer, String | | The permission for the Java home directory | -| java_home_owner | String | | Owner of the Java Home | -| java_home_group | String | | Group for the Java Home | -| default | Boolean | | Whether to set this as the defalut Java | -| bin_cmds | Array | | A list of bin_cmds based on the version and variant | -| alternatives_priority | Integer | | Alternatives priority to set for this Java | -| reset_alternatives | Boolean | | Whether to reset alternatives before setting | -| pkg_names | Array | | List of packages to install | -| pkg_version | String | | Package version to install | +| version | String | | Java version to install | | +| url | String | | The URL to download from | | +| checksum | String | | The checksum for the downloaded file | | +| java_home | String | | Set to override the java_home | | +| java_home_mode | Integer, String | | The permission for the Java home directory | | +| java_home_owner | String | | Owner of the Java Home | | +| java_home_group | String | | Group for the Java Home | | +| default | Boolean | | Whether to set this as the defalut Java | | +| bin_cmds | Array | | A list of bin_cmds based on the version and variant | | +| alternatives_priority | Integer | | Alternatives priority to set for this Java | | +| reset_alternatives | Boolean | | Whether to reset alternatives before setting | | +| pkg_names | Array | | List of packages to install | | +| pkg_version | String | | Package version to install | | | install_type | String | | Installation type | `package` `source` | ## Examples diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 1dfe62c8..6ead9e8e 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -22,11 +22,6 @@ platforms: image: dokken/amazonlinux-2023 pid_one_command: /usr/lib/systemd/systemd - - name: centos-stream-8 - driver: - image: dokken/centos-stream-8 - pid_one_command: /usr/lib/systemd/systemd - - name: centos-stream-9 driver: image: dokken/centos-stream-9 diff --git a/kitchen.global.yml b/kitchen.global.yml index 4396f11e..1740e461 100644 --- a/kitchen.global.yml +++ b/kitchen.global.yml @@ -18,7 +18,6 @@ platforms: - name: almalinux-8 - name: almalinux-9 - name: amazonlinux-2023 - - name: centos-stream-8 - name: centos-stream-9 - name: debian-11 - name: debian-12 From b1797f450d075205fcf53f830ad08824425f9c8b Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jul 2024 01:30:51 +0800 Subject: [PATCH 225/278] Update changelog for 12.0.6 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ab09cfa..27ed33de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.6 - *2024-07-15* Standardise files with files in sous-chefs/repo-management From 9bfeef05e2a2918d2e8116c6ddac6c99672d181f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jul 2024 01:30:52 +0800 Subject: [PATCH 226/278] Update metadata for 12.0.6 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 16f3e2e1..d2a9b475 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.5' +version '12.0.6' supports 'debian' supports 'ubuntu' From 1c8147d0790efd58b86ed512e19beff6bb93b29f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 16 Jul 2024 01:30:55 +0800 Subject: [PATCH 227/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27ed33de..e53b2ac7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.6 - *2024-07-15* Standardise files with files in sous-chefs/repo-management From 2c4e04d53c85d5e87278a2330e965f51df8169b4 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Nov 2024 02:29:45 +0800 Subject: [PATCH 228/278] Automated PR: Standardising Files (#719) * Standardise files with files in sous-chefs/repo-management Signed-off-by: kitchen-porter * Standardise files with files in sous-chefs/repo-management Signed-off-by: kitchen-porter --------- Signed-off-by: kitchen-porter --- .markdownlint-cli2.yaml | 2 ++ CHANGELOG.md | 4 ++++ kitchen.dokken.yml | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index 6fa8e776..0196ac7b 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -3,3 +3,5 @@ config: line-length: false # MD013 no-duplicate-heading: false # MD024 reference-links-images: false # MD052 +ignores: + - .github/copilot-instructions.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e53b2ac7..66f029f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + +Standardise files with files in sous-chefs/repo-management + ## 12.0.6 - *2024-07-15* Standardise files with files in sous-chefs/repo-management diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 6ead9e8e..998bb20c 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -17,6 +17,11 @@ platforms: image: dokken/almalinux-9 pid_one_command: /usr/lib/systemd/systemd + - name: almalinux-10 + driver: + image: dokken/almalinux-10 + pid_one_command: /usr/lib/systemd/systemd + - name: amazonlinux-2023 driver: image: dokken/amazonlinux-2023 @@ -27,6 +32,11 @@ platforms: image: dokken/centos-stream-9 pid_one_command: /usr/lib/systemd/systemd + - name: centos-stream-10 + driver: + image: dokken/centos-stream-10 + pid_one_command: /usr/lib/systemd/systemd + - name: debian-11 driver: image: dokken/debian-11 From 9c3c1bb9450c577e4babb318cd3b3d1a59f7a288 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Nov 2024 02:29:49 +0800 Subject: [PATCH 229/278] Update changelog for 12.0.7 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66f029f6..5336a137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.0.7 - *2024-11-18* Standardise files with files in sous-chefs/repo-management From 7214b0208f4667afadbcfd131a558b59de21d511 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Nov 2024 02:29:50 +0800 Subject: [PATCH 230/278] Update metadata for 12.0.7 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index d2a9b475..f0a5e8dc 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.6' +version '12.0.7' supports 'debian' supports 'ubuntu' From 2989ee626303b1d48b175936171f9c6a16012287 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Tue, 19 Nov 2024 02:29:53 +0800 Subject: [PATCH 231/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5336a137..c50f0ff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.0.7 - *2024-11-18* Standardise files with files in sous-chefs/repo-management From 5bfb37c0f162b8ce8bd8d9f56e3c721b7755283d Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 3 Dec 2024 13:11:42 -0800 Subject: [PATCH 232/278] Add support for OpenJDK versions 19, 20, 21 and 22 (#715) * Add support for OpenJDK versions 19, 20, 21 and 22 * Remove the commented-out adoptopenjdk_linux_install resource. * chore(deps): update sous-chefs/.github action to v3.1.0 * chore(deps): update actionshub/chef-install action to v3 * Doc fixes * Cleanup changelog * Update platforms * Remove AdoptOpenJDK * Remove MacOS suite --------- Signed-off-by: Lance Albertson Signed-off-by: Dan Webb Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Dan Webb --- .github/workflows/ci.yml | 70 +-- .rubocop.yml | 2 + CHANGELOG.md | 450 ++---------------- README.md | 1 - .../resources/adoptopenjdk_install.md | 58 --- .../resources/adoptopenjdk_linux_install.md | 53 --- .../resources/adoptopenjdk_macos_install.md | 65 --- kitchen.macos.local.yml | 8 +- kitchen.macos.yml | 11 +- kitchen.yml | 168 +------ libraries/adopt_openjdk_macos_helpers.rb | 19 - libraries/openjdk_helpers.rb | 2 +- resources/adoptopenjdk_install.rb | 80 ---- resources/adoptopenjdk_linux_install.rb | 45 -- resources/adoptopenjdk_macos_install.rb | 71 --- spec/spec_helper.rb | 1 - .../cookbooks/test/recipes/custom_package.rb | 7 - .../recipes/remove-adoptopenjdk-11-openj9.rb | 8 - .../controls/verify_adoptopenjdk.rb | 78 --- .../inputs/adoptopenjdk-11-hotspot.yml | 4 - .../adoptopenjdk-11-openj9-large-heap.yml | 4 - .../inputs/adoptopenjdk-11-openj9.yml | 4 - .../inputs/adoptopenjdk-14-hotspot.yml | 4 - .../inputs/adoptopenjdk-14-macos.yml | 4 - .../adoptopenjdk-14-openj9-large-heap.yml | 4 - .../inputs/adoptopenjdk-14-openj9.yml | 4 - .../inputs/adoptopenjdk-8-hotspot.yml | 4 - .../adoptopenjdk-8-openj9-large-heap.yml | 4 - .../inputs/adoptopenjdk-8-openj9.yml | 4 - test/integration/adoptopenjdk/inspec.yml | 7 - .../controls/verify_adoptopenjdk-removal.rb | 35 -- .../remove-adoptopenjdk/inspec.yml | 7 - 32 files changed, 97 insertions(+), 1189 deletions(-) create mode 100644 .rubocop.yml delete mode 100644 documentation/resources/adoptopenjdk_install.md delete mode 100644 documentation/resources/adoptopenjdk_linux_install.md delete mode 100644 documentation/resources/adoptopenjdk_macos_install.md delete mode 100644 libraries/adopt_openjdk_macos_helpers.rb delete mode 100644 resources/adoptopenjdk_install.rb delete mode 100644 resources/adoptopenjdk_linux_install.rb delete mode 100644 resources/adoptopenjdk_macos_install.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/custom_package.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb delete mode 100644 test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml delete mode 100644 test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml delete mode 100644 test/integration/adoptopenjdk/inspec.yml delete mode 100644 test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb delete mode 100644 test/integration/remove-adoptopenjdk/inspec.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fd3faee..3d03247f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,36 +22,25 @@ jobs: strategy: matrix: os: - - almalinux-8 - - amazonlinux-2 - - debian-10 + - amazonlinux-2023 + - debian-12 - debian-11 - - centos-7 - - centos-stream-8 - - ubuntu-1804 - - ubuntu-2004 - - ubuntu-2204 + - rockylinux-9 - rockylinux-8 + - ubuntu-2204 + - ubuntu-2004 suite: - - openjdk-11 + # - openjdk-11 # Debian doesn't have an 11 package - openjdk-16 - openjdk-17 - - adoptopenjdk-8-openj9 - - adoptopenjdk-11-hotspot - - adoptopenjdk-11-openj9 - - adoptopenjdk-11-openj9-large-heap - - adoptopenjdk-14-hotspot - - adoptopenjdk-14-openj9 - - adoptopenjdk-14-openj9-large-heap - - adoptopenjdk-removal-11-openj9 + # - temurin-8-hotspot + # - temurin-11-hotspot + # - semeru-11-openj9 + # - semeru-17-openj9 - corretto-8 - corretto-11 - corretto-17 - corretto-18 - - custom-package-8 - - custom-package-11 - - custom-package-11-openj9 - - custom-package-11-openj9-large-heap fail-fast: false steps: - name: Check out code @@ -67,45 +56,8 @@ jobs: suite: ${{ matrix.suite }} os: ${{ matrix.os }} - integration-macos: - needs: "lint-unit" - runs-on: macos-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Install Chef - uses: actionshub/chef-install@3.0.0 - - name: Kitchen Converge - uses: actionshub/test-kitchen@3.0.0 - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.macos.yml - TERM: xterm-256color - with: - suite: adoptopenjdk-14 - os: macos - action: converge - - name: Source Profile for JAVA_HOME - run: | - source /etc/profile - echo "sourced profile for JAVA_HOME" - echo "New JAVA home after Chef run is: ${JAVA_HOME}" - # Magic line for github actions to persist the change - echo "JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - name: Kitchen Verify - uses: actionshub/test-kitchen@3.0.0 - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.macos.yml - TERM: xterm-256color - with: - suite: adoptopenjdk-14 - os: macos - action: verify - final: runs-on: ubuntu-latest - needs: [integration, integration-macos] + needs: [integration] steps: - run: echo ${{needs.integration.outputs}} - - run: echo ${{needs.integration-macos.outputs}} diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..61883002 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,2 @@ +require: + - cookstyle diff --git a/CHANGELOG.md b/CHANGELOG.md index c50f0ff6..ef8067e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,83 +4,32 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased -## 12.0.7 - *2024-11-18* +- Add support for OpenJDK versions 19, 20, 21 and 22 +- Remove commented out `adoptopenjdk_linux_install` resource +- CI: chore(deps): update sous-chefs/.github action to v3.1.0 +- CI: chore(deps): update actionshub/chef-install action to v3 +- Update platforms +- Replace AdoptOpenJDK with Eclipse Temurin and IBM Semeru -Standardise files with files in sous-chefs/repo-management +## 12.0.7 - *2024-11-18* -Standardise files with files in sous-chefs/repo-management +- Standardise files with files in sous-chefs/repo-management ## 12.0.6 - *2024-07-15* -Standardise files with files in sous-chefs/repo-management - -Standardise files with files in sous-chefs/repo-management - -Standardise files with files in sous-chefs/repo-management - -## 12.0.5 - *2024-05-03* - -## 12.0.4 - *2024-05-03* - -## 12.0.3 - *2024-01-16* +- Standardise files with files in sous-chefs/repo-management ## 12.0.2 - *2024-01-16* - Fix `openjdk_pkg_install` to obey `pkg_version` property for all `pkg_names` -## 11.2.2 - *2023-09-28* - -## 11.2.1 - *2023-09-12* - ## 11.2.0 - *2023-09-12* -## 11.1.14 - *2023-09-04* - -## 11.1.13 - *2023-07-10* - -## 11.1.12 - *2023-05-16* - -## 11.1.11 - *2023-04-17* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.10 - *2023-04-07* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.9 - *2023-04-01* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.8 - *2023-04-01* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.7 - *2023-04-01* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.6 - *2023-03-02* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.5 - *2023-02-20* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.4 - *2023-02-15* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.3 - *2023-02-14* - -Standardise files with files in sous-chefs/repo-management - -## 11.1.2 - *2023-02-14* +- Standardise files with files in sous-chefs/repo-management -## 11.1.1 - *2022-12-08* +## 11.1.0 - *2023-04-17* -Standardise files with files in sous-chefs/repo-management +- Standardise files with files in sous-chefs/repo-management ## 11.1.0 - *2022-04-26* @@ -88,39 +37,16 @@ Standardise files with files in sous-chefs/repo-management - Add Corretto 17 and 18 - Change the defualt download URL for Corretto to the versioned resources URL, rather than latest. -## 11.0.2 - *2022-04-20* - -- Standardise files with files in sous-chefs/repo-management - -## 11.0.1 - *2022-02-16* - -- Elevate permissions for reuable workflow - ## 11.0.0 - *2022-02-16* - Require Chef 16 for resource partials - Add resource partials for: MacOS, Linux, Java Home and Common as these are used in a multiple places -## 10.2.2 - *2022-02-14* - -- Standardise files with files in sous-chefs/repo-management - -## 10.2.1 - *2022-02-02* - -- Standardise files with files in sous-chefs/repo-management - ## 10.2.0 - *2022-01-26* - Remove tap_full option as this is no longer supported and there is no replacement - -## 10.1.2 - *2022-01-26* - - Remove delivery and move to calling RSpec directly via a reusable workflow -## 10.1.1 - *2021-10-19* - -Standardise files with files in sous-chefs/repo-management - ## 10.1.0 - *2021-10-06* - Revert worklfow split out @@ -131,37 +57,19 @@ Standardise files with files in sous-chefs/repo-management - Remove testing for end of life OpenJDK suites - Primarily support OpenJDK LTS versions 11, 17 - Drop support for OpenJDK package installs for non-LTS versions - - These packages are still possible to install though they will now default to a source install - Direct Amazon users to Amazon Corretto instead of installing OpenJDK -- Drop package install support for Java 8. Most supported operating systems no longer support OpenJDK 8 - - To install OpenJDK 8, a 'source' install from an internal mirror is now recommended - -## 10.0.1 - *2021-09-21* - -- Split out workflows to allow standardfiles to control markdown, yaml and delivery -- Adds a "Final" workflow to set a known pass/failure hook - - This allows us to have Terraform set the Final workflow as a required check +- Drop package install support for Java 8 ## 10.0.0 - *2021-09-02* - Remove recipes to stop confusing users -## 9.0.1 - *2021-08-30* - -- Standardise files with files in sous-chefs/repo-management - ## 9.0.0 - *2021-06-04* -- Remove Corretto checksum code defualts as this changes reguarly, - and is not provide in the SHA256 format via an API +- Remove Corretto checksum code defaults as this changes regularly, and is not provided in the SHA256 format via an API - Set unified_mode to true for Chef 17 support - Bump the minimum Chef version to 15.3 for unified_mode support -## 8.6.1 - *2021-06-01* - ## 8.6.0 - *2021-01-22* - Added Amazon Corretto 15 support to `corretto_install` @@ -170,56 +78,33 @@ Standardise files with files in sous-chefs/repo-management ## 8.5.0 - *2020-12-03* -- resolved cookstyle error: spec/spec_helper.rb:4:18 convention: `Style/RedundantFileExtensionInRequire` -- resolved cookstyle error: spec/spec_helper.rb:5:18 convention: `Style/RedundantFileExtensionInRequire` -- resolved cookstyle error: spec/spec_helper.rb:6:18 convention: `Style/RedundantFileExtensionInRequire` -- resolved cookstyle error: spec/spec_helper.rb:7:18 convention: `Style/RedundantFileExtensionInRequire` - If installation issues with `openjdk_install` resource (fixes #645) - Remove testing of Amazon Linux 1 - Use fedora-latest -## 8.4.0 (2020-09-09) +## 8.4.0 - *2020-09-09* - Add `starttls` property to `java_certificate` resource to allow fetching certificates from non HTTPS endpoints -## 8.3.2 (2020-08-20) +## 8.3.2 - *2020-08-20* - Add aarch64 installation candidate for Corretto -## 8.3.1 (2020-08-06) +## 8.3.1 - *2020-08-06* - Extract correct JAVA_HOME from custom URLs -## 8.3.0 (2020-06-18) +## 8.3.0 - *2020-06-18* - Restore compatibility with Chef Infra Client < 16 - Update Fedora releases in the Kitchen configs -## 8.2.1 (2020-06-02) +## 8.2.0 - *2020-06-02* - resolved cookstyle error: resources/adoptopenjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- resolved cookstyle error: resources/adoptopenjdk_linux_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- resolved cookstyle error: resources/adoptopenjdk_macos_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- resolved cookstyle error: resources/corretto_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- resolved cookstyle error: resources/openjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- resolved cookstyle error: resources/openjdk_pkg_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- resolved cookstyle error: resources/openjdk_source_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` - -## 8.2.0 (2020-05-22) - -- Fixed java_certificate resource :remove bugs preventing removal - -## 8.1.2 (2020-04-20) +- Remove testing of Ubuntu 14.04, support at this point is no longer guaranteed -- Add OpenJDK source install resource -- Add documentation for openjdk_source_install -- Default the openjdk_install resource to install using the package manager by default - -## 8.1.1 (2020-04-19) - -- Fix JAVA_HOME for `adoptopenjdk_linux_install` resource - -## 8.1.0 (2020-04-19) +## 8.1.0 - *2020-04-19* - Added `openjdk_pkg_install` resource - Added documentation for openjdk_pkg_install @@ -232,11 +117,7 @@ Standardise files with files in sous-chefs/repo-management - Resolved cookstyle error: resources/alternatives.rb:75:11 refactor: `ChefCorrectness/ChefApplicationFatal` - Resolved cookstyle error: resources/jce.rb:51:6 refactor: `ChefStyle/UnnecessaryOSCheck` -## 8.0.1 (2020-03-30) - -- Added documentation in documentation/resources for `adoptopenjdk_install`, `alternatives`, `certificate`, `corretto_install`, `jce`, `openjdk_install` - -## 8.0.0 (2020-03-30) +## 8.0.0 - *2020-03-30* - Added `openjdk_install` resource & documentation - Removed openjdk, corretto, default_java_symlink, ibm & ibm_tar, notify & oracle recipes @@ -244,7 +125,7 @@ Standardise files with files in sous-chefs/repo-management - Temporarily removed support for Windows - Split out helpers for each provider into their own namespace and file -## 7.0.0 (2020-03-05) +## 7.0.0 - *2020-03-05* - Refactored and sped up unit tests. - Added `adoptopenjdk_install` resource & documentation @@ -253,11 +134,11 @@ Standardise files with files in sous-chefs/repo-management - Increased the minimum Chef requirement to Chef 15 to use the archive resource. - Removed AdoptOpenJDK 10 testing -## 6.0.0 (2020-03-02) +## 6.0.0 - *2020-03-02* - The resource alias `java_ark` has been deprecated in favour of `java_oracle_install` -## 5.0.0 (2020-02-21) +## 5.0.0 - *2020-02-21* - Fixed java_certificate regex where it checks if cert exists in cacert file. - Make Homebrew Cask name an attribute to allow for other options (ex: adoptopenjdk) @@ -271,22 +152,22 @@ Standardise files with files in sous-chefs/repo-management - Removes openjdk-direct for Debian 8 - Removes oracle variants from test configurations -## 4.3.0 (2019-08-04) +## 4.3.0 - *2019-08-04* - Upgrade Amazon Corretto to the latest versions: 8.222.10.1 and 11.0.4.11.1 - Upgrade circleci orb to version 2 and add yamllint and markdown lint -## 4.2.0 - (2019-07-15) +## 4.2.0 - *2019-07-15* - Fix for issue 538 - Added "download_path" node attribute defaulting to file_cache_path - Replaced all hardcoded instances of file_cache_path with the node attribute -## 4.1.0 - (2019-05-08) +## 4.1.0 - *2019-05-08* - Added new install flavor "corretto" for Amazon's Corretto distribution of OpenJDK -## 4.0.0 - (2019-04-19) +## 4.0.0 - *2019-04-19* - Added new install flavor "adoptopenjdk" for AdoptOpenJDK's distribution of Java - The certificate resource now uses the Java version to determine the default cacerts location @@ -298,27 +179,27 @@ Standardise files with files in sous-chefs/repo-management - Fixed oracle download link for JDK 8 (update to 8u202 from 8u201) - fixed specs for windows -## 3.2.0 - (2019-01-24) +## 3.2.0 - *2019-01-24* - Add support OpenJDK 11 - Fixed oracle download link again -## 3.1.2 - (2018-12-11) +## 3.1.2 - *2018-12-11* - Set java home on macosx using /usr/libexec/java_home - Find command should have ./ for path to search, works for nix and mac - Make `java_certificate` work with SNI endpoints -## 3.1.1 - (2018-11-09) +## 3.1.1 - *2018-11-09* - Fix jce installation linux - Allow overwrite `returns` property of windows_packages -## 3.1.0 - (2018-10-18) +## 3.1.0 - *2018-10-18* - Add support for JDK 11 -## 3.0.0 - (2018-10-18) +## 3.0.0 - *2018-10-18* - Fix broken JCE with JRE installations - make cert alias matching case insensitive as `keytool` always returns results downcases @@ -327,17 +208,17 @@ Standardise files with files in sous-chefs/repo-management - fixed `recipes/openjdk` when `node['java']['jdk_version']` by casting it to a string - Updated Oracle Java links to 8u191 -## 2.2.1 - (2018-09-29) +## 2.2.1 - *2018-09-29* - Allows for additional Oracle (post 9) jdk download file naming, including '10.0.2'. '18.9', '11' -## 2.2.0 - (2018-07-19) +## 2.2.0 - *2018-07-19* - Updated Oracle Java links to 8u181 - Fixed incorrect kitchen setup runlists that preventing local testing - Resolve undefined certout errors -## 2.1.0 - (2018-05-25) +## 2.1.0 - *2018-05-25* - Added Java 10 JCE attributes to default attrs - Update oracle recipeM to not perform a switch on java major version and instead use the version provided in attributes. This allows end users to include new Java versions without the cookbook requiring an update each time a major version gets released @@ -346,11 +227,11 @@ Standardise files with files in sous-chefs/repo-management - Fix JCE installation on Windows - Avoid EmptyWindowsCommand error on Windows -## v2.0.1 - (2018-05-02) +## v2.0.1 - *2018-05-02* - Fix java_certificate and java_oracle_install to work on FIPS enabled systems -## v2.0.0 - (2018-05-02) +## v2.0.0 - *2018-05-02* - Converted alternatives, ark, and certificate LWRP/HWRPs to custom resources with improved logging and convergence notification. - Renamed the java_ark resource to java_oracle_install, which better represents what it does. The existing name will continue to function @@ -363,147 +244,6 @@ Standardise files with files in sous-chefs/repo-management - Moved the warning code for downloading directly from Oracle into the resource to prevent another resource showing as converged - Updated the metadata to resolve failures to parse chef_version on older chef-client releases. - Added installation of tar directly to the ark resource when uncompression .tar.gz files. This prevents installation in the recipe that occurred even if tar wasn't needed. -- Deprecated the java::purge recipe which purged old Sun Java packages which were distributed in distro repos before the Oracle acquisition of Sun. Migration away from these packages occurred many years ago and this recipe will be removed in the next major release of this cookbook. -- Updated the metadata license string to an SPDX compliant string to resolve Foodcritic warnings. -- Removed Chef 10 compatibility code in the Windows recipe that resulted in Foodcritic warnings. -- Removed logic to support paths on Debian < 7 and Ubuntu < 12.04 as these are both EOL. -- Removed duplicate logging in the resources. -- Converted integration tests from bats to InSpec. -- Moved template files out of the default directory as -- Corrected deprecation warnings in the ChefSpecs. -- Moved all Kitchen testing logic to the test_java cookbook and eliminated the need for the apt & free_bsd bash cookbooks in testing -- Don't try to create Chef's cache directory in the certificate resource. -- Disabled certificate integration tests since we're not currently running the certificate resource in Test Kitchen. -- Removed testing of Oracle JDK 6/7 since Oracle no longer allows directly downloading these releases. -- Added kitchen-dokken based testing - -## v1.50.0 - (05/24/2017) - -- Oracle downloads changed again. Only Oracle 8 is able to be downloaded automatically. Please host your own copy internally to avoid issues such as this. -- Add Log warning if download url contains oracle.com - -## v1.49.0 - (04/21/2017) - -- potential 'curl' resource cloning #415 -- Oracle 8u131 -- Add ChefSpec matchers for java_certificate resource -- Remove unnecessary apt update - -## v1.48.0 - (03/31/2017) - -- Update Oracle Java links from 101 to 121 -- Remove convergence report -- Remove Fedora 24 testing -- Fix test cookbook license -- Update platforms in the specs -- Remove testing on EOL platforms - -## v1.47.0 - (01/30/2017) - -- Fix typo in method name (#397) -- Remove useless ruby_block[set-env-java-home] -- Update README: using java::notify -- Add forgotten "do" to README - -## v1.46.0 - (01/09/2017) - -- fix jce installation on windows #386 - -## v1.45.0 - (12/27/2016) - -- Update to resolve latest rubocop rules - -## v1.44.0 - (12/27/2016) - -- Unpublished due to newer rubocop rules in travis -- Added zlinux defaults - -## v1.43.0 - (12/6/2016) - -- Switch recursive chown from executing on the jdk parent directory to executing on the jdk directory itself. -- Added proxy support to curl -- add java_certificate LWRP from java-libraries cookbook - java-libraries now depricated. -- (Windows) support removal of obsolete JREs via optional attribute -- (Windows) Can download from s3 only using an IAM profile -- (Windows) aws session token for windows java download - -## v1.42.0 - (8/8/2016) - -- Use openjdk ppa for all ubuntu versions to allow for older/newer jdks to be installed. Fixes #368 -- update oracle java 8u101 - Use sha256 hash (seems to help with downloading each converge) -- Mac default converge fails since notify is not included by homebrew -- Remove chef 14(!) depreciation warning in tests -- Resolve chef-12 related warning - -## v1.41.0 - (7/15/2016) - -- Feature: Add new resource for cookbooks to subscribe to, see README -- Use a remote_file resource for JCE download instead of curl in an execute block. -- Since v1.40.4 Travis deploys cookbook to supermarket - expect more frequent, smaller releases. - -## v1.40.4 - (7/12/2016) - -- Automated deploy, no cookbook changes. - -## v1.40.3 - (7/12/2016) - -- Attempt to have travis publish this. -- Mac depends on homebrew. -- Fixed typo in platform family spelling for OS X -- fix openjdk version logic for freebsd -- Enable Ark provider to handle URI with get parameters - -## v1.40.1 - (7/8/2016) - -- Fixed: JAVA_HOME not set on systems with restrictive umask #359 - -## v1.40 - (6/29/2016) - -- Travis build green -- Add Windows JCE support -- Changes to prevent re-execution of resource creating file '/etc/profile.d/jdk.sh' -- Fix JDK checksum -- Update ibm_jdk.installer.properties.erb for IBM JDK 1.8 -- Install OpenJDK from distribution if Ubuntu version >= 15.10 -- Fixes #342 - Tar is included in macosx and homebrews package is gnutar which causes this to fail -- Add 12.04 to jdk8 test suite -- Add source and issues urls to supermarket -- Distinguishing the Java version for installing on the Mac OS X -- Doc and cruft cleanup - -## v1.39 - (1/14/2016) - -- Travis debugging only, no code changes. - -## v1.38 - (1/13/2016) - -- (Win) Fix for Java install failing on Windows (introduced in #315) -- Travis fixes/badge - -## v1.37 - (11/9/2015) - -- (Win) Attirbute for specifying the install directory for the public jre #315 - -## v1.36 - (9/3/2015) - -- Oracle JDK 1.8.0_65 -- Add Ubuntu ppa (allows OpenJDK 8) -- Added ChefSpec matchers #284 -- Fix compile error using Chef::Application.fatal #279 -- #222 Provide possibility to set ark download timeout -- Openjdk6 does not exist in deb 8.2 -- Change to create java home dir even if top level doesn't exist(Eg mkdir_p instead of mkdir) -- Fix berks url and remove apt -- Documentation and dependency updates - -## v1.35 - (8/4/2015) - -- Use bento boxes and remove EOL distros from testing suite. -- Update to latest JDKs. Note Oracle JDK7 is now EOL. -- Alternatives improvements -- Fixes #155 to allow install of OpenJDK 1.8 -- Fixes #257 Changed switches for the jdk 8 exe installer on windows -- Make sure tar package installed for java_ark - Add support for Mac OS X "mac_os_x" via homebrew. - Update metadata.rb to contain source and issue information for supermarket and chef-repo convenience @@ -511,14 +251,14 @@ Standardise files with files in sous-chefs/repo-management - Kitchen CI test with 12.04 fails due to hostname unable to be set. -## v1.31 - (2/3/2015) +## v1.31 - *2/3/2015* - Update to latest JDKs for 7 and 8\. JDK7 will be EOL April 2015 - Fix up Travis support. - Add ability to install JCE policy files for oracle JDK #228 - Change connect timeout to 30 seconds -## v1.29.0 - (11/14/2014) +## v1.29.0 - *11/14/2014* - Ensure dirs, links, and jinfo files are owned correctly - Update to Oracle JDK 8u25 @@ -528,23 +268,23 @@ Standardise files with files in sous-chefs/repo-management - Adding ISSUES.md for guidance on creating new issues for the Java cookbook. - Fix IBM unit tests. -## v1.28.0 - (9/6/2014) +## v1.28.0 - *9/6/2014* - Allow setting of group to extracted java files. - Add -no-same-owner parameter to tar extract to avoid issues when the chef cache dir is on an NFS mounted drive. - In the ark provider, it doesn't compare the MD5 sum with the right value which causes Java cookbook always download tarball from oracle server -## v1.27.0 - (8/22/2014) +## v1.27.0 - *8/22/2014* - Update Oracle JDK8 to version 8u20 -## v1.26.0 - (8/16/2014) +## v1.26.0 - *8/16/2014* - Allow pinning of package versions for openjdk - Update Oracle JDK7 to version 7u67 - Support specific version and name for Oracle RPM -## v1.25.0 - (8/1/2014) +## v1.25.0 - *8/1/2014* - Resource ark -> attribute bin_cmds default value - Add option to put JAVA_HOME in /etc/environment @@ -557,7 +297,7 @@ Standardise files with files in sous-chefs/repo-management - rspec cleanup - Adding ubuntu-14.04 to test suite -## v1.24.0 - (7/25/2014) +## v1.24.0 - *7/25/2014* New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** @@ -569,10 +309,10 @@ New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** - default: don't fail when using java 8 on windows - Support for Server JRE - Updated README for accepting oracle terms --Remove VirtualBox specific box_urls +- Remove VirtualBox specific box_urls - List AgileOrbit as the maintainer (AgileOrbit took over from Socrata in July 2014) -## v1.23.0 - (7/25/2014) +## v1.23.0 - *7/25/2014* - Tagged but never published to community cookbooks. All changes rolled into 1.24.0 @@ -585,104 +325,14 @@ New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** ## v1.21.2 -- Update Oracle accept-license-terms cookie format +[COOK-4210] - remove unneeded run_command to prevent zombie processes ## v1.21.0 -- Symlink /usr/lib/jvm/default-java for both OpenJDK and Oracle -- Remove /var/lib/alternatives/#{cmd} before calling alternatives (Hopefully fixes sporadic issues when setting alternatives) -- Make default_java_symlink conditional on set_default attribute +- Update Oracle accept-license-terms cookie format ## v1.20.0 -- Create /usr/lib/jvm/default-java on Debian -- allow wrapping cookbook without providing templates -- Adds set_default attribute to toggle setting JDK as default -- set java_home correctly for oracle_rpm - -## v1.19.2 - -- Upgrade to ChefSpec 3 -- Rewrite unit tests for better coverage and to work with ChefSpec 3 (various commits) -- List Socrata as the maintainer (Socrata took over from Opscode in December 2013) -- Allow jdk_version to be a string or number -- Fix JDK install on Windows -- Fix openjdk_packages on Arch Linux -- - -## v1.19.0 - -Refactor the cookbook to better support wrapper cookbooks and other cookbook authoring patterns. - -- Update documentation & add warning for issue 122 -- Refactor default recipe to better enable wrapper cookbooks -- Removes the attribute to purge deprecated packages -- Add safety check if attributes are unset -- Adds tests for directly using openjdk and oracle recipes -- Adds recipes to README -- The Opscode CCLA is no longer required -- Adds tests for openjdk-7 and oracle-7 -- Use java_home instead of java_location for update-alternatives -- Fix java_home for rhel and fedora - -## v1.18.0 - -- Upgrade to 7u51 -- Suggest windows and aws - -## v1.17.6 - -- Revert **[COOK-4165]** - The headers option was only added to remote_file in Chef 11.6.0, meaning this change breaks older clients. - -## v1.17.4 - -- Fix alternatives for centos - -- Replace curl with remote_file with cookie header -- Update openjdk to use the alternatives resource - -## v1.17.2 - -- Add md5 parameter to java_ark resource - -## v1.17.0 - -- Test Kitchen no longer works after merging Pull Request #95 for openjdk tests on Debian/Ubuntu -- update-alternatives fails to run -- Ensure local directory hierarchy -- Expose LWRP state attributes support for MD5 checksum -- Fixed windows case to prevent bad java_home variable setting -- Update checksums to the officially-published ones -- Further test kitchen fixes - -## v1.16.4 - -- set alternatives when using ibm_tar recipe -- Specify windows attributes in attribute files - -## v1.16.2 - -- set alternatives for ibm jdk -- IBM Java installer needs 'rpm' package on Ubuntu - -- do not unescape the java windows url before parsing it -- fixes update-alternatives for openjdk installs -- Use escaped quotes for Windows INSTALLDIR - -## v1.16.0 - -- Upgrade to JDK 7u45-b18 - -## v1.15.4 - -[COOK-4210] - remove unneeded run_command to prevent zombie processes - -## v1.15.2 - -[CHEF-4210] remove unneeded run_command to prevent zombie processes - -## v1.15.0 - - Fixing version number. Accidently released at 0.15.x instead of 1.15.x ## v0.15.2 diff --git a/README.md b/README.md index cf51517f..1673d7af 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ Chef 15.3+ ## Resources - [adoptopenjdk_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/adoptopenjdk_install.md) -- [adoptopenjdk_linux_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/adoptopenjdk_linux_install.md) - [adoptopenjdk_macos_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/adoptopenjdk_macos_install.md) - [alternatives](https://github.com/sous-chefs/java/blob/master/documentation/resources/alternatives.md) - [certificate](https://github.com/sous-chefs/java/blob/master/documentation/resources/certificate.md) diff --git a/documentation/resources/adoptopenjdk_install.md b/documentation/resources/adoptopenjdk_install.md deleted file mode 100644 index 6edee611..00000000 --- a/documentation/resources/adoptopenjdk_install.md +++ /dev/null @@ -1,58 +0,0 @@ -# adoptopenjdk_install - -[back to resource list](https://github.com/sous-chefs/java#resources) - -Introduced: v7.0.0 - -## Actions - -- `:install` -- `:remove` - -## Properties - -| Name | Type | Default | Description | -| --------------------- | ----------------- | ------- | -------------------------------------------------------------- | -| version | String | | Java version to install | -| variant | String | | Install flavour', default: 'openj9 | -| url | String | | The URL to download from | -| checksum | String | | The checksum for the downloaded file | -| java_home | String | | Set to override the java_home | -| java_home_mode | String | | The permission for the Java home directory | -| java_home_owner | String | | Owner of the Java Home | -| java_home_group | String | | Group for the Java Home | -| default | [true, false] | | Whether to set this as the defalut Java | -| bin_cmds | Array | | A list of bin_cmds based on the version and variant | -| alternatives_priority | Integer | | Alternatives priority to set for this Java | -| reset_alternatives | [true, false] | | Whether to reset alternatives before setting | -| tap_url | String, | | The URL of the tap | -| cask_options | String, | | Options to pass to the brew command during installation | -| homebrew_path | String, | | The path to the homebrew binary | -| owner | [String, Integer] | | The owner of the Homebrew installation | - -## Examples - -To install Hotspot AdoptOpenJDK 11 and set it as the default Java: - -```ruby -adoptopenjdk_install '11' -``` - -To install hotspot AdoptOpenJDK 11 and set it as second highest priority: - -```ruby -adoptopenjdk_install '10' do - variant 'hotspot' - alternatives_priority 2 -end -``` - -To install AdoptOpenJDK 11 from a custom tarball: - -```ruby -adoptopenjdk_install '11' do - variant 'hotspot' - url 'http://url.of/path/to/OpenJDK11U-jdk_x64_linux_hotspot_11.0.7_10.tar.gz' - checksum 'asdfasdfasdf' -end -``` diff --git a/documentation/resources/adoptopenjdk_linux_install.md b/documentation/resources/adoptopenjdk_linux_install.md deleted file mode 100644 index 3e20ccbf..00000000 --- a/documentation/resources/adoptopenjdk_linux_install.md +++ /dev/null @@ -1,53 +0,0 @@ - -# adoptopenjdk_linux_install - -[back to resource list](https://github.com/sous-chefs/java#resources) - -Introduced: v8.1.0 - -## Actions - -- `:install` -- `:remove` - -## Properties - -| Name | Type | Default | Description | -| --------------------- | ------------- | ---------------------------------------------------------------------- | ----------------------------------------------------- | -| variant | String | `openj9` | Install flavour | -| url | String | `default_adopt_openjdk_url(version)[variant]` | The URL to download from | -| checksum | String | `default_adopt_openjdk_checksum(version)[variant]` | The checksum for the downloaded file | -| java_home | String | `/usr/lib/jvm/java-#{version}-adoptopenjdk-#{variant}/#{sub_dir(url)}` | Set to override the java_home | -| java_home_mode | String | | Owner of the Java Home | -| java_home_group | String | `node['root_group']` | Group for the Java Home | -| default | [true, false] | `true` | Whether to set this as the defalut Java | -| bin_cmds | Array | `default_adopt_openjdk_bin_cmds(version)[variant]` | A list of `bin_cmds` based on the version and variant | -| alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | -| reset_alternatives | [true, false] | `true` | Whether to reset alternatives before setting | - -## Examples - -To install Hotspot AdoptOpenJDK 11 and set it as the default Java: - -```ruby -adoptopenjdk_linux_install1 '11' -``` - -To install hotspot AdoptOpenJDK 11 and set it as second highest priority: - -```ruby -adoptopenjdk_linux_install1 '10' do - variant 'hotspot' - alternatives_priority 2 -end -``` - -To install AdoptOpenJDK 11 from a custom tarball: - -```ruby -adoptopenjdk_install '11' do - variant 'hotspot' - url 'http://url.of/path/to/OpenJDK11U-jdk_x64_linux_hotspot_11.0.7_10.tar.gz' - checksum 'asdfasdfasdf' -end -``` diff --git a/documentation/resources/adoptopenjdk_macos_install.md b/documentation/resources/adoptopenjdk_macos_install.md deleted file mode 100644 index 9336a334..00000000 --- a/documentation/resources/adoptopenjdk_macos_install.md +++ /dev/null @@ -1,65 +0,0 @@ - -# adoptopenjdk_macos_install - -[back to resource list](https://github.com/sous-chefs/java#resources) - -Introduced: v8.1.0 - -## Actions - -- `:install` -- `:remove` - -## Properties - -| Name | Type | Default | Description | Allowed Values | -| ------------- | ----------------- | -------------------------- | -------------------------------------------------------------- | -| tap_url | String | | The URL of the tap | -| cask_options | String | | Options to pass to the brew command during installation | -| homebrew_path | String | | The path to the homebrew binary | -| owner | [String, Integer] | | The owner of the Homebrew installation | -| java_home | String | `macos_java_home(version)` | MacOS specific JAVA_HOME | -| version | String | `adoptopenjdk14` | | See list below | - -## Allowed Install Versions - -- adoptopenjdk8 -- adoptopenjdk8-openj9 -- adoptopenjdk8-openj9-large -- adoptopenjdk8-jre -- adoptopenjdk8-openj9-jre -- adoptopenjdk8-jre-large -- adoptopenjdk9 -- adoptopenjdk10 -- adoptopenjdk11 -- adoptopenjdk11-openj9 -- adoptopenjdk11-openj9-large -- adoptopenjdk11-jre -- adoptopenjdk11-openj9-jre -- adoptopenjdk11-openj9-jre-large -- adoptopenjdk12 -- adoptopenjdk12-openj9 -- adoptopenjdk12-openj9-large -- adoptopenjdk12-jre -- adoptopenjdk12-openj9-jre -- adoptopenjdk12-openj9-jre-large -- adoptopenjdk13 -- adoptopenjdk13-openj9 -- adoptopenjdk13-openj9-large -- adoptopenjdk13-jre -- adoptopenjdk13-openj9-jre -- adoptopenjdk13-openj9-jre-large -- adoptopenjdk14 -- adoptopenjdk14-openj9 -- adoptopenjdk14-openj9-large -- adoptopenjdk14-jre -- adoptopenjdk14-openj9-jre -- adoptopenjdk14-openj9-jre-large - -## Examples - -To install Hotspot AdoptOpenJDK 11 and set it as the default Java: - -```ruby -adoptopenjdk_macos_install 'adoptopenjdk14-jre' -``` diff --git a/kitchen.macos.local.yml b/kitchen.macos.local.yml index 9de6bec9..071b95cd 100644 --- a/kitchen.macos.local.yml +++ b/kitchen.macos.local.yml @@ -13,13 +13,13 @@ platforms: gui: false suites: - - name: adoptopenjdk-14 + - name: default run_list: - recipe[homebrew] - - recipe[test::adoptopenjdk] + - recipe[test::openjdk] attributes: version: 14 variant: openj9 verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml] + inspec_tests: [test/integration/openjdk] + input_files: [test/integration/openjdk/inputs/openjdk-14-macos.yml] diff --git a/kitchen.macos.yml b/kitchen.macos.yml index 2fc17f27..0b6a7052 100644 --- a/kitchen.macos.yml +++ b/kitchen.macos.yml @@ -20,12 +20,11 @@ platforms: gui: false suites: - - name: adoptopenjdk-14 + - name: default run_list: - - recipe[test::adoptopenjdk] + - recipe[test::openjdk] attributes: - version: 14 - variant: openj9 + version: 17 verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: [test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml] + inspec_tests: [test/integration/openjdk] + inputs: { java_version: "17" } diff --git a/kitchen.yml b/kitchen.yml index 30ee8389..b8771bba 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -11,16 +11,14 @@ verifier: name: inspec platforms: - - name: amazonlinux-2 - - name: centos-7 - - name: centos-8 - - name: debian-9 - - name: debian-10 + - name: amazonlinux-2023 + - name: debian-12 - name: debian-11 - - name: freebsd-11 - - name: freebsd-12 + - name: freebsd-13 - name: fedora-latest - - name: ubuntu-18.04 + - name: rockylinux-9 + - name: rockylinux-8 + - name: ubuntu-22.04 - name: ubuntu-20.04 suites: @@ -49,117 +47,46 @@ suites: inspec_tests: [test/integration/openjdk] inputs: { java_version: "17" } - # AdoptOpenJDK - # Version 8 - - name: adoptopenjdk-8-hotspot + # Temurin/Semeru + - name: temurin-8-hotspot run_list: - - recipe[test::adoptopenjdk] + - recipe[test::openjdk] attributes: version: 8 variant: hotspot verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml - - - name: adoptopenjdk-8-openj9 - run_list: - - recipe[test::adoptopenjdk] - attributes: - version: 8 - variant: openj9 - verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml - - - name: adoptopenjdk-8-openj9-large-heap - run_list: - - recipe[test::adoptopenjdk] - attributes: - version: 8 - variant: openj9-large-heap - verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml + inspec_tests: [test/integration/openjdk] + inputs: { java_version: "8" } - # Version 11 - - name: adoptopenjdk-11-hotspot + - name: temurin-11-hotspot run_list: - - recipe[test::adoptopenjdk] + - recipe[test::openjdk] attributes: version: 11 variant: hotspot verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml - - name: adoptopenjdk-11-openj9 + inspec_tests: [test/integration/openjdk] + inputs: { java_version: "11" } + + - name: semeru-11-openj9 run_list: - - recipe[test::adoptopenjdk] + - recipe[test::openjdk] attributes: version: 11 variant: openj9 verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml - - name: adoptopenjdk-11-openj9-large-heap - run_list: - - recipe[test::adoptopenjdk] - attributes: - version: 11 - variant: openj9-large-heap - verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml - - # Version 17 - - name: adoptopenjdk-17-openj9-large-heap - run_list: - - recipe[test::adoptopenjdk] - attributes: - version: 17 - variant: openj9-large-heap - verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-17-openj9-large-heap.yml + inspec_tests: [test/integration/openjdk] + inputs: { java_version: "11" } - - name: adoptopenjdk-17-openj9 - run_list: - - recipe[test::adoptopenjdk] - attributes: - version: 17 - variant: openj9 - verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-17-openj9.yml - - name: adoptopenjdk-17-hotspot + - name: semeru-17-openj9 run_list: - - recipe[test::adoptopenjdk] + - recipe[test::openjdk] attributes: version: 17 - variant: hotspot - verifier: - inspec_tests: [test/integration/adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml - - # 11 Removal - - name: adoptopenjdk-removal-11-openj9 - run_list: - - recipe[test::remove-adoptopenjdk-11-openj9] - attributes: - version: 11 variant: openj9 verifier: - inspec_tests: [test/integration/remove-adoptopenjdk] - input_files: - - test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml + inspec_tests: [test/integration/openjdk] + inputs: { java_version: "17" } # Corretto - name: corretto-8 @@ -190,50 +117,3 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: { java_version: "18" } - - # Custom URL tests - - name: custom-package-8 - run_list: - - recipe[test::custom_package] - attributes: - version: 8 - variant: hotspot - url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK8U-jdk_x64_linux_hotspot_8u232b09.tar.gz - checksum: 7b7884f2eb2ba2d47f4c0bf3bb1a2a95b73a3a7734bd47ebf9798483a7bcc423 - verifier: - inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/inputs/hotspot-8.yml] - - name: custom-package-11 - run_list: - - recipe[test::custom_package] - attributes: - version: 11 - variant: hotspot - url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz - checksum: 330d19a2eaa07ed02757d7a785a77bab49f5ee710ea03b4ee2fa220ddd0feffc - verifier: - inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/inputs/hotspot-11.yml] - - name: custom-package-11-openj9 - run_list: - - recipe[test::custom_package] - attributes: - version: 11 - variant: openj9 - url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz - checksum: 1530172ee98edd129954fcdca1bf725f7b30c8bfc3cdc381c88de96b7d19e690 - verifier: - inspec_tests: [test/integration/custom-package] - input_files: [test/integration/custom-package/inputs/openj9-11.yml] - - name: custom-package-11-openj9-large-heap - run_list: - - recipe[test::custom_package] - attributes: - version: 11 - variant: openj9-large-heap - url: http://ftp.osuosl.org/pub/osl/sous-chefs/OpenJDK11U-jdk_x64_linux_openj9_linuxXL_11.0.6_10_openj9-0.18.1.tar.gz - checksum: 6524d85d2ce334c955a4347015567326067ef15fe5f6a805714b25cace256f40 - verifier: - inspec_tests: [test/integration/custom-package] - input_files: - [test/integration/custom-package/inputs/openj9-large-heap-11.yml] diff --git a/libraries/adopt_openjdk_macos_helpers.rb b/libraries/adopt_openjdk_macos_helpers.rb deleted file mode 100644 index 3680c9ce..00000000 --- a/libraries/adopt_openjdk_macos_helpers.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Java - module Cookbook - module AdoptOpenJdkMacOsHelpers - def macos_java_home(version) - if version.include? 'jre' - ending = '.jre' - version.gsub!('-jre', '') - else - ending = '.jdk' - end - - version.gsub!('jdk', 'jdk-') - version.slice!('-large') - - "/Library/Java/JavaVirtualMachines/#{version}#{ending}/Contents/Home" - end - end - end -end diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 0ef5a4b3..362e1d52 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -140,7 +140,7 @@ def default_openjdk_bin_cmds(version) %w(appletviewer idlj jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool orbd pack200 rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) when '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) - when '12', '13', '14', '15', '16', '17', 'latest' + when '12', '13', '14', '15', '16', '17', '19', '20', '21', '22', 'latest' %w(jaotc jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) else Chef::Log.fatal('Version specified does not have a default set of bin_cmds') diff --git a/resources/adoptopenjdk_install.rb b/resources/adoptopenjdk_install.rb deleted file mode 100644 index 45743a19..00000000 --- a/resources/adoptopenjdk_install.rb +++ /dev/null @@ -1,80 +0,0 @@ -provides :adoptopenjdk_install -unified_mode true - -property :variant, - String, - description: 'Install flavour', default: 'openj9' - -property :url, - String, - description: 'The URL to download from' - -property :checksum, - String, - description: 'The checksum for the downloaded file' - -property :java_home, - String, - description: 'Set to override the java_home' - -property :bin_cmds, - Array, - description: 'A list of bin_cmds based on the version and variant' - -use 'partial/_common' -use 'partial/_linux' -use 'partial/_java_home' -use 'partial/_macos' - -action :install do - case node['platform_family'] - when 'mac_os_x' - variant = if new_resource.variant.include? 'openj9' - '' - else - "-#{new_resource.variant}" - end - - adoptopenjdk_macos_install 'homebrew' do - tap_url new_resource.tap_url - cask_options new_resource.cask_options - homebrew_path new_resource.homebrew_path - owner new_resource.owner - version "adoptopenjdk#{new_resource.version}#{variant}" - end - when 'windows' - log 'not yet implemented' - else - adoptopenjdk_linux_install new_resource.version do - variant new_resource.variant - url new_resource.url - checksum new_resource.checksum - java_home new_resource.java_home - java_home_mode new_resource.java_home_mode - java_home_group new_resource.java_home_group - end - end -end - -action :remove do - case node['platform_family'] - when 'mac_os_x' - adoptopenjdk_macos_install 'homebrew' do - tap_url new_resource.tap_url - cask_options new_resource.cask_options - homebrew_path new_resource.homebrew_path - owner new_resource.owner - action :remove - end - when 'windows' - log 'not yet implemented' - else - adoptopenjdk_linux_install 'linux' do - version new_resource.version unless new_resource.version.nil? - variant new_resource.variant unless new_resource.variant.nil? - java_home new_resource.java_home unless new_resource.java_home.nil? - bin_cmds new_resource.bin_cmds unless new_resource.bin_cmds.nil? - action :remove - end - end -end diff --git a/resources/adoptopenjdk_linux_install.rb b/resources/adoptopenjdk_linux_install.rb deleted file mode 100644 index 70026542..00000000 --- a/resources/adoptopenjdk_linux_install.rb +++ /dev/null @@ -1,45 +0,0 @@ -# provides :adoptopenjdk_linux_install -# unified_mode true -# include Java::Cookbook::OpenJdkHelpers - -# property :variant, String, -# equal_to: %w(hotspot openj9 openj9-large-heap), -# default: 'openj9', -# description: 'Install flavour' - -# property :url, String, -# default: lazy { default_openjdk_url(version, variant) }, -# description: 'The URL to download from' - -# property :checksum, String, -# regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, -# default: lazy { default_openjdk_checksum(version, variant) }, -# description: 'The checksum for the downloaded file' - -# property :java_home, String, -# default: lazy { "/usr/lib/jvm/java-#{version}-adoptopenjdk-#{variant}/#{sub_dir(url)}" }, -# description: 'Set to override the java_home' - -# property :bin_cmds, Array, -# default: lazy { default_openjdk_bin_cmds(version, variant) }, -# description: 'A list of bin_cmds based on the version and variant' - -# use 'partial/_common' -# use 'partial/_linux' -# use 'partial/_java_home' - -# action :install do -# template "/usr/lib/jvm/.java-#{new_resource.version}-adoptopenjdk-#{new_resource.variant}.jinfo" do -# cookbook 'java' -# source 'jinfo.erb' -# owner new_resource.java_home_owner -# group new_resource.java_home_group -# variables( -# priority: new_resource.alternatives_priority, -# bin_cmds: new_resource.bin_cmds, -# name: extract_dir.split('/').last, -# app_dir: new_resource.java_home -# ) -# only_if { platform_family?('debian') } -# end -# end diff --git a/resources/adoptopenjdk_macos_install.rb b/resources/adoptopenjdk_macos_install.rb deleted file mode 100644 index 92fd6c7e..00000000 --- a/resources/adoptopenjdk_macos_install.rb +++ /dev/null @@ -1,71 +0,0 @@ -provides :adoptopenjdk_macos_install -unified_mode true -include Java::Cookbook::AdoptOpenJdkMacOsHelpers - -use 'partial/_macos' - -property :java_home, String, - default: lazy { macos_java_home(version) }, - description: 'MacOS specific JAVA_HOME' - -property :version, String, - default: 'adoptopenjdk14', - equal_to: %w( - adoptopenjdk8 adoptopenjdk8-openj9 adoptopenjdk8-openj9-large - adoptopenjdk8-jre adoptopenjdk8-openj9-jre adoptopenjdk8-jre-large - adoptopenjdk9 adoptopenjdk10 - adoptopenjdk11 adoptopenjdk11-openj9 adoptopenjdk11-openj9-large - adoptopenjdk11-jre adoptopenjdk11-openj9-jre adoptopenjdk11-openj9-jre-large - adoptopenjdk12 adoptopenjdk12-openj9 adoptopenjdk12-openj9-large - adoptopenjdk12-jre adoptopenjdk12-openj9-jre adoptopenjdk12-openj9-jre-large - adoptopenjdk13 adoptopenjdk13-openj9 adoptopenjdk13-openj9-large - adoptopenjdk13-jre adoptopenjdk13-openj9-jre adoptopenjdk13-openj9-jre-large - adoptopenjdk14 adoptopenjdk14-openj9 adoptopenjdk14-openj9-large - adoptopenjdk14-jre adoptopenjdk14-openj9-jre adoptopenjdk14-openj9-jre-large - ) - -action :install do - homebrew_tap 'AdoptOpenJDK/openjdk' do - homebrew_path new_resource.homebrew_path - owner new_resource.owner - url new_resource.tap_url - action :tap - end - - homebrew_cask "AdoptOpenJDK/openjdk/#{new_resource.version}" do - homebrew_path new_resource.homebrew_path - install_cask true - options new_resource.cask_options - owner new_resource.owner - action :install - end - - # Bash system wide environment variables - append_if_no_line 'Java Home' do - path '/etc/profile' - line "export JAVA_HOME=#{new_resource.java_home}" - end - - # Zsh system wide environment variables - append_if_no_line 'Java Home' do - path '/etc/zshrc' - line "export JAVA_HOME=#{new_resource.java_home}" - end - - node.default['java']['java_home'] = new_resource.java_home -end - -action :remove do - homebrew_tap 'AdoptOpenJDK/openjdk' do - homebrew_path new_resource.homebrew_path - owner new_resource.owner - action :untap - end - - homebrew_cask "adoptopenjdk#{new_resource.version}" do - homebrew_path new_resource.homebrew_path - options new_resource.cask_options - owner new_resource.owner - action :remove - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ee2b6646..317bf1fa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,6 @@ require 'chefspec' require 'chefspec/berkshelf' -require_relative '../libraries/adopt_openjdk_macos_helpers' require_relative '../libraries/certificate_helpers' require_relative '../libraries/corretto_helpers' require_relative '../libraries/openjdk_helpers' diff --git a/test/fixtures/cookbooks/test/recipes/custom_package.rb b/test/fixtures/cookbooks/test/recipes/custom_package.rb deleted file mode 100644 index 4b59004e..00000000 --- a/test/fixtures/cookbooks/test/recipes/custom_package.rb +++ /dev/null @@ -1,7 +0,0 @@ -adoptopenjdk_install node['version'] do - variant node['variant'] - url node['url'] - checksum node['checksum'] - default true - alternatives_priority 1 -end diff --git a/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb b/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb deleted file mode 100644 index 02857f5b..00000000 --- a/test/fixtures/cookbooks/test/recipes/remove-adoptopenjdk-11-openj9.rb +++ /dev/null @@ -1,8 +0,0 @@ -apt_update - -include_recipe 'test::adoptopenjdk' - -adoptopenjdk_install '11' do - variant 'openj9' - action :remove -end diff --git a/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb b/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb deleted file mode 100644 index 2ae80294..00000000 --- a/test/integration/adoptopenjdk/controls/verify_adoptopenjdk.rb +++ /dev/null @@ -1,78 +0,0 @@ -variant = input('variant', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') -java_version = input('java_version', description: 'Which version of java should be installed') -certificate_sha256_checksum = input('certificate_sha256_checksum', - value: '64:F3:3B:A7:EF:C3:5C:6B:2D:ED:95:0B:CB:4E:96:3B:12:97:B8:62:BA:1A:8E:30:13:B0:B0:59:77:12:31:EA', - description: 'The SHA256 checksum of the certificate' -) -parent_install_dir = input('parent_install_dir', - value: "java-#{java_version.to_i > 8 ? java_version.to_i : java_version.split('.')[1]}-adoptopenjdk-#{variant}", - description: 'The parent of the Java home') -keystore_location = input('keystore_location', - value: nil, - description: 'Where the java keystore is located' -) -keystore_password = input('keystore_password', - value: 'changeit', - description: 'Password to the Java keystore') - -control 'check-java-version' do - impact 1.0 - title 'Verify java version' - desc 'Verify the correct version of java is installed' - - describe command('java -version 2>&1') do - its('stdout') { should match /AdoptOpenJDK/ } unless java_version.to_i == 1 - its('stdout') { should match Regexp.new(java_version.to_s) } - end -end - -if os.linux? - control 'check-java-alternatives' do - impact 1.0 - title 'Verify alternatives for java' - desc 'Verify alternatives for java are set to the correct version' - - %w(jar jarsigner java javac).each do |cmd| - describe command("update-alternatives --display #{cmd}") do - its('stdout') { should match parent_install_dir.to_s } - end - end - end -end - -control 'check-jce' do - impact 1.0 - title 'Verify JCE is Unlimitied' - desc 'Verify JCE unlimited support and string' - - describe command('java -jar /tmp/UnlimitedSupportJCETest.jar') do - its('stdout') { should match /isUnlimitedSupported=TRUE/ } - its('stdout') { should match /strength: 2147483647/ } - end -end - -control 'check-certificate' do - impact 1.0 - title 'Verify Java keystore contains the certificate' - desc 'Verify Java keystore exists and contains the certificate' - - unless certificate_sha256_checksum.nil? || certificate_sha256_checksum.empty? - cmd = "keytool -list -v -keystore #{keystore_location}" - cmd.concat(" -storepass #{keystore_password}") unless keystore_password.nil? - describe command("#{cmd} | grep SHA256:") do - its('stdout') { should match certificate_sha256_checksum } - end - end -end - -if os.darwin? - control 'JAVA_HOME' do - impact 0.1 - title 'Verify the JAVA_HOME is set correctly' - desc 'Verify that JAVA_HOME is set correctly and to the correct version in the bash profile' - - describe file('/etc/profile') do - its('content') { should match /JAVA_HOME/ } - end - end -end diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml deleted file mode 100644 index aca4299e..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-hotspot.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 11.0.6 -variant: "hotspot" -keystore_location: '/usr/lib/jvm/java-11-adoptopenjdk-hotspot/jdk-11.0.6+10/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml deleted file mode 100644 index ceb92c0b..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9-large-heap.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 11.0.6 -variant: "openj9-large-heap" -keystore_location: '/usr/lib/jvm/java-11-adoptopenjdk-openj9-large-heap/jdk-11.0.6+10/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml deleted file mode 100644 index 51f0e887..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-11-openj9.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 11.0.6 -variant: "openj9" -keystore_location: '/usr/lib/jvm/java-11-adoptopenjdk-openj9/jdk-11.0.6+10/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml deleted file mode 100644 index 7be7f985..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-hotspot.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 14 -variant: "hotspot" -keystore_location: '/usr/lib/jvm/java-14-adoptopenjdk-hotspot/jdk-14+36/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml deleted file mode 100644 index 315dca34..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-macos.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: '14' -variant: "openj9" -keystore_location: '/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml deleted file mode 100644 index 3cc4019b..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9-large-heap.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 14 -variant: "openj9-large-heap" -keystore_location: '/usr/lib/jvm/java-14-adoptopenjdk-openj9-large-heap/jdk-14+36/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml deleted file mode 100644 index 06f74fe2..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-14-openj9.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 14 -variant: "openj9" -keystore_location: '/usr/lib/jvm/java-14-adoptopenjdk-openj9/jdk-14+36/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml deleted file mode 100644 index ed5cfa28..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-hotspot.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 1.8.0 -variant: "hotspot" -keystore_location: '/usr/lib/jvm/java-8-adoptopenjdk-hotspot/jdk8u242-b08/jre/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml deleted file mode 100644 index e6ebc7c7..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9-large-heap.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 1.8.0 -variant: "openj9-large-heap" -keystore_location: '/usr/lib/jvm/java-8-adoptopenjdk-openj9-large-heap/jdk8u242-b08/jre/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml b/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml deleted file mode 100644 index f7c4ccf6..00000000 --- a/test/integration/adoptopenjdk/inputs/adoptopenjdk-8-openj9.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -java_version: 1.8.0 -variant: "openj9" -keystore_location: '/usr/lib/jvm/java-8-adoptopenjdk-openj9/jdk8u242-b08/jre/lib/security/cacerts' diff --git a/test/integration/adoptopenjdk/inspec.yml b/test/integration/adoptopenjdk/inspec.yml deleted file mode 100644 index 69dff34a..00000000 --- a/test/integration/adoptopenjdk/inspec.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: adoptopenjdk -title: AdoptOpenJDK tests -license: Public domain -copyright: None -summary: Verify installation of AdoptOpenJDK -version: 0.0.1 diff --git a/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb b/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb deleted file mode 100644 index 73ec00a7..00000000 --- a/test/integration/remove-adoptopenjdk/controls/verify_adoptopenjdk-removal.rb +++ /dev/null @@ -1,35 +0,0 @@ -variant = input('variant', value: 'openj9', description: 'Variant being used: openj9, openj9-large-heap, or hotspot') -alternative_bin_cmds = input('alternative_bin_cmds', - value: %w(jar java keytool), - description: 'List of bin commands that should be included in alternatives') -java_version = input('java_version', - value: '1.8.0', - description: 'Which version of java should be installed') -java_home = input('java_home', - value: "/usr/lib/jvm/java-#{java_version.to_i > 8 ? java_version.to_i : java_version.split('.')[1]}-adoptopenjdk-#{variant}", - description: 'Path to the Java home directory') - -control 'check-removal-java-directory' do - impact 1.0 - title 'Verify java directory has been removed' - desc 'Verify java directory has been removed' - - describe directory(java_home) do - it { should_not exist } - end -end - -control 'check-java-alternatives-removal' do - impact 1.0 - title 'Verify alternatives for java are removed' - desc 'Verify alternatives for java are removed' - - # NOTE: platform_family?('rhel') is not working for amazon-linux - if os.family == 'redhat' - alternative_bin_cmds.each do |cmd| - describe command("update-alternatives --display #{cmd}") do - its('stdout') { should_not match "#{java_home}/bin/#{cmd}" } - end - end - end -end diff --git a/test/integration/remove-adoptopenjdk/inspec.yml b/test/integration/remove-adoptopenjdk/inspec.yml deleted file mode 100644 index 22d8d373..00000000 --- a/test/integration/remove-adoptopenjdk/inspec.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: remove-adoptopenjdk -title: AdoptOpenJDK removal tests -license: Public domain -copyright: None -summary: Verify removal of AdoptOpenJDK -version: 0.0.1 From 09c09f19b20ca6341a3a7169b2abdfdca2520f94 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 4 Dec 2024 05:11:47 +0800 Subject: [PATCH 233/278] Update changelog for 12.1.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef8067e4..af16abc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.1.0 - *2024-12-03* - Add support for OpenJDK versions 19, 20, 21 and 22 - Remove commented out `adoptopenjdk_linux_install` resource From 4be0f233ed78ded6cbc0ab7ad901d237242c42f3 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 4 Dec 2024 05:11:47 +0800 Subject: [PATCH 234/278] Update metadata for 12.1.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index f0a5e8dc..53afdc63 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.0.7' +version '12.1.0' supports 'debian' supports 'ubuntu' From 2d69fe3de2a326fc60f267b1e4b368aba45001ed Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 4 Dec 2024 05:11:51 +0800 Subject: [PATCH 235/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af16abc7..91bf5840 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.1.0 - *2024-12-03* - Add support for OpenJDK versions 19, 20, 21 and 22 From bd9eb9fa64eca470bbf43dcf7aca9d252eb79176 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:44:43 -0600 Subject: [PATCH 236/278] chore(deps): update actionshub/chef-install action to v3.0.1 (#721) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d03247f..660823e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Check out code uses: actions/checkout@v4 - name: Install Chef - uses: actionshub/chef-install@3.0.0 + uses: actionshub/chef-install@3.0.1 - name: Dokken uses: actionshub/test-kitchen@3.0.0 env: From 8a2fb861446a5913b0fb093aaf610e23d668d538 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 6 Dec 2024 00:44:47 +0800 Subject: [PATCH 237/278] Update changelog for 12.1.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91bf5840..b44b5866 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 12.1.1 - *2024-12-05* ## 12.1.0 - *2024-12-03* From 442c4796fc0299bdd48393f958d89f2ad1cf8e19 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 6 Dec 2024 00:44:48 +0800 Subject: [PATCH 238/278] Update metadata for 12.1.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 53afdc63..5ac8b3f3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.1.0' +version '12.1.1' supports 'debian' supports 'ubuntu' From f2e340ace9ef2139b9d5095b9c2ee26d3dbea867 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 6 Dec 2024 00:44:51 +0800 Subject: [PATCH 239/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b44b5866..1caecfe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 12.1.1 - *2024-12-05* ## 12.1.0 - *2024-12-03* From 17fa3f1a39038367dcaf259be2cfde5da96be446 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Sun, 13 Jul 2025 21:15:57 +0100 Subject: [PATCH 240/278] Update Temurin support (#722) - Remove Semeru from test matrix - Remove Semeru as it's currently failing. Will re-add at a later stage when it is known to be working - Add Temurin 21 to the matrix --------- Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 14 +- .tool-versions | 1 + CHANGELOG.md | 11 ++ bin/check_java_versions.rb | 96 +++++++++++++ bin/check_temurin_versions.sh | 13 ++ .../resource_temurin_package_install.md | 64 +++++++++ .../resources/openjdk_pkg_install.md | 2 +- .../resources/openjdk_source_install.md | 2 +- kitchen.yml | 43 ++++-- lefthook.yml | 8 ++ libraries/bin_cmd_helpers.rb | 26 ++++ libraries/certificate_helpers.rb | 11 +- libraries/corretto_helpers.rb | 4 - libraries/openjdk_helpers.rb | 133 ++++++++---------- libraries/temurin_helpers.rb | 54 +++++++ resources/alternatives.rb | 82 +++++++++-- resources/certificate.rb | 4 +- resources/openjdk_install.rb | 3 + resources/openjdk_pkg_install.rb | 4 +- resources/openjdk_source_install.rb | 9 +- resources/partial/_openjdk.rb | 4 + resources/temurin_package_install.rb | 114 +++++++++++++++ spec/libraries/certificate_helpers_spec.rb | 29 +--- spec/libraries/corretto_helpers_spec.rb | 65 --------- spec/libraries/openjdk_helpers_spec.rb | 14 ++ spec/libraries/semeru_helpers_spec.rb | 15 +- .../cookbooks/test/recipes/openjdk.rb | 10 +- .../cookbooks/test/recipes/temurin_pkg.rb | 4 + .../openjdk/controls/verify_openjdk.rb | 19 +++ .../temurin/controls/verify_temurin.rb | 57 ++++++++ test/integration/temurin/inspec.yml | 6 + 31 files changed, 684 insertions(+), 237 deletions(-) create mode 100644 .tool-versions create mode 100755 bin/check_java_versions.rb create mode 100755 bin/check_temurin_versions.sh create mode 100644 documentation/resource_temurin_package_install.md create mode 100644 lefthook.yml create mode 100644 libraries/bin_cmd_helpers.rb create mode 100644 libraries/temurin_helpers.rb create mode 100644 resources/partial/_openjdk.rb create mode 100644 resources/temurin_package_install.rb create mode 100644 test/fixtures/cookbooks/test/recipes/temurin_pkg.rb create mode 100644 test/integration/temurin/controls/verify_temurin.rb create mode 100644 test/integration/temurin/inspec.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 660823e3..0d091bb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,17 +30,15 @@ jobs: - ubuntu-2204 - ubuntu-2004 suite: - # - openjdk-11 # Debian doesn't have an 11 package - - openjdk-16 - - openjdk-17 - # - temurin-8-hotspot - # - temurin-11-hotspot - # - semeru-11-openj9 - # - semeru-17-openj9 - - corretto-8 - corretto-11 - corretto-17 - corretto-18 + - temurin-8 + - temurin-11 + - temurin-17 + - temurin-21 + # - semeru-11 + # - semeru-17 fail-fast: false steps: - name: Check out code diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..58f0386e --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby system diff --git a/CHANGELOG.md b/CHANGELOG.md index 1caecfe8..3e03c615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Add new resource `temurin_package_install` +- Add script to check for Java updates +- Update Temurin Java 8 support +- Update Temurin repositories +- Update bin commands for all OpenJDK versions +- Fix Java alternatives to prevent unnecessary removal and re-addition of alternatives +- Move bin_cmds from Java::Cookbook::OpenJdkHelpers to Java::Cookbook::BinCmdHelpers for reuse outside of OpenJDK +- Fix apt_repository failing to install the GPG in the correct location +- Add Temurin 21 to the test matrix +- Remove Semeru from the test matrix + ## 12.1.1 - *2024-12-05* ## 12.1.0 - *2024-12-03* diff --git a/bin/check_java_versions.rb b/bin/check_java_versions.rb new file mode 100755 index 00000000..bb6336ea --- /dev/null +++ b/bin/check_java_versions.rb @@ -0,0 +1,96 @@ +#!/usr/bin/env ruby + +require 'net/http' +require 'json' +require 'uri' + +TEMURIN_REPOS = { + '11' => 'adoptium/temurin11-binaries', + '17' => 'adoptium/temurin17-binaries', +}.freeze + +SEMERU_REPOS = { + '11' => 'ibmruntimes/semeru11-binaries', + '17' => 'ibmruntimes/semeru17-binaries', +}.freeze + +CORRETTO_REPOS = { + '11' => 'corretto-11', + '17' => 'corretto-17', +}.freeze + +def get_latest_release(repo) + uri = URI("https://api.github.com/repos/#{repo}/releases/latest") + response = Net::HTTP.get_response(uri) + + if response.is_a?(Net::HTTPSuccess) + JSON.parse(response.body) + else + puts "Failed to fetch release info for #{repo}: #{response.code} #{response.message}" + nil + end +end + +def verify_url(url) + uri = URI(url) + response = Net::HTTP.get_response(uri) + + case response + when Net::HTTPRedirection + location = response['location'] + puts " ✓ URL redirects successfully to: #{location}" + true + when Net::HTTPSuccess + puts ' ✓ URL is directly accessible' + true + else + puts " ✗ URL is not accessible: #{response.code} #{response.message}" + false + end +end + +def find_linux_x64_jdk(assets) + assets.find { |asset| asset['name'] =~ /OpenJDK\d+U-jdk_x64_linux_hotspot.*\.tar\.gz$/ } +end + +def check_versions + puts 'Checking Temurin versions...' + puts '-' * 50 + + TEMURIN_REPOS.each do |version, repo| + puts "\nChecking Java #{version}..." + release = get_latest_release(repo) + next unless release + + tag = release['tag_name'] + puts "Latest release: #{tag}" + + asset = find_linux_x64_jdk(release['assets']) + if asset + url = asset['browser_download_url'] + puts "Download URL: #{url}" + if verify_url(url) + puts 'Current version in cookbook needs updating!' if url != current_url_in_cookbook(version) + end + else + puts ' ✗ No Linux x64 JDK found in release assets' + end + end +end + +def current_url_in_cookbook(version) + # Read the current URLs from openjdk_helpers.rb + helpers_file = File.join(File.dirname(__FILE__), '..', 'libraries', 'openjdk_helpers.rb') + content = File.read(helpers_file) + + case version + when '11' + content.match(/temurin.*when '11'\s+'(.+?)'/m)&.[](1) + when '17' + content.match(/temurin.*when '17'\s+'(.+?)'/m)&.[](1) + end +end + +if __FILE__ == $PROGRAM_NAME + check_versions +end diff --git a/bin/check_temurin_versions.sh b/bin/check_temurin_versions.sh new file mode 100755 index 00000000..3532a21f --- /dev/null +++ b/bin/check_temurin_versions.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# # Fetch latest Temurin versions from endoflife.date API +# curl --request GET \ +# --url https://endoflife.date/api/eclipse-temurin.json \ +# --header 'Accept: application/json' | jq '.' + +# Filter for LTS versions only +echo "LTS Versions:" +curl -s --request GET \ + --url https://endoflife.date/api/eclipse-temurin.json \ + --header 'Accept: application/json' | \ + jq -r '.[] | select(.lts == true) | "Java \(.cycle) (LTS) - Latest: \(.latest), EOL: \(.eol)"' diff --git a/documentation/resource_temurin_package_install.md b/documentation/resource_temurin_package_install.md new file mode 100644 index 00000000..6590c519 --- /dev/null +++ b/documentation/resource_temurin_package_install.md @@ -0,0 +1,64 @@ +# temurin_package_install + +Installs Java Temurin (AdoptOpenJDK) packages provided by Adoptium. This resource handles the repository setup and package installation for Temurin JDK packages across various platforms. + +## Actions + +- `:install` - Installs Temurin JDK packages +- `:remove` - Removes Temurin JDK packages + +## Properties + +| Property | Type | Default | Description | +|-----------------------|----------------|----------------------------------------|----------------------------------------------| +| `version` | String | Name Property | Java version to install (e.g. '8', '11', '17') | +| `pkg_name` | String | `temurin-#{version}-jdk` | Package name to install | +| `pkg_version` | String | `nil` | Package version to install | +| `java_home` | String | Platform-specific JAVA_HOME | Path to set as JAVA_HOME | +| `bin_cmds` | Array | Version-specific binary commands | Commands for alternatives | +| `alternatives_priority` | Integer | 1062 | Priority for alternatives system | +| `reset_alternatives` | Boolean | true | Whether to reset alternatives before setting | +| `default` | Boolean | true | Whether to set this as the default Java | + +## Examples + +### Install Temurin JDK 11 + +```ruby +temurin_package_install '11' +``` + +### Install Temurin JDK 17 with custom alternatives priority + +```ruby +temurin_package_install '17' do + alternatives_priority 1100 +end +``` + +### Install specific version with custom package name + +```ruby +temurin_package_install '11' do + pkg_name 'temurin-11-jdk' +end +``` + +## Platform Support + +This resource supports the following platforms: + +- Debian +- Ubuntu +- RHEL/CentOS/Rocky Linux +- Fedora +- Amazon Linux +- OpenSUSE/SLES + +Each platform will have the appropriate Adoptium repository configured automatically. + +## Notes + +- This resource uses the Adoptium API to validate available releases. +- The resource will warn if a requested version is not available as an LTS release. +- For most use cases, you can simply specify the major version number. diff --git a/documentation/resources/openjdk_pkg_install.md b/documentation/resources/openjdk_pkg_install.md index 49045cec..e177b2ed 100644 --- a/documentation/resources/openjdk_pkg_install.md +++ b/documentation/resources/openjdk_pkg_install.md @@ -19,7 +19,7 @@ Introduced: v8.1.0 | pkg_version | String | `nil` | Package version to install | | java_home | String | Based on the version | Set to override the java_home | | default | Boolean | `true` | Whether to set this as the defalut Java | -| bin_cmds | Array | `default_openjdk_bin_cmds(version)` | A list of bin_cmds based on the version and variant | +| bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | `1062` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | diff --git a/documentation/resources/openjdk_source_install.md b/documentation/resources/openjdk_source_install.md index b2ad8b5a..f14824f5 100644 --- a/documentation/resources/openjdk_source_install.md +++ b/documentation/resources/openjdk_source_install.md @@ -22,7 +22,7 @@ Introduced: v8.0.0 | java_home_owner | String | `root` | Owner of the Java Home | | java_home_group | String | `node['root_group']` | Group for the Java Home | | default | Boolean | `true` | Whether to set this as the defalut Java | -| bin_cmds | Array | `default_openjdk_bin_cmds(version)` | A list of bin_cmds based on the version and variant | +| bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | diff --git a/kitchen.yml b/kitchen.yml index b8771bba..14ae3f34 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -48,42 +48,61 @@ suites: inputs: { java_version: "17" } # Temurin/Semeru - - name: temurin-8-hotspot + - name: temurin-8 run_list: - - recipe[test::openjdk] + - recipe[test::temurin_pkg] attributes: version: 8 - variant: hotspot verifier: - inspec_tests: [test/integration/openjdk] + inspec_tests: [test/integration/temurin] inputs: { java_version: "8" } - - name: temurin-11-hotspot + - name: temurin-11 run_list: - - recipe[test::openjdk] + - recipe[test::temurin_pkg] attributes: version: 11 - variant: hotspot verifier: - inspec_tests: [test/integration/openjdk] + inspec_tests: + - test/integration/temurin inputs: { java_version: "11" } - - name: semeru-11-openj9 + - name: temurin-17 + run_list: + - recipe[test::temurin_pkg] + attributes: + version: 17 + verifier: + inspec_tests: + - test/integration/temurin + inputs: { java_version: "17" } + + - name: temurin-21 + run_list: + - recipe[test::temurin_pkg] + attributes: + version: 21 + verifier: + inspec_tests: + - test/integration/temurin + inputs: { java_version: "21" } + + - name: semeru-11 run_list: - recipe[test::openjdk] attributes: version: 11 - variant: openj9 + variant: semeru verifier: inspec_tests: [test/integration/openjdk] inputs: { java_version: "11" } - - name: semeru-17-openj9 + - name: semeru-17 run_list: - recipe[test::openjdk] attributes: version: 17 - variant: openj9 + variant: semeru verifier: inspec_tests: [test/integration/openjdk] inputs: { java_version: "17" } diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..bf255f83 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,8 @@ +pre-commit: + commands: + rubocop: + glob: "*.rb" + run: chef exec rubocop {staged_files} + skip: + - merge + - rebase diff --git a/libraries/bin_cmd_helpers.rb b/libraries/bin_cmd_helpers.rb new file mode 100644 index 00000000..3127b71d --- /dev/null +++ b/libraries/bin_cmd_helpers.rb @@ -0,0 +1,26 @@ +module Java + module Cookbook + module BinCmdHelpers + def default_bin_cmds(version) + case version + when '8' + %w(appletviewer extcheck idlj jar jarsigner java javac javadoc javah javap jcmd jconsole jdb jdeps jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) + when '9' + %w(appletviewer idlj jaotc jar jarsigner java javac javadoc javah javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) + when '10' + %w(appletviewer idlj jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool orbd pack200 rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) + when '11' + %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) + when '12', '13', '14', '15', '16' + %w(jaotc jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) + when '17' + %w(jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) + when '18', '19', '20', '21', '22', 'latest' + %w(jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver jwebserver) + else + Chef::Log.fatal('Version specified does not have a default set of bin_cmds') + end + end + end + end +end diff --git a/libraries/certificate_helpers.rb b/libraries/certificate_helpers.rb index 6dad63e6..3425fc76 100644 --- a/libraries/certificate_helpers.rb +++ b/libraries/certificate_helpers.rb @@ -5,16 +5,13 @@ def default_truststore_path(version, java_home) if version.to_i > 8 "#{java_home}/lib/security/cacerts" else - "#{java_home}/jre/lib/security/cacerts" + Chef::Log.fatal('Java 8 is no longer supported') + raise 'Java 8 is no longer supported' end end - def keystore_argument(version, cacerts, truststore_path) - if version.to_i > 8 && cacerts - '-cacerts' - else - "-keystore #{truststore_path}" - end + def keystore_argument(cacerts, truststore_path) + cacerts ? '-cacerts' : "-keystore #{truststore_path}" end end end diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 350e5f54..0d6a8b38 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -7,8 +7,6 @@ def corretto_arch def default_corretto_bin_cmds(version) case version.to_s - when '8' - %w(appletviewer clhsdb extcheck hsdb idlj jar jarsigner java java-rmi.cgi javac javadoc javafxpackager javah javap javapackager jcmd jconsole jdb jdeps jfr jhat jinfo jjs jmap jps jrunscript jsadebugd jstack jstat jstatd keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) when '11' %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) when '15', '17', '18' @@ -20,8 +18,6 @@ def default_corretto_bin_cmds(version) def default_corretto_minor(version) case version - when '8' - '8.332.08.1' when '11' '11.0.15.9.1' when '17' diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 362e1d52..e07851e5 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -34,71 +34,58 @@ def default_openjdk_install_method(version) end end - def default_openjdk_url(version, variant = nil) - # Always default to OpenJDK - # If the user passes variant we'll also select that variant's URL - case version - when '8' - case variant - when 'semeru' - 'https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u322-b06_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_8u322b06_openj9-0.30.0.tar.gz' - when 'temurin' - 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz' + def default_openjdk_url(version, variant = 'openjdk') + case variant.downcase + when 'temurin' + case version + when '11' + 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.25%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz' + when '17' + 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' else Chef::Log.fatal('Version specified does not have a URL value set') raise 'Version supplied does not have a download URL set' end - when '9' - 'https://download.java.net/java/GA/jdk9/9/binaries/openjdk-9_linux-x64_bin.tar.gz' - when '10' - 'https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_linux-x64_bin.tar.gz' - when '11' - case variant - when 'semeru' + when 'semeru' + case version + when '11' 'https://github.com/ibmruntimes/semeru11-binaries/releases/download/jdk-11.0.14.1%2B1_openj9-0.30.1/ibm-semeru-open-jdk_x64_linux_11.0.14.1_1_openj9-0.30.1.tar.gz' - when 'temurin' - 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz' - else - 'https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz' - end - when '12' - 'https://download.java.net/java/GA/jdk12/33/GPL/openjdk-12_linux-x64_bin.tar.gz' - when '13' - 'https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz' - when '14' - 'https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz' - when '15' - 'https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_linux-x64_bin.tar.gz' - when '16' - case variant - when 'semeru' + when '16' 'https://github.com/ibmruntimes/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.1/ibm-semeru-open-jdk_ppc64le_linux_16.0.2_7_openj9-0.27.1.tar.gz' - when 'temurin' - 'https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz' - else - 'https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_linux-x64_bin.tar.gz' - end - when '17' - case variant - when 'semeru' + when '17' 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' - when 'temurin' - 'https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz' - else - 'https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz' - end - when '18' - case variant - when 'semeru' + when '18' 'https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.1%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_18.0.1_10_openj9-0.32.0.tar.gz' - when 'temurin' - 'https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz' else - 'https://download.java.net/java/GA/jdk18.0.1/3f48cabb83014f9fab465e280ccf630b/10/GPL/openjdk-18.0.1_linux-x64_bin.tar.gz' + Chef::Log.fatal('Version specified does not have a URL value set') + raise 'Version supplied does not have a download URL set' end else - Chef::Log.fatal('Version specified does not have a URL value set') - raise 'Version supplied does not have a download URL set' + case version + when '9' + 'https://download.java.net/java/GA/jdk9/9/binaries/openjdk-9_linux-x64_bin.tar.gz' + when '10' + 'https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_linux-x64_bin.tar.gz' + when '11' + 'https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz' + when '12' + 'https://download.java.net/java/GA/jdk12/33/GPL/openjdk-12_linux-x64_bin.tar.gz' + when '13' + 'https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz' + when '14' + 'https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz' + when '15' + 'https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_linux-x64_bin.tar.gz' + when '16' + 'https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_linux-x64_bin.tar.gz' + when '17' + 'https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz' + when '18' + 'https://download.java.net/java/GA/jdk18.0.1/3f48cabb83014f9fab465e280ccf630b/10/GPL/openjdk-18.0.1_linux-x64_bin.tar.gz' + else + Chef::Log.fatal('Version specified does not have a URL value set') + raise 'Version supplied does not have a download URL set' + end end end @@ -128,25 +115,6 @@ def default_openjdk_checksum(version) end end - def default_openjdk_bin_cmds(version) - case version - when '7' - %w(appletviewer apt ControlPanel extcheck idlj jar jarsigner java javac javadoc javafxpackager javah javap javaws jcmd jconsole jcontrol jdb jdeps jhat jinfo jjs jmap jmc jps jrunscript jsadebugd jstack jstat jstatd jvisualvm keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) - when '8' - %w(appletviewer apt ControlPanel extcheck idlj jar jarsigner java javac javadoc javafxpackager javah javap javaws jcmd jconsole jcontrol jdb jdeps jhat jinfo jjs jmap jmc jps jrunscript jsadebugd jstack jstat jstatd jvisualvm keytool native2ascii orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) - when '9' - %w(appletviewer idlj jaotc jar jarsigner java javac javadoc javah javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool orbd pack200 policytool rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) - when '10' - %w(appletviewer idlj jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool orbd pack200 rmic rmid rmiregistry schemagen serialver servertool tnameserv unpack200 wsgen wsimport xjc) - when '11' - %w(jaotc jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jhsdb jimage jinfo jjs jlink jmap jmod jps jrunscript jshell jstack jstat jstatd keytool pack200 rmic rmid rmiregistry serialver unpack200) - when '12', '13', '14', '15', '16', '17', '19', '20', '21', '22', 'latest' - %w(jaotc jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) - else - Chef::Log.fatal('Version specified does not have a default set of bin_cmds') - end - end - def default_openjdk_pkg_names(version) value_for_platform_family( amazon: ["java-1.#{version}.0-openjdk", "java-1.#{version}.0-openjdk-devel"], @@ -160,13 +128,30 @@ def default_openjdk_pkg_names(version) end def default_openjdk_pkg_java_home(version) + # For both standard OpenJDK and Temurin/Semeru variants, use the standard OpenJDK paths + # Temurin and Semeru variants are installed using package managers with standard paths + + # Map architecture to the correct suffix used in Java paths + arch = case node['kernel']['machine'] + when 'x86_64' + 'amd64' + when 'aarch64', 'arm64' + 'arm64' + when 'i386', 'i686' + 'i386' + else + node['kernel']['machine'] + end + + # For Debian-based systems, Temurin and standard OpenJDK use the same path structure + # with architecture-specific suffixes value_for_platform_family( %w(rhel fedora) => version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/java-#{version}", amazon: version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/jre-#{version}", suse: "/usr/lib#{node['kernel']['machine'] == 'x86_64' ? '64' : nil}/jvm/java-#{version.to_i == 8 ? "1.#{version}.0" : version}", freebsd: "/usr/local/openjdk#{version}", arch: "/usr/lib/jvm/java-#{version}-openjdk", - debian: "/usr/lib/jvm/java-#{version}-openjdk-#{node['kernel']['machine'] == 'x86_64' ? 'amd64' : 'i386'}", + debian: "/usr/lib/jvm/java-#{version}-openjdk-#{arch}", default: '/usr/lib/jvm/default-java' ) end diff --git a/libraries/temurin_helpers.rb b/libraries/temurin_helpers.rb new file mode 100644 index 00000000..87a2e210 --- /dev/null +++ b/libraries/temurin_helpers.rb @@ -0,0 +1,54 @@ +module Java + module Cookbook + module TemurinHelpers + # Fetch available Temurin releases from Adoptium API + def available_temurin_releases + require 'net/http' + require 'json' + require 'uri' + + uri = URI('https://api.adoptium.net/v3/info/available_releases') + response = Net::HTTP.get_response(uri) + + if response.is_a?(Net::HTTPSuccess) + releases = JSON.parse(response.body) + Chef::Log.info("Available Temurin releases: #{releases}") + releases + else + Chef::Log.warn("Failed to fetch Temurin releases: #{response.code} #{response.message}") + {} + end + rescue => e + Chef::Log.warn("Error fetching Temurin releases: #{e.message}") + {} + end + + # Get available LTS versions + def temurin_lts_versions + releases = available_temurin_releases + return [] unless releases.is_a?(Hash) && releases.key?('available_lts_releases') + + releases['available_lts_releases'] + end + + # Get latest LTS version + def temurin_latest_lts + lts = temurin_lts_versions + lts.empty? ? '17' : lts.max.to_s + end + + # Helper to determine if a version is available as LTS + def temurin_version_available?(version) + version = version.to_s + lts = temurin_lts_versions + + return true if lts.include?(version.to_i) + false + end + end + end +end + +# Ensure the helper is included in the recipe DSL +Chef::DSL::Recipe.include Java::Cookbook::TemurinHelpers +Chef::Resource.include Java::Cookbook::TemurinHelpers diff --git a/resources/alternatives.rb b/resources/alternatives.rb index bb5b820a..06f680d7 100644 --- a/resources/alternatives.rb +++ b/resources/alternatives.rb @@ -20,11 +20,36 @@ property :reset_alternatives, [true, false], - default: true, + default: false, description: 'Whether to reset alternatives before setting them' action :set do - if new_resource.bin_cmds + bin_cmds_to_setup = parse_java_alternatives + # Use not_if guard to make resource fully idempotent + set_alternatives(bin_cmds_to_setup) do |cmd, alt_path| + # Skip if the alternative file already exists with our path + alternative_exists = ::File.exist?("/var/lib/alternatives/#{cmd}") && + shell_out("#{alternatives_cmd} --display #{cmd}").stdout.include?(alt_path) + Chef::Log.debug("Alternative for #{cmd} exists with correct path? #{alternative_exists}") + alternative_exists + end +end + +action :unset do + new_resource.bin_cmds.each do |cmd| + converge_by("Remove alternative for #{cmd}") do + shell_out("#{alternatives_cmd} --remove #{cmd} #{new_resource.java_location}/bin/#{cmd}") + end + end +end + +action_class do + def alternatives_cmd + platform_family?('rhel', 'fedora', 'amazon') ? 'alternatives' : 'update-alternatives' + end + + def parse_java_alternatives + bin_cmds_to_setup = [] new_resource.bin_cmds.each do |cmd| bin_path = "/usr/bin/#{cmd}" alt_path = "#{new_resource.java_location}/bin/#{cmd}" @@ -35,24 +60,55 @@ next end - alternative_exists_same_priority = shell_out("#{alternatives_cmd} --display #{cmd} | grep #{alt_path} | grep 'priority #{priority}$'").exitstatus == 0 - alternative_exists = shell_out("#{alternatives_cmd} --display #{cmd} | grep #{alt_path}").exitstatus == 0 - # remove alternative if priority is changed and install it with new priority - if alternative_exists && !alternative_exists_same_priority - converge_by("Removing alternative for #{cmd} with old priority") do - Chef::Log.debug "Removing alternative for #{cmd} with old priority" + # Add this command to the list of commands to process + bin_cmds_to_setup << [cmd, bin_path, alt_path, priority] + end + bin_cmds_to_setup + end + + def set_alternatives(bin_cmds) + bin_cmds.each do |cmd, bin_path, alt_path, priority| + # Use a custom not_if condition if provided as a block + if block_given? && yield(cmd, alt_path) + Chef::Log.debug "Skipping alternative for #{cmd} as it already exists with correct path" + next + end + + # Get the full output of update-alternatives for this command + display_result = shell_out("#{alternatives_cmd} --display #{cmd}") + cmd_output = display_result.stdout + + # Check if the alternative exists at all + alternative_system_exists = display_result.exitstatus == 0 && !cmd_output.empty? + + # Check if our specific path is already configured as an alternative + our_alternative_exists = alternative_system_exists && cmd_output.include?(alt_path) + + # Parse the priority of the existing alternative + existing_priority = nil + if our_alternative_exists + if cmd_output =~ /#{Regexp.escape(alt_path)}.*priority\s+(\d+)/ + existing_priority = Regexp.last_match(1).to_i + end + end + + # Only remove alternative if it exists with a different priority + if our_alternative_exists && existing_priority && existing_priority != priority + converge_by("Removing alternative for #{cmd} with old priority #{existing_priority}") do remove_cmd = shell_out("#{alternatives_cmd} --remove #{cmd} #{alt_path}") - alternative_exists = false unless remove_cmd.exitstatus == 0 raise(%( remove alternative failed )) end end end - # install the alternative if needed - unless alternative_exists + + # Check if the alternative file exists at all + alternative_file_exists = ::File.exist?("/var/lib/alternatives/#{cmd}") + + # Install the alternative if needed + if !our_alternative_exists || !alternative_file_exists converge_by("Add alternative for #{cmd}") do - Chef::Log.debug "Adding alternative for #{cmd}" - if new_resource.reset_alternatives + if new_resource.reset_alternatives && alternative_file_exists shell_out("rm /var/lib/alternatives/#{cmd}") end install_cmd = shell_out("#{alternatives_cmd} --install #{bin_path} #{cmd} #{alt_path} #{priority}") diff --git a/resources/certificate.rb b/resources/certificate.rb index 1c5286fe..62053219 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -56,7 +56,7 @@ action :install do require 'openssl' - keystore_argument = keystore_argument(new_resource.java_version, new_resource.cacerts, new_resource.keystore_path) + keystore_argument = keystore_argument(new_resource.cacerts, new_resource.keystore_path) certdata = new_resource.cert_data || fetch_certdata @@ -107,7 +107,7 @@ end action :remove do - keystore_argument = keystore_argument(new_resource.java_version, new_resource.cacerts, new_resource.keystore_path) + keystore_argument = keystore_argument(new_resource.cacerts, new_resource.keystore_path) cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -v | grep \"#{new_resource.cert_alias}\"") cmd.run_command diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 137a13b2..07cf0f52 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -1,6 +1,7 @@ provides :openjdk_install unified_mode true include Java::Cookbook::OpenJdkHelpers +include Java::Cookbook::BinCmdHelpers property :install_type, String, @@ -22,6 +23,7 @@ property :bin_cmds, Array, + default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version and variant' property :url, @@ -35,6 +37,7 @@ use 'partial/_common' use 'partial/_linux' use 'partial/_java_home' +use 'partial/_openjdk' action :install do if new_resource.install_type == 'package' diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 8c191320..1c88ddd8 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -1,6 +1,7 @@ provides :openjdk_pkg_install unified_mode true include Java::Cookbook::OpenJdkHelpers +include Java::Cookbook::BinCmdHelpers property :pkg_names, [String, Array], default: lazy { default_openjdk_pkg_names(version) }, @@ -14,7 +15,7 @@ description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_openjdk_bin_cmds(version) }, + default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version and variant' property :alternatives_priority, Integer, @@ -23,6 +24,7 @@ use 'partial/_common' use 'partial/_linux' +use 'partial/_openjdk' action :install do if platform?('ubuntu') diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index d27cf20c..f1caca57 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,16 +1,12 @@ provides :openjdk_source_install unified_mode true include Java::Cookbook::OpenJdkHelpers +include Java::Cookbook::BinCmdHelpers property :version, String, name_property: true, description: 'Java version to install' -property :variant, String, - equal_to: %w(openjdk semeru temurin), - default: 'openjdk', - description: 'Install flavour' - property :url, String, default: lazy { default_openjdk_url(version, variant) }, description: 'The URL to download from' @@ -25,12 +21,13 @@ description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_openjdk_bin_cmds(version) }, + default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version and variant' use 'partial/_common' use 'partial/_linux' use 'partial/_java_home' +use 'partial/_openjdk' action :install do extract_dir = new_resource.java_home.split('/')[0..-2].join('/') diff --git a/resources/partial/_openjdk.rb b/resources/partial/_openjdk.rb new file mode 100644 index 00000000..a0c93f3e --- /dev/null +++ b/resources/partial/_openjdk.rb @@ -0,0 +1,4 @@ +property :variant, String, + equal_to: %w(openjdk semeru temurin), + default: 'openjdk', + description: 'Install flavour' diff --git a/resources/temurin_package_install.rb b/resources/temurin_package_install.rb new file mode 100644 index 00000000..9dd5228f --- /dev/null +++ b/resources/temurin_package_install.rb @@ -0,0 +1,114 @@ +provides :temurin_package_install +unified_mode true +include Java::Cookbook::OpenJdkHelpers +include Java::Cookbook::TemurinHelpers +include Java::Cookbook::BinCmdHelpers + +def default_temurin_pkg_name(version) + # Validate version against available releases + unless temurin_version_available?(version) + Chef::Log.warn("Temurin version #{version} might not be available. Available LTS versions: #{temurin_lts_versions.join(', ')}") + end + "temurin-#{version}-jdk" +end + +property :pkg_name, String, + default: lazy { default_temurin_pkg_name(version) }, + description: 'Package name to install' + +property :pkg_version, String, + description: 'Package version to install' + +property :java_home, String, + default: lazy { "/usr/lib/jvm/temurin-#{version}-jdk" }, + description: 'Set to override the java_home' + +property :bin_cmds, Array, + default: lazy { default_bin_cmds(version) }, + description: 'A list of bin_cmds based on the version' + +use 'partial/_common' +use 'partial/_linux' + +action :install do + apt_repository 'adoptium' do + uri 'https://packages.adoptium.net/artifactory/deb' + components ['main'] + distribution lazy { node['lsb']['codename'] || node['debian']['distribution_codename'] } + # TODO: https://github.com/chef/chef/pull/15043 + # key '843C48A565F8F04B' + # keyserver 'keyserver.ubuntu.com' + signed_by false + trusted true + only_if { platform_family?('debian') } + end + + yum_repository 'adoptium' do + description 'Eclipse Adoptium' + baseurl value_for_platform( + 'amazon' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/amazonlinux/2/$basearch' }, + 'centos' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/centos/$releasever/$basearch' }, + 'fedora' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/fedora/$releasever/$basearch' }, + 'opensuse' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch' }, + 'oracle' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/oraclelinux/$releasever/$basearch' }, + 'redhat' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/rhel/$releasever/$basearch' }, + 'rocky' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/rocky/8/$basearch' }, + 'suse' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/sles/$releasever/$basearch' } + ) + enabled true + gpgcheck true + gpgkey 'https://packages.adoptium.net/artifactory/api/gpg/key/public' + only_if { platform_family?('rhel', 'fedora', 'amazon', 'rocky', 'suse', 'oraclelinux') } + end + + zypper_repository 'adoptium' do + description 'Eclipse Adoptium' + baseurl 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch' + gpgcheck true + gpgkey 'https://packages.adoptium.net/artifactory/api/gpg/key/public' + action :create + only_if { platform_family?('suse') } + end + + package new_resource.pkg_name do + version new_resource.pkg_version if new_resource.pkg_version + end + + node.default['java']['java_home'] = new_resource.java_home + + java_alternatives 'set-java-alternatives' do + java_location new_resource.java_home + bin_cmds new_resource.bin_cmds + priority new_resource.alternatives_priority + default new_resource.default + reset_alternatives new_resource.reset_alternatives + end +end + +action :remove do + java_alternatives 'unset-java-alternatives' do + java_location new_resource.java_home + bin_cmds new_resource.bin_cmds + only_if { ::File.exist?(new_resource.java_home) } + action :unset + end + + package new_resource.pkg_name do + action :remove + end + + apt_repository 'adoptium' do + action :remove + only_if { platform_family?('debian') } + end + + yum_repository 'adoptium' do + action :remove + only_if { platform_family?('rhel', 'fedora', 'amazon', 'rocky', 'suse', 'oraclelinux') } + end + + zypper_repository 'adoptium' do + action :remove + only_if { platform_family?('suse') } + end +end diff --git a/spec/libraries/certificate_helpers_spec.rb b/spec/libraries/certificate_helpers_spec.rb index 926f8f3e..59fd240f 100644 --- a/spec/libraries/certificate_helpers_spec.rb +++ b/spec/libraries/certificate_helpers_spec.rb @@ -8,15 +8,6 @@ class DummyClass < Chef::Node subject { DummyClass.new } describe '#default_truststore_path' do - context 'Java 8' do - let(:version) { '8' } - let(:java_home) { '/usr/lib/jvm/corretto-8' } - - it 'returns the correct path' do - expect(subject.default_truststore_path(version, java_home)).to eq('/usr/lib/jvm/corretto-8/jre/lib/security/cacerts') - end - end - context 'Java 9' do let(:version) { '9' } let(:java_home) { '/usr/lib/jvm/corretto-9' } @@ -28,33 +19,21 @@ class DummyClass < Chef::Node end describe '#keystore_argument' do - context 'Java 8 and cacerts' do - let(:version) { '8' } - let(:cacerts) { true } - let(:truststore_path) { '/usr/lib/jvm/corretto-8/jre/lib/security/cacerts' } - - it 'returns the correct argument' do - expect(subject.keystore_argument(version, cacerts, truststore_path)).to eq('-keystore /usr/lib/jvm/corretto-8/jre/lib/security/cacerts') - end - end - - context 'Java 9 and cacerts' do - let(:version) { '9' } + context 'cacerts set ' do let(:cacerts) { true } let(:truststore_path) { '/usr/lib/jvm/corretto-9/jre/lib/security/cacerts' } it 'returns the correct argument' do - expect(subject.keystore_argument(version, cacerts, truststore_path)).to eq('-cacerts') + expect(subject.keystore_argument(cacerts, truststore_path)).to eq('-cacerts') end end - context 'Java 9 and no cacerts' do - let(:version) { '9' } + context 'no cacerts' do let(:cacerts) { false } let(:truststore_path) { '/mycertstore.jks' } it 'returns the correct argument' do - expect(subject.keystore_argument(version, cacerts, truststore_path)).to eq('-keystore /mycertstore.jks') + expect(subject.keystore_argument(cacerts, truststore_path)).to eq('-keystore /mycertstore.jks') end end end diff --git a/spec/libraries/corretto_helpers_spec.rb b/spec/libraries/corretto_helpers_spec.rb index c7239dad..152f7077 100644 --- a/spec/libraries/corretto_helpers_spec.rb +++ b/spec/libraries/corretto_helpers_spec.rb @@ -13,15 +13,6 @@ class DummyClass < Chef::Node allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine) end - context 'Corretto 8 x64' do - let(:version) { '8' } - let(:machine) { 'x86_64' } - - it 'returns the correct URL' do - expect(subject.default_corretto_url(version)).to match /corretto-8.+\.tar.gz/ - end - end - context 'Corretto 11 x64' do let(:version) { '11' } let(:machine) { 'x86_64' } @@ -49,15 +40,6 @@ class DummyClass < Chef::Node end end - context 'Corretto 8 aarch64' do - let(:version) { '8' } - let(:machine) { 'aarch64' } - - it 'returns the correct URL' do - expect(subject.default_corretto_url(version)).to match /corretto-8.+\.tar.gz/ - end - end - context 'Corretto 11 aarch64' do let(:version) { '11' } let(:machine) { 'aarch64' } @@ -91,15 +73,6 @@ class DummyClass < Chef::Node allow(subject).to receive(:[]).with('version').and_return(version) end - context 'Corretto 8' do - let(:version) { '8' } - - it 'returns the correct bin command array' do - expect(subject.default_corretto_bin_cmds(version)).to include 'appletviewer' - expect(subject.default_corretto_bin_cmds(version)).to_not include 'jaotc' - end - end - context 'Corretto 11' do let(:version) { '11' } @@ -133,24 +106,6 @@ class DummyClass < Chef::Node allow(subject).to receive(:[]).with('kernel').and_return('machine' => machine) end - context 'No full_version passed for Corretto 8 x64' do - let(:version) { '8' } - let(:machine) { 'x86_64' } - - it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version)).to include '8.332.08.1' - end - end - - context 'No full_version passed for Corretto 8 aarch64' do - let(:version) { '8' } - let(:machine) { 'aarch64' } - - it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version)).to include '8.332.08.1' - end - end - context 'No full_version passed for Corretto 11 x64' do let(:version) { '11' } let(:machine) { 'x86_64' } @@ -204,26 +159,6 @@ class DummyClass < Chef::Node expect(subject.corretto_sub_dir(version)).to include '18.0.1.10.1' end end - - context 'A full version passed for for Corretto 8 x64' do - let(:version) { '8' } - let(:full_version) { '8.123.45.6' } - let(:machine) { 'x86_64' } - - it 'returns the default directory value for Corrretto 8 x64' do - expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' - end - end - - context 'A full version passed for for Corretto 8 aarch64' do - let(:version) { '8' } - let(:full_version) { '8.123.45.6' } - let(:machine) { 'aarch64' } - - it 'returns the default directory value for Corrretto 8 aarch64' do - expect(subject.corretto_sub_dir(version, full_version)).to include '8.123.45.6' - end - end end end end diff --git a/spec/libraries/openjdk_helpers_spec.rb b/spec/libraries/openjdk_helpers_spec.rb index f57d4724..e541ffdf 100644 --- a/spec/libraries/openjdk_helpers_spec.rb +++ b/spec/libraries/openjdk_helpers_spec.rb @@ -34,6 +34,20 @@ class DummyClass < Chef::Node .to raise_error('Version supplied does not have a download URL set') end end + + context 'Temurin' do + let(:version) { '17' } + + it 'returns the correct download URL for Temurin' do + expect(subject.default_openjdk_url(version, 'temurin')) + .to eq 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' + end + + it 'returns the correct download URL for Temurin 11' do + expect(subject.default_openjdk_url('11', 'temurin')) + .to eq 'https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.25%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz' + end + end end describe '#default_openjdk_install_method' do diff --git a/spec/libraries/semeru_helpers_spec.rb b/spec/libraries/semeru_helpers_spec.rb index 8910a555..c608a783 100644 --- a/spec/libraries/semeru_helpers_spec.rb +++ b/spec/libraries/semeru_helpers_spec.rb @@ -12,11 +12,11 @@ class DummyClass < Chef::Node allow(subject).to receive(:[]).with('url').and_return(url) end - context 'OpenJDK Semeru 8' do - let(:url) { 'https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u322-b06_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_8u322b06_openj9-0.30.0.tar.gz' } + context 'OpenJDK Semeru 17' do + let(:url) { 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' } it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk8u322-b06' + expect(subject.sub_dir(url)).to eq 'jdk-17.0.2-b8' end end @@ -34,15 +34,6 @@ class DummyClass < Chef::Node allow(subject).to receive(:[]).with('version').and_return(version) end - context 'Semeru 8' do - let(:version) { '8' } - let(:variant) { 'semeru' } - - it 'returns the correct URL' do - expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u322-b06_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_8u322b06_openj9-0.30.0.tar.gz' - end - end - context 'Semeru 11' do let(:version) { '11' } let(:variant) { 'semeru' } diff --git a/test/fixtures/cookbooks/test/recipes/openjdk.rb b/test/fixtures/cookbooks/test/recipes/openjdk.rb index 6fea755a..7da43653 100644 --- a/test/fixtures/cookbooks/test/recipes/openjdk.rb +++ b/test/fixtures/cookbooks/test/recipes/openjdk.rb @@ -1,8 +1,6 @@ -openjdk_install node['version'] do +# Test recipe for verifying installation paths +# This focuses only on path verification, avoiding non-idempotent operations + +openjdk_install node['version'].to_s do variant node['variant'] if node['variant'] end - -# openjdk || semeru || temurin -# openjdk OpenJ9 || hotspot - -include_recipe 'test::java_cert' diff --git a/test/fixtures/cookbooks/test/recipes/temurin_pkg.rb b/test/fixtures/cookbooks/test/recipes/temurin_pkg.rb new file mode 100644 index 00000000..a502a752 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/temurin_pkg.rb @@ -0,0 +1,4 @@ +# This recipe tests the temurin_package_install resource +# It should install temurin java packages based on the version specified + +temurin_package_install node['version'] diff --git a/test/integration/openjdk/controls/verify_openjdk.rb b/test/integration/openjdk/controls/verify_openjdk.rb index a2b6fe08..64e62479 100644 --- a/test/integration/openjdk/controls/verify_openjdk.rb +++ b/test/integration/openjdk/controls/verify_openjdk.rb @@ -7,8 +7,27 @@ describe command('java -version 2>&1') do its('stdout') { should match java_version.to_s } end +end + +control 'Java path is correct' do + impact 1.0 + title 'Path Verification' + desc 'Verifies that keytool and other binaries are accessible in the correct paths using update-alternatives' + + # Get architecture suffix + arch_suffix = command('uname -m').stdout.strip == 'x86_64' ? 'amd64' : 'arm64' describe command('update-alternatives --display jar') do its('stdout') { should match %r{/usr/lib/jvm/java} } end + + describe command('update-alternatives --display java') do + its('stdout') { should match %r{/usr/lib/jvm/java-#{java_version}-openjdk-#{arch_suffix}/bin/java} } + end + + describe command('update-alternatives --display keytool') do + its('stdout') { should match %r{link best version is /usr/lib/jvm/java-#{java_version}-openjdk-#{arch_suffix}/bin/keytool} } + its('stdout') { should match %r{link keytool is /usr/bin/keytool} } + its('stdout') { should match /priority 1/ } + end end diff --git a/test/integration/temurin/controls/verify_temurin.rb b/test/integration/temurin/controls/verify_temurin.rb new file mode 100644 index 00000000..64850472 --- /dev/null +++ b/test/integration/temurin/controls/verify_temurin.rb @@ -0,0 +1,57 @@ +java_version = input('java_version', description: 'Which version of java should be installed') + +control 'Temurin Java is installed & linked correctly' do + impact 1.0 + title 'Installed' + desc 'Temurin Java is installed & linked correctly' + + describe command('java -version 2>&1') do + its('stdout') { should match(java_version.to_s) } + its('stdout') { should match(/Temurin/) } + end +end + +control 'Temurin Java path is correct' do + impact 1.0 + title 'Path Verification' + desc 'Verifies that keytool and other binaries are accessible in the correct paths using update-alternatives' + + # Handle architecture-specific paths + describe command('update-alternatives --display jar') do + its('stdout') { should match %r{/usr/lib/jvm/temurin-#{java_version}-jdk(-[a-z0-9]+)?/bin/jar} } + end + + describe command('update-alternatives --display java') do + its('stdout') { should match %r{/usr/lib/jvm/temurin-#{java_version}-jdk(-[a-z0-9]+)?/bin/java} } + end + + describe command('update-alternatives --display keytool') do + # Check for architecture-specific paths with regex that allows for optional architecture suffix + its('stdout') { should match %r{/usr/lib/jvm/temurin-#{java_version}-jdk(-[a-z0-9]+)?/bin/keytool} } + its('stdout') { should match(/priority/) } + end +end + +control 'Adoptium repository is properly configured' do + impact 1.0 + title 'Repository Configuration' + desc 'Verifies that the Adoptium repository is properly configured' + + # Handle platform detection more robustly + if os.family == 'debian' + describe file('/etc/apt/sources.list.d/adoptium.list') do + it { should exist } + its('content') { should match(/packages.adoptium.net/) } + end + elsif os.family == 'redhat' || os.family == 'fedora' || os.name == 'amazon' + describe file('/etc/yum.repos.d/adoptium.repo') do + it { should exist } + its('content') { should match(/packages.adoptium.net/) } + end + elsif os.family == 'suse' + describe file('/etc/zypp/repos.d/adoptium.repo') do + it { should exist } + its('content') { should match(/packages.adoptium.net/) } + end + end +end diff --git a/test/integration/temurin/inspec.yml b/test/integration/temurin/inspec.yml new file mode 100644 index 00000000..7b558efa --- /dev/null +++ b/test/integration/temurin/inspec.yml @@ -0,0 +1,6 @@ +name: temurin +title: Temurin Java Installation +maintainer: Sous Chefs +copyright: Sous Chefs +license: Apache-2.0 +version: 1.0.0 From 1e1ed94c859da73ebd05dd9591e5431e61140e61 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sun, 13 Jul 2025 21:16:01 +0100 Subject: [PATCH 241/278] Update changelog for 13.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e03c615..74aa4b34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 13.0.0 - *2025-07-13* - Add new resource `temurin_package_install` - Add script to check for Java updates From 6e481b47a3bf30ee443f184228779ab85d71826f Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sun, 13 Jul 2025 21:16:02 +0100 Subject: [PATCH 242/278] Update metadata for 13.0.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 5ac8b3f3..64625e4f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '12.1.1' +version '13.0.0' supports 'debian' supports 'ubuntu' From 7b7c3d9053c16b97cb033204a45367685f72725b Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Sun, 13 Jul 2025 21:16:05 +0100 Subject: [PATCH 243/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74aa4b34..9030190b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 13.0.0 - *2025-07-13* - Add new resource `temurin_package_install` From c1e613b29ee7e357ff1fc4042725ae6d676f9d20 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 14 Jul 2025 09:37:23 +0100 Subject: [PATCH 244/278] feat: Add skip_alternatives (@dschlenk) (#727) - Add skip_alternatives for cases when management of alternatives is not desired - Update documentation for resources Signed-off-by: Dan Webb --- CHANGELOG.md | 2 ++ documentation/resources/corretto_install.md | 9 ++++++++- documentation/resources/openjdk_install.md | 5 ++++- .../resources/openjdk_pkg_install.md | 9 ++++++++- .../resources/openjdk_source_install.md | 7 +++++-- .../temurin_package_install.md} | 19 +++++++++++++++++++ resources/corretto_install.rb | 2 +- resources/openjdk_install.rb | 4 ++++ resources/openjdk_pkg_install.rb | 1 + resources/openjdk_source_install.rb | 2 ++ resources/partial/_common.rb | 4 ++++ resources/temurin_package_install.rb | 2 ++ 12 files changed, 60 insertions(+), 6 deletions(-) rename documentation/{resource_temurin_package_install.md => resources/temurin_package_install.md} (70%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9030190b..f2fc8f80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- add `skip_alternatives` to resources `corretto_install`, `openjdk_install`, `openjdk_pkg_install`, `openjdk_source_install` for cases when management of alternatives is not desired. (@dschlenk) + ## 13.0.0 - *2025-07-13* - Add new resource `temurin_package_install` diff --git a/documentation/resources/corretto_install.md b/documentation/resources/corretto_install.md index 2bf76155..2c078524 100644 --- a/documentation/resources/corretto_install.md +++ b/documentation/resources/corretto_install.md @@ -3,6 +3,8 @@ [back to resource list](https://github.com/sous-chefs/java#resources) +Installs Amazon Corretto Java distribution. This resource handles downloading, extracting and configuring Amazon's Corretto distribution of OpenJDK, including setting up Java home directories and configuring system alternatives. + Introduced: v8.0.0 ## Actions @@ -22,10 +24,11 @@ Introduced: v8.0.0 | java_home_mode | Integer, String | `0755` | The permission for the Java home directory | | java_home_owner | String | `root` | Owner of the Java Home | | java_home_group | String | `node['root_group']` | Group for the Java Home | -| default | Boolean | `true` | Whether to set this as the defalut Java | +| default | Boolean | `true` | Whether to set this as the default Java | | bin_cmds | Array | `default_corretto_bin_cmds(version)` | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | +| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | ## Examples @@ -42,3 +45,7 @@ corretto_install '8' do alternatives_priority 2 end ``` + +## Architecture Support + +This resource supports installation on both x86_64 and ARM64 architectures. Amazon Corretto provides architecture-specific builds and the resource automatically handles the correct paths and downloads for the target platform. diff --git a/documentation/resources/openjdk_install.md b/documentation/resources/openjdk_install.md index afe02fcb..b9185b15 100644 --- a/documentation/resources/openjdk_install.md +++ b/documentation/resources/openjdk_install.md @@ -3,6 +3,8 @@ [back to resource list](https://github.com/sous-chefs/java#resources) +Installs OpenJDK Java via source or package manager. This resource selects the appropriate installation method based on the `install_type` property and handles cross-platform Java installation including alternatives configuration. + Introduced: v8.0.0 ## Actions @@ -21,10 +23,11 @@ Introduced: v8.0.0 | java_home_mode | Integer, String | | The permission for the Java home directory | | | java_home_owner | String | | Owner of the Java Home | | | java_home_group | String | | Group for the Java Home | | -| default | Boolean | | Whether to set this as the defalut Java | | +| default | Boolean | | Whether to set this as the default Java | | | bin_cmds | Array | | A list of bin_cmds based on the version and variant | | | alternatives_priority | Integer | | Alternatives priority to set for this Java | | | reset_alternatives | Boolean | | Whether to reset alternatives before setting | | +| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | | | pkg_names | Array | | List of packages to install | | | pkg_version | String | | Package version to install | | | install_type | String | | Installation type | `package` `source` | diff --git a/documentation/resources/openjdk_pkg_install.md b/documentation/resources/openjdk_pkg_install.md index e177b2ed..9bdeecb3 100644 --- a/documentation/resources/openjdk_pkg_install.md +++ b/documentation/resources/openjdk_pkg_install.md @@ -3,6 +3,8 @@ [back to resource list](https://github.com/sous-chefs/java#resources) +Installs OpenJDK Java packages from the system's package manager. This resource handles platform-specific package installation for OpenJDK across different Linux distributions and versions, and configures the alternatives system appropriately. + Introduced: v8.1.0 ## Actions @@ -18,10 +20,11 @@ Introduced: v8.1.0 | pkg_names | Array | `default_openjdk_pkg_names(version)` | List of packages to install | | pkg_version | String | `nil` | Package version to install | | java_home | String | Based on the version | Set to override the java_home | -| default | Boolean | `true` | Whether to set this as the defalut Java | +| default | Boolean | `true` | Whether to set this as the default Java | | bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | `1062` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | +| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | ## Examples @@ -38,3 +41,7 @@ openjdk_pkg_install '11' do alternatives_priority 2 end ``` + +## Architecture Support + +This resource supports installation on both x86_64 and ARM64 architectures. On ARM64 platforms (like ARM Macs or ARM-based cloud instances), package paths may include architecture-specific suffixes in paths (e.g., `-arm64` or `-aarch64`). diff --git a/documentation/resources/openjdk_source_install.md b/documentation/resources/openjdk_source_install.md index f14824f5..c6d2f11b 100644 --- a/documentation/resources/openjdk_source_install.md +++ b/documentation/resources/openjdk_source_install.md @@ -1,8 +1,10 @@ -# openjdk_install +# openjdk_source_install [back to resource list](https://github.com/sous-chefs/java#resources) +Installs OpenJDK Java from source archives. This resource handles downloading, extracting, and configuring OpenJDK from source tarballs, including setting up the Java home directory and alternatives system entries. + Introduced: v8.0.0 ## Actions @@ -21,10 +23,11 @@ Introduced: v8.0.0 | java_home_mode | Integer, String | `0755` | The permission for the Java home directory | | java_home_owner | String | `root` | Owner of the Java Home | | java_home_group | String | `node['root_group']` | Group for the Java Home | -| default | Boolean | `true` | Whether to set this as the defalut Java | +| default | Boolean | `true` | Whether to set this as the default Java | | bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | +| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | ## Examples diff --git a/documentation/resource_temurin_package_install.md b/documentation/resources/temurin_package_install.md similarity index 70% rename from documentation/resource_temurin_package_install.md rename to documentation/resources/temurin_package_install.md index 6590c519..d7330e20 100644 --- a/documentation/resource_temurin_package_install.md +++ b/documentation/resources/temurin_package_install.md @@ -1,7 +1,11 @@ # temurin_package_install +[back to resource list](https://github.com/sous-chefs/java#resources) + Installs Java Temurin (AdoptOpenJDK) packages provided by Adoptium. This resource handles the repository setup and package installation for Temurin JDK packages across various platforms. +Introduced: v12.0.0 + ## Actions - `:install` - Installs Temurin JDK packages @@ -19,6 +23,21 @@ Installs Java Temurin (AdoptOpenJDK) packages provided by Adoptium. This resourc | `alternatives_priority` | Integer | 1062 | Priority for alternatives system | | `reset_alternatives` | Boolean | true | Whether to reset alternatives before setting | | `default` | Boolean | true | Whether to set this as the default Java | +| `skip_alternatives` | Boolean | false | Skip alternatives installation completely | + +## Platform Support + +- Debian/Ubuntu: Uses apt_repository with `signed_by false` and `trusted true` options to bypass GPG signature verification issues +- Amazon Linux/CentOS/RHEL: Uses yum_repository with standard configuration +- SUSE: Uses zypper_repository with standard configuration + +## Architecture Support + +This resource supports installation on both x86_64 and ARM64 architectures. On ARM64 platforms (like ARM Macs or ARM-based cloud instances), the package paths may include architecture-specific suffixes (e.g., `/usr/lib/jvm/temurin-8-jdk-arm64/bin/java`). + +## Notes + +- Due to a bug in Chef's apt_repository resource ([PR #15043](https://github.com/chef/chef/pull/15043)), GPG key verification is disabled by default on Debian-family systems to ensure the repository can be used successfully ## Examples diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 245cea2e..8b4a5ac4 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -72,7 +72,7 @@ priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives - action :set + not_if { new_resource.skip_alternatives } end end diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index 07cf0f52..dc9f3810 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -47,6 +47,7 @@ java_home new_resource.java_home default new_resource.default bin_cmds new_resource.bin_cmds + skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives end @@ -59,6 +60,7 @@ java_home_group new_resource.java_home_group default new_resource.default bin_cmds new_resource.bin_cmds + skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives end @@ -75,6 +77,7 @@ java_home new_resource.java_home default new_resource.default bin_cmds new_resource.bin_cmds + skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives action :remove @@ -88,6 +91,7 @@ java_home_group new_resource.java_home_group default new_resource.default bin_cmds new_resource.bin_cmds + skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives action :remove diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 1c88ddd8..233041cd 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -52,6 +52,7 @@ priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives + skip_alternatives new_resource.skip_alternatives action :set end end diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index f1caca57..efec3733 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -61,6 +61,7 @@ priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives + not_if { new_resource.skip_alternatives } action :set end @@ -77,6 +78,7 @@ java_location new_resource.java_home bin_cmds new_resource.bin_cmds only_if { ::File.exist?(extract_dir) } + not_if { new_resource.skip_alternatives } action :unset end diff --git a/resources/partial/_common.rb b/resources/partial/_common.rb index 1e8f424c..49c93c39 100644 --- a/resources/partial/_common.rb +++ b/resources/partial/_common.rb @@ -1,3 +1,7 @@ property :version, String, name_property: true, description: 'Java version to install' + +property :skip_alternatives, [true, false], + default: false, + description: 'Skip alternatives installation' diff --git a/resources/temurin_package_install.rb b/resources/temurin_package_install.rb index 9dd5228f..e9781bb3 100644 --- a/resources/temurin_package_install.rb +++ b/resources/temurin_package_install.rb @@ -82,6 +82,7 @@ def default_temurin_pkg_name(version) priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives + not_if { new_resource.skip_alternatives } end end @@ -91,6 +92,7 @@ def default_temurin_pkg_name(version) bin_cmds new_resource.bin_cmds only_if { ::File.exist?(new_resource.java_home) } action :unset + not_if { new_resource.skip_alternatives } end package new_resource.pkg_name do From 166c0369403ec8c49a1fc0c154719a1afb2df244 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 09:37:27 +0100 Subject: [PATCH 245/278] Update changelog for 13.1.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2fc8f80..e0215e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 13.1.0 - *2025-07-14* - add `skip_alternatives` to resources `corretto_install`, `openjdk_install`, `openjdk_pkg_install`, `openjdk_source_install` for cases when management of alternatives is not desired. (@dschlenk) From 945ed94959398efa8defa02fc7d79c3d73895fda Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 09:37:27 +0100 Subject: [PATCH 246/278] Update metadata for 13.1.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 64625e4f..75601340 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '13.0.0' +version '13.1.0' supports 'debian' supports 'ubuntu' From dcc9d279f6e074ed43664479457637570abd7452 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 09:37:31 +0100 Subject: [PATCH 247/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0215e16..e7334aaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 13.1.0 - *2025-07-14* - add `skip_alternatives` to resources `corretto_install`, `openjdk_install`, `openjdk_pkg_install`, `openjdk_source_install` for cases when management of alternatives is not desired. (@dschlenk) From 756441110e504d6f22aadea9ec15cd112ed5fe2c Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 09:38:30 +0100 Subject: [PATCH 248/278] Standardise files with files in sous-chefs/repo-management (#725) Signed-off-by: kitchen-porter Co-authored-by: Dan Webb --- .vscode/extensions.json | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 51d0ae7a..cf171a37 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,7 @@ { "recommendations": [ "chef-software.chef", - "rebornix.ruby", + "Shopify.ruby-lsp", "editorconfig.editorconfig", "DavidAnson.vscode-markdownlint" ] diff --git a/CHANGELOG.md b/CHANGELOG.md index e7334aaa..e656d5cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management +- Update the recommended Ruby VSCode extensions + ## 13.1.0 - *2025-07-14* - add `skip_alternatives` to resources `corretto_install`, `openjdk_install`, `openjdk_pkg_install`, `openjdk_source_install` for cases when management of alternatives is not desired. (@dschlenk) From 67063e801b4fd861e33801490cd620613b0789cd Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 14 Jul 2025 10:52:51 +0100 Subject: [PATCH 249/278] skip alternatives patch (#729) * fix missing skip_alternatives Signed-off-by: Dan Webb * Fix missing skip_alternatives Signed-off-by: Dan Webb --------- Signed-off-by: Dan Webb --- CHANGELOG.md | 2 ++ resources/openjdk_pkg_install.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e656d5cf..71813621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased Standardise files with files in sous-chefs/repo-management + - Update the recommended Ruby VSCode extensions +- Fix missing skip_alternatives property in openjdk_pkg_install ## 13.1.0 - *2025-07-14* diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 233041cd..ca5d3cf9 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -52,8 +52,7 @@ priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives - skip_alternatives new_resource.skip_alternatives - action :set + not_if { new_resource.skip_alternatives } end end @@ -62,6 +61,7 @@ java_location new_resource.java_home bin_cmds new_resource.bin_cmds only_if { ::File.exist?(new_resource.java_home) } + not_if { new_resource.skip_alternatives } action :unset end From e18ea1b37294fb0b774d4f1205cc3751ca9bbe0d Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 14 Jul 2025 10:57:54 +0100 Subject: [PATCH 250/278] Air gap mode and alternative URLs for repository addresses (#730) Signed-off-by: Dan Webb --- CHANGELOG.md | 7 ++++--- documentation/resources/openjdk_pkg_install.md | 1 + documentation/resources/temurin_package_install.md | 7 +++++-- resources/openjdk_pkg_install.rb | 5 ++++- resources/openjdk_source_install.rb | 2 +- resources/temurin_package_install.rb | 9 ++++++--- test/integration/temurin_mirror/inspec.yml | 0 7 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 test/integration/temurin_mirror/inspec.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 71813621..87a0077d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased -Standardise files with files in sous-chefs/repo-management - -- Update the recommended Ruby VSCode extensions +- Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728)) +- Clarify documentation for `url` property in `openjdk_source_install` resource to note it can be used for internal mirrors +- Standardise files with files in sous-chefs/repo-management + Update the recommended Ruby VSCode extensions - Fix missing skip_alternatives property in openjdk_pkg_install ## 13.1.0 - *2025-07-14* diff --git a/documentation/resources/openjdk_pkg_install.md b/documentation/resources/openjdk_pkg_install.md index 9bdeecb3..b135c291 100644 --- a/documentation/resources/openjdk_pkg_install.md +++ b/documentation/resources/openjdk_pkg_install.md @@ -25,6 +25,7 @@ Introduced: v8.1.0 | alternatives_priority | Integer | `1062` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | | skip_alternatives | Boolean | `false` | Skip alternatives installation completely | +| repository_uri | String | `nil` | URI for the repository mirror to use instead of default repository URLs | ## Examples diff --git a/documentation/resources/temurin_package_install.md b/documentation/resources/temurin_package_install.md index d7330e20..82e9779c 100644 --- a/documentation/resources/temurin_package_install.md +++ b/documentation/resources/temurin_package_install.md @@ -24,6 +24,8 @@ Introduced: v12.0.0 | `reset_alternatives` | Boolean | true | Whether to reset alternatives before setting | | `default` | Boolean | true | Whether to set this as the default Java | | `skip_alternatives` | Boolean | false | Skip alternatives installation completely | +| `repository_uri` | String | `nil` | URI for the repository mirror to use instead of default repository URLs | +| air_gap | Boolean | false | Whether to install in air-gap mode | ## Platform Support @@ -63,7 +65,7 @@ temurin_package_install '11' do end ``` -## Platform Support +## Supported Platforms This resource supports the following platforms: @@ -76,8 +78,9 @@ This resource supports the following platforms: Each platform will have the appropriate Adoptium repository configured automatically. -## Notes +## Additional Information - This resource uses the Adoptium API to validate available releases. - The resource will warn if a requested version is not available as an LTS release. - For most use cases, you can simply specify the major version number. +- Air-gap mode disables version checking via the Adoptium API and instead uses the version specified in the `pkg_version` property. diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index ca5d3cf9..86449b0b 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -22,6 +22,9 @@ default: 1062, description: 'Alternatives priority to set for this Java' +property :repository_uri, String, + description: 'URI for the repository mirror (e.g., "https://custom-mirror.example.com/openjdk/ubuntu")' + use 'partial/_common' use 'partial/_linux' use 'partial/_openjdk' @@ -29,7 +32,7 @@ action :install do if platform?('ubuntu') apt_repository 'openjdk-r-ppa' do - uri 'ppa:openjdk-r' + uri new_resource.repository_uri || 'ppa:openjdk-r' end end diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index efec3733..5eef5e0a 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -9,7 +9,7 @@ property :url, String, default: lazy { default_openjdk_url(version, variant) }, - description: 'The URL to download from' + description: 'The URL to download from. Can be an internal mirror URL (e.g., "https://internal-mirror.example.com/java/openjdk/").' property :checksum, String, regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, diff --git a/resources/temurin_package_install.rb b/resources/temurin_package_install.rb index e9781bb3..0a7b5b43 100644 --- a/resources/temurin_package_install.rb +++ b/resources/temurin_package_install.rb @@ -27,12 +27,15 @@ def default_temurin_pkg_name(version) default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version' +property :repository_uri, String, + description: 'URI for the repository mirror (e.g., "https://custom-mirror.example.com/artifactory/deb")' + use 'partial/_common' use 'partial/_linux' action :install do apt_repository 'adoptium' do - uri 'https://packages.adoptium.net/artifactory/deb' + uri new_resource.repository_uri || 'https://packages.adoptium.net/artifactory/deb' components ['main'] distribution lazy { node['lsb']['codename'] || node['debian']['distribution_codename'] } # TODO: https://github.com/chef/chef/pull/15043 @@ -45,7 +48,7 @@ def default_temurin_pkg_name(version) yum_repository 'adoptium' do description 'Eclipse Adoptium' - baseurl value_for_platform( + baseurl new_resource.repository_uri || value_for_platform( 'amazon' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/amazonlinux/2/$basearch' }, 'centos' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/centos/$releasever/$basearch' }, 'fedora' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/fedora/$releasever/$basearch' }, @@ -63,7 +66,7 @@ def default_temurin_pkg_name(version) zypper_repository 'adoptium' do description 'Eclipse Adoptium' - baseurl 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch' + baseurl new_resource.repository_uri || 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch' gpgcheck true gpgkey 'https://packages.adoptium.net/artifactory/api/gpg/key/public' action :create diff --git a/test/integration/temurin_mirror/inspec.yml b/test/integration/temurin_mirror/inspec.yml new file mode 100644 index 00000000..e69de29b From d4d971e6a1c3dceb84e183d1fc07860aae1f620b Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 10:57:58 +0100 Subject: [PATCH 251/278] Update changelog for 13.2.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a0077d..ea01300b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 13.2.0 - *2025-07-14* - Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728)) - Clarify documentation for `url` property in `openjdk_source_install` resource to note it can be used for internal mirrors From abd9c7a89c86149b255c6b8d0d40f4cdf2c4ed27 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 10:57:58 +0100 Subject: [PATCH 252/278] Update metadata for 13.2.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 75601340..6bb55d2a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '13.1.0' +version '13.2.0' supports 'debian' supports 'ubuntu' From bfa53a8708ba5739913c13c02b2a6a28110b1b10 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 14 Jul 2025 10:58:02 +0100 Subject: [PATCH 253/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea01300b..1531855e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 13.2.0 - *2025-07-14* - Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728)) From a6bfaa9a1228757e1d507b4734f934eb6dcbf3e0 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 16 Jul 2025 11:20:29 +0100 Subject: [PATCH 254/278] Remove partial Semeru support (#731) - It looks like the install is provided mainly via a straight package download from GitHub. In this case, this cookbook is not useful in supporting that install method Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 2 - CHANGELOG.md | 2 + bin/check_java_versions.rb | 5 --- kitchen.yml | 22 +-------- libraries/openjdk_helpers.rb | 20 ++------- resources/partial/_openjdk.rb | 2 +- spec/libraries/semeru_helpers_spec.rb | 64 --------------------------- 7 files changed, 7 insertions(+), 110 deletions(-) delete mode 100644 spec/libraries/semeru_helpers_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d091bb6..85aecdca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,6 @@ jobs: - temurin-11 - temurin-17 - temurin-21 - # - semeru-11 - # - semeru-17 fail-fast: false steps: - name: Check out code diff --git a/CHANGELOG.md b/CHANGELOG.md index 1531855e..1fd4abc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +- Remove Semeru support as there is no clean yum or apt repository for it + ## 13.2.0 - *2025-07-14* - Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728)) diff --git a/bin/check_java_versions.rb b/bin/check_java_versions.rb index bb6336ea..d2a778ea 100755 --- a/bin/check_java_versions.rb +++ b/bin/check_java_versions.rb @@ -9,11 +9,6 @@ '17' => 'adoptium/temurin17-binaries', }.freeze -SEMERU_REPOS = { - '11' => 'ibmruntimes/semeru11-binaries', - '17' => 'ibmruntimes/semeru17-binaries', -}.freeze - CORRETTO_REPOS = { '11' => 'corretto-11', '17' => 'corretto-17', diff --git a/kitchen.yml b/kitchen.yml index 14ae3f34..122ee54c 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -47,7 +47,7 @@ suites: inspec_tests: [test/integration/openjdk] inputs: { java_version: "17" } - # Temurin/Semeru + # Temurin - name: temurin-8 run_list: - recipe[test::temurin_pkg] @@ -87,26 +87,6 @@ suites: - test/integration/temurin inputs: { java_version: "21" } - - name: semeru-11 - run_list: - - recipe[test::openjdk] - attributes: - version: 11 - variant: semeru - verifier: - inspec_tests: [test/integration/openjdk] - inputs: { java_version: "11" } - - - name: semeru-17 - run_list: - - recipe[test::openjdk] - attributes: - version: 17 - variant: semeru - verifier: - inspec_tests: [test/integration/openjdk] - inputs: { java_version: "17" } - # Corretto - name: corretto-8 run_list: diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index e07851e5..1cde1059 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -46,20 +46,6 @@ def default_openjdk_url(version, variant = 'openjdk') Chef::Log.fatal('Version specified does not have a URL value set') raise 'Version supplied does not have a download URL set' end - when 'semeru' - case version - when '11' - 'https://github.com/ibmruntimes/semeru11-binaries/releases/download/jdk-11.0.14.1%2B1_openj9-0.30.1/ibm-semeru-open-jdk_x64_linux_11.0.14.1_1_openj9-0.30.1.tar.gz' - when '16' - 'https://github.com/ibmruntimes/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.1/ibm-semeru-open-jdk_ppc64le_linux_16.0.2_7_openj9-0.27.1.tar.gz' - when '17' - 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' - when '18' - 'https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.1%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_18.0.1_10_openj9-0.32.0.tar.gz' - else - Chef::Log.fatal('Version specified does not have a URL value set') - raise 'Version supplied does not have a download URL set' - end else case version when '9' @@ -128,8 +114,8 @@ def default_openjdk_pkg_names(version) end def default_openjdk_pkg_java_home(version) - # For both standard OpenJDK and Temurin/Semeru variants, use the standard OpenJDK paths - # Temurin and Semeru variants are installed using package managers with standard paths + # For both standard OpenJDK and Temurin variants, use the standard OpenJDK paths + # Temurin variant is installed using package managers with standard paths # Map architecture to the correct suffix used in Java paths arch = case node['kernel']['machine'] @@ -143,7 +129,7 @@ def default_openjdk_pkg_java_home(version) node['kernel']['machine'] end - # For Debian-based systems, Temurin and standard OpenJDK use the same path structure + # For Debian-based systems, Temurin variant uses the same path structure # with architecture-specific suffixes value_for_platform_family( %w(rhel fedora) => version.to_i < 11 ? "/usr/lib/jvm/java-1.#{version}.0" : "/usr/lib/jvm/java-#{version}", diff --git a/resources/partial/_openjdk.rb b/resources/partial/_openjdk.rb index a0c93f3e..d51c680b 100644 --- a/resources/partial/_openjdk.rb +++ b/resources/partial/_openjdk.rb @@ -1,4 +1,4 @@ property :variant, String, - equal_to: %w(openjdk semeru temurin), + equal_to: %w(openjdk temurin), default: 'openjdk', description: 'Install flavour' diff --git a/spec/libraries/semeru_helpers_spec.rb b/spec/libraries/semeru_helpers_spec.rb deleted file mode 100644 index c608a783..00000000 --- a/spec/libraries/semeru_helpers_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -require 'spec_helper' - -RSpec.describe Java::Cookbook::OpenJdkHelpers do - class DummyClass < Chef::Node - include Java::Cookbook::OpenJdkHelpers - end - - subject { DummyClass.new } - - describe '#sub_dir' do - before do - allow(subject).to receive(:[]).with('url').and_return(url) - end - - context 'OpenJDK Semeru 17' do - let(:url) { 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' } - - it 'returns the correct folder name' do - expect(subject.sub_dir(url)).to eq 'jdk-17.0.2-b8' - end - end - - context 'Malformed URL' do - let(:url) { 'a\bad/path/\to\/some.tar.gz' } - - it 'throws an error' do - expect { subject.sub_dir(url) }.to raise_error(URI::InvalidURIError) - end - end - end - - describe '#defaul_openjdk_url' do - before do - allow(subject).to receive(:[]).with('version').and_return(version) - end - - context 'Semeru 11' do - let(:version) { '11' } - let(:variant) { 'semeru' } - - it 'returns the correct URL' do - expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru11-binaries/releases/download/jdk-11.0.14.1%2B1_openj9-0.30.1/ibm-semeru-open-jdk_x64_linux_11.0.14.1_1_openj9-0.30.1.tar.gz' - end - end - - context 'Semeru 16' do - let(:version) { '16' } - let(:variant) { 'semeru' } - - it 'returns the correct URL' do - expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.1/ibm-semeru-open-jdk_ppc64le_linux_16.0.2_7_openj9-0.27.1.tar.gz' - end - end - - context 'Semeru 17' do - let(:version) { '17' } - let(:variant) { 'semeru' } - - it 'returns the correct URL' do - expect(subject.default_openjdk_url(version, variant)).to eq 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.2%2B8_openj9-0.30.0/ibm-semeru-open-jdk_x64_linux_17.0.2_8_openj9-0.30.0.tar.gz' - end - end - end -end From 87c2de03da3d149595f9eff0a265dc2f02d5beea Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 16 Jul 2025 11:20:34 +0100 Subject: [PATCH 255/278] Update changelog for 14.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd4abc9..a15068d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 14.0.0 - *2025-07-16* - Remove Semeru support as there is no clean yum or apt repository for it From 44206a661125d16d6c2578e197588f917ddfacc3 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 16 Jul 2025 11:20:35 +0100 Subject: [PATCH 256/278] Update metadata for 14.0.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 6bb55d2a..9c0051fc 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '13.2.0' +version '14.0.0' supports 'debian' supports 'ubuntu' From a76591ab709045bc49408d19426294aeb2e5c88e Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 16 Jul 2025 11:20:39 +0100 Subject: [PATCH 257/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a15068d7..6b8ff6bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 14.0.0 - *2025-07-16* - Remove Semeru support as there is no clean yum or apt repository for it From cfc3652fd1a3b4e8f04d0cbe82b4f6b77f0e8e08 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:04:12 -0700 Subject: [PATCH 258/278] chore(deps): update actions/checkout action to v5 (#732) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85aecdca..243e2a5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Chef uses: actionshub/chef-install@3.0.1 - name: Dokken From e21839837bc39ddbe9f9484ceadb68e336c29153 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 4 Sep 2025 19:04:16 +0100 Subject: [PATCH 259/278] Update changelog for 14.0.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b8ff6bd..277a4573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This file is used to list changes made in each version of the Java cookbook. -## Unreleased +## 14.0.1 - *2025-09-04* ## 14.0.0 - *2025-07-16* From 9314de7127987064c82b4ec8002260314e107318 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 4 Sep 2025 19:04:17 +0100 Subject: [PATCH 260/278] Update metadata for 14.0.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 9c0051fc..b491406f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 16.0' -version '14.0.0' +version '14.0.1' supports 'debian' supports 'ubuntu' From a6bd1a5026c93b77b2bc13a2475f2e00a1b4f854 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Thu, 4 Sep 2025 19:04:21 +0100 Subject: [PATCH 261/278] Set Changelog to ## Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 277a4573..024b9a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This file is used to list changes made in each version of the Java cookbook. +## Unreleased + ## 14.0.1 - *2025-09-04* ## 14.0.0 - *2025-07-16* From 8b1c1459f946120c4f0a8fd9781e7b51e6d39f80 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:18:07 -0700 Subject: [PATCH 262/278] chore(deps): update actions/stale action to v10 (#735) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d4dae8fc..d9e5240b 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@v10 with: repo-token: ${{ secrets.GITHUB_TOKEN }} close-issue-message: > From 93e714c792e882e8b47dba4c08ad266939d3e665 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 09:29:47 -0700 Subject: [PATCH 263/278] chore(deps): update sous-chefs/.github action to v4 (#736) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 243e2a5d..79433322 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@4.0.0 permissions: actions: write checks: write From b6085cd4feca6bc907382b867163f0ca526dff2e Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Wed, 17 Sep 2025 22:03:24 +0100 Subject: [PATCH 264/278] Standardise files with files in sous-chefs/repo-management (#738) Signed-off-by: kitchen-porter --- CHANGELOG.md | 2 ++ kitchen.dokken.yml | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 024b9a8d..16b6910c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the Java cookbook. ## Unreleased +Standardise files with files in sous-chefs/repo-management + ## 14.0.1 - *2025-09-04* ## 14.0.0 - *2025-07-16* diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 998bb20c..1d8623e0 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -37,16 +37,16 @@ platforms: image: dokken/centos-stream-10 pid_one_command: /usr/lib/systemd/systemd - - name: debian-11 - driver: - image: dokken/debian-11 - pid_one_command: /bin/systemd - - name: debian-12 driver: image: dokken/debian-12 pid_one_command: /bin/systemd + - name: debian-13 + driver: + image: dokken/debian-13 + pid_one_command: /usr/lib/systemd/systemd + - name: fedora-latest driver: image: dokken/fedora-latest @@ -77,6 +77,11 @@ platforms: image: dokken/rockylinux-9 pid_one_command: /usr/lib/systemd/systemd + - name: rockylinux-10 + driver: + image: dokken/rockylinux-10 + pid_one_command: /usr/lib/systemd/systemd + - name: ubuntu-20.04 driver: image: dokken/ubuntu-20.04 From 6dcbf88334f883bec6bb6e6c46f3f66e4b254eed Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Fri, 19 Sep 2025 16:54:25 +0100 Subject: [PATCH 265/278] Standardise files with files in sous-chefs/repo-management (#739) Signed-off-by: kitchen-porter --- .github/copilot-instructions.md | 95 +++++++++++++++++++++++++++++++++ CHANGELOG.md | 2 + 2 files changed, 97 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..e1084932 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,95 @@ +# Copilot Instructions for Sous Chefs Cookbooks + +## Repository Overview + +**Chef cookbook** for managing software installation and configuration. Part of the Sous Chefs cookbook ecosystem. + +**Key Facts:** Ruby-based, Chef >= 16 required, supports various OS platforms (check metadata.rb, kitchen.yml and .github/workflows/ci.yml for which platforms to specifically test) + +## Project Structure + +**Critical Paths:** +- `recipes/` - Chef recipes for cookbook functionality (if this is a recipe-driven cookbook) +- `resources/` - Custom Chef resources with properties and actions (if this is a resource-driven cookbook) +- `spec/` - ChefSpec unit tests +- `test/integration/` - InSpec integration tests (tests all platforms supported) +- `test/cookbooks/` or `test/fixtures/` - Example cookbooks used during testing that show good examples of custom resource usage +- `attributes/` - Configuration for recipe driven cookbooks (not applicable to resource cookbooks) +- `libraries/` - Library helpers to assist with the cookbook. May contain multiple files depending on complexity of the cookbook. +- `templates/` - ERB templates that may be used in the cookbook +- `files/` - files that may be used in the cookbook +- `metadata.rb`, `Berksfile` - Cookbook metadata and dependencies + +## Build and Test System + +### Environment Setup +**MANDATORY:** Install Chef Workstation first - provides chef, berks, cookstyle, kitchen tools. + +### Essential Commands (strict order) +```bash +berks install # Install dependencies (always first) +cookstyle # Ruby/Chef linting +yamllint . # YAML linting +markdownlint-cli2 '**/*.md' # Markdown linting +chef exec rspec # Unit tests (ChefSpec) +# Integration tests will be done via the ci.yml action. Do not run these. Only check the action logs for issues after CI is done running. +``` + +### Critical Testing Details +- **Kitchen Matrix:** Multiple OS platforms × software versions (check kitchen.yml for specific combinations) +- **Docker Required:** Integration tests use Dokken driver +- **CI Environment:** Set `CHEF_LICENSE=accept-no-persist` +- **Full CI Runtime:** 30+ minutes for complete matrix + +### Common Issues and Solutions +- **Always run `berks install` first** - most failures are dependency-related +- **Docker must be running** for kitchen tests +- **Chef Workstation required** - no workarounds, no alternatives +- **Test data bags needed** (optional for some cookbooks) in `test/integration/data_bags/` for convergence + +## Development Workflow + +### Making Changes +1. Edit recipes/resources/attributes/templates/libraries +2. Update corresponding ChefSpec tests in `spec/` +3. Also update any InSpec tests under test/integration +4. Ensure cookstyle and rspec passes at least. You may run `cookstyle -a` to automatically fix issues if needed. +5. Also always update all documentation found in README.md and any files under documentation/* +6. **Always update CHANGELOG.md** (required by Dangerfile) - Make sure this conforms with the Sous Chefs changelog standards. + +### Pull Request Requirements +- **PR description >10 chars** (Danger enforced) +- **CHANGELOG.md entry** for all code changes +- **Version labels** (major/minor/patch) required +- **All linters must pass** (cookstyle, yamllint, markdownlint) +- **Test updates** needed for code changes >5 lines and parameter changes that affect the code logic + +## Chef Cookbook Patterns + +### Resource Development +- Custom resources in `resources/` with properties and actions +- Include comprehensive ChefSpec tests for all actions +- Follow Chef resource DSL patterns + +### Recipe Conventions +- Use `include_recipe` for modularity +- Handle platforms with `platform_family?` conditionals +- Use encrypted data bags for secrets (passwords, SSL certs) +- Leverage attributes for configuration with defaults + +### Testing Approach +- **ChefSpec (Unit):** Mock dependencies, test recipe logic in `spec/` +- **InSpec (Integration):** Verify actual system state in `test/integration/inspec/` - InSpec files should contain proper inspec.yml and controls directories so that it could be used by other suites more easily. +- One test file per recipe, use standard Chef testing patterns + +## Trust These Instructions + +These instructions are validated for Sous Chefs cookbooks. **Do not search for build instructions** unless information here fails. + +**Error Resolution Checklist:** +1. Verify Chef Workstation installation +2. Confirm `berks install` completed successfully +3. Ensure Docker is running for integration tests +4. Check for missing test data dependencies + +The CI system uses these exact commands - following them matches CI behavior precisely. diff --git a/CHANGELOG.md b/CHANGELOG.md index 16b6910c..af7b6d58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This file is used to list changes made in each version of the Java cookbook. Standardise files with files in sous-chefs/repo-management +Standardise files with files in sous-chefs/repo-management + ## 14.0.1 - *2025-09-04* ## 14.0.0 - *2025-07-16* From ff7a749685473efe072358e67c85d48c053db6aa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 10:49:34 +0100 Subject: [PATCH 266/278] chore(deps): update sous-chefs/.github action to v5 (#741) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79433322..a1129a2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@4.0.0 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@5.0.3 permissions: actions: write checks: write From b77e2a2ffb6cfd3103a5924bc41014a31b6405b2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 14:06:23 +0000 Subject: [PATCH 267/278] chore(deps): update sous-chefs/.github action to v5.0.8 (#744) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1129a2d..5db87b6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@5.0.3 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@5.0.8 permissions: actions: write checks: write From 5c3f2817aeb0ec0ea9e6e98f4be2ba8352e76f80 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 7 Jan 2026 23:03:11 +0000 Subject: [PATCH 268/278] platforms (#748) * fix: Debian suites Signed-off-by: Dan Webb * Switch Debian 11 for 13 Signed-off-by: Dan Webb --------- Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 25 ++++++++++++++++++ kitchen.yml | 49 +++++++++++++++++++---------------- 3 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5db87b6e..00142900 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: os: - amazonlinux-2023 - debian-12 - - debian-11 + - debian-13 - rockylinux-9 - rockylinux-8 - ubuntu-2204 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..6d78aa6b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +--- +name: release + + +"on": + push: + branches: [main] + +permissions: + contents: write + issues: write + pull-requests: write + packages: write + attestations: write + id-token: write + +jobs: + release: + uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@main + secrets: + token: ${{ secrets.PORTER_GITHUB_TOKEN }} + supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }} + supermarket_key: ${{ secrets.CHEF_SUPERMARKET_KEY }} + slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }} + slack_channel_id: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/kitchen.yml b/kitchen.yml index 122ee54c..21f690a0 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -13,7 +13,7 @@ verifier: platforms: - name: amazonlinux-2023 - name: debian-12 - - name: debian-11 + - name: debian-13 - name: freebsd-13 - name: fedora-latest - name: rockylinux-9 @@ -31,14 +31,6 @@ suites: inspec_tests: [test/integration/openjdk] inputs: { java_version: "11" } - - name: openjdk-16 - run_list: - - recipe[test::openjdk] - attributes: { version: "16" } - verifier: - inspec_tests: [test/integration/openjdk] - inputs: { java_version: "16" } - - name: openjdk-17 run_list: - recipe[test::openjdk] @@ -48,23 +40,13 @@ suites: inputs: { java_version: "17" } # Temurin - - name: temurin-8 - run_list: - - recipe[test::temurin_pkg] - attributes: - version: 8 - verifier: - inspec_tests: [test/integration/temurin] - inputs: { java_version: "8" } - - name: temurin-11 run_list: - recipe[test::temurin_pkg] attributes: version: 11 verifier: - inspec_tests: - - test/integration/temurin + inspec_tests: [test/integration/temurin] inputs: { java_version: "11" } - name: temurin-17 @@ -87,6 +69,16 @@ suites: - test/integration/temurin inputs: { java_version: "21" } + - name: temurin-25 + run_list: + - recipe[test::temurin_pkg] + attributes: + version: 25 + verifier: + inspec_tests: + - test/integration/temurin + inputs: { java_version: "25" } + # Corretto - name: corretto-8 run_list: @@ -95,6 +87,7 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: { java_version: "8" } + - name: corretto-11 run_list: - recipe[test::corretto] @@ -102,6 +95,7 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: { java_version: "11" } + - name: corretto-17 run_list: - recipe[test::corretto] @@ -109,10 +103,19 @@ suites: verifier: inspec_tests: [test/integration/corretto] inputs: { java_version: "17" } - - name: corretto-18 + + - name: corretto-21 + run_list: + - recipe[test::corretto] + attributes: { version: "21" } + verifier: + inspec_tests: [test/integration/corretto] + inputs: { java_version: "21" } + + - name: corretto-25 run_list: - recipe[test::corretto] - attributes: { version: "18" } + attributes: { version: "25" } verifier: inspec_tests: [test/integration/corretto] - inputs: { java_version: "18" } + inputs: { java_version: "25" } From cb768e2efe552e842b99affddcc851ebb08da8d2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:33:09 +0000 Subject: [PATCH 269/278] chore(deps): update actions to v6 (#746) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00142900..2ef0c18d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,9 +40,9 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Install Chef - uses: actionshub/chef-install@3.0.1 + uses: actionshub/chef-install@6.0.0 - name: Dokken uses: actionshub/test-kitchen@3.0.0 env: From 5f949dabcb57199550fb00b4af75c3c6328dfd0e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 21 Apr 2026 09:48:56 +0100 Subject: [PATCH 270/278] Update sous-chefs/.github action to v6 (#752) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ef0c18d..cb44831a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@5.0.8 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@6.0.0 permissions: actions: write checks: write From 8d7844b5d1889af62574656c7c3e33904a9e75b5 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 9 Jun 2026 11:18:04 +0100 Subject: [PATCH 271/278] ci: use sous-chefs workflows 8.0.1 (#754) --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb44831a..dd8f9ee8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@6.0.0 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@8.0.1 permissions: actions: write checks: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d78aa6b..5096863d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ permissions: jobs: release: - uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@main + uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@8.0.1 secrets: token: ${{ secrets.PORTER_GITHUB_TOKEN }} supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }} From f2832484ccedf4b277a03080a7b413b80a1c34d5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:58:24 +0100 Subject: [PATCH 272/278] Update Actions to v8.0.2 (#755) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd8f9ee8..4f871f10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@8.0.1 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@8.0.2 permissions: actions: write checks: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5096863d..fe2dca8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ permissions: jobs: release: - uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@8.0.1 + uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@8.0.2 secrets: token: ${{ secrets.PORTER_GITHUB_TOKEN }} supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }} From 14e673eee215a0fb5faca1111399272b04735e4b Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 22 Jun 2026 10:26:33 +0100 Subject: [PATCH 273/278] feat!: remove legacy Java node attribute API (#758) * fix: repair workflow actionlint failures * chore: modernize Java cookbook Replace Berkshelf with Policyfile wiring, tighten CI and Kitchen matrices, and update resource implementations for safer shell usage, explicit provides names, cleanup actions, and stronger ChefSpec coverage. --- .github/workflows/ci.yml | 33 ++++-- .github/workflows/release.yml | 2 +- AGENTS.md | 79 ++++++++++++++ Berksfile | 7 -- Policyfile.rb | 15 +++ README.md | 6 +- documentation/resources/alternatives.md | 8 +- documentation/resources/certificate.md | 22 ++-- documentation/resources/corretto_install.md | 30 ++--- documentation/resources/jce.md | 21 ++-- .../resources/openjdk_pkg_install.md | 24 ++-- .../resources/openjdk_source_install.md | 6 +- .../resources/temurin_package_install.md | 31 +++--- kitchen.dokken.yml | 10 -- kitchen.global.yml | 7 +- kitchen.yml | 53 +++++---- libraries/bin_cmd_helpers.rb | 4 +- libraries/certificate_helpers.rb | 4 +- libraries/corretto_helpers.rb | 2 + libraries/openjdk_helpers.rb | 38 +++++-- libraries/temurin_helpers.rb | 6 +- metadata.rb | 20 ++-- resources/alternatives.rb | 64 ++++------- resources/certificate.rb | 58 ++++++---- resources/corretto_install.rb | 9 +- resources/jce.rb | 96 ++++++++++++---- resources/openjdk_install.rb | 26 +++-- resources/openjdk_pkg_install.rb | 45 ++++---- resources/openjdk_source_install.rb | 46 ++++---- resources/partial/_common.rb | 2 + resources/partial/_java_home.rb | 2 + resources/partial/_linux.rb | 2 + resources/partial/_macos.rb | 2 + resources/partial/_openjdk.rb | 2 + resources/temurin_package_install.rb | 82 ++++++++------ spec/libraries/bin_cmd_helpers_spec.rb | 25 +++++ spec/libraries/certificate_helpers_spec.rb | 4 +- spec/libraries/openjdk_helpers_spec.rb | 103 ++++++++++++++++++ spec/resources/alternatives_spec.rb | 19 ++++ spec/resources/certificate_spec.rb | 19 ++++ spec/resources/corretto_install_spec.rb | 16 +++ spec/resources/jce_spec.rb | 29 +++++ spec/resources/openjdk_install_spec.rb | 40 +++++++ spec/resources/openjdk_pkg_install_spec.rb | 21 ++++ spec/resources/openjdk_source_install_spec.rb | 36 ++++++ .../resources/temurin_package_install_spec.rb | 48 ++++++++ spec/spec_helper.rb | 17 ++- templates/jdk.sh.erb | 1 - .../test/recipes/alternatives_spec.rb | 4 + .../test/recipes/alternatives_unset_spec.rb | 5 + .../test/recipes/certificate_spec.rb | 20 ++++ .../cookbooks/test/recipes/corretto.rb | 11 +- .../cookbooks/test/recipes/corretto_spec.rb | 7 ++ .../cookbooks/test/recipes/java_cert.rb | 6 + .../cookbooks/test/recipes/jce_remove_spec.rb | 9 ++ .../cookbooks/test/recipes/jce_spec.rb | 8 ++ .../test/recipes/openjdk_package_spec.rb | 7 ++ .../test/recipes/openjdk_pkg_spec.rb | 6 + .../recipes/openjdk_source_direct_spec.rb | 7 ++ .../recipes/openjdk_source_remove_spec.rb | 8 ++ .../test/recipes/openjdk_source_spec.rb | 8 ++ .../test/recipes/temurin_package_spec.rb | 4 + .../custom-package/controls/verify_home.rb | 2 +- .../openjdk/controls/verify_openjdk.rb | 11 +- 64 files changed, 1019 insertions(+), 346 deletions(-) create mode 100644 AGENTS.md delete mode 100644 Berksfile create mode 100644 Policyfile.rb create mode 100644 spec/libraries/bin_cmd_helpers_spec.rb create mode 100644 spec/resources/alternatives_spec.rb create mode 100644 spec/resources/certificate_spec.rb create mode 100644 spec/resources/corretto_install_spec.rb create mode 100644 spec/resources/jce_spec.rb create mode 100644 spec/resources/openjdk_install_spec.rb create mode 100644 spec/resources/openjdk_pkg_install_spec.rb create mode 100644 spec/resources/openjdk_source_install_spec.rb create mode 100644 spec/resources/temurin_package_install_spec.rb delete mode 100644 templates/jdk.sh.erb create mode 100644 test/fixtures/cookbooks/test/recipes/alternatives_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/alternatives_unset_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/certificate_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/corretto_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/jce_remove_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/jce_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_package_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_pkg_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_source_direct_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_source_remove_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/temurin_package_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f871f10..b4d4ec9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,13 +8,12 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@8.0.2 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@8.0.4 permissions: - actions: write checks: write pull-requests: write statuses: write - issues: write + secrets: inherit integration: needs: "lint-unit" @@ -22,29 +21,39 @@ jobs: strategy: matrix: os: + - almalinux-8 + - almalinux-9 + - almalinux-10 - amazonlinux-2023 + - centos-stream-9 + - centos-stream-10 - debian-12 - debian-13 - - rockylinux-9 + - fedora-latest + - oraclelinux-8 + - oraclelinux-9 - rockylinux-8 + - rockylinux-9 + - rockylinux-10 - ubuntu-2204 - - ubuntu-2004 + - ubuntu-2404 suite: - - corretto-11 - - corretto-17 - - corretto-18 - - temurin-8 + - openjdk-11 + - openjdk-17 - temurin-11 - temurin-17 - temurin-21 + - temurin-25 + - corretto-11 + - corretto-17 fail-fast: false steps: - name: Check out code uses: actions/checkout@v6 - name: Install Chef - uses: actionshub/chef-install@6.0.0 + uses: sous-chefs/.github/.github/actions/install-workstation@8.0.4 - name: Dokken - uses: actionshub/test-kitchen@3.0.0 + uses: actionshub/test-kitchen@main env: CHEF_LICENSE: accept-no-persist KITCHEN_LOCAL_YAML: kitchen.dokken.yml @@ -56,4 +65,4 @@ jobs: runs-on: ubuntu-latest needs: [integration] steps: - - run: echo ${{needs.integration.outputs}} + - run: echo "integration completed" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe2dca8f..7334bb52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ permissions: jobs: release: - uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@8.0.2 + uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@8.0.4 secrets: token: ${{ secrets.PORTER_GITHUB_TOKEN }} supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..4013626d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,79 @@ +# AGENTS.md + +## Purpose + +This file records maintainer and agent decisions for the Java cookbook. Keep it focused on durable +patterns, support boundaries, and non-obvious implementation choices. Do not use it as a task +changelog. + +## Modernization Scope + +This cookbook is being modernized incrementally. Preserve the existing custom-resource API where it +is still useful, and avoid broad rewrites unless the requested work explicitly calls for a full +migration. + +Prefer resource properties and helper-derived defaults over cookbook node attributes. Do not add +`attributes/` back to provide defaults for resources. + +## Resource Defaults + +Cookbook-owned defaults should live on resources as static defaults, `lazy` helper calls, or helper +methods in `libraries/`. This keeps defaults visible at the resource boundary and testable through +ChefSpec. + +Do not write cookbook state into `node.default`, `node.normal`, `node.override`, or +`node.automatic`. In particular, do not reintroduce `node['java']` as an API surface for +`java_home`, `jdk_version`, `download_path`, install type, JCE values, or similar resource inputs. + +Do not create custom Ohai plugins for cookbook defaults. Ohai automatic attributes should describe +discovered machine facts, not cookbook policy or resource configuration. + +## Platform Support + +Keep `metadata.rb`, Kitchen files, and GitHub Actions matrices aligned. Platform entries should be +current, non-EOL, and backed by either vendor support or explicit cookbook helper behavior. + +OpenJDK package installs use the platform package manager where helper logic supports the requested +Java version. Source installs remain the fallback when a requested version is not available through +the package path. + +## Dependency Management + +Use `Policyfile.rb` for dependency resolution. Keep it local-only unless a real external cookbook +dependency is introduced. Do not add `default_source :supermarket` when every cookbook in the policy +is supplied by a path. + +Avoid external cookbook dependencies for simple file edits in custom resources. Prefer native Chef +resources so unit tests and Kitchen do not need to contact Supermarket during Policyfile setup. + +Do not reintroduce Berkshelf files or ChefSpec Berkshelf loading unless there is an explicit +compatibility reason. + +## Resource Notes + +`java_alternatives` accepts `bin_cmds` as an Array. Its public actions are `:set` and `:unset`. +Keep both actions covered by ChefSpec when changing alternatives behavior. + +Linux install resources that include the shared Linux partial (`openjdk_pkg_install`, +`openjdk_source_install`, `openjdk_install`, `corretto_install`, and `temurin_package_install`) +default `reset_alternatives` to `true` through that partial. + +`java_certificate` should provide sensible resource defaults without reading `node['java']`. +Current defaults are Java 17 and a platform-specific OpenJDK package `java_home` derived from helper +logic. + +`java_jce` documents legacy Oracle JCE policy file installation only. It should not be described as +a general Java vendor installation path. JCE URL, checksum, and Java home are explicit resource +inputs; staging defaults to Chef's file cache path. + +`temurin_package_install` does not have an `air_gap` property. It supports `repository_uri` for +alternate or mirrored package repositories. The resource must not make live Adoptium API calls while +evaluating defaults. + +Amazon Corretto installs are source archive based and support the architecture-specific Corretto +archive naming handled by helper code (`x64` and `aarch64`). Kitchen and CI cover Corretto 11 and 17 +only; do not add Corretto suites for other majors unless `libraries/corretto_helpers.rb`, docs, and +tests are updated with explicit archive metadata. + +`openjdk_source_install` documentation examples should call `openjdk_source_install`, not the +dispatcher resource `openjdk_install`. diff --git a/Berksfile b/Berksfile deleted file mode 100644 index e09849c7..00000000 --- a/Berksfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://supermarket.chef.io' - -metadata - -group :integration do - cookbook 'test', path: 'test/fixtures/cookbooks/test' -end diff --git a/Policyfile.rb b/Policyfile.rb new file mode 100644 index 00000000..9fea7a53 --- /dev/null +++ b/Policyfile.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +name 'java' + +cookbook 'java', path: '.' +cookbook 'test', path: 'test/fixtures/cookbooks/test' + +run_list 'test::base' + +named_run_list :base, 'test::base' +named_run_list :openjdk, 'test::openjdk' +named_run_list :openjdk_pkg, 'test::openjdk_pkg' +named_run_list :temurin_pkg, 'test::temurin_pkg' +named_run_list :corretto, 'test::corretto' +named_run_list :java_cert, 'test::java_cert' diff --git a/README.md b/README.md index 1673d7af..65664747 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) -This cookbook installs a Java JDK/JRE. It defaults to installing [OpenJDK](https://openjdk.java.net/), but it can also install [AdoptOpenJDK](https://adoptopenjdk.net/) and [Amazon Corretto](https://corretto.aws/). +This cookbook installs a Java JDK/JRE. It defaults to installing [OpenJDK](https://openjdk.java.net/), but it can also install [Eclipse Temurin](https://adoptium.net/temurin/) and [Amazon Corretto](https://corretto.aws/). ## Maintainers @@ -25,14 +25,14 @@ Chef 15.3+ ## Resources -- [adoptopenjdk_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/adoptopenjdk_install.md) -- [adoptopenjdk_macos_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/adoptopenjdk_macos_install.md) - [alternatives](https://github.com/sous-chefs/java/blob/master/documentation/resources/alternatives.md) - [certificate](https://github.com/sous-chefs/java/blob/master/documentation/resources/certificate.md) - [corretto_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/corretto_install.md) - [jce](https://github.com/sous-chefs/java/blob/master/documentation/resources/jce.md) - [openjdk_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/openjdk_install.md) - [openjdk_pkg_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/openjdk_pkg_install.md) +- [openjdk_source_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/openjdk_source_install.md) +- [temurin_package_install](https://github.com/sous-chefs/java/blob/master/documentation/resources/temurin_package_install.md) ## Contributors diff --git a/documentation/resources/alternatives.md b/documentation/resources/alternatives.md index 902e4f6b..cb599c9d 100644 --- a/documentation/resources/alternatives.md +++ b/documentation/resources/alternatives.md @@ -15,10 +15,10 @@ The `java_alternatives` resource uses `update-alternatives` command to set and u | Name | Type | Default | Description | | -------------------- | ------------- | ------- | ---------------------------------------------------------------------------- | | `java_location` | `String` | | Java installation location | -| `bin_cmds` | `String` | | Array of Java tool names to set or unset alternatives on | +| `bin_cmds` | `Array` | | Array of Java tool names to set or unset alternatives on | | `default` | `true, false` | `true` | Whether to set the Java tools as system default. Boolean, defaults to `true` | | `priority` | `Integer` | `1061` | Priority of the alternatives. Integer, defaults to `1061` | -| `reset_alternatives` | `true, false` | `true` | Whether to reset alternatives before setting them | +| `reset_alternatives` | `true, false` | `false` | Whether to reset alternatives before setting them | - `java_location`: Java installation location. - `bin_cmds`: . @@ -29,7 +29,7 @@ The `java_alternatives` resource uses `update-alternatives` command to set and u ```ruby java_alternatives "set java alternatives" do - java_location '/usr/local/java' - bin_cmds ["java", "javac"] + java_location '/usr/local/java' + bin_cmds ["java", "javac"] end ``` diff --git a/documentation/resources/certificate.md b/documentation/resources/certificate.md index 019f1a77..864c0c87 100644 --- a/documentation/resources/certificate.md +++ b/documentation/resources/certificate.md @@ -13,17 +13,17 @@ It can also populate the keystore with a certificate retrieved from a given SSL ## Properties -| Name | Type | Default | Description | -| ----------------- | ------ | --------------------------- | --------------------------------------------------------------------------------------- | -| `java_home` | | `node['java']['java_home']` | The java home directory | -| `java_version` | | `node['java']['jdk_version']` | The java version | -| `keystore_path` | String | | Path to the keystore | -| `keystore_passwd` | String | `changeit` | Password to the keystore | -| `cert_alias` | String | | The alias of the certificate in the keystore. This defaults to the name of the resource | -| `cert_data` | String | | The certificate data to install | -| `cert_file` | String | | Path to a certificate file to install | -| `ssl_endpoint` | String | | An SSL end-point from which to download the certificate | -| `starttls` | String | | Control the TLS protocol handler when fetching a remote certificate from `ssl_endpoint` | +| Name | Type | Default | Description | +| --- | --- | --- | --- | +| `java_home` | String | Platform-specific path for `java_version` | The java home directory | +| `java_version` | String | `17` | The java version | +| `keystore_path` | String | | Path to the keystore | +| `keystore_passwd` | String | `changeit` | Password to the keystore | +| `cert_alias` | String | | The alias of the certificate in the keystore. This defaults to the name of the resource | +| `cert_data` | String | | The certificate data to install | +| `cert_file` | String | | Path to a certificate file to install | +| `ssl_endpoint` | String | | An SSL end-point from which to download the certificate | +| `starttls` | String | | Control the TLS protocol handler when fetching a remote certificate from `ssl_endpoint` | ## Examples diff --git a/documentation/resources/corretto_install.md b/documentation/resources/corretto_install.md index 2c078524..58e9fddf 100644 --- a/documentation/resources/corretto_install.md +++ b/documentation/resources/corretto_install.md @@ -14,21 +14,21 @@ Introduced: v8.0.0 ## Properties -| Name | Type | Default | Description | -| --------------------- | --------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | -| version | String | | Java version to install | -| full_version | String | | Used to configure the package directory, change this is the version installed by the package is no longer correct | -| url | String | `default_corretto_url(version)` | The URL to download from | -| checksum | String | | The checksum for the downloaded file | -| java_home | String | Based on the version | Set to override the java_home | -| java_home_mode | Integer, String | `0755` | The permission for the Java home directory | -| java_home_owner | String | `root` | Owner of the Java Home | -| java_home_group | String | `node['root_group']` | Group for the Java Home | -| default | Boolean | `true` | Whether to set this as the default Java | -| bin_cmds | Array | `default_corretto_bin_cmds(version)` | A list of bin_cmds based on the version and variant | -| alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | -| reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | -| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | +| Name | Type | Default | Description | +| --- | --- | --- | --- | +| version | String | | Java version to install | +| full_version | String | | Used to configure the package directory, change this is the version installed by the package is no longer correct | +| url | String | `default_corretto_url(version)` | The URL to download from | +| checksum | String | | The checksum for the downloaded file | +| java_home | String | Based on the version | Set to override the java_home | +| java_home_mode | Integer, String | `0755` | The permission for the Java home directory | +| java_home_owner | String | `root` | Owner of the Java Home | +| java_home_group | String | `node['root_group']` | Group for the Java Home | +| default | Boolean | `true` | Whether to set this as the default Java | +| bin_cmds | Array | `default_corretto_bin_cmds(version)` | A list of bin_cmds based on the version and variant | +| alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | +| reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | +| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | ## Examples diff --git a/documentation/resources/jce.md b/documentation/resources/jce.md index d0714855..3a154fa1 100644 --- a/documentation/resources/jce.md +++ b/documentation/resources/jce.md @@ -8,18 +8,21 @@ ## Actions - `:install`: Installs the JCE policy files. +- `:remove`: Removes the staged JCE policy files, archive, and managed policy symlinks. ## Properties -| Name | Type | Default | Description | -| -------------- | ------ | -------------------------------------------------------- | -------------------------------------------------------------------------- | -| `jdk_version` | String | `node['java']['jdk_version']` | The Java version to install into | -| `jce_url` | String | `node['java']['oracle']['jce'][jdk_version]['url']` | The URL for the JCE distribution | -| `jce_checksum` | String | `node['java']['oracle']['jce'][jdk_version]['checksum']` | The checksum of the JCE distribution | -| `jce_cookie` | String | `node['java']['oracle']['accept_oracle_download_terms']` | Indicates that you accept Oracle's EULA | -| `jce_home` | String | `node['java']['oracle']['jce']['home']` | The location where JCE files will be decompressed for installation | -| `java_home` | String | `node['java']['java_home']` | The location of the Java installation | -| `principal` | String | `node['java']['windows']['owner']` | For Windows installations only, this determines the owner of the JCE files | +| Name | Type | Default | Description | +| --------------- | ------ | -------------------------------------------------------- | -------------------------------------------------------------------------- | +| `jdk_version` | String | Resource name | The Java version to install into | +| `jce_url` | String | Required | The URL for the JCE distribution | +| `jce_checksum` | String | Required | The checksum of the JCE distribution | +| `jce_cookie` | String | `''` | Indicates that you accept Oracle's EULA | +| `jce_home` | String | `/usr/lib/jvm/jce` | The location where JCE files will be decompressed for installation | +| `java_home` | String | Required | The location of the Java installation | +| `principal` | String | `administrator` | For Windows installations only, this determines the owner of the JCE files | +| `download_path` | String | Chef file cache path | Path used to stage the JCE archive | +| `install_type` | String | `jdk` | Whether the Java install is a jdk or jre layout | ## Examples diff --git a/documentation/resources/openjdk_pkg_install.md b/documentation/resources/openjdk_pkg_install.md index b135c291..885d5bb1 100644 --- a/documentation/resources/openjdk_pkg_install.md +++ b/documentation/resources/openjdk_pkg_install.md @@ -14,18 +14,18 @@ Introduced: v8.1.0 ## Properties -| Name | Type | Default | Description | -| --------------------- | ------- | ------------------------------------ | --------------------------------------------------- | -| version | String | | Java major version to install | -| pkg_names | Array | `default_openjdk_pkg_names(version)` | List of packages to install | -| pkg_version | String | `nil` | Package version to install | -| java_home | String | Based on the version | Set to override the java_home | -| default | Boolean | `true` | Whether to set this as the default Java | -| bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | -| alternatives_priority | Integer | `1062` | Alternatives priority to set for this Java | -| reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | -| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | -| repository_uri | String | `nil` | URI for the repository mirror to use instead of default repository URLs | +| Name | Type | Default | Description | +| --- | --- | --- | --- | +| version | String | | Java major version to install | +| pkg_names | Array | `default_openjdk_pkg_names(version)` | List of packages to install | +| pkg_version | String | `nil` | Package version to install | +| java_home | String | Based on the version | Set to override the java_home | +| default | Boolean | `true` | Whether to set this as the default Java | +| bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | +| alternatives_priority | Integer | `1062` | Alternatives priority to set for this Java | +| reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | +| skip_alternatives | Boolean | `false` | Skip alternatives installation completely | +| repository_uri | String | `nil` | URI for the repository mirror to use instead of default repository URLs | ## Examples diff --git a/documentation/resources/openjdk_source_install.md b/documentation/resources/openjdk_source_install.md index c6d2f11b..7032ba8d 100644 --- a/documentation/resources/openjdk_source_install.md +++ b/documentation/resources/openjdk_source_install.md @@ -24,7 +24,7 @@ Introduced: v8.0.0 | java_home_owner | String | `root` | Owner of the Java Home | | java_home_group | String | `node['root_group']` | Group for the Java Home | | default | Boolean | `true` | Whether to set this as the default Java | -| bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | +| bin_cmds | Array | `default_bin_cmds(version)` | A list of bin_cmds based on the version and variant | | alternatives_priority | Integer | `1` | Alternatives priority to set for this Java | | reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting | | skip_alternatives | Boolean | `false` | Skip alternatives installation completely | @@ -34,13 +34,13 @@ Introduced: v8.0.0 To install OpenJDK 11 and set it as the default Java: ```ruby -openjdk_install '11' +openjdk_source_install '11' ``` To install OpenJDK 11 and set it as second highest priority: ```ruby -openjdk_install '11' do +openjdk_source_install '11' do alternatives_priority 2 end ``` diff --git a/documentation/resources/temurin_package_install.md b/documentation/resources/temurin_package_install.md index 82e9779c..a1965f8a 100644 --- a/documentation/resources/temurin_package_install.md +++ b/documentation/resources/temurin_package_install.md @@ -2,7 +2,7 @@ [back to resource list](https://github.com/sous-chefs/java#resources) -Installs Java Temurin (AdoptOpenJDK) packages provided by Adoptium. This resource handles the repository setup and package installation for Temurin JDK packages across various platforms. +Installs Eclipse Temurin packages provided by Adoptium. This resource handles the repository setup and package installation for Temurin JDK packages across various platforms. Introduced: v12.0.0 @@ -13,19 +13,18 @@ Introduced: v12.0.0 ## Properties -| Property | Type | Default | Description | -|-----------------------|----------------|----------------------------------------|----------------------------------------------| -| `version` | String | Name Property | Java version to install (e.g. '8', '11', '17') | -| `pkg_name` | String | `temurin-#{version}-jdk` | Package name to install | -| `pkg_version` | String | `nil` | Package version to install | -| `java_home` | String | Platform-specific JAVA_HOME | Path to set as JAVA_HOME | -| `bin_cmds` | Array | Version-specific binary commands | Commands for alternatives | -| `alternatives_priority` | Integer | 1062 | Priority for alternatives system | -| `reset_alternatives` | Boolean | true | Whether to reset alternatives before setting | -| `default` | Boolean | true | Whether to set this as the default Java | -| `skip_alternatives` | Boolean | false | Skip alternatives installation completely | -| `repository_uri` | String | `nil` | URI for the repository mirror to use instead of default repository URLs | -| air_gap | Boolean | false | Whether to install in air-gap mode | +| Property | Type | Default | Description | +| --- | --- | --- | --- | +| `version` | String | Name Property | Java version to install (e.g. '8', '11', '17') | +| `pkg_name` | String | `temurin-#{version}-jdk` | Package name to install | +| `pkg_version` | String | `nil` | Package version to install | +| `java_home` | String | Platform-specific JAVA_HOME | Path to set as JAVA_HOME | +| `bin_cmds` | Array | Version-specific binary commands | Commands for alternatives | +| `alternatives_priority` | Integer | `1062` | Priority for alternatives system | +| `reset_alternatives` | Boolean | `true` | Whether to reset alternatives before setting | +| `default` | Boolean | `true` | Whether to set this as the default Java | +| `skip_alternatives` | Boolean | `false` | Skip alternatives installation completely | +| `repository_uri` | String | `nil` | URI for the repository mirror to use instead of default repository URLs | ## Platform Support @@ -80,7 +79,5 @@ Each platform will have the appropriate Adoptium repository configured automatic ## Additional Information -- This resource uses the Adoptium API to validate available releases. -- The resource will warn if a requested version is not available as an LTS release. - For most use cases, you can simply specify the major version number. -- Air-gap mode disables version checking via the Adoptium API and instead uses the version specified in the `pkg_version` property. +- `repository_uri` can point package repository setup at an internal mirror. diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 1d8623e0..e898fcd0 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -52,11 +52,6 @@ platforms: image: dokken/fedora-latest pid_one_command: /usr/lib/systemd/systemd - - name: opensuse-leap-15 - driver: - image: dokken/opensuse-leap-15 - pid_one_command: /usr/lib/systemd/systemd - - name: oraclelinux-8 driver: image: dokken/oraclelinux-8 @@ -82,11 +77,6 @@ platforms: image: dokken/rockylinux-10 pid_one_command: /usr/lib/systemd/systemd - - name: ubuntu-20.04 - driver: - image: dokken/ubuntu-20.04 - pid_one_command: /bin/systemd - - name: ubuntu-22.04 driver: image: dokken/ubuntu-22.04 diff --git a/kitchen.global.yml b/kitchen.global.yml index 1740e461..ad83b623 100644 --- a/kitchen.global.yml +++ b/kitchen.global.yml @@ -17,16 +17,17 @@ verifier: platforms: - name: almalinux-8 - name: almalinux-9 + - name: almalinux-10 - name: amazonlinux-2023 - name: centos-stream-9 - - name: debian-11 + - name: centos-stream-10 - name: debian-12 + - name: debian-13 - name: fedora-latest - - name: opensuse-leap-15 - name: oraclelinux-8 - name: oraclelinux-9 - name: rockylinux-8 - name: rockylinux-9 - - name: ubuntu-20.04 + - name: rockylinux-10 - name: ubuntu-22.04 - name: ubuntu-24.04 diff --git a/kitchen.yml b/kitchen.yml index 21f690a0..cdb91a2c 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -11,19 +11,28 @@ verifier: name: inspec platforms: + - name: almalinux-8 + - name: almalinux-9 + - name: almalinux-10 - name: amazonlinux-2023 + - name: centos-stream-9 + - name: centos-stream-10 - name: debian-12 - name: debian-13 - - name: freebsd-13 - name: fedora-latest - - name: rockylinux-9 + - name: oraclelinux-8 + - name: oraclelinux-9 - name: rockylinux-8 + - name: rockylinux-9 + - name: rockylinux-10 - name: ubuntu-22.04 - - name: ubuntu-20.04 + - name: ubuntu-24.04 suites: # OpenJDK - name: openjdk-11 + provisioner: + named_run_list: openjdk run_list: - recipe[test::openjdk] attributes: { version: "11" } @@ -32,6 +41,8 @@ suites: inputs: { java_version: "11" } - name: openjdk-17 + provisioner: + named_run_list: openjdk run_list: - recipe[test::openjdk] attributes: { version: "17" } @@ -41,6 +52,8 @@ suites: # Temurin - name: temurin-11 + provisioner: + named_run_list: temurin_pkg run_list: - recipe[test::temurin_pkg] attributes: @@ -50,6 +63,8 @@ suites: inputs: { java_version: "11" } - name: temurin-17 + provisioner: + named_run_list: temurin_pkg run_list: - recipe[test::temurin_pkg] attributes: @@ -60,6 +75,8 @@ suites: inputs: { java_version: "17" } - name: temurin-21 + provisioner: + named_run_list: temurin_pkg run_list: - recipe[test::temurin_pkg] attributes: @@ -70,6 +87,8 @@ suites: inputs: { java_version: "21" } - name: temurin-25 + provisioner: + named_run_list: temurin_pkg run_list: - recipe[test::temurin_pkg] attributes: @@ -80,15 +99,9 @@ suites: inputs: { java_version: "25" } # Corretto - - name: corretto-8 - run_list: - - recipe[test::corretto] - attributes: { version: "8" } - verifier: - inspec_tests: [test/integration/corretto] - inputs: { java_version: "8" } - - name: corretto-11 + provisioner: + named_run_list: corretto run_list: - recipe[test::corretto] attributes: { version: "11" } @@ -97,25 +110,11 @@ suites: inputs: { java_version: "11" } - name: corretto-17 + provisioner: + named_run_list: corretto run_list: - recipe[test::corretto] attributes: { version: "17" } verifier: inspec_tests: [test/integration/corretto] inputs: { java_version: "17" } - - - name: corretto-21 - run_list: - - recipe[test::corretto] - attributes: { version: "21" } - verifier: - inspec_tests: [test/integration/corretto] - inputs: { java_version: "21" } - - - name: corretto-25 - run_list: - - recipe[test::corretto] - attributes: { version: "25" } - verifier: - inspec_tests: [test/integration/corretto] - inputs: { java_version: "25" } diff --git a/libraries/bin_cmd_helpers.rb b/libraries/bin_cmd_helpers.rb index 3127b71d..ac8de87b 100644 --- a/libraries/bin_cmd_helpers.rb +++ b/libraries/bin_cmd_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Java module Cookbook module BinCmdHelpers @@ -15,7 +17,7 @@ def default_bin_cmds(version) %w(jaotc jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) when '17' %w(jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver) - when '18', '19', '20', '21', '22', 'latest' + when '18', '19', '20', '21', '22', '23', '24', '25', 'latest' %w(jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200 jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver jwebserver) else Chef::Log.fatal('Version specified does not have a default set of bin_cmds') diff --git a/libraries/certificate_helpers.rb b/libraries/certificate_helpers.rb index 3425fc76..e2491486 100644 --- a/libraries/certificate_helpers.rb +++ b/libraries/certificate_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Java module Cookbook module CertificateHelpers @@ -11,7 +13,7 @@ def default_truststore_path(version, java_home) end def keystore_argument(cacerts, truststore_path) - cacerts ? '-cacerts' : "-keystore #{truststore_path}" + cacerts ? ['-cacerts'] : ['-keystore', truststore_path] end end end diff --git a/libraries/corretto_helpers.rb b/libraries/corretto_helpers.rb index 0d6a8b38..0e53c7cd 100644 --- a/libraries/corretto_helpers.rb +++ b/libraries/corretto_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Java module Cookbook module CorrettoHelpers diff --git a/libraries/openjdk_helpers.rb b/libraries/openjdk_helpers.rb index 1cde1059..30114df1 100644 --- a/libraries/openjdk_helpers.rb +++ b/libraries/openjdk_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Java module Cookbook module OpenJdkHelpers @@ -9,7 +11,7 @@ def lts # e.g. https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.3_7.tar.gz def sub_dir(url) URI.parse(url) - url.split('/')[7].split('_')[0].gsub('%2', '-').downcase + url.split('/')[7].split('_').first.gsub('%2', '-').downcase end def default_openjdk_install_method(version) @@ -17,17 +19,35 @@ def default_openjdk_install_method(version) when 'amazon' 'source' when 'rhel' - supported = lts.delete('11') + supported = node['platform_version'].to_i >= 10 ? [] : lts supported.include?(version) ? 'package' : 'source' + when 'fedora' + 'source' when 'debian' - case node['platform_version'] - when '10', '18.04' - supported = lts - ['17'] - supported.include?(version) ? 'package' : 'source' - when '9' - %w(8).include?(version) ? 'package' : 'source' + if node['platform'] == 'debian' + case node['platform_version'].to_i + when 9 + %w(8).include?(version) ? 'package' : 'source' + when 10 + supported = lts - ['17'] + supported.include?(version) ? 'package' : 'source' + when 11 + lts.include?(version) ? 'package' : 'source' + when 12 + %w(17).include?(version) ? 'package' : 'source' + else + 'source' + end else - lts.include?(version) ? 'package' : 'source' + case node['platform_version'] + when '10', '18.04' + supported = lts - ['17'] + supported.include?(version) ? 'package' : 'source' + when '9' + %w(8).include?(version) ? 'package' : 'source' + else + lts.include?(version) ? 'package' : 'source' + end end else lts.include?(version) ? 'package' : 'source' diff --git a/libraries/temurin_helpers.rb b/libraries/temurin_helpers.rb index 87a2e210..58285b7d 100644 --- a/libraries/temurin_helpers.rb +++ b/libraries/temurin_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Java module Cookbook module TemurinHelpers @@ -48,7 +50,3 @@ def temurin_version_available?(version) end end end - -# Ensure the helper is included in the recipe DSL -Chef::DSL::Recipe.include Java::Cookbook::TemurinHelpers -Chef::Resource.include Java::Cookbook::TemurinHelpers diff --git a/metadata.rb b/metadata.rb index b491406f..999bf085 100644 --- a/metadata.rb +++ b/metadata.rb @@ -8,16 +8,12 @@ chef_version '>= 16.0' version '14.0.1' -supports 'debian' -supports 'ubuntu' -supports 'centos' -supports 'redhat' -supports 'scientific' +supports 'almalinux', '>= 8.0' +supports 'amazon', '>= 2023.0' +supports 'centos_stream', '>= 9.0' +supports 'debian', '>= 12.0' supports 'fedora' -supports 'amazon' -supports 'oracle' -supports 'freebsd' -supports 'suse' -supports 'opensuseleap' - -depends 'line' +supports 'oracle', '>= 8.0' +supports 'redhat', '>= 8.0' +supports 'rocky', '>= 8.0' +supports 'ubuntu', '>= 22.04' diff --git a/resources/alternatives.rb b/resources/alternatives.rb index 06f680d7..f67e7c44 100644 --- a/resources/alternatives.rb +++ b/resources/alternatives.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + +provides :java_alternatives unified_mode true property :java_location, @@ -6,6 +9,11 @@ property :bin_cmds, Array, + callbacks: { + 'must contain only command names' => lambda { |cmds| + cmds.all? { |cmd| cmd.match?(/\A[A-Za-z0-9_.+-]+\z/) } + }, + }, description: 'Array of Java tool names to set or unset alternatives on' property :default, @@ -25,11 +33,9 @@ action :set do bin_cmds_to_setup = parse_java_alternatives - # Use not_if guard to make resource fully idempotent set_alternatives(bin_cmds_to_setup) do |cmd, alt_path| - # Skip if the alternative file already exists with our path alternative_exists = ::File.exist?("/var/lib/alternatives/#{cmd}") && - shell_out("#{alternatives_cmd} --display #{cmd}").stdout.include?(alt_path) + alternatives_display(cmd).stdout.include?(alt_path) Chef::Log.debug("Alternative for #{cmd} exists with correct path? #{alternative_exists}") alternative_exists end @@ -38,7 +44,7 @@ action :unset do new_resource.bin_cmds.each do |cmd| converge_by("Remove alternative for #{cmd}") do - shell_out("#{alternatives_cmd} --remove #{cmd} #{new_resource.java_location}/bin/#{cmd}") + shell_out!(alternatives_cmd, '--remove', cmd, "#{new_resource.java_location}/bin/#{cmd}") end end end @@ -48,6 +54,10 @@ def alternatives_cmd platform_family?('rhel', 'fedora', 'amazon') ? 'alternatives' : 'update-alternatives' end + def alternatives_display(cmd) + shell_out(alternatives_cmd, '--display', cmd) + end + def parse_java_alternatives bin_cmds_to_setup = [] new_resource.bin_cmds.each do |cmd| @@ -60,7 +70,6 @@ def parse_java_alternatives next end - # Add this command to the list of commands to process bin_cmds_to_setup << [cmd, bin_path, alt_path, priority] end bin_cmds_to_setup @@ -68,23 +77,17 @@ def parse_java_alternatives def set_alternatives(bin_cmds) bin_cmds.each do |cmd, bin_path, alt_path, priority| - # Use a custom not_if condition if provided as a block if block_given? && yield(cmd, alt_path) Chef::Log.debug "Skipping alternative for #{cmd} as it already exists with correct path" next end - # Get the full output of update-alternatives for this command - display_result = shell_out("#{alternatives_cmd} --display #{cmd}") + display_result = alternatives_display(cmd) cmd_output = display_result.stdout - # Check if the alternative exists at all alternative_system_exists = display_result.exitstatus == 0 && !cmd_output.empty? - - # Check if our specific path is already configured as an alternative our_alternative_exists = alternative_system_exists && cmd_output.include?(alt_path) - # Parse the priority of the existing alternative existing_priority = nil if our_alternative_exists if cmd_output =~ /#{Regexp.escape(alt_path)}.*priority\s+(\d+)/ @@ -92,57 +95,30 @@ def set_alternatives(bin_cmds) end end - # Only remove alternative if it exists with a different priority if our_alternative_exists && existing_priority && existing_priority != priority converge_by("Removing alternative for #{cmd} with old priority #{existing_priority}") do - remove_cmd = shell_out("#{alternatives_cmd} --remove #{cmd} #{alt_path}") - unless remove_cmd.exitstatus == 0 - raise(%( remove alternative failed )) - end + shell_out!(alternatives_cmd, '--remove', cmd, alt_path) end end - # Check if the alternative file exists at all alternative_file_exists = ::File.exist?("/var/lib/alternatives/#{cmd}") - # Install the alternative if needed if !our_alternative_exists || !alternative_file_exists converge_by("Add alternative for #{cmd}") do if new_resource.reset_alternatives && alternative_file_exists - shell_out("rm /var/lib/alternatives/#{cmd}") - end - install_cmd = shell_out("#{alternatives_cmd} --install #{bin_path} #{cmd} #{alt_path} #{priority}") - unless install_cmd.exitstatus == 0 - raise(%( install alternative failed )) + ::FileUtils.rm_f("/var/lib/alternatives/#{cmd}") end + shell_out!(alternatives_cmd, '--install', bin_path, cmd, alt_path, priority.to_s) end end - # set the alternative if default next unless new_resource.default - alternative_is_set = shell_out("#{alternatives_cmd} --display #{cmd} | grep \"link currently points to #{alt_path}\"").exitstatus == 0 + alternative_is_set = alternatives_display(cmd).stdout.include?("link currently points to #{alt_path}") next if alternative_is_set converge_by("Set alternative for #{cmd}") do Chef::Log.debug "Setting alternative for #{cmd}" - set_cmd = shell_out("#{alternatives_cmd} --set #{cmd} #{alt_path}") - unless set_cmd.exitstatus == 0 - raise(%( set alternative failed )) - end + shell_out!(alternatives_cmd, '--set', cmd, alt_path) end end end end - -action :unset do - new_resource.bin_cmds.each do |cmd| - converge_by("Remove alternative for #{cmd}") do - shell_out("#{alternatives_cmd} --remove #{cmd} #{new_resource.java_location}/bin/#{cmd}") - end - end -end - -action_class do - def alternatives_cmd - platform_family?('rhel', 'fedora', 'amazon') ? 'alternatives' : 'update-alternatives' - end -end diff --git a/resources/certificate.rb b/resources/certificate.rb index 62053219..c39e4016 100644 --- a/resources/certificate.rb +++ b/resources/certificate.rb @@ -1,21 +1,26 @@ +# frozen_string_literal: true + +provides :java_certificate unified_mode true include Java::Cookbook::CertificateHelpers +include Java::Cookbook::OpenJdkHelpers property :cert_alias, String, + regex: /\A[A-Za-z0-9_.-]+\z/, name_property: true, description: 'The alias of the certificate in the keystore. This defaults to the name of the resource' -property :java_home, - String, - default: lazy { node['java']['java_home'] }, - description: 'The java home directory' - property :java_version, String, - default: lazy { node['java']['jdk_version'] }, + default: '17', description: 'The major java version' +property :java_home, + String, + default: lazy { default_openjdk_pkg_java_home(java_version) }, + description: 'The java home directory' + property :cacerts, [true, false], default: true, @@ -41,6 +46,11 @@ property :ssl_endpoint, String, + callbacks: { + 'must be a host:port endpoint' => lambda { |endpoint| + endpoint.match?(/\A[A-Za-z0-9.-]+:\d+\z/) + }, + }, description: 'An SSL end-point from which to download the certificate' property :starttls, @@ -56,14 +66,14 @@ action :install do require 'openssl' - keystore_argument = keystore_argument(new_resource.cacerts, new_resource.keystore_path) + keystore_arguments = keystore_argument(new_resource.cacerts, new_resource.keystore_path) certdata = new_resource.cert_data || fetch_certdata hash = OpenSSL::Digest::SHA512.hexdigest(certdata) certfile = ::File.join(new_resource.file_cache_path, "#{new_resource.cert_alias}.cert.#{hash}") - cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -rfc -alias \"#{new_resource.cert_alias}\"") + cmd = keytool('-list', *keystore_arguments, '-storepass', new_resource.keystore_passwd, '-rfc', '-alias', new_resource.cert_alias) cmd.run_command keystore_cert = cmd.stdout.match(/^[-]+BEGIN.*END(\s|\w)+[-]+$/m).to_s @@ -72,16 +82,16 @@ if keystore_cert_digest == certfile_digest Chef::Log.debug("Certificate \"#{new_resource.cert_alias}\" in keystore \"#{new_resource.keystore_path}\" is up-to-date.") else - cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -v") + cmd = keytool('-list', *keystore_arguments, '-storepass', new_resource.keystore_passwd, '-v') cmd.run_command Chef::Log.debug(cmd.format_for_exception) Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless cmd.exitstatus == 0 - has_key = !cmd.stdout[/Alias name: \b#{new_resource.cert_alias}\s*$/i].nil? + has_key = !cmd.stdout[/Alias name: \b#{Regexp.escape(new_resource.cert_alias)}\s*$/i].nil? if has_key converge_by("delete existing certificate #{new_resource.cert_alias} from #{new_resource.keystore_path}") do - cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -delete -alias \"#{new_resource.cert_alias}\" #{keystore_argument} -storepass #{new_resource.keystore_passwd}") + cmd = keytool('-delete', '-alias', new_resource.cert_alias, *keystore_arguments, '-storepass', new_resource.keystore_passwd) cmd.run_command Chef::Log.debug(cmd.format_for_exception) unless cmd.exitstatus == 0 @@ -91,10 +101,11 @@ end end + ::FileUtils.mkdir_p(new_resource.file_cache_path) ::File.open(certfile, 'w', 0o644) { |f| f.write(certdata) } converge_by("add certificate #{new_resource.cert_alias} to keystore #{new_resource.keystore_path}") do - cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -import -trustcacerts -alias \"#{new_resource.cert_alias}\" -file #{certfile} #{keystore_argument} -storepass #{new_resource.keystore_passwd} -noprompt") + cmd = keytool('-import', '-trustcacerts', '-alias', new_resource.cert_alias, '-file', certfile, *keystore_arguments, '-storepass', new_resource.keystore_passwd, '-noprompt') cmd.run_command Chef::Log.debug(cmd.format_for_exception) @@ -107,17 +118,17 @@ end action :remove do - keystore_argument = keystore_argument(new_resource.cacerts, new_resource.keystore_path) + keystore_arguments = keystore_argument(new_resource.cacerts, new_resource.keystore_path) - cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -list #{keystore_argument} -storepass #{new_resource.keystore_passwd} -v | grep \"#{new_resource.cert_alias}\"") + cmd = keytool('-list', *keystore_arguments, '-storepass', new_resource.keystore_passwd, '-v') cmd.run_command - has_key = !cmd.stdout[/Alias name: #{new_resource.cert_alias}/].nil? - does_not_exist = cmd.stdout[/Alias <#{new_resource.cert_alias}> does not exist/].nil? + has_key = !cmd.stdout[/Alias name: #{Regexp.escape(new_resource.cert_alias)}/].nil? + does_not_exist = cmd.stdout[/Alias <#{Regexp.escape(new_resource.cert_alias)}> does not exist/] Chef::Application.fatal!("Error querying keystore for existing certificate: #{cmd.exitstatus}", cmd.exitstatus) unless (cmd.exitstatus == 0) || does_not_exist if has_key converge_by("remove certificate #{new_resource.cert_alias} from #{new_resource.keystore_path}") do - cmd = Mixlib::ShellOut.new("#{new_resource.java_home}/bin/keytool -delete -alias \"#{new_resource.cert_alias}\" #{keystore_argument} -storepass #{new_resource.keystore_passwd}") + cmd = keytool('-delete', '-alias', new_resource.cert_alias, *keystore_arguments, '-storepass', new_resource.keystore_passwd) cmd.run_command unless cmd.exitstatus == 0 Chef::Application.fatal!("Error deleting existing certificate \"#{new_resource.cert_alias}\" in " \ @@ -126,23 +137,28 @@ end end - FileUtils.rm_f("#{new_resource.file_cache_path}/#{new_resource.cert_alias}.cert.*") + FileUtils.rm_f(::Dir.glob(::File.join(new_resource.file_cache_path, "#{new_resource.cert_alias}.cert.*"))) end action_class do + def keytool(*args) + Mixlib::ShellOut.new(::File.join(new_resource.java_home, 'bin', 'keytool'), *args) + end + def fetch_certdata return IO.read(new_resource.cert_file) unless new_resource.cert_file.nil? certendpoint = new_resource.ssl_endpoint - starttls = new_resource.starttls.nil? ? '' : "-starttls #{new_resource.starttls}" unless certendpoint.nil? - cmd = Mixlib::ShellOut.new("echo QUIT | openssl s_client -showcerts -servername #{certendpoint.split(':').first} -connect #{certendpoint} #{starttls} 2> /dev/null | openssl x509") + host = certendpoint.split(':').first + starttls = new_resource.starttls.nil? ? [] : ['-starttls', new_resource.starttls] + cmd = Mixlib::ShellOut.new('openssl', 's_client', '-showcerts', '-servername', host, '-connect', certendpoint, *starttls, input: "QUIT\n", timeout: 30) cmd.run_command Chef::Log.debug(cmd.format_for_exception) Chef::Application.fatal!("Error returned when attempting to retrieve certificate from remote endpoint #{certendpoint}: #{cmd.exitstatus}", cmd.exitstatus) unless cmd.exitstatus == 0 - certout = cmd.stdout + certout = cmd.stdout[/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m].to_s return certout unless certout.empty? Chef::Application.fatal!("Unable to parse certificate from openssl query of #{certendpoint}.", 999) end diff --git a/resources/corretto_install.rb b/resources/corretto_install.rb index 8b4a5ac4..0a5a53ac 100644 --- a/resources/corretto_install.rb +++ b/resources/corretto_install.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + provides :corretto_install unified_mode true include Java::Cookbook::CorrettoHelpers @@ -49,8 +51,6 @@ destination extract_dir end - node.default['java']['java_home'] = new_resource.java_home - # Set up .jinfo file for update-java-alternatives template "/usr/lib/jvm/.java-#{new_resource.version}-corretto.jinfo" do cookbook 'java' @@ -92,4 +92,9 @@ only_if { ::File.exist?(extract_dir) } action :delete end + + file "/usr/lib/jvm/.java-#{new_resource.version}-corretto.jinfo" do + only_if { platform_family?('debian') } + action :delete + end end diff --git a/resources/jce.rb b/resources/jce.rb index ee11918b..af69473e 100644 --- a/resources/jce.rb +++ b/resources/jce.rb @@ -1,32 +1,44 @@ +# frozen_string_literal: true + +provides :java_jce unified_mode true property :jdk_version, String, - default: lazy { node['java']['jdk_version'].to_s }, description: 'The Java version to install into' + name_property: true, description: 'The Java version to install into' property :jce_url, String, - default: lazy { node['java']['oracle']['jce'][jdk_version]['url'] }, description: 'The URL for the JCE distribution' + required: true, description: 'The URL for the JCE distribution' property :jce_checksum, String, - default: lazy { node['java']['oracle']['jce'][jdk_version]['checksum'] }, description: 'The checksum of the JCE distribution' + required: true, description: 'The checksum of the JCE distribution' property :java_home, String, - default: lazy { node['java']['java_home'] }, description: 'The location of the Java installation' + required: true, description: 'The location of the Java installation' property :jce_home, String, - default: lazy { node['java']['oracle']['jce']['home'] }, description: 'The location where JCE files will be decompressed for installation' + default: '/usr/lib/jvm/jce', description: 'The location where JCE files will be decompressed for installation' property :jce_cookie, String, - default: lazy { node['java']['oracle']['accept_oracle_download_terms'] ? 'oraclelicense=accept-securebackup-cookie' : '' }, description: 'Indicates that you accept Oracles EULA' + default: '', description: 'Indicates that you accept Oracles EULA' property :principal, String, - default: lazy { platform_family?('windows') ? node['java']['windows']['owner'] : 'administrator' }, description: 'For Windows installations only, this determines the owner of the JCE files' + default: 'administrator', description: 'For Windows installations only, this determines the owner of the JCE files' + +property :download_path, + String, + default: Chef::Config[:file_cache_path], description: 'Path used to stage the JCE archive' + +property :install_type, + String, + equal_to: %w(jdk jre), + default: 'jdk', description: 'Whether the Java install is a jdk or jre layout' action :install do jdk_version = new_resource.jdk_version @@ -36,13 +48,20 @@ jce_home = new_resource.jce_home jce_cookie = new_resource.jce_cookie principal = new_resource.principal + download_path = new_resource.download_path + install_type = new_resource.install_type directory ::File.join(jce_home, jdk_version) do mode '0755' recursive true end - r = remote_file "#{node['java']['download_path']}/jce.zip" do + directory download_path do + mode '0755' + recursive true + end + + r = remote_file ::File.join(download_path, 'jce.zip') do source jce_url checksum jce_checksum headers( @@ -52,7 +71,7 @@ end # JRE installation does not have a jre folder - jre_path = node['java']['install_type'] == 'jdk' ? 'jre' : '' + jre_path = install_type == 'jdk' ? 'jre' : '' if platform_family?('windows') @@ -82,19 +101,23 @@ else package 'unzip' - package 'curl' - - execute 'extract jce' do - command <<-EOF - rm -rf java_jce - mkdir java_jce - cd java_jce - unzip -o ../jce.zip - find ./ -name '*.jar' | xargs -I JCE_JAR mv JCE_JAR #{jce_home}/#{jdk_version}/ - chmod -R 0644 #{jce_home}/#{jdk_version}/*.jar - EOF - cwd node['java']['download_path'] - creates ::File.join(jce_home, jdk_version, 'US_export_policy.jar') + + archive_file 'extract jce' do + path r.path + destination ::File.join(download_path, 'java_jce') + overwrite true + not_if { ::File.exist?(::File.join(jce_home, jdk_version, 'US_export_policy.jar')) } + end + + ruby_block 'stage jce policy jars' do + block do + ::Dir.glob(::File.join(download_path, 'java_jce', '**', '*.jar')).each do |jar| + destination = ::File.join(jce_home, jdk_version, ::File.basename(jar)) + ::FileUtils.mv(jar, destination) + ::FileUtils.chmod(0o644, destination) + end + end + not_if { ::File.exist?(::File.join(jce_home, jdk_version, 'US_export_policy.jar')) } end %w(local_policy.jar US_export_policy.jar).each do |jar| @@ -110,3 +133,32 @@ end end end + +action :remove do + jdk_version = new_resource.jdk_version + java_home = new_resource.java_home + jce_home = new_resource.jce_home + download_path = new_resource.download_path + jre_path = new_resource.install_type == 'jdk' ? 'jre' : '' + + %w(local_policy.jar US_export_policy.jar).each do |jar| + file ::File.join(java_home, jre_path, 'lib', 'security', jar) do + action :delete + only_if { ::File.symlink?(path) } + end + end + + directory ::File.join(jce_home, jdk_version) do + recursive true + action :delete + end + + directory ::File.join(download_path, 'java_jce') do + recursive true + action :delete + end + + file ::File.join(download_path, 'jce.zip') do + action :delete + end +end diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index dc9f3810..e5c9ce9e 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + provides :openjdk_install unified_mode true include Java::Cookbook::OpenJdkHelpers @@ -5,7 +7,6 @@ property :install_type, String, - default: lazy { default_openjdk_install_method(version) }, equal_to: %w( package source ), description: 'Installation type' @@ -23,7 +24,6 @@ property :bin_cmds, Array, - default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version and variant' property :url, @@ -40,18 +40,21 @@ use 'partial/_openjdk' action :install do - if new_resource.install_type == 'package' + install_type = new_resource.install_type || default_openjdk_install_method(new_resource.version) + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + + if install_type == 'package' openjdk_pkg_install new_resource.version do pkg_names new_resource.pkg_names pkg_version new_resource.pkg_version java_home new_resource.java_home default new_resource.default - bin_cmds new_resource.bin_cmds + bin_cmds bin_cmds skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives end - elsif new_resource.install_type == 'source' + elsif install_type == 'source' openjdk_source_install new_resource.version do url new_resource.url checksum new_resource.checksum @@ -59,7 +62,7 @@ java_home_mode new_resource.java_home_mode java_home_group new_resource.java_home_group default new_resource.default - bin_cmds new_resource.bin_cmds + bin_cmds bin_cmds skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives @@ -70,19 +73,22 @@ end action :remove do - if new_resource.install_type == 'package' + install_type = new_resource.install_type || default_openjdk_install_method(new_resource.version) + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + + if install_type == 'package' openjdk_pkg_install new_resource.version do pkg_names new_resource.pkg_names pkg_version new_resource.pkg_version java_home new_resource.java_home default new_resource.default - bin_cmds new_resource.bin_cmds + bin_cmds bin_cmds skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives action :remove end - elsif new_resource.install_type == 'source' + elsif install_type == 'source' openjdk_source_install new_resource.version do url new_resource.url checksum new_resource.checksum @@ -90,7 +96,7 @@ java_home_mode new_resource.java_home_mode java_home_group new_resource.java_home_group default new_resource.default - bin_cmds new_resource.bin_cmds + bin_cmds bin_cmds skip_alternatives new_resource.skip_alternatives alternatives_priority new_resource.alternatives_priority reset_alternatives new_resource.reset_alternatives diff --git a/resources/openjdk_pkg_install.rb b/resources/openjdk_pkg_install.rb index 86449b0b..783df2b8 100644 --- a/resources/openjdk_pkg_install.rb +++ b/resources/openjdk_pkg_install.rb @@ -1,21 +1,24 @@ +# frozen_string_literal: true + provides :openjdk_pkg_install unified_mode true include Java::Cookbook::OpenJdkHelpers include Java::Cookbook::BinCmdHelpers +use 'partial/_common' +use 'partial/_linux' +use 'partial/_openjdk' + property :pkg_names, [String, Array], - default: lazy { default_openjdk_pkg_names(version) }, description: 'List of packages to install' property :pkg_version, String, description: 'Package version to install' property :java_home, String, - default: lazy { default_openjdk_pkg_java_home(version) }, description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version and variant' property :alternatives_priority, Integer, @@ -25,11 +28,11 @@ property :repository_uri, String, description: 'URI for the repository mirror (e.g., "https://custom-mirror.example.com/openjdk/ubuntu")' -use 'partial/_common' -use 'partial/_linux' -use 'partial/_openjdk' - action :install do + pkg_names = new_resource.pkg_names || default_openjdk_pkg_names(new_resource.version) + java_home = new_resource.java_home || default_openjdk_pkg_java_home(new_resource.version) + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + if platform?('ubuntu') apt_repository 'openjdk-r-ppa' do uri new_resource.repository_uri || 'ppa:openjdk-r' @@ -37,21 +40,19 @@ end pkg_version = - if new_resource.pkg_version && new_resource.pkg_names.is_a?(String) - version new_resource.pkg_version - elsif new_resource.pkg_version && new_resource.pkg_names.is_a?(Array) - Array.new(new_resource.pkg_names.size, new_resource.pkg_version) + if new_resource.pkg_version && pkg_names.is_a?(String) + new_resource.pkg_version + elsif new_resource.pkg_version && pkg_names.is_a?(Array) + Array.new(pkg_names.size, new_resource.pkg_version) end - package new_resource.pkg_names do + package pkg_names do version pkg_version if pkg_version end - node.default['java']['java_home'] = new_resource.java_home - java_alternatives 'set-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds + java_location java_home + bin_cmds bin_cmds priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives @@ -60,15 +61,19 @@ end action :remove do + pkg_names = new_resource.pkg_names || default_openjdk_pkg_names(new_resource.version) + java_home = new_resource.java_home || default_openjdk_pkg_java_home(new_resource.version) + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + java_alternatives 'unset-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds - only_if { ::File.exist?(new_resource.java_home) } + java_location java_home + bin_cmds bin_cmds + only_if { ::File.exist?(java_home) } not_if { new_resource.skip_alternatives } action :unset end - package new_resource.pkg_names do + package pkg_names do action :remove end diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index 5eef5e0a..dae97036 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + provides :openjdk_source_install unified_mode true include Java::Cookbook::OpenJdkHelpers @@ -8,20 +10,16 @@ description: 'Java version to install' property :url, String, - default: lazy { default_openjdk_url(version, variant) }, description: 'The URL to download from. Can be an internal mirror URL (e.g., "https://internal-mirror.example.com/java/openjdk/").' property :checksum, String, regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, - default: lazy { default_openjdk_checksum(version) }, description: 'The checksum for the downloaded file' property :java_home, String, - default: lazy { "/usr/lib/jvm/java-#{version}-openjdk/jdk-#{version}" }, description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version and variant' use 'partial/_common' @@ -30,9 +28,13 @@ use 'partial/_openjdk' action :install do - extract_dir = new_resource.java_home.split('/')[0..-2].join('/') - parent_dir = new_resource.java_home.split('/')[0..-3].join('/') - tarball_name = new_resource.url.split('/').last + url = new_resource.url || default_openjdk_url(new_resource.version, new_resource.variant) + checksum = new_resource.checksum || default_openjdk_checksum(new_resource.version) + java_home = new_resource.java_home || "/usr/lib/jvm/java-#{new_resource.version}-openjdk/jdk-#{new_resource.version}" + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + extract_dir = java_home.split('/')[0..-2].join('/') + parent_dir = java_home.split('/')[0..-3].join('/') + tarball_name = url.split('/').last directory parent_dir do owner new_resource.java_home_owner @@ -42,8 +44,8 @@ end remote_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do - source new_resource.url - checksum new_resource.checksum + source url + checksum checksum retries new_resource.retries retry_delay new_resource.retry_delay mode '644' @@ -53,11 +55,9 @@ destination extract_dir end - node.default['java']['java_home'] = new_resource.java_home - java_alternatives 'set-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds + java_location java_home + bin_cmds bin_cmds priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives @@ -65,18 +65,22 @@ action :set end - append_if_no_line 'Java Home' do - path '/etc/profile.d/java.sh' - line "export JAVA_HOME=#{new_resource.java_home}" + file '/etc/profile.d/java.sh' do + content "export JAVA_HOME=#{java_home}\n" + owner 'root' + group 'root' + mode '0644' end end action :remove do - extract_dir = new_resource.java_home.split('/')[0..-2].join('/') + java_home = new_resource.java_home || "/usr/lib/jvm/java-#{new_resource.version}-openjdk/jdk-#{new_resource.version}" + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + extract_dir = java_home.split('/')[0..-2].join('/') java_alternatives 'unset-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds + java_location java_home + bin_cmds bin_cmds only_if { ::File.exist?(extract_dir) } not_if { new_resource.skip_alternatives } action :unset @@ -88,4 +92,8 @@ only_if { ::File.exist?(extract_dir) } action :delete end + + file '/etc/profile.d/java.sh' do + action :delete + end end diff --git a/resources/partial/_common.rb b/resources/partial/_common.rb index 49c93c39..c95d9b88 100644 --- a/resources/partial/_common.rb +++ b/resources/partial/_common.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + property :version, String, name_property: true, description: 'Java version to install' diff --git a/resources/partial/_java_home.rb b/resources/partial/_java_home.rb index 8abdfc15..a99ae72a 100644 --- a/resources/partial/_java_home.rb +++ b/resources/partial/_java_home.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + property :java_home_mode, String, default: '0755', description: 'The permission for the Java home directory' diff --git a/resources/partial/_linux.rb b/resources/partial/_linux.rb index 3fcad6c0..d18532d3 100644 --- a/resources/partial/_linux.rb +++ b/resources/partial/_linux.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + property :alternatives_priority, Integer, default: 1, description: 'Alternatives priority to set for this Java' diff --git a/resources/partial/_macos.rb b/resources/partial/_macos.rb index 2e872fc3..0c2402fd 100644 --- a/resources/partial/_macos.rb +++ b/resources/partial/_macos.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + property :tap_url, String, description: 'The URL of the tap' diff --git a/resources/partial/_openjdk.rb b/resources/partial/_openjdk.rb index d51c680b..ec7a0721 100644 --- a/resources/partial/_openjdk.rb +++ b/resources/partial/_openjdk.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + property :variant, String, equal_to: %w(openjdk temurin), default: 'openjdk', diff --git a/resources/temurin_package_install.rb b/resources/temurin_package_install.rb index 0a7b5b43..b7308da3 100644 --- a/resources/temurin_package_install.rb +++ b/resources/temurin_package_install.rb @@ -1,63 +1,68 @@ +# frozen_string_literal: true + provides :temurin_package_install unified_mode true include Java::Cookbook::OpenJdkHelpers -include Java::Cookbook::TemurinHelpers include Java::Cookbook::BinCmdHelpers +use 'partial/_common' +use 'partial/_linux' + def default_temurin_pkg_name(version) - # Validate version against available releases - unless temurin_version_available?(version) - Chef::Log.warn("Temurin version #{version} might not be available. Available LTS versions: #{temurin_lts_versions.join(', ')}") - end "temurin-#{version}-jdk" end +def default_temurin_rpm_baseurl + return 'https://packages.adoptium.net/artifactory/rpm/amazonlinux/2/$basearch' if platform?('amazon') + + repository_platform = value_for_platform( + %w(almalinux oracle redhat rocky) => { 'default' => 'rhel' }, + 'centos' => { 'default' => 'centos' }, + 'fedora' => { 'default' => 'fedora' }, + 'default' => node['platform'] + ) + + "https://packages.adoptium.net/artifactory/rpm/#{repository_platform}/$releasever/$basearch" +end + property :pkg_name, String, - default: lazy { default_temurin_pkg_name(version) }, description: 'Package name to install' property :pkg_version, String, description: 'Package version to install' property :java_home, String, - default: lazy { "/usr/lib/jvm/temurin-#{version}-jdk" }, description: 'Set to override the java_home' property :bin_cmds, Array, - default: lazy { default_bin_cmds(version) }, description: 'A list of bin_cmds based on the version' property :repository_uri, String, description: 'URI for the repository mirror (e.g., "https://custom-mirror.example.com/artifactory/deb")' -use 'partial/_common' -use 'partial/_linux' - action :install do + keyring_path = '/usr/share/keyrings/adoptium.asc' + pkg_name = new_resource.pkg_name || default_temurin_pkg_name(new_resource.version) + java_home = new_resource.java_home || "/usr/lib/jvm/temurin-#{new_resource.version}-jdk" + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + + remote_file keyring_path do + source 'https://packages.adoptium.net/artifactory/api/gpg/key/public' + mode '0644' + only_if { platform_family?('debian') } + end + apt_repository 'adoptium' do uri new_resource.repository_uri || 'https://packages.adoptium.net/artifactory/deb' components ['main'] distribution lazy { node['lsb']['codename'] || node['debian']['distribution_codename'] } - # TODO: https://github.com/chef/chef/pull/15043 - # key '843C48A565F8F04B' - # keyserver 'keyserver.ubuntu.com' - signed_by false - trusted true + signed_by keyring_path only_if { platform_family?('debian') } end yum_repository 'adoptium' do description 'Eclipse Adoptium' - baseurl new_resource.repository_uri || value_for_platform( - 'amazon' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/amazonlinux/2/$basearch' }, - 'centos' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/centos/$releasever/$basearch' }, - 'fedora' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/fedora/$releasever/$basearch' }, - 'opensuse' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch' }, - 'oracle' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/oraclelinux/$releasever/$basearch' }, - 'redhat' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/rhel/$releasever/$basearch' }, - 'rocky' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/rocky/8/$basearch' }, - 'suse' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/sles/$releasever/$basearch' } - ) + baseurl new_resource.repository_uri || default_temurin_rpm_baseurl enabled true gpgcheck true gpgkey 'https://packages.adoptium.net/artifactory/api/gpg/key/public' @@ -73,15 +78,13 @@ def default_temurin_pkg_name(version) only_if { platform_family?('suse') } end - package new_resource.pkg_name do + package pkg_name do version new_resource.pkg_version if new_resource.pkg_version end - node.default['java']['java_home'] = new_resource.java_home - java_alternatives 'set-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds + java_location java_home + bin_cmds bin_cmds priority new_resource.alternatives_priority default new_resource.default reset_alternatives new_resource.reset_alternatives @@ -90,15 +93,19 @@ def default_temurin_pkg_name(version) end action :remove do + pkg_name = new_resource.pkg_name || default_temurin_pkg_name(new_resource.version) + java_home = new_resource.java_home || "/usr/lib/jvm/temurin-#{new_resource.version}-jdk" + bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) + java_alternatives 'unset-java-alternatives' do - java_location new_resource.java_home - bin_cmds new_resource.bin_cmds - only_if { ::File.exist?(new_resource.java_home) } + java_location java_home + bin_cmds bin_cmds + only_if { ::File.exist?(java_home) } action :unset not_if { new_resource.skip_alternatives } end - package new_resource.pkg_name do + package pkg_name do action :remove end @@ -107,6 +114,11 @@ def default_temurin_pkg_name(version) only_if { platform_family?('debian') } end + file '/usr/share/keyrings/adoptium.asc' do + action :delete + only_if { platform_family?('debian') } + end + yum_repository 'adoptium' do action :remove only_if { platform_family?('rhel', 'fedora', 'amazon', 'rocky', 'suse', 'oraclelinux') } diff --git a/spec/libraries/bin_cmd_helpers_spec.rb b/spec/libraries/bin_cmd_helpers_spec.rb new file mode 100644 index 00000000..2217ca20 --- /dev/null +++ b/spec/libraries/bin_cmd_helpers_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Java::Cookbook::BinCmdHelpers do + subject(:helper) do + Class.new do + include Java::Cookbook::BinCmdHelpers + end.new + end + + describe '#default_bin_cmds' do + it 'returns Java command alternatives for Temurin 25' do + expect(helper.default_bin_cmds('25')).to include('java', 'javac', 'keytool', 'jwebserver') + end + + it 'logs a fatal error for unsupported versions' do + allow(Chef::Log).to receive(:fatal) + + helper.default_bin_cmds('26') + + expect(Chef::Log).to have_received(:fatal).with('Version specified does not have a default set of bin_cmds') + end + end +end diff --git a/spec/libraries/certificate_helpers_spec.rb b/spec/libraries/certificate_helpers_spec.rb index 59fd240f..0f60f40b 100644 --- a/spec/libraries/certificate_helpers_spec.rb +++ b/spec/libraries/certificate_helpers_spec.rb @@ -24,7 +24,7 @@ class DummyClass < Chef::Node let(:truststore_path) { '/usr/lib/jvm/corretto-9/jre/lib/security/cacerts' } it 'returns the correct argument' do - expect(subject.keystore_argument(cacerts, truststore_path)).to eq('-cacerts') + expect(subject.keystore_argument(cacerts, truststore_path)).to eq(['-cacerts']) end end @@ -33,7 +33,7 @@ class DummyClass < Chef::Node let(:truststore_path) { '/mycertstore.jks' } it 'returns the correct argument' do - expect(subject.keystore_argument(cacerts, truststore_path)).to eq('-keystore /mycertstore.jks') + expect(subject.keystore_argument(cacerts, truststore_path)).to eq(['-keystore', '/mycertstore.jks']) end end end diff --git a/spec/libraries/openjdk_helpers_spec.rb b/spec/libraries/openjdk_helpers_spec.rb index e541ffdf..b9950f9b 100644 --- a/spec/libraries/openjdk_helpers_spec.rb +++ b/spec/libraries/openjdk_helpers_spec.rb @@ -54,11 +54,13 @@ class DummyClass < Chef::Node before do allow(subject).to receive(:[]).with(version).and_return(version) allow(subject).to receive(:[]).with('platform_family').and_return(platform_family) + allow(subject).to receive(:[]).with('platform').and_return(platform) allow(subject).to receive(:[]).with('platform_version').and_return(platform_version) end context 'Amazon' do let(:platform_family) { 'amazon' } + let(:platform) { 'amazon' } let(:platform_version) { '2' } let(:version) { '17' } it 'should default to a source install' do @@ -66,8 +68,75 @@ class DummyClass < Chef::Node end end + context 'RHEL 9' do + let(:platform_family) { 'rhel' } + let(:platform) { 'almalinux' } + let(:platform_version) { '9.6' } + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + end + + context 'RHEL 10' do + let(:platform_family) { 'rhel' } + let(:platform) { 'almalinux' } + let(:platform_version) { '10.2' } + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + end + + context 'Fedora' do + let(:platform_family) { 'fedora' } + let(:platform) { 'fedora' } + let(:platform_version) { '44' } + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + end + context 'Debian' do let(:platform_family) { 'debian' } + let(:platform) { 'debian' } context '9' do let(:platform_version) { '9' } @@ -137,7 +206,40 @@ class DummyClass < Chef::Node end end + context '12' do + let(:platform_version) { '12' } + + context 'OpenJDK 11' do + let(:version) { '11' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a package install' do + expect(subject.default_openjdk_install_method(version)).to eq 'package' + end + end + end + + context '13' do + let(:platform_version) { '13' } + + context 'OpenJDK 17' do + let(:version) { '17' } + + it 'should default to a source install' do + expect(subject.default_openjdk_install_method(version)).to eq 'source' + end + end + end + context 'Ubuntu 18.04' do + let(:platform) { 'ubuntu' } let(:platform_version) { '18.04' } context 'OpenJDK 17' do @@ -158,6 +260,7 @@ class DummyClass < Chef::Node end context 'Ubuntu 20.04' do + let(:platform) { 'ubuntu' } let(:platform_version) { '20.04' } context 'OpenJDK 17' do diff --git a/spec/resources/alternatives_spec.rb b/spec/resources/alternatives_spec.rb new file mode 100644 index 00000000..cdc5ad20 --- /dev/null +++ b/spec/resources/alternatives_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'java_alternatives' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['java_alternatives']) } + + it 'converges with an empty command list without shelling out' do + expect { runner.converge('test::alternatives_spec') }.not_to raise_error + end + + it 'supports unsetting command alternatives' do + stubs_for_provider('java_alternatives[test-unset-alternatives]') do |provider| + allow(provider).to receive_shell_out('update-alternatives', '--remove', 'java', '/opt/java/bin/java') + end + + expect { runner.converge('test::alternatives_unset_spec') }.not_to raise_error + end +end diff --git a/spec/resources/certificate_spec.rb b/spec/resources/certificate_spec.rb new file mode 100644 index 00000000..f71fd487 --- /dev/null +++ b/spec/resources/certificate_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'java_certificate' do + let(:shellout) do + instance_double(Mixlib::ShellOut, run_command: nil, stdout: '', exitstatus: 0, format_for_exception: '') + end + + before do + allow(Mixlib::ShellOut).to receive(:new).and_return(shellout) + end + + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['java_certificate']) } + + it 'steps into certificate install without invoking host keytool' do + expect { runner.converge('test::certificate_spec') }.not_to raise_error + end +end diff --git a/spec/resources/corretto_install_spec.rb b/spec/resources/corretto_install_spec.rb new file mode 100644 index 00000000..c42aaf13 --- /dev/null +++ b/spec/resources/corretto_install_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'corretto_install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['corretto_install']) } + let(:converge) { runner.converge('test::corretto_spec') } + + it 'downloads the Corretto archive' do + expect(converge).to create_remote_file(::File.join(Chef::Config[:file_cache_path], 'corretto.tar.gz')) + end + + it 'creates a Debian jinfo file' do + expect(converge).to create_template('/usr/lib/jvm/.java-17-corretto.jinfo') + end +end diff --git a/spec/resources/jce_spec.rb b/spec/resources/jce_spec.rb new file mode 100644 index 00000000..1524c614 --- /dev/null +++ b/spec/resources/jce_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'java_jce' do + context 'install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['java_jce']) } + let(:converge) { runner.converge('test::jce_spec') } + + it 'downloads the JCE archive to the explicit download path' do + expect(converge).to create_remote_file('/tmp/java/jce.zip') + end + + it 'extracts the archive without a shell execute resource' do + expect(converge).to extract_archive_file('extract jce') + expect(converge).to_not run_execute('extract jce') + end + end + + context 'remove' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['java_jce']) } + let(:converge) { runner.converge('test::jce_remove_spec') } + + it 'removes staged JCE artifacts' do + expect(converge).to delete_directory('/usr/lib/jvm/jce/17') + expect(converge).to delete_file('/tmp/java/jce.zip') + end + end +end diff --git a/spec/resources/openjdk_install_spec.rb b/spec/resources/openjdk_install_spec.rb new file mode 100644 index 00000000..6451c4fe --- /dev/null +++ b/spec/resources/openjdk_install_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'openjdk_install' do + context 'package install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_install']) } + + let(:converge) do + runner.converge('test::openjdk_package_spec') + end + + it 'delegates to openjdk_pkg_install' do + expect(converge).to install_openjdk_pkg_install('17').with( + pkg_names: %w(openjdk-17-jdk openjdk-17-jre-headless), + java_home: '/usr/lib/jvm/java-17-openjdk-amd64', + bin_cmds: %w(java javac), + skip_alternatives: true + ) + end + end + + context 'source install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_install']) } + + let(:converge) do + runner.converge('test::openjdk_source_spec') + end + + it 'delegates to openjdk_source_install' do + expect(converge).to install_openjdk_source_install('17').with( + url: 'https://example.test/openjdk.tar.gz', + checksum: 'a' * 64, + java_home: '/usr/lib/jvm/java-17-openjdk/jdk-17', + bin_cmds: %w(java javac), + skip_alternatives: true + ) + end + end +end diff --git a/spec/resources/openjdk_pkg_install_spec.rb b/spec/resources/openjdk_pkg_install_spec.rb new file mode 100644 index 00000000..e1ddb0c8 --- /dev/null +++ b/spec/resources/openjdk_pkg_install_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'openjdk_pkg_install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_pkg_install']) } + + let(:converge) do + runner.converge('test::openjdk_pkg_spec') + end + + it 'installs the requested OpenJDK packages' do + expect(converge).to install_package(%w(openjdk-17-jdk openjdk-17-jre-headless)) + end + + it 'does not write node java_home state' do + expect(converge.node.default_attrs).not_to have_key('java') + expect(converge.node.normal_attrs).not_to have_key('java') + expect(converge.node.override_attrs).not_to have_key('java') + end +end diff --git a/spec/resources/openjdk_source_install_spec.rb b/spec/resources/openjdk_source_install_spec.rb new file mode 100644 index 00000000..ba4e723e --- /dev/null +++ b/spec/resources/openjdk_source_install_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'openjdk_source_install' do + context 'install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_source_install']) } + let(:converge) { runner.converge('test::openjdk_source_direct_spec') } + + it 'downloads the source archive' do + expect(converge).to create_remote_file(::File.join(Chef::Config[:file_cache_path], 'openjdk.tar.gz')) + end + + it 'sets JAVA_HOME in the profile file' do + resource = converge.resource_collection.to_a.find do |candidate| + candidate.resource_name == :file && candidate.name == '/etc/profile.d/java.sh' + end + + expect(resource.content).to eq("export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/jdk-17\n") + expect(resource.mode).to eq('0644') + end + end + + context 'remove' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_source_install']) } + let(:converge) { runner.converge('test::openjdk_source_remove_spec') } + + it 'removes the managed JAVA_HOME line' do + resource = converge.resource_collection.to_a.find do |candidate| + candidate.resource_name == :file && candidate.name == '/etc/profile.d/java.sh' + end + + expect(resource.action).to eq([:delete]) + end + end +end diff --git a/spec/resources/temurin_package_install_spec.rb b/spec/resources/temurin_package_install_spec.rb new file mode 100644 index 00000000..4cb660fe --- /dev/null +++ b/spec/resources/temurin_package_install_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'temurin_package_install' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['temurin_package_install']) } + + let(:converge) do + runner.converge('test::temurin_package_spec') + end + + it 'installs the Adoptium apt keyring' do + expect(converge).to create_remote_file('/usr/share/keyrings/adoptium.asc').with( + source: 'https://packages.adoptium.net/artifactory/api/gpg/key/public', + mode: '0644' + ) + end + + it 'configures the apt repository with signed_by instead of trusted mode' do + expect(converge).to add_apt_repository('adoptium').with( + signed_by: '/usr/share/keyrings/adoptium.asc' + ) + end + + it 'installs the Temurin package' do + expect(converge).to install_package('temurin-17-jdk') + end + + context 'on AlmaLinux' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'almalinux', version: '8', step_into: ['temurin_package_install']) } + + it 'uses the RHEL-compatible Adoptium RPM repository' do + expect(converge).to create_yum_repository('adoptium').with( + baseurl: 'https://packages.adoptium.net/artifactory/rpm/rhel/$releasever/$basearch' + ) + end + end + + context 'on Amazon Linux' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'amazon', version: '2', step_into: ['temurin_package_install']) } + + it 'uses the Adoptium Amazon Linux 2 RPM repository' do + expect(converge).to create_yum_repository('adoptium').with( + baseurl: 'https://packages.adoptium.net/artifactory/rpm/amazonlinux/2/$basearch' + ) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 317bf1fa..b9669727 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,25 @@ require 'chefspec' -require 'chefspec/berkshelf' +require 'chefspec/policyfile' require_relative '../libraries/certificate_helpers' +require_relative '../libraries/bin_cmd_helpers' require_relative '../libraries/corretto_helpers' require_relative '../libraries/openjdk_helpers' +module PolicyfileCookbookPath + def initialize(options = {}) + if Array(options[:cookbook_path]).include?('spec/fixtures/cookbooks') + options = options.merge( + cookbook_path: Array(RSpec.configuration.cookbook_path) + [File.expand_path('fixtures/cookbooks', __dir__)] + ) + end + + super(options) + end +end + +ChefSpec::SoloRunner.prepend(PolicyfileCookbookPath) + RSpec.configure do |config| config.file_cache_path = File.join(Dir.tmpdir, 'chefspec') if config.respond_to?(:file_cache_path) config.color = true diff --git a/templates/jdk.sh.erb b/templates/jdk.sh.erb deleted file mode 100644 index 39486d3c..00000000 --- a/templates/jdk.sh.erb +++ /dev/null @@ -1 +0,0 @@ -export JAVA_HOME=<%= node['java']['java_home']%> diff --git a/test/fixtures/cookbooks/test/recipes/alternatives_spec.rb b/test/fixtures/cookbooks/test/recipes/alternatives_spec.rb new file mode 100644 index 00000000..f4167760 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/alternatives_spec.rb @@ -0,0 +1,4 @@ +java_alternatives 'test-alternatives' do + java_location '/opt/java' + bin_cmds [] +end diff --git a/test/fixtures/cookbooks/test/recipes/alternatives_unset_spec.rb b/test/fixtures/cookbooks/test/recipes/alternatives_unset_spec.rb new file mode 100644 index 00000000..ef7469a8 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/alternatives_unset_spec.rb @@ -0,0 +1,5 @@ +java_alternatives 'test-unset-alternatives' do + java_location '/opt/java' + bin_cmds ['java'] + action :unset +end diff --git a/test/fixtures/cookbooks/test/recipes/certificate_spec.rb b/test/fixtures/cookbooks/test/recipes/certificate_spec.rb new file mode 100644 index 00000000..f467a886 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/certificate_spec.rb @@ -0,0 +1,20 @@ +java_certificate 'java_certificate_test' do + cert_data <<~CERT + -----BEGIN CERTIFICATE----- + MIICjzCCAfigAwIBAgIJAOXrhcX4ZaGtMA0GCSqGSIb3DQEBBQUAMDoxCzAJBgNV + BAYTAlVTMQ0wCwYDVQQIEwRUZXN0MQ0wCwYDVQQKEwRUZXN0MQ0wCwYDVQQDEwR0 + ZXN0MB4XDTE2MTAxMzAxMTkzOVoXDTM2MTAwODAxMTkzOVowOjELMAkGA1UEBhMC + VVMxDTALBgNVBAgTBFRlc3QxDTALBgNVBAoTBFRlc3QxDTALBgNVBAMTBHRlc3Qw + gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALu8/ylmItn9wUOB4qvlONEiFQpJ + DCK5bt/OkjT02Knm+aAEZS1EDTVEiZWkumM884fd2+WgaMREk02Gy6u5CraOTtEz + VjLeHdr7V9CBZpR6l5gmUY5Ujk1coHZImiqRs3STLVlWHJGjzLXMkRx10CIU8SHC + zgTr57kNG/FT+e25AgMBAAGjgZwwgZkwHQYDVR0OBBYEFP3Ox0pHbZ0u6z746Hp0 + Yk1EBTacMGoGA1UdIwRjMGGAFP3Ox0pHbZ0u6z746Hp0Yk1EBTacoT6kPDA6MQsw + CQYDVQQGEwJVUzENMAsGA1UECBMEVGVzdDENMAsGA1UEChMEVGVzdDENMAsGA1UE + AxMEdGVzdIIJAOXrhcX4ZaGtMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD + gYEAG4idDXusAZ9OrzqdWdFQ+rhQYRovZnfSgPSdF7hugWL5i/qGGlsFjZld2Kyj + X0msGzk61iW7C6kv6OfPGaGNzdNtsH8jUvIYP1IrKpf1NKTKetIWiP08ZI1XNF4H + bXmOxdtxzlHW4qukka+HkK0RBrwX35C8HYqePmInI51JnqY= + -----END CERTIFICATE----- + CERT +end diff --git a/test/fixtures/cookbooks/test/recipes/corretto.rb b/test/fixtures/cookbooks/test/recipes/corretto.rb index c79294d6..338e87fe 100644 --- a/test/fixtures/cookbooks/test/recipes/corretto.rb +++ b/test/fixtures/cookbooks/test/recipes/corretto.rb @@ -1,3 +1,12 @@ -corretto_install node['version'] +extend Java::Cookbook::CorrettoHelpers + +version = node['version'].to_s +java_home = "/usr/lib/jvm/java-#{version}-corretto/#{corretto_sub_dir(version)}" + +corretto_install version do + java_home java_home +end + +node.run_state['java_certificate_java_home'] = java_home include_recipe 'test::java_cert' diff --git a/test/fixtures/cookbooks/test/recipes/corretto_spec.rb b/test/fixtures/cookbooks/test/recipes/corretto_spec.rb new file mode 100644 index 00000000..9664c1eb --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/corretto_spec.rb @@ -0,0 +1,7 @@ +declare_resource(:corretto_install, '17') do + url 'https://example.test/corretto.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/usr/lib/jvm/java-17-corretto/amazon-corretto-17' + bin_cmds %w(java javac) + skip_alternatives true +end diff --git a/test/fixtures/cookbooks/test/recipes/java_cert.rb b/test/fixtures/cookbooks/test/recipes/java_cert.rb index 857d1874..7931ce01 100644 --- a/test/fixtures/cookbooks/test/recipes/java_cert.rb +++ b/test/fixtures/cookbooks/test/recipes/java_cert.rb @@ -1,4 +1,5 @@ version = node['version'].to_s +certificate_java_home = node.run_state['java_certificate_java_home'] cookbook_file '/tmp/java_certificate_test.pem' do source 'java_certificate_test.pem' @@ -7,15 +8,18 @@ java_certificate 'java_certificate_test' do cert_file '/tmp/java_certificate_test.pem' java_version version + java_home certificate_java_home if certificate_java_home end java_certificate 'java_certificate_ssl_endpoint' do ssl_endpoint 'google.com:443' java_version version + java_home certificate_java_home if certificate_java_home end java_certificate 'java_certificate_ssl_endpoint' do java_version version + java_home certificate_java_home if certificate_java_home action :remove end @@ -23,9 +27,11 @@ ssl_endpoint 'smtp.gmail.com:587' starttls 'smtp' java_version version + java_home certificate_java_home if certificate_java_home end java_certificate 'java_certificate_ssl_endpoint_starttls_smtp' do java_version version + java_home certificate_java_home if certificate_java_home action :remove end diff --git a/test/fixtures/cookbooks/test/recipes/jce_remove_spec.rb b/test/fixtures/cookbooks/test/recipes/jce_remove_spec.rb new file mode 100644 index 00000000..7e5d05e6 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/jce_remove_spec.rb @@ -0,0 +1,9 @@ +declare_resource(:java_jce, '17') do + jce_url 'https://example.test/jce.zip' + jce_checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/usr/lib/jvm/java-17-openjdk-amd64' + jce_home '/usr/lib/jvm/jce' + download_path '/tmp/java' + install_type 'jdk' + action :remove +end diff --git a/test/fixtures/cookbooks/test/recipes/jce_spec.rb b/test/fixtures/cookbooks/test/recipes/jce_spec.rb new file mode 100644 index 00000000..51ac7427 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/jce_spec.rb @@ -0,0 +1,8 @@ +declare_resource(:java_jce, '17') do + jce_url 'https://example.test/jce.zip' + jce_checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/usr/lib/jvm/java-17-openjdk-amd64' + jce_home '/usr/lib/jvm/jce' + download_path '/tmp/java' + install_type 'jdk' +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_package_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_package_spec.rb new file mode 100644 index 00000000..4f413866 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_package_spec.rb @@ -0,0 +1,7 @@ +declare_resource(:openjdk_install, '17') do + install_type 'package' + pkg_names %w(openjdk-17-jdk openjdk-17-jre-headless) + java_home '/usr/lib/jvm/java-17-openjdk-amd64' + bin_cmds %w(java javac) + skip_alternatives true +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_pkg_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_pkg_spec.rb new file mode 100644 index 00000000..5bb3e045 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_pkg_spec.rb @@ -0,0 +1,6 @@ +declare_resource(:openjdk_pkg_install, '17') do + pkg_names %w(openjdk-17-jdk openjdk-17-jre-headless) + java_home '/usr/lib/jvm/java-17-openjdk-amd64' + bin_cmds %w(java javac) + skip_alternatives true +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_direct_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_direct_spec.rb new file mode 100644 index 00000000..9a2207bb --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_direct_spec.rb @@ -0,0 +1,7 @@ +declare_resource(:openjdk_source_install, '17') do + url 'https://example.test/openjdk.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/usr/lib/jvm/java-17-openjdk/jdk-17' + bin_cmds %w(java javac) + skip_alternatives true +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_remove_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_remove_spec.rb new file mode 100644 index 00000000..c822322c --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_remove_spec.rb @@ -0,0 +1,8 @@ +declare_resource(:openjdk_source_install, '17') do + url 'https://example.test/openjdk.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/usr/lib/jvm/java-17-openjdk/jdk-17' + bin_cmds %w(java javac) + skip_alternatives true + action :remove +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb new file mode 100644 index 00000000..b4a6227a --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb @@ -0,0 +1,8 @@ +declare_resource(:openjdk_install, '17') do + install_type 'source' + url 'https://example.test/openjdk.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/usr/lib/jvm/java-17-openjdk/jdk-17' + bin_cmds %w(java javac) + skip_alternatives true +end diff --git a/test/fixtures/cookbooks/test/recipes/temurin_package_spec.rb b/test/fixtures/cookbooks/test/recipes/temurin_package_spec.rb new file mode 100644 index 00000000..bc3b4eec --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/temurin_package_spec.rb @@ -0,0 +1,4 @@ +declare_resource(:temurin_package_install, '17') do + bin_cmds %w(java javac) + skip_alternatives true +end diff --git a/test/integration/custom-package/controls/verify_home.rb b/test/integration/custom-package/controls/verify_home.rb index bad2ff4d..9b63691d 100644 --- a/test/integration/custom-package/controls/verify_home.rb +++ b/test/integration/custom-package/controls/verify_home.rb @@ -11,7 +11,7 @@ desc 'Verify the correct version of java is installed' describe command('java -version 2>&1') do - its('stdout') { should match /AdoptOpenJDK/ } unless java_version.to_i == 1 + its('stdout') { should match(/OpenJDK|Temurin|Corretto/) } unless java_version.to_i == 1 its('stdout') { should match Regexp.new(java_version.to_s) } end end diff --git a/test/integration/openjdk/controls/verify_openjdk.rb b/test/integration/openjdk/controls/verify_openjdk.rb index 64e62479..cd5a75f0 100644 --- a/test/integration/openjdk/controls/verify_openjdk.rb +++ b/test/integration/openjdk/controls/verify_openjdk.rb @@ -14,20 +14,19 @@ title 'Path Verification' desc 'Verifies that keytool and other binaries are accessible in the correct paths using update-alternatives' - # Get architecture suffix - arch_suffix = command('uname -m').stdout.strip == 'x86_64' ? 'amd64' : 'arm64' - describe command('update-alternatives --display jar') do its('stdout') { should match %r{/usr/lib/jvm/java} } end + expected_java_home = %r{/usr/lib/jvm/java-#{java_version}[^\s]*/} + describe command('update-alternatives --display java') do - its('stdout') { should match %r{/usr/lib/jvm/java-#{java_version}-openjdk-#{arch_suffix}/bin/java} } + its('stdout') { should match %r{#{expected_java_home}bin/java} } end describe command('update-alternatives --display keytool') do - its('stdout') { should match %r{link best version is /usr/lib/jvm/java-#{java_version}-openjdk-#{arch_suffix}/bin/keytool} } - its('stdout') { should match %r{link keytool is /usr/bin/keytool} } + its('stdout') { should match %r{#{expected_java_home}bin/keytool} } + its('stdout') { should match %r{link (keytool )?(is )?/usr/bin/keytool|keytool - status} } its('stdout') { should match /priority 1/ } end end From 6045c5b44a4152586bbc3e6c6d38eff0c2712faf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 10:26:50 +0100 Subject: [PATCH 274/278] Update Actions to v7 (#759) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4d4ec9d..256d7fec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Install Chef uses: sous-chefs/.github/.github/actions/install-workstation@8.0.4 - name: Dokken From e6b00140ecc5f1e83a65d2f7a9173dd33f105431 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 22 Jun 2026 10:50:46 +0100 Subject: [PATCH 275/278] fix: add release-please manifest (#760) * fix: repair workflow actionlint failures * chore: modernize Java cookbook Replace Berkshelf with Policyfile wiring, tighten CI and Kitchen matrices, and update resource implementations for safer shell usage, explicit provides names, cleanup actions, and stronger ChefSpec coverage. * fix: add release-please manifest --- .release-please-manifest.json | 3 +++ release-please-config.json | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..b2abfd3a --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "14.0.1" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..36027f41 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,12 @@ +{ + "packages": { + ".": { + "package-name": "java", + "changelog-path": "CHANGELOG.md", + "release-type": "ruby", + "include-component-in-tag": false, + "version-file": "metadata.rb" + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} From 97433eab0686fb9b06b9b57fca75e37cd116fbc3 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 22 Jun 2026 14:25:48 +0100 Subject: [PATCH 276/278] fix!: support source archive upgrades (#762) Add version-aware source archive installs with source_install_dir support, pass java_home_owner through openjdk_install, and make Debian alternatives detection idempotent. Closes #745 Closes #708 Closes #649 --- documentation/resources/openjdk_install.md | 15 +++++ .../resources/openjdk_source_install.md | 26 ++++++++ metadata.rb | 2 +- resources/alternatives.rb | 14 +++- resources/openjdk_install.rb | 8 +++ resources/openjdk_source_install.rb | 51 +++++++++++---- spec/resources/alternatives_spec.rb | 26 ++++++++ spec/resources/openjdk_install_spec.rb | 2 + spec/resources/openjdk_source_install_spec.rb | 64 +++++++++++++++++++ .../recipes/alternatives_existing_spec.rb | 5 ++ .../recipes/openjdk_source_custom_url_spec.rb | 5 ++ .../openjdk_source_explicit_java_home_spec.rb | 6 ++ .../openjdk_source_install_dir_spec.rb | 6 ++ .../test/recipes/openjdk_source_spec.rb | 2 + 14 files changed, 217 insertions(+), 15 deletions(-) create mode 100644 test/fixtures/cookbooks/test/recipes/alternatives_existing_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_source_custom_url_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_source_explicit_java_home_spec.rb create mode 100644 test/fixtures/cookbooks/test/recipes/openjdk_source_install_dir_spec.rb diff --git a/documentation/resources/openjdk_install.md b/documentation/resources/openjdk_install.md index b9185b15..a9ad46d7 100644 --- a/documentation/resources/openjdk_install.md +++ b/documentation/resources/openjdk_install.md @@ -31,6 +31,7 @@ Introduced: v8.0.0 | pkg_names | Array | | List of packages to install | | | pkg_version | String | | Package version to install | | | install_type | String | | Installation type | `package` `source` | +| source_install_dir | String | | Source install directory | | ## Examples @@ -47,3 +48,17 @@ openjdk_install '11' do alternatives_priority 2 end ``` + +To install a source archive from an internal mirror: + +```ruby +openjdk_install '17' do + install_type 'source' + url 'https://artifacts.example.com/java/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +end +``` + +For source installs, custom URLs install into a directory derived from the archive name unless +`java_home` or `source_install_dir` is set. Source archives must contain a single top-level +directory because the source installer strips one leading path component during extraction. diff --git a/documentation/resources/openjdk_source_install.md b/documentation/resources/openjdk_source_install.md index 7032ba8d..e8dcb9d8 100644 --- a/documentation/resources/openjdk_source_install.md +++ b/documentation/resources/openjdk_source_install.md @@ -20,6 +20,7 @@ Introduced: v8.0.0 | url | String | `default_openjdk_url(version)` | The URL to download from | | checksum | String | `default_openjdk_checksum(version)` | The checksum for the downloaded file | | java_home | String | Based on the version | Set to override the java_home | +| source_install_dir | String | Based on the archive name | Source install directory | | java_home_mode | Integer, String | `0755` | The permission for the Java home directory | | java_home_owner | String | `root` | Owner of the Java Home | | java_home_group | String | `node['root_group']` | Group for the Java Home | @@ -44,3 +45,28 @@ openjdk_source_install '11' do alternatives_priority 2 end ``` + +To install a custom OpenJDK archive from an internal mirror: + +```ruby +openjdk_source_install '17' do + url 'https://artifacts.example.com/java/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +end +``` + +This installs to `/usr/lib/jvm/java-17-openjdk/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9` +and configures alternatives from that Java home. + +To choose a stable install directory for a custom archive: + +```ruby +openjdk_source_install '17' do + url 'https://artifacts.example.com/java/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + source_install_dir 'jdk-17.0.9+9' +end +``` + +Source archives must contain a single top-level directory. The resource extracts archives with +one leading path component stripped so the archive contents land directly in `java_home`. diff --git a/metadata.rb b/metadata.rb index 999bf085..55d8fa99 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ description 'Recipes and resources for installing Java and managing certificates' source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' -chef_version '>= 16.0' +chef_version '>= 17.5' version '14.0.1' supports 'almalinux', '>= 8.0' diff --git a/resources/alternatives.rb b/resources/alternatives.rb index f67e7c44..2def88b3 100644 --- a/resources/alternatives.rb +++ b/resources/alternatives.rb @@ -34,7 +34,7 @@ action :set do bin_cmds_to_setup = parse_java_alternatives set_alternatives(bin_cmds_to_setup) do |cmd, alt_path| - alternative_exists = ::File.exist?("/var/lib/alternatives/#{cmd}") && + alternative_exists = ::File.exist?(alternative_file_path(cmd)) && alternatives_display(cmd).stdout.include?(alt_path) Chef::Log.debug("Alternative for #{cmd} exists with correct path? #{alternative_exists}") alternative_exists @@ -58,6 +58,14 @@ def alternatives_display(cmd) shell_out(alternatives_cmd, '--display', cmd) end + def alternative_file_path(cmd) + if platform_family?('debian') + "/var/lib/dpkg/alternatives/#{cmd}" + else + "/var/lib/alternatives/#{cmd}" + end + end + def parse_java_alternatives bin_cmds_to_setup = [] new_resource.bin_cmds.each do |cmd| @@ -101,12 +109,12 @@ def set_alternatives(bin_cmds) end end - alternative_file_exists = ::File.exist?("/var/lib/alternatives/#{cmd}") + alternative_file_exists = ::File.exist?(alternative_file_path(cmd)) if !our_alternative_exists || !alternative_file_exists converge_by("Add alternative for #{cmd}") do if new_resource.reset_alternatives && alternative_file_exists - ::FileUtils.rm_f("/var/lib/alternatives/#{cmd}") + ::FileUtils.rm_f(alternative_file_path(cmd)) end shell_out!(alternatives_cmd, '--install', bin_path, cmd, alt_path, priority.to_s) end diff --git a/resources/openjdk_install.rb b/resources/openjdk_install.rb index e5c9ce9e..e119b717 100644 --- a/resources/openjdk_install.rb +++ b/resources/openjdk_install.rb @@ -22,6 +22,10 @@ String, description: 'Set to override the java_home' +property :source_install_dir, + String, + description: 'Directory under the versioned parent path where the source archive is installed' + property :bin_cmds, Array, description: 'A list of bin_cmds based on the version and variant' @@ -59,7 +63,9 @@ url new_resource.url checksum new_resource.checksum java_home new_resource.java_home + source_install_dir new_resource.source_install_dir java_home_mode new_resource.java_home_mode + java_home_owner new_resource.java_home_owner java_home_group new_resource.java_home_group default new_resource.default bin_cmds bin_cmds @@ -93,7 +99,9 @@ url new_resource.url checksum new_resource.checksum java_home new_resource.java_home + source_install_dir new_resource.source_install_dir java_home_mode new_resource.java_home_mode + java_home_owner new_resource.java_home_owner java_home_group new_resource.java_home_group default new_resource.default bin_cmds bin_cmds diff --git a/resources/openjdk_source_install.rb b/resources/openjdk_source_install.rb index dae97036..0b07ecb7 100644 --- a/resources/openjdk_source_install.rb +++ b/resources/openjdk_source_install.rb @@ -19,6 +19,9 @@ property :java_home, String, description: 'Set to override the java_home' +property :source_install_dir, String, + description: 'Directory under the versioned parent path where the source archive is installed' + property :bin_cmds, Array, description: 'A list of bin_cmds based on the version and variant' @@ -30,13 +33,11 @@ action :install do url = new_resource.url || default_openjdk_url(new_resource.version, new_resource.variant) checksum = new_resource.checksum || default_openjdk_checksum(new_resource.version) - java_home = new_resource.java_home || "/usr/lib/jvm/java-#{new_resource.version}-openjdk/jdk-#{new_resource.version}" + java_home = resolved_java_home(url) bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) - extract_dir = java_home.split('/')[0..-2].join('/') - parent_dir = java_home.split('/')[0..-3].join('/') tarball_name = url.split('/').last - directory parent_dir do + directory java_home do owner new_resource.java_home_owner group new_resource.java_home_group mode new_resource.java_home_mode @@ -52,7 +53,13 @@ end archive_file "#{Chef::Config[:file_cache_path]}/#{tarball_name}" do - destination extract_dir + destination java_home + strip_components 1 + overwrite true + owner new_resource.java_home_owner + group new_resource.java_home_group + mode new_resource.java_home_mode + not_if { ::File.exist?(::File.join(java_home, 'bin', 'java')) } end java_alternatives 'set-java-alternatives' do @@ -74,22 +81,22 @@ end action :remove do - java_home = new_resource.java_home || "/usr/lib/jvm/java-#{new_resource.version}-openjdk/jdk-#{new_resource.version}" + url = new_resource.url || default_openjdk_url(new_resource.version, new_resource.variant) + java_home = resolved_java_home(url) bin_cmds = new_resource.bin_cmds || default_bin_cmds(new_resource.version) - extract_dir = java_home.split('/')[0..-2].join('/') java_alternatives 'unset-java-alternatives' do java_location java_home bin_cmds bin_cmds - only_if { ::File.exist?(extract_dir) } + only_if { ::File.exist?(java_home) } not_if { new_resource.skip_alternatives } action :unset end - directory "Removing #{extract_dir}" do - path extract_dir + directory "Removing #{java_home}" do + path java_home recursive true - only_if { ::File.exist?(extract_dir) } + only_if { ::File.exist?(java_home) } action :delete end @@ -97,3 +104,25 @@ action :delete end end + +action_class do + def resolved_java_home(url) + return new_resource.java_home if new_resource.java_home + + install_dir = + if new_resource.source_install_dir + new_resource.source_install_dir + elsif new_resource.url + source_install_dir_from_url(url) + else + "jdk-#{new_resource.version}" + end + + "/usr/lib/jvm/java-#{new_resource.version}-openjdk/#{install_dir}" + end + + def source_install_dir_from_url(url) + ::File.basename(::URI.parse(url).path) + .sub(/\.(?:tar\.(?:gz|bz2|xz)|tgz|tbz2|zip)\z/i, '') + end +end diff --git a/spec/resources/alternatives_spec.rb b/spec/resources/alternatives_spec.rb index cdc5ad20..3d4953d8 100644 --- a/spec/resources/alternatives_spec.rb +++ b/spec/resources/alternatives_spec.rb @@ -16,4 +16,30 @@ expect { runner.converge('test::alternatives_unset_spec') }.not_to raise_error end + + it 'does not reinstall an existing Debian alternative' do + allow(::File).to receive(:exist?).and_call_original + allow(::File).to receive(:exist?).with('/opt/java/bin/java').and_return(true) + allow(::File).to receive(:exist?).with('/var/lib/dpkg/alternatives/java').and_return(true) + allow(::File).to receive(:exist?).with('/var/lib/alternatives/java').and_return(false) + + stubs_for_provider('java_alternatives[test-existing-alternatives]') do |provider| + display = <<~OUTPUT + java - auto mode + link best version is /opt/java/bin/java + link currently points to /opt/java/bin/java + link java is /usr/bin/java + /opt/java/bin/java - priority 1062 + OUTPUT + + allow(provider).to receive(:shell_out) + .with('update-alternatives', '--display', 'java') + .and_return(instance_double(Mixlib::ShellOut, stdout: display, exitstatus: 0)) + allow(provider).to receive(:shell_out!) do |*args| + raise "unexpected shell_out!: #{args.join(' ')}" + end + end + + expect { runner.converge('test::alternatives_existing_spec') }.not_to raise_error + end end diff --git a/spec/resources/openjdk_install_spec.rb b/spec/resources/openjdk_install_spec.rb index 6451c4fe..8bb387fe 100644 --- a/spec/resources/openjdk_install_spec.rb +++ b/spec/resources/openjdk_install_spec.rb @@ -32,6 +32,8 @@ url: 'https://example.test/openjdk.tar.gz', checksum: 'a' * 64, java_home: '/usr/lib/jvm/java-17-openjdk/jdk-17', + source_install_dir: 'jdk-17.0.9+9', + java_home_owner: 'javauser', bin_cmds: %w(java javac), skip_alternatives: true ) diff --git a/spec/resources/openjdk_source_install_spec.rb b/spec/resources/openjdk_source_install_spec.rb index ba4e723e..efcef1af 100644 --- a/spec/resources/openjdk_source_install_spec.rb +++ b/spec/resources/openjdk_source_install_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'openjdk_source_install' do + let(:cache_path) { Chef::Config[:file_cache_path] } + context 'install' do let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_source_install']) } let(:converge) { runner.converge('test::openjdk_source_direct_spec') } @@ -19,6 +21,68 @@ expect(resource.content).to eq("export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/jdk-17\n") expect(resource.mode).to eq('0644') end + + it 'extracts the archive into the final java_home' do + archive = converge.resource_collection.find(archive_file: ::File.join(cache_path, 'openjdk.tar.gz')) + + expect(archive.destination).to eq('/usr/lib/jvm/java-17-openjdk/jdk-17') + expect(archive.strip_components).to eq(1) + expect(archive.overwrite).to be true + expect(archive.not_if).not_to be_empty + end + end + + context 'custom source URL' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_source_install']) } + let(:converge) { runner.converge('test::openjdk_source_custom_url_spec') } + let(:java_home) { '/usr/lib/jvm/java-17-openjdk/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9' } + + it 'derives java_home from the archive file name' do + resource = converge.resource_collection.find(file: '/etc/profile.d/java.sh') + + expect(resource.content).to eq("export JAVA_HOME=#{java_home}\n") + end + + it 'sets alternatives to the derived java_home' do + expect(converge).to set_java_alternatives('set-java-alternatives').with( + java_location: java_home, + bin_cmds: %w(java javac) + ) + end + + it 'extracts the archive into the derived java_home' do + archive = converge.resource_collection.find(archive_file: ::File.join(cache_path, 'OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz')) + + expect(archive.destination).to eq(java_home) + expect(archive.strip_components).to eq(1) + expect(archive.overwrite).to be true + expect(archive.owner).to eq('root') + expect(archive.group).to eq('root') + expect(archive.mode).to eq('0755') + expect(archive.not_if).not_to be_empty + end + end + + context 'custom source URL with explicit java_home' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_source_install']) } + let(:converge) { runner.converge('test::openjdk_source_explicit_java_home_spec') } + + it 'uses the explicit java_home' do + resource = converge.resource_collection.find(file: '/etc/profile.d/java.sh') + + expect(resource.content).to eq("export JAVA_HOME=/opt/java/custom-openjdk\n") + end + end + + context 'custom source URL with source_install_dir' do + let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04', step_into: ['openjdk_source_install']) } + let(:converge) { runner.converge('test::openjdk_source_install_dir_spec') } + + it 'uses source_install_dir under the versioned parent directory' do + resource = converge.resource_collection.find(file: '/etc/profile.d/java.sh') + + expect(resource.content).to eq("export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/jdk-17.0.9+9\n") + end end context 'remove' do diff --git a/test/fixtures/cookbooks/test/recipes/alternatives_existing_spec.rb b/test/fixtures/cookbooks/test/recipes/alternatives_existing_spec.rb new file mode 100644 index 00000000..b714fd5e --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/alternatives_existing_spec.rb @@ -0,0 +1,5 @@ +java_alternatives 'test-existing-alternatives' do + java_location '/opt/java' + bin_cmds ['java'] + priority 1062 +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_custom_url_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_custom_url_spec.rb new file mode 100644 index 00000000..8ac6fcf7 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_custom_url_spec.rb @@ -0,0 +1,5 @@ +declare_resource(:openjdk_source_install, '17') do + url 'https://artifacts.example.test/java/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + bin_cmds %w(java javac) +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_explicit_java_home_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_explicit_java_home_spec.rb new file mode 100644 index 00000000..4fc8a521 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_explicit_java_home_spec.rb @@ -0,0 +1,6 @@ +declare_resource(:openjdk_source_install, '17') do + url 'https://artifacts.example.test/java/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + java_home '/opt/java/custom-openjdk' + bin_cmds %w(java javac) +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_install_dir_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_install_dir_spec.rb new file mode 100644 index 00000000..dab3492d --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_install_dir_spec.rb @@ -0,0 +1,6 @@ +declare_resource(:openjdk_source_install, '17') do + url 'https://artifacts.example.test/java/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz' + checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + source_install_dir 'jdk-17.0.9+9' + bin_cmds %w(java javac) +end diff --git a/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb b/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb index b4a6227a..80b2f26e 100644 --- a/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb +++ b/test/fixtures/cookbooks/test/recipes/openjdk_source_spec.rb @@ -3,6 +3,8 @@ url 'https://example.test/openjdk.tar.gz' checksum 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' java_home '/usr/lib/jvm/java-17-openjdk/jdk-17' + source_install_dir 'jdk-17.0.9+9' + java_home_owner 'javauser' bin_cmds %w(java javac) skip_alternatives true end From ba8dba239d98eebf58a9a39dd31553f3650aca84 Mon Sep 17 00:00:00 2001 From: Sous Chefs Bot <33356041+kitchen-porter@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:43:34 +0100 Subject: [PATCH 277/278] chore(main): release 15.0.0 (#761) * chore(main): release 15.0.0 * fix markdown Signed-off-by: Dan Webb --------- Signed-off-by: Dan Webb Co-authored-by: Dan Webb --- .markdownlint-cli2.yaml | 3 + .release-please-manifest.json | 2 +- CHANGELOG.md | 527 ++++++++++++++++++---------------- metadata.rb | 2 +- 4 files changed, 277 insertions(+), 257 deletions(-) diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index 0196ac7b..e42be9b1 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -3,5 +3,8 @@ config: line-length: false # MD013 no-duplicate-heading: false # MD024 reference-links-images: false # MD052 + no-multiple-blanks: + maximum: 2 ignores: - .github/copilot-instructions.md + - .windsurf/** diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b2abfd3a..b87683f4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "14.0.1" + ".": "15.0.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index af7b6d58..2203cc0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,359 +8,376 @@ Standardise files with files in sous-chefs/repo-management Standardise files with files in sous-chefs/repo-management +## [15.0.0](https://github.com/sous-chefs/java/compare/14.0.1...v15.0.0) (2026-06-22) + + +### ⚠ BREAKING CHANGES + +* support source archive upgrades ([#762](https://github.com/sous-chefs/java/issues/762)) +* remove legacy Java node attribute API ([#758](https://github.com/sous-chefs/java/issues/758)) + +### Features + +* remove legacy Java node attribute API ([#758](https://github.com/sous-chefs/java/issues/758)) ([14e673e](https://github.com/sous-chefs/java/commit/14e673eee215a0fb5faca1111399272b04735e4b)) + +### Bug Fixes + +* add release-please manifest ([#760](https://github.com/sous-chefs/java/issues/760)) ([e6b0014](https://github.com/sous-chefs/java/commit/e6b00140ecc5f1e83a65d2f7a9173dd33f105431)) +* support source archive upgrades ([#762](https://github.com/sous-chefs/java/issues/762)) ([97433ea](https://github.com/sous-chefs/java/commit/97433eab0686fb9b06b9b57fca75e37cd116fbc3)), closes [#745](https://github.com/sous-chefs/java/issues/745) [#708](https://github.com/sous-chefs/java/issues/708) [#649](https://github.com/sous-chefs/java/issues/649) + ## 14.0.1 - *2025-09-04* ## 14.0.0 - *2025-07-16* -- Remove Semeru support as there is no clean yum or apt repository for it +* Remove Semeru support as there is no clean yum or apt repository for it ## 13.2.0 - *2025-07-14* -- Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728)) -- Clarify documentation for `url` property in `openjdk_source_install` resource to note it can be used for internal mirrors -- Standardise files with files in sous-chefs/repo-management +* Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728)) +* Clarify documentation for `url` property in `openjdk_source_install` resource to note it can be used for internal mirrors +* Standardise files with files in sous-chefs/repo-management Update the recommended Ruby VSCode extensions -- Fix missing skip_alternatives property in openjdk_pkg_install +* Fix missing skip_alternatives property in openjdk_pkg_install ## 13.1.0 - *2025-07-14* -- add `skip_alternatives` to resources `corretto_install`, `openjdk_install`, `openjdk_pkg_install`, `openjdk_source_install` for cases when management of alternatives is not desired. (@dschlenk) +* add `skip_alternatives` to resources `corretto_install`, `openjdk_install`, `openjdk_pkg_install`, `openjdk_source_install` for cases when management of alternatives is not desired. (@dschlenk) ## 13.0.0 - *2025-07-13* -- Add new resource `temurin_package_install` -- Add script to check for Java updates -- Update Temurin Java 8 support -- Update Temurin repositories -- Update bin commands for all OpenJDK versions -- Fix Java alternatives to prevent unnecessary removal and re-addition of alternatives -- Move bin_cmds from Java::Cookbook::OpenJdkHelpers to Java::Cookbook::BinCmdHelpers for reuse outside of OpenJDK -- Fix apt_repository failing to install the GPG in the correct location -- Add Temurin 21 to the test matrix -- Remove Semeru from the test matrix +* Add new resource `temurin_package_install` +* Add script to check for Java updates +* Update Temurin Java 8 support +* Update Temurin repositories +* Update bin commands for all OpenJDK versions +* Fix Java alternatives to prevent unnecessary removal and re-addition of alternatives +* Move bin_cmds from Java::Cookbook::OpenJdkHelpers to Java::Cookbook::BinCmdHelpers for reuse outside of OpenJDK +* Fix apt_repository failing to install the GPG in the correct location +* Add Temurin 21 to the test matrix +* Remove Semeru from the test matrix ## 12.1.1 - *2024-12-05* ## 12.1.0 - *2024-12-03* -- Add support for OpenJDK versions 19, 20, 21 and 22 -- Remove commented out `adoptopenjdk_linux_install` resource -- CI: chore(deps): update sous-chefs/.github action to v3.1.0 -- CI: chore(deps): update actionshub/chef-install action to v3 -- Update platforms -- Replace AdoptOpenJDK with Eclipse Temurin and IBM Semeru +* Add support for OpenJDK versions 19, 20, 21 and 22 +* Remove commented out `adoptopenjdk_linux_install` resource +* CI: chore(deps): update sous-chefs/.github action to v3.1.0 +* CI: chore(deps): update actionshub/chef-install action to v3 +* Update platforms +* Replace AdoptOpenJDK with Eclipse Temurin and IBM Semeru ## 12.0.7 - *2024-11-18* -- Standardise files with files in sous-chefs/repo-management +* Standardise files with files in sous-chefs/repo-management ## 12.0.6 - *2024-07-15* -- Standardise files with files in sous-chefs/repo-management +* Standardise files with files in sous-chefs/repo-management ## 12.0.2 - *2024-01-16* -- Fix `openjdk_pkg_install` to obey `pkg_version` property for all `pkg_names` +* Fix `openjdk_pkg_install` to obey `pkg_version` property for all `pkg_names` ## 11.2.0 - *2023-09-12* -- Standardise files with files in sous-chefs/repo-management +* Standardise files with files in sous-chefs/repo-management ## 11.1.0 - *2023-04-17* -- Standardise files with files in sous-chefs/repo-management +* Standardise files with files in sous-chefs/repo-management ## 11.1.0 - *2022-04-26* -- Remove Correto 15 and 16 -- Add Corretto 17 and 18 -- Change the defualt download URL for Corretto to the versioned resources URL, rather than latest. +* Remove Correto 15 and 16 +* Add Corretto 17 and 18 +* Change the defualt download URL for Corretto to the versioned resources URL, rather than latest. ## 11.0.0 - *2022-02-16* -- Require Chef 16 for resource partials -- Add resource partials for: MacOS, Linux, Java Home and Common as these are used in a multiple places +* Require Chef 16 for resource partials +* Add resource partials for: MacOS, Linux, Java Home and Common as these are used in a multiple places ## 10.2.0 - *2022-01-26* -- Remove tap_full option as this is no longer supported and there is no replacement -- Remove delivery and move to calling RSpec directly via a reusable workflow +* Remove tap_full option as this is no longer supported and there is no replacement +* Remove delivery and move to calling RSpec directly via a reusable workflow ## 10.1.0 - *2021-10-06* -- Revert worklfow split out -- Rename InSpec attribute folders to input -- Add Corretto 16 -- Update the Corretto minor version numbers -- Default the Debian install method to package -- Remove testing for end of life OpenJDK suites -- Primarily support OpenJDK LTS versions 11, 17 -- Drop support for OpenJDK package installs for non-LTS versions -- Direct Amazon users to Amazon Corretto instead of installing OpenJDK -- Drop package install support for Java 8 +* Revert worklfow split out +* Rename InSpec attribute folders to input +* Add Corretto 16 +* Update the Corretto minor version numbers +* Default the Debian install method to package +* Remove testing for end of life OpenJDK suites +* Primarily support OpenJDK LTS versions 11, 17 +* Drop support for OpenJDK package installs for non-LTS versions +* Direct Amazon users to Amazon Corretto instead of installing OpenJDK +* Drop package install support for Java 8 ## 10.0.0 - *2021-09-02* -- Remove recipes to stop confusing users +* Remove recipes to stop confusing users ## 9.0.0 - *2021-06-04* -- Remove Corretto checksum code defaults as this changes regularly, and is not provided in the SHA256 format via an API -- Set unified_mode to true for Chef 17 support -- Bump the minimum Chef version to 15.3 for unified_mode support +* Remove Corretto checksum code defaults as this changes regularly, and is not provided in the SHA256 format via an API +* Set unified_mode to true for Chef 17 support +* Bump the minimum Chef version to 15.3 for unified_mode support ## 8.6.0 - *2021-01-22* -- Added Amazon Corretto 15 support to `corretto_install` -- Added configurable `file_cache_path` property to `java_certificate` -- Added `cacerts` property to `java_certificate` for interacting with java cacerts file (Java 9+) +* Added Amazon Corretto 15 support to `corretto_install` +* Added configurable `file_cache_path` property to `java_certificate` +* Added `cacerts` property to `java_certificate` for interacting with java cacerts file (Java 9+) ## 8.5.0 - *2020-12-03* -- If installation issues with `openjdk_install` resource (fixes #645) -- Remove testing of Amazon Linux 1 -- Use fedora-latest +* If installation issues with `openjdk_install` resource (fixes #645) +* Remove testing of Amazon Linux 1 +* Use fedora-latest ## 8.4.0 - *2020-09-09* -- Add `starttls` property to `java_certificate` resource to allow fetching certificates from non HTTPS endpoints +* Add `starttls` property to `java_certificate` resource to allow fetching certificates from non HTTPS endpoints ## 8.3.2 - *2020-08-20* -- Add aarch64 installation candidate for Corretto +* Add aarch64 installation candidate for Corretto ## 8.3.1 - *2020-08-06* -- Extract correct JAVA_HOME from custom URLs +* Extract correct JAVA_HOME from custom URLs ## 8.3.0 - *2020-06-18* -- Restore compatibility with Chef Infra Client < 16 -- Update Fedora releases in the Kitchen configs +* Restore compatibility with Chef Infra Client < 16 +* Update Fedora releases in the Kitchen configs ## 8.2.0 - *2020-06-02* -- resolved cookstyle error: resources/adoptopenjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` -- Remove testing of Ubuntu 14.04, support at this point is no longer guaranteed +* resolved cookstyle error: resources/adoptopenjdk_install.rb:1:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` +* Remove testing of Ubuntu 14.04, support at this point is no longer guaranteed ## 8.1.0 - *2020-04-19* -- Added `openjdk_pkg_install` resource -- Added documentation for openjdk_pkg_install -- Added `adoptopenjdk_linux_install` resource -- Added `adoptopenjdk_macos_install` resource -- Added documentation for `adoptopenjdk_linux_install` -- Added documentation for `adoptopenjdk_macos_install` -- Resolved cookstyle error: resources/alternatives.rb:49:13 refactor: `ChefCorrectness/ChefApplicationFatal` -- Resolved cookstyle error: resources/alternatives.rb:62:13 refactor: `ChefCorrectness/ChefApplicationFatal` -- Resolved cookstyle error: resources/alternatives.rb:75:11 refactor: `ChefCorrectness/ChefApplicationFatal` -- Resolved cookstyle error: resources/jce.rb:51:6 refactor: `ChefStyle/UnnecessaryOSCheck` +* Added `openjdk_pkg_install` resource +* Added documentation for openjdk_pkg_install +* Added `adoptopenjdk_linux_install` resource +* Added `adoptopenjdk_macos_install` resource +* Added documentation for `adoptopenjdk_linux_install` +* Added documentation for `adoptopenjdk_macos_install` +* Resolved cookstyle error: resources/alternatives.rb:49:13 refactor: `ChefCorrectness/ChefApplicationFatal` +* Resolved cookstyle error: resources/alternatives.rb:62:13 refactor: `ChefCorrectness/ChefApplicationFatal` +* Resolved cookstyle error: resources/alternatives.rb:75:11 refactor: `ChefCorrectness/ChefApplicationFatal` +* Resolved cookstyle error: resources/jce.rb:51:6 refactor: `ChefStyle/UnnecessaryOSCheck` ## 8.0.0 - *2020-03-30* -- Added `openjdk_install` resource & documentation -- Removed openjdk, corretto, default_java_symlink, ibm & ibm_tar, notify & oracle recipes -- Removed support for IBM and Oracle Java -- Temporarily removed support for Windows -- Split out helpers for each provider into their own namespace and file +* Added `openjdk_install` resource & documentation +* Removed openjdk, corretto, default_java_symlink, ibm & ibm_tar, notify & oracle recipes +* Removed support for IBM and Oracle Java +* Temporarily removed support for Windows +* Split out helpers for each provider into their own namespace and file ## 7.0.0 - *2020-03-05* -- Refactored and sped up unit tests. -- Added `adoptopenjdk_install` resource & documentation -- Added AdoptOpenJDK 13 testing -- Removed the adoptopenjdk recipe, please use the `adoptopenjdk_install` resource instead. -- Increased the minimum Chef requirement to Chef 15 to use the archive resource. -- Removed AdoptOpenJDK 10 testing +* Refactored and sped up unit tests. +* Added `adoptopenjdk_install` resource & documentation +* Added AdoptOpenJDK 13 testing +* Removed the adoptopenjdk recipe, please use the `adoptopenjdk_install` resource instead. +* Increased the minimum Chef requirement to Chef 15 to use the archive resource. +* Removed AdoptOpenJDK 10 testing ## 6.0.0 - *2020-03-02* -- The resource alias `java_ark` has been deprecated in favour of `java_oracle_install` +* The resource alias `java_ark` has been deprecated in favour of `java_oracle_install` ## 5.0.0 - *2020-02-21* -- Fixed java_certificate regex where it checks if cert exists in cacert file. -- Make Homebrew Cask name an attribute to allow for other options (ex: adoptopenjdk) -- Switch homebrew tap to homebrew/cask-versions -- Make builds parallel -- Updates package name and link changes for adoptopenjdk -- Migrated testing to github actions -- Removes openjdk-6 -- Removes openjdk-7 for Ubuntu 16.04 -- Removes openjdk-11 for Ubuntu -- Removes openjdk-direct for Debian 8 -- Removes oracle variants from test configurations +* Fixed java_certificate regex where it checks if cert exists in cacert file. +* Make Homebrew Cask name an attribute to allow for other options (ex: adoptopenjdk) +* Switch homebrew tap to homebrew/cask-versions +* Make builds parallel +* Updates package name and link changes for adoptopenjdk +* Migrated testing to github actions +* Removes openjdk-6 +* Removes openjdk-7 for Ubuntu 16.04 +* Removes openjdk-11 for Ubuntu +* Removes openjdk-direct for Debian 8 +* Removes oracle variants from test configurations ## 4.3.0 - *2019-08-04* -- Upgrade Amazon Corretto to the latest versions: 8.222.10.1 and 11.0.4.11.1 -- Upgrade circleci orb to version 2 and add yamllint and markdown lint +* Upgrade Amazon Corretto to the latest versions: 8.222.10.1 and 11.0.4.11.1 +* Upgrade circleci orb to version 2 and add yamllint and markdown lint ## 4.2.0 - *2019-07-15* -- Fix for issue 538 -- Added "download_path" node attribute defaulting to file_cache_path -- Replaced all hardcoded instances of file_cache_path with the node attribute +* Fix for issue 538 +* Added "download_path" node attribute defaulting to file_cache_path +* Replaced all hardcoded instances of file_cache_path with the node attribute ## 4.1.0 - *2019-05-08* -- Added new install flavor "corretto" for Amazon's Corretto distribution of OpenJDK +* Added new install flavor "corretto" for Amazon's Corretto distribution of OpenJDK ## 4.0.0 - *2019-04-19* -- Added new install flavor "adoptopenjdk" for AdoptOpenJDK's distribution of Java -- The certificate resource now uses the Java version to determine the default cacerts location -- Updated AdoptOpenJDK links for Java 8 -- Updated AdoptOpenJDK links for Java 11 to 11.0.1 -- BREAKING CHANGE: Remove support for Java 6 & 7 -- Remove platform suport for untested platforms (smartOS, XenServer, zlinux, arch) -- Remove testing of Ubuntu 14.04, support at this point is no longer guaranteed and patches or other changes may not be accepted going further as Ubuntu 14.04 will be shortly EOL -- Fixed oracle download link for JDK 8 (update to 8u202 from 8u201) -- fixed specs for windows +* Added new install flavor "adoptopenjdk" for AdoptOpenJDK's distribution of Java +* The certificate resource now uses the Java version to determine the default cacerts location +* Updated AdoptOpenJDK links for Java 8 +* Updated AdoptOpenJDK links for Java 11 to 11.0.1 +* BREAKING CHANGE: Remove support for Java 6 & 7 +* Remove platform suport for untested platforms (smartOS, XenServer, zlinux, arch) +* Remove testing of Ubuntu 14.04, support at this point is no longer guaranteed and patches or other changes may not be accepted going further as Ubuntu 14.04 will be shortly EOL +* Fixed oracle download link for JDK 8 (update to 8u202 from 8u201) +* fixed specs for windows ## 3.2.0 - *2019-01-24* -- Add support OpenJDK 11 -- Fixed oracle download link again +* Add support OpenJDK 11 +* Fixed oracle download link again ## 3.1.2 - *2018-12-11* -- Set java home on macosx using /usr/libexec/java_home -- Find command should have ./ for path to search, works for nix and mac -- Make `java_certificate` work with SNI endpoints +* Set java home on macosx using /usr/libexec/java_home +* Find command should have ./ for path to search, works for nix and mac +* Make `java_certificate` work with SNI endpoints ## 3.1.1 - *2018-11-09* -- Fix jce installation linux -- Allow overwrite `returns` property of windows_packages +* Fix jce installation linux +* Allow overwrite `returns` property of windows_packages ## 3.1.0 - *2018-10-18* -- Add support for JDK 11 +* Add support for JDK 11 ## 3.0.0 - *2018-10-18* -- Fix broken JCE with JRE installations -- make cert alias matching case insensitive as `keytool` always returns results downcases -- BREAKING CHANGE: fixed greedy matching by adding a word boundry when checking cert alias this prevents matching `foo_123` as `foo` -- verify artifact after downloading from oracle -- fixed `recipes/openjdk` when `node['java']['jdk_version']` by casting it to a string -- Updated Oracle Java links to 8u191 +* Fix broken JCE with JRE installations +* make cert alias matching case insensitive as `keytool` always returns results downcases +* BREAKING CHANGE: fixed greedy matching by adding a word boundry when checking cert alias this prevents matching `foo_123` as `foo` +* verify artifact after downloading from oracle +* fixed `recipes/openjdk` when `node['java']['jdk_version']` by casting it to a string +* Updated Oracle Java links to 8u191 ## 2.2.1 - *2018-09-29* -- Allows for additional Oracle (post 9) jdk download file naming, including '10.0.2'. '18.9', '11' +* Allows for additional Oracle (post 9) jdk download file naming, including '10.0.2'. '18.9', '11' ## 2.2.0 - *2018-07-19* -- Updated Oracle Java links to 8u181 -- Fixed incorrect kitchen setup runlists that preventing local testing -- Resolve undefined certout errors +* Updated Oracle Java links to 8u181 +* Fixed incorrect kitchen setup runlists that preventing local testing +* Resolve undefined certout errors ## 2.1.0 - *2018-05-25* -- Added Java 10 JCE attributes to default attrs -- Update oracle recipeM to not perform a switch on java major version and instead use the version provided in attributes. This allows end users to include new Java versions without the cookbook requiring an update each time a major version gets released -- Updated the oracle_install resource to pick up semantic versioning that Oracle has started using for Java 10+ -- Updated the default attributes file to include x86_64 endpoint and checksum for Oracle Java 10\. The i586 version is not (yet) available. -- Fix JCE installation on Windows -- Avoid EmptyWindowsCommand error on Windows +* Added Java 10 JCE attributes to default attrs +* Update oracle recipeM to not perform a switch on java major version and instead use the version provided in attributes. This allows end users to include new Java versions without the cookbook requiring an update each time a major version gets released +* Updated the oracle_install resource to pick up semantic versioning that Oracle has started using for Java 10+ +* Updated the default attributes file to include x86_64 endpoint and checksum for Oracle Java 10\. The i586 version is not (yet) available. +* Fix JCE installation on Windows +* Avoid EmptyWindowsCommand error on Windows ## v2.0.1 - *2018-05-02* -- Fix java_certificate and java_oracle_install to work on FIPS enabled systems +* Fix java_certificate and java_oracle_install to work on FIPS enabled systems ## v2.0.0 - *2018-05-02* -- Converted alternatives, ark, and certificate LWRP/HWRPs to custom resources with improved logging and convergence notification. -- Renamed the java_ark resource to java_oracle_install, which better represents what it does. The existing name will continue to function -- Removed the need for the apt cookbook and instead require Chef 12.9+ -- Fixed Amazon Linux support on Chef 13+. -- Fixed the alternatives commands on Fedora systems. -- Added initial openSUSE leap support. -- Updated code to use multi-package installs to speed up runs -- Made the 'cert_alias' property in the certificate resource the name_property to allow users to avoid resource cloning and to be able to use friendly resource names -- Moved the warning code for downloading directly from Oracle into the resource to prevent another resource showing as converged -- Updated the metadata to resolve failures to parse chef_version on older chef-client releases. -- Added installation of tar directly to the ark resource when uncompression .tar.gz files. This prevents installation in the recipe that occurred even if tar wasn't needed. -- Add support for Mac OS X "mac_os_x" via homebrew. -- Update metadata.rb to contain source and issue information for supermarket and chef-repo convenience +* Converted alternatives, ark, and certificate LWRP/HWRPs to custom resources with improved logging and convergence notification. +* Renamed the java_ark resource to java_oracle_install, which better represents what it does. The existing name will continue to function +* Removed the need for the apt cookbook and instead require Chef 12.9+ +* Fixed Amazon Linux support on Chef 13+. +* Fixed the alternatives commands on Fedora systems. +* Added initial openSUSE leap support. +* Updated code to use multi-package installs to speed up runs +* Made the 'cert_alias' property in the certificate resource the name_property to allow users to avoid resource cloning and to be able to use friendly resource names +* Moved the warning code for downloading directly from Oracle into the resource to prevent another resource showing as converged +* Updated the metadata to resolve failures to parse chef_version on older chef-client releases. +* Added installation of tar directly to the ark resource when uncompression .tar.gz files. This prevents installation in the recipe that occurred even if tar wasn't needed. +* Add support for Mac OS X "mac_os_x" via homebrew. +* Update metadata.rb to contain source and issue information for supermarket and chef-repo convenience ### Known Issues -- Kitchen CI test with 12.04 fails due to hostname unable to be set. +* Kitchen CI test with 12.04 fails due to hostname unable to be set. ## v1.31 - *2/3/2015* -- Update to latest JDKs for 7 and 8\. JDK7 will be EOL April 2015 -- Fix up Travis support. -- Add ability to install JCE policy files for oracle JDK #228 -- Change connect timeout to 30 seconds +* Update to latest JDKs for 7 and 8\. JDK7 will be EOL April 2015 +* Fix up Travis support. +* Add ability to install JCE policy files for oracle JDK #228 +* Change connect timeout to 30 seconds ## v1.29.0 - *11/14/2014* -- Ensure dirs, links, and jinfo files are owned correctly -- Update to Oracle JDK 8u25 -- Update to Oracle JDK 7u71-b14 -- Adding a connect_timeout option for downloading java. -- Switched to chef-zero provisioner in test suites. -- Adding ISSUES.md for guidance on creating new issues for the Java cookbook. -- Fix IBM unit tests. +* Ensure dirs, links, and jinfo files are owned correctly +* Update to Oracle JDK 8u25 +* Update to Oracle JDK 7u71-b14 +* Adding a connect_timeout option for downloading java. +* Switched to chef-zero provisioner in test suites. +* Adding ISSUES.md for guidance on creating new issues for the Java cookbook. +* Fix IBM unit tests. ## v1.28.0 - *9/6/2014* -- Allow setting of group to extracted java files. -- Add -no-same-owner parameter to tar extract to avoid issues when the chef cache dir is on an NFS mounted drive. -- In the ark provider, it doesn't compare the MD5 sum with the right value which causes Java cookbook always download tarball from oracle server +* Allow setting of group to extracted java files. +* Add -no-same-owner parameter to tar extract to avoid issues when the chef cache dir is on an NFS mounted drive. +* In the ark provider, it doesn't compare the MD5 sum with the right value which causes Java cookbook always download tarball from oracle server ## v1.27.0 - *8/22/2014* -- Update Oracle JDK8 to version 8u20 +* Update Oracle JDK8 to version 8u20 ## v1.26.0 - *8/16/2014* -- Allow pinning of package versions for openjdk -- Update Oracle JDK7 to version 7u67 -- Support specific version and name for Oracle RPM +* Allow pinning of package versions for openjdk +* Update Oracle JDK7 to version 7u67 +* Support specific version and name for Oracle RPM ## v1.25.0 - *8/1/2014* -- Resource ark -> attribute bin_cmds default value -- Add option to put JAVA_HOME in /etc/environment -- Allow ark to pull from http and files ending in .gz. -- Recommendations for inclusion in community cookbooks -- Production Deployment with Oracle Java -- Update testing instructions for chefdk -- Various Readme formatting. -- Use Supermarket endpoint in berksfile -- rspec cleanup -- Adding ubuntu-14.04 to test suite +* Resource ark -> attribute bin_cmds default value +* Add option to put JAVA_HOME in /etc/environment +* Allow ark to pull from http and files ending in .gz. +* Recommendations for inclusion in community cookbooks +* Production Deployment with Oracle Java +* Update testing instructions for chefdk +* Various Readme formatting. +* Use Supermarket endpoint in berksfile +* rspec cleanup +* Adding ubuntu-14.04 to test suite ## v1.24.0 - *7/25/2014* New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** -- Bump JDK7 URLs to 7u65 -- Upgrade Oracle's Java 8 to u11 -- Allow for alternatives priority to be set from attribute. -- Change ownership of extracted files -- Add retries and retry_delay parameters to java_ark LWRP -- default: don't fail when using java 8 on windows -- Support for Server JRE -- Updated README for accepting oracle terms -- Remove VirtualBox specific box_urls -- List AgileOrbit as the maintainer (AgileOrbit took over from Socrata in July 2014) +* Bump JDK7 URLs to 7u65 +* Upgrade Oracle's Java 8 to u11 +* Allow for alternatives priority to be set from attribute. +* Change ownership of extracted files +* Add retries and retry_delay parameters to java_ark LWRP +* default: don't fail when using java 8 on windows +* Support for Server JRE +* Updated README for accepting oracle terms +* Remove VirtualBox specific box_urls +* List AgileOrbit as the maintainer (AgileOrbit took over from Socrata in July 2014) ## v1.23.0 - *7/25/2014* -- Tagged but never published to community cookbooks. All changes rolled into 1.24.0 +* Tagged but never published to community cookbooks. All changes rolled into 1.24.0 ## v1.22.0 -- Add support for Oracle JDK 1.8.0 -- Make use of Chef's cache directory instead of /tmp -- Update Test Kitchen suites -- Add safety check for JDK 8 on non-Oracle +* Add support for Oracle JDK 1.8.0 +* Make use of Chef's cache directory instead of /tmp +* Update Test Kitchen suites +* Add safety check for JDK 8 on non-Oracle ## v1.21.2 @@ -368,128 +385,128 @@ New Cookbook maintainer! **[Agile Orbit](http://agileorbit.com)** ## v1.21.0 -- Update Oracle accept-license-terms cookie format +* Update Oracle accept-license-terms cookie format ## v1.20.0 -- Fixing version number. Accidently released at 0.15.x instead of 1.15.x +* Fixing version number. Accidently released at 0.15.x instead of 1.15.x ## v0.15.2 ### FIX -- Fixing JAVA_HOME on Ubuntu 10.04 +* Fixing JAVA_HOME on Ubuntu 10.04 ## v1.14.0 -- Fix alternatives when the package is already installed -- Fix a condition that would result in an error executing action `run` on resource 'bash[update-java-alternatives]' -- Fix bad checksum length -- Fix an issue where Java cookbook installs both JDK 6 and JDK 7 when JDK 7 is specified -- Allow Windoes recipe to download from signed S3 url -- Fix a failure on Centos 6.4 and Oracle JDK 7 -- Improve Windows support +* Fix alternatives when the package is already installed +* Fix a condition that would result in an error executing action `run` on resource 'bash[update-java-alternatives]' +* Fix bad checksum length +* Fix an issue where Java cookbook installs both JDK 6 and JDK 7 when JDK 7 is specified +* Allow Windoes recipe to download from signed S3 url +* Fix a failure on Centos 6.4 and Oracle JDK 7 +* Improve Windows support ## v1.13.0 -- Add default `platform_family` option in Java helper -- Fix support for Fedora -- Upgrade to Oracle Java 7u25 -- Add Oracle RPM support -- Add support for the platform `xenserver` -- Add SmartOS support +* Add default `platform_family` option in Java helper +* Fix support for Fedora +* Upgrade to Oracle Java 7u25 +* Add Oracle RPM support +* Add support for the platform `xenserver` +* Add SmartOS support ## v1.12.0 -- Add SmartOS support to java::openjdk recipe -- upgrade to Oracle Java 7u25 -- Adding support for the platform 'xenserver' (for installations of java in DOM0) -- java cookbook fails on Fedora +* Add SmartOS support to java::openjdk recipe +* upgrade to Oracle Java 7u25 +* Adding support for the platform 'xenserver' (for installations of java in DOM0) +* java cookbook fails on Fedora ## v1.11.6 -- Java cookbook does not have opensuse support -- Syntax Errors spec/default_spec.rb:4-8 +* Java cookbook does not have opensuse support +* Syntax Errors spec/default_spec.rb:4-8 ## v1.11.4 -- `bash[update-java-alternatives]` resource uses wrong attribute +* `bash[update-java-alternatives]` resource uses wrong attribute ## v1.11.2 -- Use SHA256 checksums for Oracle downloads, not SHA1. +* Use SHA256 checksums for Oracle downloads, not SHA1. ## v1.11.0 This version brings a wealth of tests and (backwards-compatible) refactoring, plus some new features (updated Java, IBM recipe). -- Add ibm recipe to java cookbook -- move java_home resources to their own recipe -- refactor ruby_block "update-java-alternatives" -- use platform_family in java cookbook -- add chefspec to java cookbook -- Refactor java cookbook -- update JDK to JDK 7u21, 6u45 +* Add ibm recipe to java cookbook +* move java_home resources to their own recipe +* refactor ruby_block "update-java-alternatives" +* use platform_family in java cookbook +* add chefspec to java cookbook +* Refactor java cookbook +* update JDK to JDK 7u21, 6u45 ## v1.10.2 -- [2415] - Fixed deprecation warnings in ark provider and openjdk recipe by using Chef::Mixin::ShellOut instead of Chef::ShellOut +* [2415] - Fixed deprecation warnings in ark provider and openjdk recipe by using Chef::Mixin::ShellOut instead of Chef::ShellOut ## v1.10.0 -- Allow java ark :url to be https -- Upgrade needed for oracle jdk in java cookbook +* Allow java ark :url to be https +* Upgrade needed for oracle jdk in java cookbook ## v1.9.6 -- add support for Oracle Linux +* add support for Oracle Linux ## v1.9.4 -- Run set-env-java-home in Java cookbook only if necessary -- ark provider does not allow for *.tgz tarballs to be used -- Java cookbook fails on CentOS6 (update-java-alternatives) +* Run set-env-java-home in Java cookbook only if necessary +* ark provider does not allow for *.tgz tarballs to be used +* Java cookbook fails on CentOS6 (update-java-alternatives) ## v1.9.2 -- FoodCritic fixes for java cookbook +* FoodCritic fixes for java cookbook ## v1.9.0 -- Update the Oracle Java version in the Java cookbook to release 1.7u11 +* Update the Oracle Java version in the Java cookbook to release 1.7u11 ## v1.8.2 -- Fix for missing /usr/lib/jvm/default-java on Debian +* Fix for missing /usr/lib/jvm/default-java on Debian ## v1.8.0 -- Add windows support +* Add windows support ## v1.7.0 -- improvements for Oracle update-alternatives -- When installing an Oracle JDK it is now registered with a higher priority than OpenJDK. (Related to COOK-1131.) -- When running both the oracle and oracle_i386 recipes, alternatives are now created for both JDKs. -- Alternatives are now created for all binaries listed in version specific attributes. (Related to COOK-1563 and COOK-1635.) -- When installing Oracke JDKs on Ubuntu, create .jinfo files for use with update-java-alternatives. Commands to set/install alternatives now only run if needed. +* improvements for Oracle update-alternatives +* When installing an Oracle JDK it is now registered with a higher priority than OpenJDK. (Related to COOK-1131.) +* When running both the oracle and oracle_i386 recipes, alternatives are now created for both JDKs. +* Alternatives are now created for all binaries listed in version specific attributes. (Related to COOK-1563 and COOK-1635.) +* When installing Oracke JDKs on Ubuntu, create .jinfo files for use with update-java-alternatives. Commands to set/install alternatives now only run if needed. ## v1.6.4 -- fixed typo in attribute for java 5 on i586 +* fixed typo in attribute for java 5 on i586 ## v1.6.2 -- whyrun support in `java_ark` LWRP -- CHEF-1804 compatibility -- install Java 6u37 and Java 7u9 -- incorrect warning text about `node['java']['oracle']['accept_oracle_download_terms']` +* whyrun support in `java_ark` LWRP +* CHEF-1804 compatibility +* install Java 6u37 and Java 7u9 +* incorrect warning text about `node['java']['oracle']['accept_oracle_download_terms']` ## v1.6.0 -- Install Oracle JDK from Oracle download directly -- set JAVA_HOME in openjdk recipe -- Install correct architecture on Amazon Linux +* Install Oracle JDK from Oracle download directly +* set JAVA_HOME in openjdk recipe +* Install correct architecture on Amazon Linux ## v1.5.4 @@ -498,21 +515,21 @@ use shellout instead of execute resource to update alternatives ## v1.5.2 -- remove sun-java6-jre on Ubuntu before installing Oracle's Java -- fails on Ubuntu 12.04 64bit with openjdk7 -- Oracle Java should symlink the jar command +* remove sun-java6-jre on Ubuntu before installing Oracle's Java +* fails on Ubuntu 12.04 64bit with openjdk7 +* Oracle Java should symlink the jar command ## v1.5.0 -- Oracle now prevents download of JDK via non-browser -- fix File.exists? +* Oracle now prevents download of JDK via non-browser +* fix File.exists? ## v1.4.2 -- fix attributes typo and platform case switch consistency +* fix attributes typo and platform case switch consistency ## v1.4.0 -- numerous updates: handle jdk6 and 7, switch from sun to oracle, make openjdk default, add `java_ark` LWRP. -- [42] - FreeBSD support -- ArchLinux support +* numerous updates: handle jdk6 and 7, switch from sun to oracle, make openjdk default, add `java_ark` LWRP. +* [42] - FreeBSD support +* ArchLinux support diff --git a/metadata.rb b/metadata.rb index 55d8fa99..602ca56d 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ source_url 'https://github.com/sous-chefs/java' issues_url 'https://github.com/sous-chefs/java/issues' chef_version '>= 17.5' -version '14.0.1' +version '15.0.0' supports 'almalinux', '>= 8.0' supports 'amazon', '>= 2023.0' From a8c0d874781140ee5167f1be2f1fd819c4193068 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 15:51:35 +0100 Subject: [PATCH 278/278] chore(deps): update sous-chefs/.github action to v9 (#763) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 256d7fec..08b47e1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ name: "Test" jobs: lint-unit: - uses: sous-chefs/.github/.github/workflows/lint-unit.yml@8.0.4 + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@9.0.0 permissions: checks: write pull-requests: write @@ -51,7 +51,7 @@ jobs: - name: Check out code uses: actions/checkout@v7 - name: Install Chef - uses: sous-chefs/.github/.github/actions/install-workstation@8.0.4 + uses: sous-chefs/.github/.github/actions/install-workstation@9.0.0 - name: Dokken uses: actionshub/test-kitchen@main env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7334bb52..bd814d3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ permissions: jobs: release: - uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@8.0.4 + uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@9.0.0 secrets: token: ${{ secrets.PORTER_GITHUB_TOKEN }} supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }}