From e134928ef655d444a370d4b00a0a9fe4de1f57d0 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Sun, 28 Jan 2024 14:23:13 +0000 Subject: [PATCH] Upgraded default Java version to 21.0.2 Keeping up with the latest changes. --- README.md | 6 +++--- defaults/main.yml | 4 ++-- molecule/java-max-lts-offline/converge.yml | 14 +++++++------- molecule/java-max-lts/tests/test_role.py | 6 +++--- vars/main.yml | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9d59472..4b838d4 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ are shown below): ```yaml # Java version number -# Specify '8', '11', '17' or '20' to get the latest patch version of that +# Specify '8', '11', '17' or '21' to get the latest patch version of that # release. -java_version: '17.0.10+7' +java_version: '21.0.2+13' # Base installation directory for any Java distribution java_install_dir: '/opt/java' @@ -127,7 +127,7 @@ You can install a specific version of the JDK by specifying the `java_version`. running the following command: ```bash -for i in 8 11 17 20; do (curl --silent http \ +for i in 8 11 17 21; do (curl --silent http \ "https://api.adoptium.net/v3/assets/feature_releases/$i/ga?\ architecture=x64&heap_size=normal&image_type=jdk&jvm_impl=hotspot&\ os=linux&project=jdk&sort_order=DESC&vendor=adoptium" \ diff --git a/defaults/main.yml b/defaults/main.yml index 8094c09..53e1e36 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,9 +1,9 @@ # code: language=ansible --- # Java version number -# Specify '8', '11', '17' or '20' to get the latest patch version of that +# Specify '8', '11', '17' or '21' to get the latest patch version of that # release. -java_version: '17.0.10+7' +java_version: '21.0.2+13' # Base installation directory for any Java distribution java_install_dir: '/opt/java' diff --git a/molecule/java-max-lts-offline/converge.yml b/molecule/java-max-lts-offline/converge.yml index 22bd09a..950e373 100644 --- a/molecule/java-max-lts-offline/converge.yml +++ b/molecule/java-max-lts-offline/converge.yml @@ -19,8 +19,8 @@ - name: Download JDK for offline install ansible.builtin.get_url: - url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-17.0.10+7' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204 - dest: '{{ java_local_archive_dir }}/OpenJDK17-jdk_x64_linux_hotspot_17.0.10_7.tar.gz' + url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-21.0.2+13' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204 + dest: '{{ java_local_archive_dir }}/OpenJDK21-jdk_x64_linux_hotspot_21.0.2_13.tar.gz' force: false timeout: '{{ java_download_timeout_seconds }}' mode: 'u=rw,go=r' @@ -29,12 +29,12 @@ roles: - role: ansible-role-java java_use_local_archive: true - java_major_version: '17' - java_version: '17.0.10+7' - java_release_name: 'jdk-17.0.10+7' + java_major_version: '21' + java_version: '21.0.2+13' + java_release_name: 'jdk-21.0.2+13' - java_redis_filename: 'OpenJDK17-jdk_x64_linux_hotspot_17.0.10_7.tar.gz' - java_redis_sha256sum: 'a8fd07e1e97352e97e330beb20f1c6b351ba064ca7878e974c7d68b8a5c1b378' + java_redis_filename: 'OpenJDK21-jdk_x64_linux_hotspot_21.0.2_13.tar.gz' + java_redis_sha256sum: '454bebb2c9fe48d981341461ffb6bf1017c7b7c6e15c6b0c29b959194ba3aaa5' post_tasks: - name: Verify java facts diff --git a/molecule/java-max-lts/tests/test_role.py b/molecule/java-max-lts/tests/test_role.py index 404b7bb..721c3ef 100644 --- a/molecule/java-max-lts/tests/test_role.py +++ b/molecule/java-max-lts/tests/test_role.py @@ -8,7 +8,7 @@ def test_java(host): m = re.search('(?:java|openjdk) version "([0-9]+)', cmd.stderr) assert m is not None java_version = m.group(1) - assert '17' == java_version + assert '21' == java_version def test_javac(host): @@ -17,11 +17,11 @@ def test_javac(host): m = re.search('javac ([0-9]+)', cmd.stdout) assert m is not None java_version = m.group(1) - assert '17' == java_version + assert '21' == java_version @pytest.mark.parametrize('version_dir_pattern', [ - 'jdk-17(\\.[0-9]+){,3}(\\+[0-9]+)?$' + 'jdk-21(\\.[0-9]+){,3}(\\+[0-9]+)?$' ]) def test_java_installed(host, version_dir_pattern): diff --git a/vars/main.yml b/vars/main.yml index 960ab16..f08c198 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -10,7 +10,7 @@ java_home: '{{ java_install_dir }}/{{ java_release_name }}' java_api_server: 'https://api.adoptium.net' # The URL for the Adoptium API requests -java_api_request: "{{ java_api_server }}/v3/assets/version/{{ java_release | urlencode }}?jvm_impl=hotspot&os={{ java_os }}&architecture={{ java_arch }}&heap_size={{ java_heap_size }}&image_type=jdk&project=jdk&release_type=ga&sort_order=DESC&vendor=adoptium" +java_api_request: "{{ java_api_server }}/v3/assets/version/%5B{{ java_release | urlencode }},{{ java_release | urlencode }}.1)?jvm_impl=hotspot&os={{ java_os }}&architecture={{ java_arch }}&heap_size={{ java_heap_size }}&image_type=jdk&project=jdk&release_type=ga&page_size=1&sort_order=ASC&vendor=adoptium" # Operating System java_os: linux