Skip to content

Commit

Permalink
unixPB: Use correct API for each JDK version
Browse files Browse the repository at this point in the history
Signed-off-by: Stewart X Addison <[email protected]>
  • Loading branch information
sxa committed Feb 15, 2024
1 parent 5046bf5 commit 19bdf20
Showing 1 changed file with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
# Check if target is installed
# Proceed with installing to /usr/lib/jvm

- name: Use adoptium API if release is available at adoptium
set_fact:
api_url: https://api.adoptium.net
when:
- ( jdk_version == 8 || jdk_version == 11 || jdk_version >= 17 )
tags: adoptopenjdk_install

{{ api_url }}

- name: Use adoptopenjdk API if release is not supported by adoptium
set_fact:
api_url: https://api.adoptopenjdk.net
when:
- ! ( jdk_version == 8 || jdk_version == 11 || jdk_version >= 17 )
tags: adoptopenjdk_install

- name: Set path variable when jdk_version == 8
set_fact:
path: /usr/lib/jvm/jdk8
Expand Down Expand Up @@ -140,15 +156,15 @@
# Api does not return release information for JDK10
block:
- name: Get Signature File Link (Linux/Alpine-Linux)
shell: curl -s 'https://api.adoptium.net/v3/assets/feature_releases/{{ jdk_version }}/ga?architecture={{ api_architecture }}&heap_size=normal&image_type=jdk&jvm_impl={{ bootjdk }}&os={{ platformLinux }}&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'
shell: curl -s '{{ api_url }}/v3/assets/feature_releases/{{ jdk_version }}/ga?architecture={{ api_architecture }}&heap_size=normal&image_type=jdk&jvm_impl={{ bootjdk }}&os={{ platformLinux }}&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'
when:
- jdk_version != 10
- not (jdk_version == 8 and ansible_architecture == "s390x")
register: sig_output

- name: Download latest release (Linux/Alpine-Linux)
get_url:
url: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/{{ platformLinux }}/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
url: {{ api_url }}/v3/binary/latest/{{ jdk_version }}/ga/{{ platformLinux }}/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
dest: /tmp/jdk{{ jdk_version }}.tar.gz
mode: 0440
retries: 3
Expand Down Expand Up @@ -212,7 +228,7 @@
tags: adoptopenjdk_install
block:
- name: Download latest JDK {{ jdk_version }} release (CentOS6)
command: wget -q 'https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/{{ platformLinux }}/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk' -O /tmp/jdk{{ jdk_version }}.tar.gz
command: wget -q '{{ api_url }}/v3/binary/latest/{{ jdk_version }}/ga/{{ platformLinux }}/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk' -O /tmp/jdk{{ jdk_version }}.tar.gz
vars:
ansible_python_interpreter: /usr/local/python2/bin/python2.7
retries: 3
Expand All @@ -221,7 +237,7 @@
until: adoptopenjdk_download is not failed

- name: Get Signature File Link (CentOS6)
shell: curl -s 'https://api.adoptium.net/v3/assets/feature_releases/{{ jdk_version }}/ga?architecture={{ api_architecture }}&heap_size=normal&image_type=jdk&jvm_impl={{ bootjdk }}&os={{ platformLinux }}&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'
shell: curl -s '{{ api_url }}/v3/assets/feature_releases/{{ jdk_version }}/ga?architecture={{ api_architecture }}&heap_size=normal&image_type=jdk&jvm_impl={{ bootjdk }}&os={{ platformLinux }}&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'
when:
- jdk_version != 10
register: sig_output
Expand Down Expand Up @@ -250,7 +266,7 @@
block:
- name: Download latest JDK {{ jdk_version }} release (macOS)
get_url:
url: https://api.adoptium.net/v3/installer/latest/{{ jdk_version }}/ga/mac/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/eclipse?project=jdk
url: {{ api_url }}/v3/installer/latest/{{ jdk_version }}/ga/mac/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/eclipse?project=jdk
dest: /tmp/{{ jdk_version }}-installer.pkg
register: adoptopenjdk_download
until: adoptopenjdk_download is not failed
Expand All @@ -259,7 +275,7 @@

- name: Download JDK10 tarball when installer is not available (macOS)
unarchive:
src: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/mac/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
src: {{ api_url }}/v3/binary/latest/{{ jdk_version }}/ga/mac/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
remote_src: yes
dest: /Library/Java/JavaVirtualMachines/
become: yes
Expand All @@ -272,7 +288,7 @@
- jdk_version == 10

- name: Get Signature File Link (macOS)
shell: curl -s 'https://api.adoptium.net/v3/assets/latest/{{ jdk_version }}/{{ bootjdk }}?architecture={{ api_architecture }}&image_type=jdk&os=mac&vendor=eclipse' | grep signature_link | grep pkg | awk '{split($0,a,"\""); print a[4]}'
shell: curl -s '{{ api_url }}/v3/assets/latest/{{ jdk_version }}/{{ bootjdk }}?architecture={{ api_architecture }}&image_type=jdk&os=mac&vendor=eclipse' | grep signature_link | grep pkg | awk '{split($0,a,"\""); print a[4]}'
when:
- jdk_version != 10
register: sig_output
Expand Down Expand Up @@ -319,12 +335,12 @@
tags: adoptopenjdk_install
block:
- name: Download latest JDK {{ jdk_version }} release (Solaris)
command: wget https://api.adoptium.net/v3/binary/latest/{{ jdk_version }}/ga/solaris/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/eclipse?project=jdk -O /tmp/jdk-{{ jdk_version }}.tar.gz
command: wget {{ api_url }}/v3/binary/latest/{{ jdk_version }}/ga/solaris/{{ api_architecture }}/jdk/{{ bootjdk }}/normal/eclipse?project=jdk -O /tmp/jdk-{{ jdk_version }}.tar.gz
register: adoptopenjdk_download
until: adoptopenjdk_download is not failed

- name: Get Signature File Link (Solaris)
shell: curl -s 'https://api.adoptium.net/v3/assets/latest/{{ jdk_version }}/{{ bootjdk }}?architecture={{ api_architecture }}&image_type=jdk&os=solaris&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'
shell: curl -s '{{ api_url }}/v3/assets/latest/{{ jdk_version }}/{{ bootjdk }}?architecture={{ api_architecture }}&image_type=jdk&os=solaris&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'
register: sig_output

- name: GPG Signature verification (Solaris)
Expand Down

0 comments on commit 19bdf20

Please sign in to comment.