Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded default Java version to 21.0.5 #388

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ are shown below):

```yaml
# Java version number
# Specify '8', '11', '17' or '21' to get the latest patch version of that
# Specify '8', '11', '17', '21' or '23' to get the latest patch version of that
# release.
java_version: '21.0.2+13'
java_version: '21.0.5+11'

# Base installation directory for any Java distribution
java_install_dir: '/opt/java'
Expand Down Expand Up @@ -118,15 +118,15 @@ You can install a specific version of the JDK by specifying the `java_version`.
- hosts: servers
roles:
- role: gantsign.java
java_version: '8.0.402+6'
java_version: '8.0.432+6'
```

**Note:** with [curl](https://curl.haxx.se) and
[jq](https://stedolan.github.io/jq) you can view the available versions by
running the following command:

```bash
for i in 21 17 11 8; do (curl --silent http \
for i in 23 21 17 11 8; do (curl --silent http \
"https://api.adoptium.net/v3/info/release_names?version=%5B$i,$(($i + 1)))\
&release_type=ga" | jq --raw-output '.releases[]' | sed -E 's/^jdk\-?//'); done
```
Expand All @@ -150,20 +150,20 @@ once:

To perform an offline install, you need to specify a bit more information (i.e.
`java_major_version`, `java_release_name`, `java_redis_filename` and
`java_redis_sha256sum`). E.g. to perform an offline install of `11.0.22+7`:
`java_redis_sha256sum`). E.g. to perform an offline install of `11.0.25+9`:

```yaml
# Before performing the offline install, download
# `OpenJDK11U-jdk_x64_linux_hotspot_11.0.22_7.tar.gz` to
# `OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz` to
# `{{ playbook_dir }}/files/` on the local machine.
- hosts: servers
roles:
- role: gantsign.java
java_major_version: '11'
java_version: '11.0.22+7'
java_release_name: 'jdk-11.0.22+7'
java_redis_filename: 'OpenJDK11U-jdk_x64_linux_hotspot_11.0.22_7.tar.gz'
java_redis_sha256sum: '25cf602cac350ef36067560a4e8042919f3be973d419eac4d839e2e0000b2cc8'
java_version: '11.0.25+9'
java_release_name: 'jdk-11.0.25+9'
java_redis_filename: 'OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz'
java_redis_sha256sum: '191baa2e052627614022171400a917d28f0987dc54da48aaf07b06f552bb9884'
```

Role Facts
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 '21' to get the latest patch version of that
# Specify '8', '11', '17', '21' or '23' to get the latest patch version of that
# release.
java_version: '21.0.2+13'
java_version: '21.0.5+11'

# Base installation directory for any Java distribution
java_install_dir: '/opt/java'
Expand Down
12 changes: 6 additions & 6 deletions molecule/java-max-lts-offline/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

- name: Download JDK for offline install
ansible.builtin.get_url:
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'
url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-21.0.5+11' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204
dest: '{{ java_local_archive_dir }}/OpenJDK21-jdk_x64_linux_hotspot_21.0.5_11.tar.gz'
force: false
timeout: '{{ java_download_timeout_seconds }}'
mode: 'u=rw,go=r'
Expand All @@ -37,11 +37,11 @@
- role: ansible-role-java
java_use_local_archive: true
java_major_version: '21'
java_version: '21.0.2+13'
java_release_name: 'jdk-21.0.2+13'
java_version: '21.0.5+11'
java_release_name: 'jdk-21.0.5+11'

java_redis_filename: 'OpenJDK21-jdk_x64_linux_hotspot_21.0.2_13.tar.gz'
java_redis_sha256sum: '454bebb2c9fe48d981341461ffb6bf1017c7b7c6e15c6b0c29b959194ba3aaa5'
java_redis_filename: 'OpenJDK21-jdk_x64_linux_hotspot_21.0.5_11.tar.gz'
java_redis_sha256sum: '3c654d98404c073b8a7e66bffb27f4ae3e7ede47d13284c132d40a83144bfd8c'

post_tasks:
- name: Verify java facts
Expand Down
14 changes: 7 additions & 7 deletions molecule/java-max-non-lts-offline/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

- name: Download JDK for offline install
ansible.builtin.get_url:
url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-20.0.2+9' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204
dest: '{{ java_local_archive_dir }}/OpenJDK20-jdk_x64_linux_hotspot_20.0.2_9.tar.gz'
url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-23.0.1+11' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204
dest: '{{ java_local_archive_dir }}/OpenJDK23-jdk_x64_linux_hotspot_23.0.1_11.tar.gz'
force: false
timeout: '{{ java_download_timeout_seconds }}'
mode: 'u=rw,go=r'
Expand All @@ -36,11 +36,11 @@
roles:
- role: ansible-role-java
java_use_local_archive: true
java_major_version: '20'
java_version: '20.0.2+9'
java_release_name: 'jdk-20.0.2+9'
java_redis_filename: 'OpenJDK20-jdk_x64_linux_hotspot_20.0.2_9.tar.gz'
java_redis_sha256sum: '3d91842e9c172967ac397076523249d05a82ead51b0006838f5f0315ad52222c'
java_major_version: '23'
java_version: '23.0.1+11'
java_release_name: 'jdk-23.0.1+11'
java_redis_filename: 'OpenJDK23-jdk_x64_linux_hotspot_23.0.1_11.tar.gz'
java_redis_sha256sum: '2400267e4e9c0f6ae880a4d763af6caf18c673714bdee5debf8388b0b5d52886'

post_tasks:
- name: Verify java facts
Expand Down
2 changes: 1 addition & 1 deletion molecule/java-max-non-lts-online/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

roles:
- role: ansible-role-java
java_version: '20'
java_version: '23'
java_use_local_archive: false

post_tasks:
Expand Down
6 changes: 3 additions & 3 deletions molecule/java-max-non-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 '20' == java_version
assert '23' == 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 '20' == java_version
assert '23' == java_version


@pytest.mark.parametrize('version_dir_pattern', [
'jdk-20(\\.[0-9]+\\.[0-9]+)?(\\+[0-9]+)?$'
'jdk-23(\\.[0-9]+\\.[0-9]+)?(\\+[0-9]+)?$'
])
def test_java_installed(host, version_dir_pattern):

Expand Down
12 changes: 6 additions & 6 deletions molecule/java-min-offline/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

- name: Download JDK for offline install
ansible.builtin.get_url:
url: 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u402-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u402b06.tar.gz'
dest: '{{ java_local_archive_dir }}/OpenJDK8U-jdk_x64_linux_hotspot_8u402b06.tar.gz'
url: 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u432-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u432b06.tar.gz'
dest: '{{ java_local_archive_dir }}/OpenJDK8U-jdk_x64_linux_hotspot_8u432b06.tar.gz'
force: false
use_proxy: true
validate_certs: true
Expand All @@ -40,11 +40,11 @@
roles:
- role: ansible-role-java
java_major_version: '8'
java_version: '8.0.402+6'
java_release_name: 'jdk8u402-b06'
java_version: '8.0.432+6'
java_release_name: 'jdk8u432-b06'
java_use_local_archive: true
java_redis_filename: 'OpenJDK8U-jdk_x64_linux_hotspot_8u402b06.tar.gz'
java_redis_sha256sum: 'fcfd08abe39f18e719e391f2fc37b8ac1053075426d10efac4cbf8969e7aa55e'
java_redis_filename: 'OpenJDK8U-jdk_x64_linux_hotspot_8u432b06.tar.gz'
java_redis_sha256sum: 'abaaa90deadf51bd28921453baf2992b3dff6171bb7142f5bdd14ef269f7b245'

post_tasks:
- name: Verify java facts
Expand Down
2 changes: 1 addition & 1 deletion molecule/java-min-online/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

roles:
- role: ansible-role-java
java_version: 8.0.402+6
java_version: 8.0.432+6
java_use_local_archive: false

post_tasks:
Expand Down
12 changes: 6 additions & 6 deletions molecule/java-old-lts-offline/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

- name: Download JDK for offline install
ansible.builtin.get_url:
url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-11.0.22+7' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204
dest: '{{ java_local_archive_dir }}/OpenJDK11U-jdk_x64_linux_hotspot_11.0.22_7.tar.gz'
url: "https://api.adoptium.net/v3/binary/version/{{ 'jdk-11.0.25+9' | urlencode }}/linux/x64/jdk/hotspot/normal/adoptium?project=jdk" # noqa 204
dest: '{{ java_local_archive_dir }}/OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz'
force: false
timeout: '{{ java_download_timeout_seconds }}'
mode: 'u=rw,go=r'
Expand All @@ -37,10 +37,10 @@
- role: ansible-role-java
java_use_local_archive: true
java_major_version: '11'
java_version: '11.0.22+7'
java_release_name: 'jdk-11.0.22+7'
java_redis_filename: 'OpenJDK11U-jdk_x64_linux_hotspot_11.0.22_7.tar.gz'
java_redis_sha256sum: '25cf602cac350ef36067560a4e8042919f3be973d419eac4d839e2e0000b2cc8'
java_version: '11.0.25+9'
java_release_name: 'jdk-11.0.25+9'
java_redis_filename: 'OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz'
java_redis_sha256sum: '191baa2e052627614022171400a917d28f0987dc54da48aaf07b06f552bb9884'

post_tasks:
- name: Verify java facts
Expand Down