diff --git a/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/main.yml index 45dccace65..ad1e3ca31c 100644 --- a/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/main.yml @@ -19,6 +19,7 @@ - '11' - '16' - '17' + - '21' - name: Set /usr/java8_64 as default file: diff --git a/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/openjdk.yml b/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/openjdk.yml index c5ca659635..8349b9d065 100644 --- a/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/openjdk.yml +++ b/ansible/playbooks/AdoptOpenJDK_AIX_Playbook/roles/bootjdk/tasks/openjdk.yml @@ -7,44 +7,57 @@ os_img: "aix/ppc64/jdk" heap: "normal" impl: "hotspot" - new_baseurl: "https://api.adoptium.net/v3/binary/latest" - new_vendor: "eclipse" - baseurl: "https://api.adoptopenjdk.net/v3/binary/latest" - vendor: "adoptopenjdk" - project: "{{ heap }}/{{ vendor }}?project=jdk" + adoptium_baseurl: "https://api.adoptium.net/v3/binary/latest" + adoptopenjdk_baseurl: "https://api.adoptopenjdk.net/v3/binary/latest" + adoptium_project: "{{ heap }}/eclipse?project=jdk" + adoptopenjdk_project: "{{ heap }}/adoptopenjdk?project=jdk" block: - name: Verify space in /usr include_tasks: chfs.yml - - name: Check for jdk {{ jdk }} availability + - name: Check for jdk {{ jdk }} availability in /usr/java{{ jdk }}_64 stat: - path: /usr/java{{ jdk }}_64 + path: /usr/java{{ jdk }}_64/bin/java register: java_installed - - name: Download JDK {{ jdk }} binary + - name: Download JDK {{ jdk }} binary from api.adoptopenjdk.net get_url: - url: "{{ baseurl }}/{{ jdk }}/ga/{{ os_img }}/{{ impl }}/{{ project }}" + url: "{{ adoptopenjdk_baseurl }}/{{ jdk }}/ga/{{ os_img }}/{{ impl }}/{{ adoptopenjdk_project }}" dest: /tmp/jdk{{ jdk }}.tar.gz mode: 0440 timeout: 25 retries: 3 delay: 5 when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists + - jdk == '10' or jdk == '16' # These are the only two we still use from adoptopenjdk API + register: openjdk + + - name: Download JDK {{ jdk }} binary from api.adoptium.net + get_url: + url: "{{ adoptium_baseurl }}/{{ jdk }}/ga/{{ os_img }}/{{ impl }}/{{ adoptium_project }}" + dest: /tmp/jdk{{ jdk }}.tar.gz + mode: 0440 + timeout: 25 + retries: 3 + delay: 5 + when: + - not java_installed.stat.exists + - not ( jdk == '10' or jdk == '16' ) register: openjdk - name: Get Signature File Link shell: curl -s 'https://api.adoptium.net/v3/assets/latest/{{ jdk }}/hotspot?architecture=ppc64&image_type=jdk&os=aix&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}' when: - jdk != '10' and jdk != '16' - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists register: sig_output - name: GPG Signature verification script: ../Supporting_Scripts/package_signature_verification.sh -f /tmp/jdk{{ jdk }}.tar.gz -sl "{{ sig_output.stdout }}" -k {{ key.adoptium }} when: - jdk != '10' and jdk != '16' - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists - name: Install JDK {{ jdk }} binary unarchive: @@ -52,7 +65,7 @@ dest: /usr remote_src: yes when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists - name: Report HTTP 404 message debug: @@ -66,7 +79,7 @@ path: /tmp/jdk{{ jdk }}.tar.gz state: absent when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists # jdk8 directories do not have a hyphen - name: Find java 8 directory @@ -75,7 +88,7 @@ paths: /usr patterns: 'jdk8u*' when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists - jdk == '8' register: java8_directory @@ -85,7 +98,7 @@ paths: /usr patterns: 'jdk-{{ jdk }}*' when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists - jdk != '8' register: java_directory @@ -98,7 +111,7 @@ with_items: - "{{ java8_directory.files }}" when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists - jdk == '8' - name: Symlink to java{{ jdk }}_64 @@ -109,7 +122,7 @@ with_items: - "{{ java_directory.files }}" when: - - java_installed.stat.isdir is not defined + - not java_installed.stat.exists - jdk != '8' # Defaults for BootJDK API # AdoptOpenJDK changes to Adoptium: diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml index 750ed586a8..6fb692ee3e 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml @@ -113,23 +113,18 @@ when: - ansible_distribution != "Solaris" tags: build_tools - - role: adoptopenjdk_install # JDK19 Build Bootstrap - jdk_version: 18 + - role: adoptopenjdk_install # JDK21 Build Bootstrap + jdk_version: 20 when: - ansible_distribution != "Alpine" - ansible_distribution != "Solaris" - ansible_architecture != "riscv64" tags: build_tools - - role: adoptopenjdk_install # JDK20 Build Bootstrap - jdk_version: 19 - when: - - ansible_distribution != "Alpine" - - ansible_distribution != "Solaris" - tags: build_tools - role: adoptopenjdk_install # Current LTS jdk_version: 21 when: - - ansible_architecture == "riscv64" + - ansible_distribution != "Solaris" + - ansible_architecture != "armv7l" tags: build_tools - role: Nagios_Plugins # AdoptOpenJDK Infrastructure tags: [nagios_plugins, adoptopenjdk] diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml index 1082036599..d7e0c79261 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml @@ -1,12 +1,28 @@ --- ############################################################## -# ansible install adoptopenjdk into /usr/lib/jvm/JDK_VERSION # +# ansible install adopt binary into /usr/lib/jvm/JDK_VERSION # ############################################################## # Conditions: # 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 + api_vendor: eclipse + when: + - jdk_version == 8 or jdk_version == 11 or ( jdk_version | int >= 17) + tags: adoptopenjdk_install + +- name: Use adoptopenjdk API if release is not supported by adoptium + set_fact: + api_url: https://api.adoptopenjdk.net + api_vendor: adoptopenjdk + when: + - jdk_version == 10 or jdk_version == 16 + tags: adoptopenjdk_install + - name: Set path variable when jdk_version == 8 set_fact: path: /usr/lib/jvm/jdk8 @@ -134,21 +150,21 @@ - ansible_distribution != "MacOSX" - not ((ansible_distribution == "RedHat" or ansible_distribution == "CentOS") and ansible_distribution_major_version == "6") - ansible_os_family != "Solaris" - - not (ansible_architecture == "riscv64" and (jdk_version == 21 or jdk_version == 19 or jdk_version == 17 or jdk_version == 11)) # Linux-riscv64 for JDK 11, 17, 19, 21 are special cased + - not (ansible_architecture == "riscv64" and (jdk_version == 21 or jdk_version == 20 or jdk_version == 19 or jdk_version == 17 or jdk_version == 11)) # Linux-riscv64 for JDK 11, 17, 19, 21 are special cased - adoptopenjdk_installed.rc != 0 tags: adoptopenjdk_install # 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={{ api_vendor }}' | grep signature_link | awk '{split($0,a,"\""); print a[4]}' when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 - 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/{{ api_vendor }}?project=jdk" dest: /tmp/jdk{{ jdk_version }}.tar.gz mode: 0440 retries: 3 @@ -159,10 +175,10 @@ - name: GPG Signature verification (Linux/Alpine-Linux) script: ../Supporting_Scripts/package_signature_verification.sh -f /tmp/jdk{{ jdk_version }}.tar.gz -sl "{{ sig_output.stdout }}" -k {{ key.adoptium }} when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 - not (jdk_version == 8 and ansible_architecture == "s390x") - - name: Install latest release if one not already installed (Linux/Alpine-Linux) + - name: Install latest Adopt JDK{{ jdk_version }} if one not already installed (Linux/Alpine-Linux) unarchive: src: /tmp/jdk{{ jdk_version }}.tar.gz dest: /usr/lib/jvm @@ -305,7 +321,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/{{ api_vendor }}?project=jdk' -O /tmp/jdk{{ jdk_version }}.tar.gz vars: ansible_python_interpreter: /usr/local/python2/bin/python2.7 retries: 3 @@ -314,15 +330,15 @@ 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={{ api_vendor }}' | grep signature_link | awk '{split($0,a,"\""); print a[4]}' when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 register: sig_output - name: GPG Signature verification (CentOS6) script: ../Supporting_Scripts/package_signature_verification.sh -f /tmp/jdk{{ jdk_version }}.tar.gz -sl "{{ sig_output.stdout }}" -k {{ key.adoptium }} when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 - name: Install latest JDK {{ jdk_version }} release (CentOS6) unarchive: @@ -343,16 +359,16 @@ 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/{{ api_vendor }}?project=jdk" dest: /tmp/{{ jdk_version }}-installer.pkg register: adoptopenjdk_download until: adoptopenjdk_download is not failed when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 - 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/{{ api_vendor }}?project=jdk" remote_src: yes dest: /Library/Java/JavaVirtualMachines/ become: yes @@ -365,20 +381,20 @@ - 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={{ api_vendor }}' | grep signature_link | grep pkg | awk '{split($0,a,"\""); print a[4]}' when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 register: sig_output - name: GPG Signature verification (macOS) script: ../Supporting_Scripts/package_signature_verification.sh -f /tmp/{{ jdk_version }}-installer.pkg -sl "{{ sig_output.stdout }}" -k {{ key.adoptium }} when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 - name: Run installer for JDK {{ jdk_version }} (macOS) shell: sudo installer -pkg /tmp/{{ jdk_version }}-installer.pkg -target / when: - - jdk_version != 10 + - jdk_version != 10 and jdk_version != 16 # The boot JDK will be installed into a temurin directory. Playbooks, build and (possibly) test scripts will look for an adoptopenjdk directory # https://github.com/adoptium/infrastructure/issues/2281#issuecomment-1059322275 @@ -412,12 +428,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/{{ api_vendor }}?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={{ api_vendor }}' | grep signature_link | awk '{split($0,a,"\""); print a[4]}' register: sig_output - name: GPG Signature verification (Solaris) diff --git a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml index c7e09c00db..afc10a15c5 100644 --- a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml @@ -59,12 +59,14 @@ jdk_version: 10 - role: Java_install # For Gradle jdk_version: 11 - - role: Java_install # JDK16 build bootstrap - jdk_version: 15 - - role: Java_install # JDK17 build bootstrap + - role: Java_install # Latest LTS, for use by agents jdk_version: 16 - - role: Java_install + - role: Java_install # Latest LTS, for use by agents jdk_version: 17 + - role: Java_install # Bootstrap for JDK21 + jdk_version: 20 + - role: Java_install # Latest LTS, for use by agents + jdk_version: 21 - ANT # Testing - role: MSVS_2013 when: ansible_architecture == "64-bit" diff --git a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/Java_install/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/Java_install/tasks/main.yml index f0eba7af35..6786ce4313 100644 --- a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/Java_install/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/Java_install/tasks/main.yml @@ -8,9 +8,25 @@ register: java_installed tags: Java_install -- name: Download Java{{ jdk_version }} +- name: Use adoptium API if release is available at adoptium + set_fact: + api_url: api.adoptium.net + api_vendor: eclipse + when: + - jdk_version == '8' or jdk_version == '11' or ( jdk_version | int >= 17) + tags: adoptopenjdk_install + +- name: Use adoptopenjdk API if release is not supported by adoptium + set_fact: + api_url: api.adoptopenjdk.net + api_vendor: adoptopenjdk + when: + - jdk_version == 10 or jdk_version == 16 + tags: adoptopenjdk_install + +- name: Download Temurin JDK {{ jdk_version }} win_get_url: - url: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/windows/x64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk + url: https://{{ api_url }}/v3/binary/latest/{{ jdk_version }}/ga/windows/x64/jdk/{{ bootjdk }}/normal/{{ api_vendor }}?project=jdk dest: 'C:\temp\jdk-{{ jdk_version }}.zip' when: not java_installed.stat.exists tags: Java_install