Skip to content

Commit

Permalink
Upgraded default Java version to 21.0.2 (#359)
Browse files Browse the repository at this point in the history
Keeping up with the latest changes.
  • Loading branch information
freemanjp authored Jan 28, 2024
1 parent ed3c70d commit 39fe0b4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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" \
Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
14 changes: 7 additions & 7 deletions molecule/java-max-lts-offline/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions molecule/java-max-lts/tests/test_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):

Expand Down
4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# code: language=ansible
---
# Java Adoptium release
java_release: "{{ java_version | string | regex_search('^((?:[0-9]+\\.)*)([0-9]+)$') | ternary('[' + (java_version | string) + ',' + (java_version | string | regex_replace('^((?:[0-9]+\\.)*)([0-9]+)$', '\\1')) + (((java_version | string | regex_replace('^((?:[0-9]+\\.)*)([0-9]+)$', '\\2') | int) + 1) | string) + ')', java_version) }}"
java_release: "{{ java_version | string | regex_search('^((?:[0-9]+\\.)*)([0-9]+)$') | ternary('[' + (java_version | string) + ',' + (java_version | string | regex_replace('^((?:[0-9]+\\.)*)([0-9]+)$', '\\1')) + (((java_version | string | regex_replace('^((?:[0-9]+\\.)*)([0-9]+)$', '\\2') | int) + 1) | string) + ')', '[' + java_version + ',' + java_version + '.1)') }}"

# The root folder of this Java installation
java_home: '{{ java_install_dir }}/{{ java_release_name }}'
Expand All @@ -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/{{ 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&page_size=1&sort_order=DESC&vendor=adoptium"

# Operating System
java_os: linux
Expand Down

0 comments on commit 39fe0b4

Please sign in to comment.