Skip to content

Commit

Permalink
Remove Java 8 support
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Webb <[email protected]>
  • Loading branch information
damacus committed Jan 13, 2025
1 parent fa3aa9a commit e83b4e2
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 157 deletions.
13 changes: 10 additions & 3 deletions bin/check_java_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
require 'uri'

TEMURIN_REPOS = {
'8' => 'adoptium/temurin8-binaries',
'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)
Expand Down Expand Up @@ -75,8 +84,6 @@ def current_url_in_cookbook(version)
content = File.read(helpers_file)

case version
when '8'
content.match(/temurin.*when '8'\s+'(.+?)'/m)&.[](1)
when '11'
content.match(/temurin.*when '11'\s+'(.+?)'/m)&.[](1)
when '17'
Expand Down
28 changes: 0 additions & 28 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ suites:
inputs: { java_version: "17" }

# Temurin/Semeru
- name: temurin-8-hotspot
run_list:
- recipe[test::openjdk]
attributes:
version: 8
variant: hotspot
verifier:
inspec_tests: [test/integration/openjdk]
inputs: { java_version: "8" }

- name: temurin-11-hotspot
run_list:
- recipe[test::openjdk]
Expand Down Expand Up @@ -88,17 +78,6 @@ suites:
inspec_tests: [test/integration/openjdk]
inputs: { java_version: "17" }

- name: temurin-8
run_list:
- recipe[test::openjdk]
attributes:
java:
version: "8"
flavor: "temurin"
verifier:
inspec_tests: [test/integration/openjdk]
inputs: { java_version: "8" }

- name: temurin-11
run_list:
- recipe[test::openjdk]
Expand All @@ -122,13 +101,6 @@ suites:
inputs: { java_version: "17" }

# 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
run_list:
- recipe[test::corretto]
Expand Down
7 changes: 4 additions & 3 deletions libraries/certificate_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +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
def keystore_argument(cacerts, truststore_path)
if cacerts
'-cacerts'
else
"-keystore #{truststore_path}"
Expand Down
4 changes: 0 additions & 4 deletions libraries/corretto_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down
12 changes: 2 additions & 10 deletions libraries/openjdk_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ def default_openjdk_install_method(version)
end
end

def default_openjdk_url(version, flavor = 'openjdk')
case flavor.downcase
def default_openjdk_url(version, variant = 'openjdk')
case variant.downcase
when 'temurin'
case version
when '8'
'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u432-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u432b06.tar.gz'
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'
Expand All @@ -50,8 +48,6 @@ def default_openjdk_url(version, flavor = 'openjdk')
end
when 'semeru'
case version
when '8'
'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 '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'
Expand Down Expand Up @@ -121,10 +117,6 @@ def default_openjdk_checksum(version)

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'
Expand Down
4 changes: 2 additions & 2 deletions resources/certificate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
29 changes: 4 additions & 25 deletions spec/libraries/certificate_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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
Expand Down
65 changes: 0 additions & 65 deletions spec/libraries/corretto_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down Expand Up @@ -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' }
Expand Down Expand Up @@ -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' }

Expand Down Expand Up @@ -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' }
Expand Down Expand Up @@ -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
5 changes: 0 additions & 5 deletions spec/libraries/openjdk_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ class DummyClass < Chef::Node
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

it 'returns the correct download URL for Temurin 8' do
expect(subject.default_openjdk_url('8', 'temurin'))
.to eq 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u432-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u432b06.tar.gz'
end
end
end

Expand Down
15 changes: 3 additions & 12 deletions spec/libraries/semeru_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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' }
Expand Down

0 comments on commit e83b4e2

Please sign in to comment.