Feat: Install OpenJDK 21 84/72484/6
authorAnil Belur <abelur@linuxfoundation.org>
Mon, 18 Dec 2023 02:00:25 +0000 (12:00 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Mon, 1 Jan 2024 13:03:24 +0000 (23:03 +1000)
- 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 <abelur@linuxfoundation.org>
meta/main.yml
molecule/default/molecule.yml
tasks/RedHat.yml
tox.ini

index b6f467c..e4940e0 100644 (file)
@@ -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
index 7274ab6..a5bbab2 100644 (file)
@@ -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
index 095fd03..af901a6 100644 (file)
   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 (file)
--- 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"