From: Anil Belur Date: Mon, 18 Dec 2023 02:00:25 +0000 (+1000) Subject: Feat: Install OpenJDK 21 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F84%2F72484%2F6;p=ansible%2Froles%2Fjava-install.git Feat: Install OpenJDK 21 - Install JDK 21 on CentOS Streams 9 - Use Centos official containers from quay.io for molecule - Update tox and molecule config - Use centos containers from quay.io official repo instead of pycontribs - Openjdk-21 package for Ubuntu 22.04 is in the -proposed repositories, will be added once available. Change-Id: I8fa02c9a5edc7949c6dd3711d950c586d1b204c4 Signed-off-by: Anil Belur --- diff --git a/meta/main.yml b/meta/main.yml index b6f467c..e4940e0 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,5 +1,7 @@ --- galaxy_info: + namespace: lfit + role_name: java_install author: Linux Foundation Release Engineering description: Install Java for use in LF Jenkins infra. company: The Linux Foundation @@ -13,9 +15,13 @@ galaxy_info: - name: EL versions: - 7 + - 8 + - name: Ubuntu versions: - xenial + - bionic + - focal galaxy_tags: - java diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 7274ab6..a5bbab2 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -11,7 +11,9 @@ platforms: - name: centos7 image: centos:7 - name: centos8 - image: quay.io/pycontribs/centos:stream8 + image: quay.io/centos/centos:stream8 + - name: centos9 + image: quay.io/centos/centos:stream9 - name: ubuntu1804 image: ubuntu:18.04 - name: ubuntu2004 diff --git a/tasks/RedHat.yml b/tasks/RedHat.yml index 095fd03..af901a6 100644 --- a/tasks/RedHat.yml +++ b/tasks/RedHat.yml @@ -21,6 +21,15 @@ when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8" become: true +- name: Install OpenJDK 21, latest + yum: + name: + - java-21-openjdk-devel + - java-latest-openjdk-devel + state: present + when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "9" + become: true + - name: Set Java path for OpenJDK 11 set_fact: java_path: /usr/lib/jvm/java-11-openjdk diff --git a/tox.ini b/tox.ini index d012e6c..d0929c3 100644 --- a/tox.ini +++ b/tox.ini @@ -19,10 +19,29 @@ deps = passenv = * commands = ./molecule.sh +allowlist_externals = + ./molecule.sh [testenv:pre-commit] basepython = python3 deps = pre-commit +allowlist_externals = /bin/sh commands = pre-commit run --all-files --show-diff-on-failure - pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG + /bin/sh -c 'if ! git config --get user.name > /dev/null; then \ + git config --global --add user.name "CI"; \ + touch .git/REMOVE_USERNAME; fi' + /bin/sh -c 'if ! git config --get user.email > /dev/null; then \ + git config --global --add user.email "ci@example.org"; \ + touch .git/REMOVE_USEREMAIL; fi' + /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \ + cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \ + git log HEAD -n1 | tail -n +5 | cut -c 5- > .git/COMMIT_MSGTOX; fi" + pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX + /bin/sh -c "rm -f .git/COMMIT_MSGTOX" + /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \ + git config --global --unset user.name; \ + rm -f .git/REMOVE_USERNAME; fi" + /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \ + git config --global --unset user.email; \ + rm -f .git/REMOVE_USEREMAIL; fi"