Add roles for handling java libraries

With OpenJDK and Maven.

Change-Id: I156d824bab7fdfbe121f5ed4c3a2453c4d7fe848
Depends-On: https://review.opendev.org/c/nebulous/library-template/+/898805
This commit is contained in:
jmarchel 2023-10-06 11:58:27 +02:00 committed by Radosław Piliszek
parent f5d27eb909
commit f26b01d8e2
9 changed files with 35 additions and 15 deletions

View File

@ -1,2 +1,14 @@
- hosts: all
tasks: []
roles:
- install_jdk
- maven
tasks:
- name: Build the project with Maven
shell: mvn clean install -DskipTests
args:
chdir: "{{ project_path }}" # Pointing to the directory with pom.xml
vars:
project_path: "{{ zuul.project.src_dir }}/{{ java_library_path }}"
environment:
MAVEN_HOME: "/opt/apache-maven-3.8.8"
PATH: "{{ ansible_env.PATH }}:/opt/apache-maven-3.8.8/bin"

View File

@ -1,2 +0,0 @@
- hosts: all
tasks: []

View File

@ -1,2 +0,0 @@
- hosts: all
tasks: []

View File

@ -0,0 +1 @@
jdk_version: openjdk-17-jdk

View File

@ -0,0 +1,7 @@
- name: Install OpenJDK
apt:
name: "{{ jdk_version }}"
cache_valid_time: 3600
state: present
become: yes
when: ansible_os_family == "Debian"

View File

@ -0,0 +1,3 @@
maven_version: "3.8.8"
maven_archive_name: "apache-maven-{{ maven_version }}-bin.tar.gz"
maven_download_url: "https://downloads.apache.org/maven/maven-3/{{ maven_version }}/binaries/{{ maven_archive_name }}"

View File

@ -0,0 +1,11 @@
- name: Download Maven
get_url:
url: "{{ maven_download_url }}"
dest: "/tmp/{{ maven_archive_name }}"
- name: Extract Maven Archive
unarchive:
src: "/tmp/{{ maven_archive_name }}"
dest: "/opt"
remote_src: yes
become: yes

View File

@ -30,11 +30,3 @@
- job:
name: nebulous-build-java-libraries
run: playbooks/java-libraries/build.yaml
- job:
name: nebulous-upload-java-libraries
run: playbooks/java-libraries/upload.yaml
- job:
name: nebulous-promote-java-libraries
run: playbooks/java-libraries/promote.yaml

View File

@ -2,7 +2,6 @@
check:
jobs:
- nox-linters
# cross-testing with component-template
- opendev-buildset-registry
- nebulous-component-template-hadolint: &cross_test_component_template
@ -15,7 +14,6 @@
gate:
jobs:
- nox-linters
# cross-testing with component-template
- opendev-buildset-registry
- nebulous-component-template-hadolint: *cross_test_component_template