osmith has uploaded this change for review.

View Change

ansible: jenkins: update install openjdk logic

New jenkins versions require newer java versions to be installed on the
jenkins nodes. Install openjdk from download.java.net instead of using
distribution packages, so we are not limited by what the distribution
offers (which is oftentimes not recent enough).

Change-Id: I1de9a67aafe71e8c8b77c57baddb09611cb2e1fd
---
M ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
1 file changed, 29 insertions(+), 19 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/28/42628/1
diff --git a/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml b/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
index 62beb8e..f009283 100644
--- a/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
+++ b/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
@@ -30,29 +30,39 @@
update_cache: yes
when: ansible_distribution == 'Debian' and ansible_distribution_release == 'jessie'

-- name: install java for jessie
- apt:
- name: openjdk-8-jre-headless
- cache_valid_time: 3600
- update_cache: yes
- install_recommends: no
- default_release: jessie-backports
- when: ansible_distribution == 'Debian' and ansible_distribution_release == 'jessie'
+# Install a recent java directly from download.java.net. This method works for
+# all debian versions, even really old ones, but only for x86_64 and aarch64.
+# Get links for new releases here: https://jdk.java.net/26/
+- name: install openjdk from download.java.net
+ when: ansible_architecture != "armv8l"
+ args:
+ creates: "/home/{{ jenkins_user }}/jenkins/jdk-26/bin/java"
+ become: true
+ become_user: "{{ jenkins_user }}"
+ shell: |
+ cd ~/jenkins
+ case "$(arch)" in
+ x86_64)
+ wget -q https://download.java.net/java/GA/jdk26/c3cc523845074aa0af4f5e1e1ed4151d/35/GPL/openjdk-26_linux-x64_bin.tar.gz
+ ;;
+ aarch64)
+ wget -q https://download.java.net/java/GA/jdk26/c3cc523845074aa0af4f5e1e1ed4151d/35/GPL/openjdk-26_linux-aarch64_bin.tar.gz
+ ;;
+ *)
+ echo "unsupported arch: $(arch)"
+ exit 1
+ ;;
+ esac
+ tar -xf openjdk-26_linux-*_bin.tar.gz
+ rm openjdk-26_linux-*_bin.tar.gz
+ ln -sf jdk-26/ jdk

-- name: install java for stretch
- apt:
- name:
- - openjdk-8-jre-headless
- cache_valid_time: 3600
- update_cache: yes
- install_recommends: no
- when: ansible_distribution == 'Debian' and ansible_distribution_version == '9'
-
-- name: install java for buster and later
+# armv8l: install java from debian repos
+- name: install openjdk from debian
+ when: ansible_architecture == "armv8l"
apt:
name:
- default-jre-headless
cache_valid_time: 3600
update_cache: yes
install_recommends: no
- when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 10

To view, visit change 42628. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I1de9a67aafe71e8c8b77c57baddb09611cb2e1fd
Gerrit-Change-Number: 42628
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>